JP7129229B2 - Image processing method, image processing device, imaging device, program, and storage medium - Google Patents

Image processing method, image processing device, imaging device, program, and storage medium Download PDF

Info

Publication number
JP7129229B2
JP7129229B2 JP2018109126A JP2018109126A JP7129229B2 JP 7129229 B2 JP7129229 B2 JP 7129229B2 JP 2018109126 A JP2018109126 A JP 2018109126A JP 2018109126 A JP2018109126 A JP 2018109126A JP 7129229 B2 JP7129229 B2 JP 7129229B2
Authority
JP
Japan
Prior art keywords
image
focus
focus image
learning
image processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2018109126A
Other languages
Japanese (ja)
Other versions
JP2019212139A5 (en
JP2019212139A (en
Inventor
智暁 井上
法人 日浅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2018109126A priority Critical patent/JP7129229B2/en
Priority to PCT/JP2019/020641 priority patent/WO2019235258A1/en
Publication of JP2019212139A publication Critical patent/JP2019212139A/en
Publication of JP2019212139A5 publication Critical patent/JP2019212139A5/ja
Application granted granted Critical
Publication of JP7129229B2 publication Critical patent/JP7129229B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/80Geometric correction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/60Image enhancement or restoration using machine learning, e.g. neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Image Processing (AREA)
  • Studio Devices (AREA)

Description

本発明は、画像処理方法に関する。 The present invention relates to an image processing method.

一般に、撮像装置の光学性能は合焦物体の結像性能で評価されるが、用途によっては、焦点外れ像(ボケ像)の見え方が撮像装置の光学性能にとって重要な評価指標になる場合がある。特に、デジタルスチルカメラ、ビデオカメラ、または、TVカメラ等の撮像装置では、焦点外れ像の見え方が重要視される傾向にある。 In general, the optical performance of an imaging device is evaluated by the imaging performance of an in-focus object, but depending on the application, the appearance of an out-of-focus image (bokeh image) may be an important evaluation index for the optical performance of the imaging device. be. In particular, in imaging devices such as digital still cameras, video cameras, and TV cameras, there is a tendency to attach importance to how an out-of-focus image appears.

特許文献1には、絞りの近傍にアポダイゼーションフィルタを備えた光学系が開示されている。一般に、広角から中望遠の撮像光学系においては、軸外光束のサジタルハロが画面周辺部における焦点外れ像の強度ムラを引き起こす。アポダイゼーションフィルタは、このようなサジタルハロの除去に効果的である。 Patent Document 1 discloses an optical system having an apodization filter in the vicinity of the diaphragm. Generally, in a wide-angle to medium-telephoto imaging optical system, a sagittal halo of an off-axis light beam causes intensity unevenness of an out-of-focus image at the periphery of the screen. Apodization filters are effective in removing such sagittal halos.

特開2016-145862号公報JP 2016-145862 A

Y.LeCun,et al., “Gradient-based Learning Applied to Document Recognition”, Proc. of The IEEE, 1998.Y. LeCun, et al. , "Gradient-based Learning Applied to Document Recognition", Proc. of The IEEE, 1998. G.E.Hinton,et al., “A fast learning algorithm for deep belief nets”, Neural Comput. 2006 Jul; 18(7): 1527-54.G. E. Hinton, et al. , "A fast learning algorithm for deep belief nets", Neural Comput. 2006 Jul; 18(7): 1527-54. I.J.Goodfellow,et al., “Maxout networks”, arXiv preprint arXiv:1302.4389 (2013).I. J. Goodfellow, et al. , "Maxout networks", arXiv preprint arXiv: 1302.4389 (2013). G.E.Hinton & R.R.Salakhutdinov (2006-07-28). “Reducing the Dimensionality of Data with Neural Networks”, Science 313(5786): 504-507.G. E. Hinton & R. R. Salakhutdinov (2006-07-28). "Reducing the Dimensionality of Data with Neural Networks", Science 313(5786): 504-507. N.Srivastava,et al., “Dropout: A simple way to prevent neural networks from overfitting”, The Journal of Machine Learning Research, 15(1):1929-1958, 2014.N. Srivastava, et al. , "Dropout: A simple way to prevent neural networks from overfitting", The Journal of Machine Learning Research, 15(1): 1929-1958, 2014. A.Krizhevsky, “Learning Multiple Layers of Features from Tiny Images”, 2009, https://www.cs.toronto.edu/~kriz/learning-features-2009-TR.pdfA. Krizhevsky, "Learning Multiple Layers of Features from Tiny Images", 2009, https://www. cs. toronto. edu/~kriz/learning-features-2009-TR. pdf

しかしながら、特許文献1に開示されたアポダイゼーションフィルタを備えた光学系では、カダディオプトリックレンズ(反射望遠レンズ)で生じるリングボケ等の口径食により生じる焦点外れ像の形状の補正に対応できない。 However, the optical system with the apodization filter disclosed in Patent Document 1 cannot correct the shape of an out-of-focus image caused by vignetting such as ring blur caused by a cadadioptric lens (reflective telephoto lens).

そこで本発明は、撮影画像から高精度に焦点外れ像の変形を推定または補正することが可能な画像処理方法、画像処理装置、撮像装置、プログラム、および、記憶媒体を提供することを目的とする。 SUMMARY OF THE INVENTION Accordingly, it is an object of the present invention to provide an image processing method, an image processing apparatus, an imaging apparatus, a program, and a storage medium capable of estimating or correcting deformation of an out-of-focus image from a captured image with high accuracy. .

本発明の一側面としての画像処理方法は、入力画像の少なくとも一部の領域を取得する工程と、口径食または収差の影響による焦点外れ像の変形に関して予め学習された学習情報を取得する工程と、前記学習情報を用いて前記領域に含まれる焦点外れ像の変形を推定または補正する工程とを有し、前記推定または補正する工程は、Nを2以上の整数、nを1からNまでの整数とするとき、前記領域に対して、前記学習情報に基づく複数の線型関数のそれぞれによる第n線型変換と、非線型関数による第n非線型変換とをnが1からNになるまで順に実行することで中間データを生成する工程と、前記中間データに対して、前記学習情報に基づく少なくとも一つの線型関数による第N+1線型変換を実行する工程とを含む。 An image processing method according to one aspect of the present invention includes the steps of acquiring at least a partial region of an input image, and acquiring learning information learned in advance regarding deformation of an out-of-focus image due to the effects of vignetting or aberration. and a step of estimating or correcting the deformation of the out-of-focus image included in the region using the learning information, wherein the step of estimating or correcting includes N being an integer of 2 or more and n being from 1 to n is an integer up to N, the region is subjected to n-th linear transformation by each of the plurality of linear functions based on the learning information and n-th nonlinear transformation by a nonlinear function, where n is from 1 to N. a step of generating intermediate data by sequentially executing up to and performing an N+1th linear transformation on the intermediate data by at least one linear function based on the learning information.

本発明の他の側面としての画像処理装置は、口径食または収差の影響による焦点外れ像の変形に関する学習情報を記憶する記憶部と、前記学習情報を用いて入力画像の少なくとも一部の領域における焦点外れ像の変形を推定または補正する画像処理部とを有し、前記画像処理部は、Nを2以上の整数、nを1からNまでの整数とするとき、前記領域に対して、前記学習情報に基づく複数の線型関数のそれぞれによる第n線型変換と、非線型関数による第n非線型変換とをnが1からNになるまで順に実行することで中間データを生成し、前記中間データに対して、前記学習情報に基づく少なくとも一つの線型関数による第N+1線型変換を実行する。 An image processing apparatus according to another aspect of the present invention includes a storage unit that stores learning information about deformation of an out-of-focus image due to the influence of vignetting or aberration; and an image processing unit for estimating or correcting deformation of an out-of- focus image in the region, wherein N is an integer of 2 or more and n is an integer from 1 to N, for the region generating intermediate data by sequentially executing the n-th linear transformation by each of the plurality of linear functions based on the learning information and the n-th nonlinear transformation by the nonlinear function until n is from 1 to N, An N+1th linear transformation is performed on the intermediate data by at least one linear function based on the learning information.

本発明の他の側面としての撮像装置は、被写体空間の像を入力画像として取得する撮像部と、前記画像処理装置とを有する。 An imaging device as another aspect of the present invention includes an imaging unit that acquires an image of a subject space as an input image, and the image processing device.

本発明の他の側面としてのプログラムは、前記画像処理方法をコンピュータに実行させる。 A program as another aspect of the present invention causes a computer to execute the image processing method.

本発明の他の側面としての記憶媒体は、前記プログラムを記憶している。 A storage medium as another aspect of the present invention stores the program.

本発明の他の目的及び特徴は、以下の実施形態において説明される。 Other objects and features of the invention are described in the following embodiments.

本発明によれば、撮影画像から高精度に焦点外れ像の変形を推定または補正することが可能な画像処理方法、画像処理装置、撮像装置、プログラム、および、記憶媒体を提供することができる。 According to the present invention, it is possible to provide an image processing method, an image processing device, an imaging device, a program, and a storage medium that can estimate or correct deformation of an out-of-focus image from a captured image with high accuracy.

実施例1および実施例2における焦点外れ像を補正するネットワーク構造を示す図である。FIG. 4 is a diagram showing a network structure for correcting out-of-focus images in Examples 1 and 2; 実施例1および実施例3における撮像装置のブロック図である。1 is a block diagram of an imaging device in Examples 1 and 3; FIG. 実施例1および実施例3における撮像装置の外観図である。1 is an external view of an imaging device in Examples 1 and 3; FIG. 実施例1における焦点外れ像の補正処理を示すフローチャートである。5 is a flowchart showing correction processing for an out-of-focus image in Example 1. FIG. 実施例1における学習情報の学習を示すフローチャートである。4 is a flow chart showing learning of learning information in Example 1. FIG. 実施例2における画像処理システムのブロック図である。FIG. 11 is a block diagram of an image processing system in Example 2; 実施例2における画像処理システムの外観図である。FIG. 11 is an external view of an image processing system in Example 2; 実施例2における焦点外れ像の補正処理を示すフローチャートである。10 is a flow chart showing correction processing for an out-of-focus image in Example 2. FIG. 実施例3における焦点外れ像の変形の推定処理を示すフローチャートである。14 is a flow chart showing a process of estimating deformation of an out-of-focus image in Example 3. FIG. 実施例3における焦点外れ像の変形を推定するネットワーク構造を示す図である。FIG. 10 is a diagram showing a network structure for estimating deformation of an out-of-focus image in Example 3; 実施例3における学習情報の学習を示すフローチャートである。11 is a flow chart showing learning of learning information in Example 3. FIG.

以下、本発明の実施形態について、図面を参照しながら詳細に説明する。各図において、同一の部材については同一の参照符号を付し、重複する説明は省略する。 BEST MODE FOR CARRYING OUT THE INVENTION Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. In each figure, the same members are denoted by the same reference numerals, and overlapping descriptions are omitted.

各実施例の具体的な説明へ入る前に、本発明の要旨を述べる。本発明では、ディープラーニング(深層学習)を用いて、撮影画像から焦点外れ像の変形(変形した焦点外れ像の形状)を推定または補正する。一般に撮像光学系は、立体被写体の撮影に適用することができる。ここで、「立体被写体」とは、光軸方向の距離が異なる複数の部分からなる被写体であり、特に、撮影時に撮像光学系の焦点面から被写界深度以上離れた点を持つ被写体のことである。このとき、結像面には焦点外れ像が形成され、焦点外れ像の直径が撮像光学系のイメージサークル半径に対して約1~2%よりも大きくなると、焦点外れ像として認識できるようになる。ここで、「イメージサークル」とは、レンズの有効径内を通った光線が結像する円である。 The gist of the present invention will be described before going into specific description of each embodiment. In the present invention, deep learning is used to estimate or correct the deformation of the out-of-focus image (the shape of the deformed out-of-focus image) from the captured image. In general, the imaging optical system can be applied to photographing a stereoscopic object. Here, a "stereoscopic subject" is a subject that consists of a plurality of parts with different distances in the optical axis direction, and in particular, a subject that has a point that is more than the depth of field away from the focal plane of the imaging optical system at the time of photographing. is. At this time, an out-of-focus image is formed on the imaging plane, and when the diameter of the out-of-focus image is larger than about 1 to 2% of the image circle radius of the imaging optical system, it becomes recognizable as an out-of-focus image. . Here, the "image circle" is a circle on which a light beam passing through the effective diameter of the lens forms an image.

本実施形態の光学系をデジタルスチルカメラやビデオカメラの撮像光学系として使用する場合、結像面はCCDセンサやCMOSセンサ等の半導体撮像素子(光電変換素子)の撮像面となる。なお、前述のイメージサークル半径は、撮像装置においては撮像面の最大像高としてもよい。また、一般的な撮像光学系では、軸外光束に口径食が見られる。「口径食」とは、光束の一部がケラレることを意味しており、ビネッティングとも呼ばれる。口径食の影響がない焦点外れ像は、絞りの形状を反映した形状となり、一般的には円形となる。口径食により、一般的な撮像光学系では軸外で円が欠けた様な形状となり、絞り中央部が遮蔽される反射望遠レンズではリング状の形状(リングボケ)となる。 When the optical system of this embodiment is used as an imaging optical system for a digital still camera or a video camera, the imaging plane is the imaging plane of a semiconductor imaging element (photoelectric conversion element) such as a CCD sensor or CMOS sensor. Note that the aforementioned image circle radius may be the maximum image height of the imaging surface of the imaging device. Also, in a general imaging optical system, vignetting is observed in the off-axis light flux. "Vignetting" means vignetting of a portion of the luminous flux and is also called vignetting. An out-of-focus image, free of vignetting effects, will have a shape that reflects the shape of the aperture, typically circular. Due to vignetting, in a general imaging optical system, the shape is such that a circle is missing off-axis, and in a reflective telephoto lens in which the central portion of the aperture is blocked, it becomes a ring-shaped shape (ring blur).

各実施例によれば、焦点外れ像の状態が異なる画像を用いて、その対応関係をディープラーニングによって学習することにより、焦点外れ像の変形(変形した焦点外れ像の形状)を高精度に推定または補正することができる。すなわち各実施例によれば、理想的な焦点外れ像の形状から光学系等の撮影条件により変形した焦点外れ像の形状を高精度に推定することが可能となる。また各実施例によれば、変形した焦点外れ像の形状を理想的な焦点外れ像の形状に高精度に補正する(理想的な焦点外れ像の形状に近づける)ことが可能となる。ここで、理想的な焦点外れ像の形状は、光学系の口径食や収差等の影響がない光学系を用いて取得された焦点外れ像の形状であり、例えば円形形状である。一方、光学系の口径食や収差等の影響により変形した焦点外れ像の形状は、例えばリング形状である。 According to each embodiment, using images with different states of out-of-focus images, the deformation of the out-of-focus images (the shape of the deformed out-of-focus images) can be estimated with high accuracy by learning the correspondence relationship through deep learning. or can be corrected. That is, according to each of the embodiments, it is possible to highly accurately estimate the shape of an out-of-focus image deformed by the photographing conditions such as the optical system from the ideal shape of the out-of-focus image. Further, according to each embodiment, it is possible to correct the shape of the deformed out-of-focus image to the shape of the ideal out-of-focus image with high precision (to bring the shape closer to the ideal shape of the out-of-focus image). Here, the ideal shape of the out-of-focus image is the shape of the out-of-focus image obtained using an optical system that is free from the effects of vignetting, aberration, etc. of the optical system, and is, for example, a circular shape. On the other hand, the shape of the out-of-focus image deformed due to vignetting or aberration of the optical system is, for example, a ring shape.

まず、図2および図3を参照して、本発明の実施例1における撮像装置について説明する。図2は、撮像装置100のブロック図である。図3は、撮像装置100の外観図である。本実施例において、撮像装置100は、画像処理方法を実行し、焦点外れ像の変形(光学系の口径食や収差等の影響により変形した焦点外れ像の形状)をディープラーニングにより補正する。 First, an imaging apparatus according to a first embodiment of the present invention will be described with reference to FIGS. 2 and 3. FIG. FIG. 2 is a block diagram of the imaging device 100. As shown in FIG. FIG. 3 is an external view of the imaging device 100. As shown in FIG. In this embodiment, the imaging apparatus 100 executes an image processing method to correct deformation of the out-of-focus image (shape of the out-of-focus image deformed due to vignetting, aberration, etc. of the optical system) by deep learning.

撮像装置100は、被写体空間の像を撮影画像(入力画像)として取得する撮像部101を有する。撮像部101は、被写体空間から入射する光を集光する結像光学系101aと、複数の画素を有する撮像素子101bとを有する。撮像素子101bは、例えば、CCD(Charge Coupled Device)センサやCMOS(Complementary Metal-Oxide Semiconductor)センサである。 The imaging device 100 has an imaging unit 101 that acquires an image of a subject space as a captured image (input image). The imaging unit 101 has an imaging optical system 101a that collects light incident from a subject space, and an imaging element 101b that has a plurality of pixels. The imaging device 101b is, for example, a CCD (Charge Coupled Device) sensor or a CMOS (Complementary Metal-Oxide Semiconductor) sensor.

画像処理部102は、撮影画像(入力画像)に対して、焦点外れ像(焦点外れ像の変形)を補正する。画像処理部102は、学習部102aと補正部102bとを有する。記憶部103は、画像処理部102による焦点外れ像(焦点外れ像の変形)を補正する際に用いられる学習情報(焦点外れ像の変形に関して予め学習された学習情報)を記憶している。この処理の詳細については後述する。画像処理部102により焦点外れ像の変形が補正された画像等の出力画像は、液晶ディスプレイなどの表示部104に表示されるか、または、記録媒体105に保存される。ただし、撮影画像を記録媒体105に保存し、任意のタイミングで焦点外れ像の補正処理を行ってもよい。撮影画像は、静止画だけでなく動画であってもよい。この場合、各フレームに対して焦点外れ像の補正処理を行う。以上の一連の制御は、システムコントローラ106により行われる。 The image processing unit 102 corrects an out-of-focus image (deformation of an out-of-focus image) for a captured image (input image). The image processing unit 102 has a learning unit 102a and a correction unit 102b. The storage unit 103 stores learning information (learning information learned in advance regarding deformation of the out-of-focus image) used when the image processing unit 102 corrects the out-of-focus image (deformation of the out-of-focus image). The details of this processing will be described later. An output image such as an image corrected for deformation of an out-of-focus image by the image processing unit 102 is displayed on a display unit 104 such as a liquid crystal display or stored in a recording medium 105 . However, the captured image may be stored in the recording medium 105 and the out-of-focus image correction process may be performed at an arbitrary timing. The captured image may be a moving image as well as a still image. In this case, out-of-focus image correction processing is performed for each frame. The above series of controls are performed by the system controller 106 .

次に、図4を参照して、画像処理部102による焦点外れ像の補正処理について説明する。画像処理部102は、焦点外れ像の補正処理の際に、事前に学習された学習情報を用いるが、この学習の詳細については後述する。図4は、焦点外れ像の補正処理を示すフローチャートである。図4の各ステップは、主に、画像処理部102の補正部102bにより実行される。 Next, correction processing of an out-of-focus image by the image processing unit 102 will be described with reference to FIG. The image processing unit 102 uses learning information that has been learned in advance when correcting an out-of-focus image, and the details of this learning will be described later. FIG. 4 is a flow chart showing an out-of-focus image correction process. Each step in FIG. 4 is mainly executed by the correction unit 102b of the image processing unit 102. FIG.

まずステップS101において、画像処理部102(補正部102b)は、焦点外れ像の変形が生じた撮影画像(入力画像)と学習情報とを取得する。ここで、焦点外れ像の変形とは、理想的な焦点外れ像に対して形状や輝度分布が異なっている状態を意味する。学習情報とは、撮影画像と焦点外れ像(焦点外れ像の変形)が補正された画像とを結び付けるために予め学習された情報である。続いてステップS102において、補正部102bは、撮影画像から、撮影画像の少なくとも一部の領域(部分領域)を取得する。焦点外れ像の補正処理は、この領域(部分領域)を単位として(部分領域ごとに)行われる。 First, in step S101, the image processing unit 102 (correction unit 102b) acquires a captured image (input image) in which an out-of-focus image is deformed and learning information. Here, the deformation of the out-of-focus image means a state in which the shape and luminance distribution are different from those of the ideal out-of-focus image. The learning information is information learned in advance for associating a captured image with an image corrected for an out-of-focus image (deformation of the out-of-focus image). Subsequently, in step S102, the correction unit 102b acquires at least a partial area (partial area) of the captured image from the captured image. Correction processing for an out-of-focus image is performed in units of this area (partial area) (each partial area).

続いてステップS103において、補正部102bは、学習情報を用いて部分領域から焦点外れ像が補正された部分領域である補正部分領域を生成する。ここで、図1を参照して、焦点外れ像の補正処理について詳述する。図1は、ディープラーニングの一つであるCNN(Convolutional Neural Network)のネットワーク構造を示している。ただし、ディープラーニングとして、CNN以外の手法、例えばDBN(Deep Belief Network)を用いても構わない。CNNおよびDBNの詳細はそれぞれ、非特許文献1および非特許文献2に説明されている。 Subsequently, in step S103, the correction unit 102b generates a corrected partial area, which is a partial area in which the out-of-focus image is corrected, from the partial area using the learning information. Now, with reference to FIG. 1, the out-of-focus image correction processing will be described in detail. FIG. 1 shows the network structure of CNN (Convolutional Neural Network), which is one of deep learning. However, as deep learning, methods other than CNN, for example, DBN (Deep Belief Network) may be used. Details of CNN and DBN are described in Non-Patent Document 1 and Non-Patent Document 2, respectively.

CNNは、複数の層構造になっており、各層で学習情報を用いた線型変換と非線型変換とが実行される。nを1からNまでの整数とするとき、n番目の層を第n層、第n層における線型変換と非線型変換とをそれぞれ、第n線型変換と第n非線型変換と呼称する。ただし、Nは2以上の整数である。部分領域201に関しては、第1層において、複数のフィルタ202のそれぞれとのコンボリューション(複数の線型関数による第1線型変換)が実行される。その後、活性化関数(Activation Function)と呼ばれる非線型関数を用いて変換(第1非線型変換)が実行される。図1において、活性化関数をAFとして示している。また、部分領域201が複数枚描画されているのは、入力画像(撮影画像)が複数のチャンネルを有するためである。本実施例において、部分領域はRGB(Red、Green、Blue)の3チャンネルを有する。ただし、チャンネルの数はこれに限定されるものではない。後述のように、複数の撮影画像が入力された場合、部分領域は、入力された撮影画像に対応する数のチャンネル数を有していてもよい。また、部分領域が複数のチャンネルを有する場合でも、1チャンネルごとに個別にCNNへ入力しても構わない。 A CNN has a multi-layered structure, and linear transformation and non-linear transformation using learning information are executed in each layer. When n is an integer from 1 to N, the n-th layer is called the n-th layer, and the linear transformation and the non-linear transformation in the n-th layer are called the n-th linear transformation and the n-th non-linear transformation, respectively. However, N is an integer of 2 or more. Concerning the partial region 201, convolution (first linear transformation by a plurality of linear functions) with each of the plurality of filters 202 is performed in the first layer. A transformation (first nonlinear transformation) is then performed using a nonlinear function called the Activation Function. In FIG. 1 the activation function is indicated as AF. A plurality of partial regions 201 are drawn because the input image (captured image) has a plurality of channels. In this embodiment, the partial area has three channels of RGB (Red, Green, Blue). However, the number of channels is not limited to this. As will be described later, when a plurality of captured images are input, the partial area may have the number of channels corresponding to the input captured images. Also, even if the partial area has a plurality of channels, each channel may be individually input to the CNN.

フィルタ202は複数存在する。補正部102bは、複数のフィルタ202のそれぞれと部分領域201とのコンボリューションを個別に算出する。フィルタ202の係数は、学習情報に基づいて決定される。学習情報は、フィルタ202の係数(フィルタ係数)そのもの、または、フィルタ202を所定の関数でフィッティングした際の係数でもよい。フィルタ202のそれぞれのチャンネル数は、部分領域201の数と一致する。部分領域201のチャンネル数が2以上の場合、3次元フィルタとなる(3次元目がチャンネル数を表す)。また、コンボリューションの結果に対して、学習情報から決定される定数(負もとり得る)を加算してもよい。 A plurality of filters 202 exist. The correction unit 102b individually calculates the convolution between each of the plurality of filters 202 and the partial region 201. FIG. The coefficients of filter 202 are determined based on the learning information. The learning information may be the coefficients (filter coefficients) of the filter 202 themselves, or the coefficients obtained by fitting the filter 202 with a predetermined function. The number of channels in each filter 202 matches the number of sub-regions 201 . When the number of channels in the partial area 201 is two or more, the filter becomes a three-dimensional filter (the third dimension represents the number of channels). Alternatively, a constant (possibly negative) determined from learning information may be added to the result of convolution.

活性化関数f(x)の例として、以下の式(1)~(3)が挙げられる。 Examples of the activation function f(x) include the following equations (1) to (3).

Figure 0007129229000001
Figure 0007129229000001

Figure 0007129229000002
Figure 0007129229000002

Figure 0007129229000003
Figure 0007129229000003

式(1)はシグモイド関数、式(2)はハイパボリックタンジェント関数、式(3)はReLU(Rectified Linear Unit)と呼ばれる。式(3)中のmaxは、引数のうち最大値を出力するMAX関数を表す。式(1)~(3)に示される活性化関数f(x)は、全て単調増加関数である。また、活性化関数としてMaxoutを使用してもよい。Maxoutは、第n線型変換の出力である複数の画像のうち、各画素で最大値である信号値を出力するMAX関数である。Maxoutの詳細は、非特許文献3に説明されている。 Equation (1) is called a sigmoid function, Equation (2) is a hyperbolic tangent function, and Equation (3) is called a ReLU (Rectified Linear Unit). max in equation (3) represents a MAX function that outputs the maximum value of the arguments. The activation functions f(x) shown in equations (1)-(3) are all monotonically increasing functions. Also, Maxout may be used as the activation function. Maxout is a MAX function that outputs the maximum signal value for each pixel in a plurality of images output from the n-th linear transformation. Details of Maxout are described in Non-Patent Document 3.

図1において、第1線型変換および第1非線型変換が施された部分領域を、第1変換部分領域203と呼称する。第1変換部分領域203の各チャンネル成分は、部分領域201と複数のフィルタ202のそれぞれとのコンボリューションから生成される。このため、第1変換部分領域203のチャンネル数は、フィルタ202の数と同じになる。 In FIG. 1 , the partial area subjected to the first linear transformation and the first nonlinear transformation is called a first transformed partial area 203 . Each channel component of the first transform sub-region 203 is generated from the convolution of the sub-region 201 with each of the plurality of filters 202 . Therefore, the number of channels in the first conversion partial area 203 is the same as the number of filters 202 .

第2層では、第1変換部分領域203に対して、第1層と同様に学習情報から決定される複数のフィルタ204とのコンボリューション(第2線型変換)と、活性化関数による非線型変換(第2非線型変換)とを行う。第2層で用いられるフィルタ204は、一般的に、第1層で用いられるフィルタ202と同一ではない。フィルタ204のサイズや数も、フィルタ204と一致しなくてもよい。ただし、フィルタ204のチャンネル数と第1変換部分領域203のチャンネル数とは互いに一致する。補正部102bは、同様の演算を第N層まで繰り返す(第n線型変換および第n非線型変換(n=1~N)を実行する)ことにより、中間データ210を取得する。 In the second layer, the first transformation partial region 203 is subjected to convolution (second linear transformation) with a plurality of filters 204 determined from learning information in the same manner as in the first layer, and nonlinear transformation using an activation function. (second nonlinear transformation). The filter 204 used in the second layer is generally not the same as the filter 202 used in the first layer. The size and number of filters 204 also need not match the filters 204 . However, the number of channels of the filter 204 and the number of channels of the first conversion partial area 203 match each other. The correcting unit 102b acquires the intermediate data 210 by repeating similar calculations up to the Nth layer (executing the nth linear transformation and the nth nonlinear transformation (n=1 to N)).

最後に、第N+1層において、中間データ210と複数のフィルタ211のそれぞれとのコンボリューションに定数を加算すること(第N+1線型変換)により、焦点外れ像が補正された補正部分領域212が取得される。ここで用いられるフィルタ211および定数もそれぞれ、学習情報に基づいて決定される。補正部分領域212のチャンネル数は、部分領域201と同じである。このため、フィルタ211の数も部分領域201のチャンネル数と同じである。補正部分領域212の各チャンネルの成分は、中間データ210とフィルタ211のそれぞれ(フィルタ211が一つの場合もある)とのコンボリューションを含む演算から求められる。なお、部分領域201と補正部分領域212とのサイズは互いに一致しなくてもよい。コンボリューションの際に、部分領域201の外側にはデータが存在しないため、データの存在する領域のみで演算すると、コンボリューション結果はサイズが小さくなる。ただし、周期境界条件などを設定することにより、サイズを保つこともできる。 Finally, in the N+1th layer, by adding a constant to the convolution of the intermediate data 210 and each of the plurality of filters 211 (N+1th linear transformation), the corrected partial area 212 in which the out-of-focus image is corrected is obtained. be. The filter 211 and the constants used here are also each determined based on the learning information. The number of channels of the correction partial area 212 is the same as that of the partial area 201 . Therefore, the number of filters 211 is also the same as the number of channels of the partial area 201 . The components of each channel of the correction partial area 212 are obtained from operations including convolution between the intermediate data 210 and each of the filters 211 (there may be one filter 211). Note that the sizes of the partial area 201 and the size of the correction partial area 212 do not have to match each other. Since there is no data outside the partial area 201 during the convolution, the size of the convolution result will be reduced if the calculation is performed only in the area where the data exists. However, the size can be maintained by setting a periodic boundary condition or the like.

ディープラーニングが高い性能を発揮できる理由は、非線型変換を多層構造によって何度も実行することにより、高い非線型性が得られるためである。仮に、非線型変換を担う活性化関数が存在せず、線型変換のみでネットワークが構成されていた場合、いくら多層にしてもそれと等価な単層の線型変換が存在するため、多層構造にする意味がない。ディープラーニングは、より多層にする方が強い非線型を得られるため、高い性能が出やすいと言われている。一般に、少なくとも3層以上を有する場合がディープラーニングと呼ばれる。 The reason why deep learning can exhibit high performance is that high nonlinearity can be obtained by executing nonlinear transformation many times with a multi-layered structure. If the activation function responsible for the nonlinear transformation does not exist and the network is composed only of linear transformations, no matter how many layers there are, there is an equivalent single-layer linear transformation. There is no Deep learning is said to be more likely to achieve high performance because the more layers it has, the more strongly nonlinear it can be obtained. In general, the case of having at least three layers is called deep learning.

続いて、図4のステップS104において、補正部102bは、撮影画像のうち所定の領域(部分領域)の全てに対して焦点外れ像の補正が完了したか否かを判定する。所定の領域の全てに対して補正部分領域212が生成されている場合、ステップS105へ進む。一方、焦点外れ像の補正が完了していない領域(部分領域)が残っている場合、ステップS102へ戻り、補正部102bは、まだ焦点外れ像が補正されていない部分領域を撮影画像から取得する。 Subsequently, in step S104 in FIG. 4, the correction unit 102b determines whether or not the out-of-focus image correction has been completed for all of the predetermined regions (partial regions) of the captured image. If the correction partial areas 212 have been generated for all of the predetermined areas, the process proceeds to step S105. On the other hand, if there remains an area (partial area) for which the out-of-focus image correction has not been completed, the process returns to step S102, and the correction unit 102b acquires the partial area for which the out-of-focus image has not yet been corrected from the captured image. .

ステップS105において、補正部102bは、焦点外れ像が補正された画像(補正画像)を出力する。焦点外れ像が補正された画像は、生成された複数の補正部分領域212を合成することにより生成される。ただし、部分領域が撮影画像の全体である場合、補正部102bは、補正部分領域212をそのまま焦点外れ像が補正された画像として出力する。以上の処理により、焦点外れ像が補正された画像(理想的な形状(例えば円形形状)の焦点外れ像)を取得することができる。 In step S105, the correction unit 102b outputs an image (corrected image) in which the out-of-focus image is corrected. An image in which the out-of-focus image is corrected is generated by synthesizing the plurality of generated correction partial areas 212 . However, when the partial area is the entire captured image, the correction unit 102b outputs the corrected partial area 212 as it is as an image in which the out-of-focus image is corrected. Through the above processing, an image in which an out-of-focus image has been corrected (an out-of-focus image having an ideal shape (for example, a circular shape)) can be acquired.

なお本実施例では、撮影画像(入力画像)、および、焦点外れ像が補正された画像(出力画像)が共に1枚の場合を説明した。しかし、本実施例はこれに限定されるものではない。例えば、複数の撮影画像(複数の入力画像)を入力し、複数の撮影画像のそれぞれの焦点外れ像が補正された複数の出力画像が一括で取得することができるように、CNNのネットワークを構成してもよい。また、複数の撮影画像を入力し、1枚の焦点外れ像が補正された画像を取得するように構成してもよい。複数の撮影画像を入力する場合、絞り値(F値)やピント位置の異なる複数の画像を用いることが好ましい。絞り値やピント位置が変化すると被写体中での焦点外れ像の大きさ、形状、輝度分布等が異なり、同一の被写体に対して、異なる焦点外れ像が生じた複数の画像を入力することにより、精度を向上することができる。また、入力する撮影画像として、複数の色のチャンネルを有する画像を用いることが好ましい。なお本実施例では、焦点外れ像を理想的な形状(円形形状)に補正する場合を説明したが、補正後の焦点外れ像の形状はこれに限定されるものではない。例えば、星型やハート型等のユーザが所望する形状に補正することも可能である。 In the present embodiment, a case has been described in which both the captured image (input image) and the out-of-focus image corrected image (output image) are one. However, this embodiment is not limited to this. For example, configure a CNN network so that multiple captured images (multiple input images) can be input and multiple output images in which the out-of-focus images of each of the multiple captured images are corrected can be acquired at once. You may Alternatively, a configuration may be adopted in which a plurality of photographed images are input and one out-of-focus image is corrected to be acquired. When inputting a plurality of captured images, it is preferable to use a plurality of images with different aperture values (F values) and different focus positions. When the aperture value or focus position changes, the size, shape, brightness distribution, etc. of the out-of-focus image in the subject differ. Accuracy can be improved. In addition, it is preferable to use an image having a plurality of color channels as the captured image to be input. In this embodiment, the case of correcting the out-of-focus image to an ideal shape (circular shape) has been described, but the shape of the out-of-focus image after correction is not limited to this. For example, it is possible to correct to a shape desired by the user, such as a star shape or a heart shape.

次に、図5を参照して、本実施例における学習情報の学習について説明する。図5は、学習情報の学習を示すフローチャートである。図5の各ステップは、主に、画像処理部102の学習部102aにより行われる。ただし本実施例はこれに限定されるものではなく、学習情報の学習は、焦点外れ像の補正前であれば、撮像装置100とは別の装置(演算装置)に設けられた学習部で行ってもよい。本実施例では、撮像装置100の学習部102aが学習情報を学習する場合について説明する。 Next, learning of learning information in this embodiment will be described with reference to FIG. FIG. 5 is a flowchart showing learning of learning information. Each step in FIG. 5 is mainly performed by the learning unit 102 a of the image processing unit 102 . However, the present embodiment is not limited to this, and learning of learning information is performed by a learning unit provided in a device (computing device) separate from the imaging device 100 before correction of an out-of-focus image. may In this embodiment, a case where the learning unit 102a of the imaging device 100 learns learning information will be described.

まずステップS201において、学習部102aは、少なくとも一対の学習画像を取得する。一対の学習画像とは、焦点外れ像の変形の状態(光学系の口径食や収差等の撮影条件に応じて変形した焦点外れ像の形状や輝度分布)が異なり、かつ同一の被写体が存在する画像である。焦点外れ像の変形が生じている画像は、焦点外れ像の変形が生じていない画像(理想的な焦点外れ像を含む画像)と一対一に対応しているか、または、1枚の焦点外れ像の変形が生じていない画像に対して複数枚存在していてもよい。後者の場合、焦点外れ像の変形が生じている画像は、焦点外れ像の大きさ、形状、または、輝度分布が異なる複数の画像である。 First, in step S201, the learning unit 102a acquires at least a pair of learning images. A pair of training images differ in the state of deformation of the out-of-focus image (the shape and luminance distribution of the out-of-focus image deformed according to the shooting conditions such as vignetting and aberration of the optical system) and the same subject is present. It is an image. An image in which deformation of an out-of-focus image occurs corresponds one-to-one with an image in which deformation of an out-of-focus image does not occur (an image containing an ideal out-of-focus image), or a single out-of-focus image There may be a plurality of images for which no deformation has occurred. In the latter case, the images with deformed out-of-focus images are a plurality of images with different sizes, shapes, or luminance distributions of the out-of-focus images.

学習画像を用意する方法として、シミュレーションや実写画像を用いてもよい。シミュレーションを行う場合、焦点外れ像の変形が生じていない画像に対して、口径食や収差の影響を考慮した撮像シミュレーションを行うことで焦点外れ像の変形が生じている画像を生成すればよい。一方、実写画像を用いる場合、同一の被写体を焦点外れ像の変形が異なる条件で撮影した画像を使用すればよい。例えば、焦点外れ像の変形が口径食の影響による場合、変形は絞り値やピント位置などに影響を受ける。または、点光源などの既知の被写体(焦点外れ像の変形が生じていない画像)を、光学系等の撮影条件を変えて撮影することで、焦点外れ像の変形が異なる学習画像を得てもよい。 A simulation or a photographed image may be used as a method of preparing a learning image. When the simulation is performed, an image in which the out-of-focus image is not deformed may be generated by performing imaging simulation in consideration of the effects of vignetting and aberration on the image in which the out-of-focus image is not deformed. On the other hand, when a photographed image is used, images obtained by photographing the same subject under different deformation conditions of the out-of-focus image may be used. For example, if the deformation of an out-of-focus image is due to vignetting, the deformation is affected by aperture value, focus position, and the like. Alternatively, by photographing a known object such as a point light source (an image in which the out-of-focus image is not deformed) under different shooting conditions such as the optical system, training images with different deformations of the out-of-focus image can be obtained. good.

また、焦点外れ像の変形が生じている画像に対してディープラーニング以外の手法を用いて焦点外れ像が補正された画像を推定し、学習画像を用意してもよい。なお学習画像は、様々な焦点外れ像(様々な変形した焦点外れ像の形状)が含まれる画像を含むことが好ましい。学習画像に含まれない変形の仕方をしている画像は、高精度に焦点外れ像を補正することができないためである。また、学習画像に含まれる焦点外れ像の変形が異なる画像は一対のみでもよいが、前述の理由により複数の画像を含むことが好ましい。 Alternatively, a training image may be prepared by estimating an image in which an out-of-focus image is deformed using a technique other than deep learning to estimate an image in which the out-of-focus image is corrected. Note that the training images preferably include images containing various out-of-focus images (various deformed shapes of out-of-focus images). This is because an out-of-focus image cannot be corrected with high accuracy for an image that is deformed in a way that is not included in the training images. In addition, the learning image may include only a pair of images with different deformations of the out-of-focus image, but preferably includes a plurality of images for the reason described above.

続いてステップS202において、学習部102aは、ステップS201にて取得した学習画像から、複数の学習ペアを取得する。学習ペアは、学習部分領域(学習領域)と学習補正部分領域とからなる。学習補正部分領域は焦点外れ像の変形が生じている画像から取得され、そのサイズはステップS102にて取得した撮影画像の部分領域と同じである。学習部分領域は焦点外れ像の変形が生じていない画像から取得され、学習部分領域の中心は画像において学習補正部分領域の中心と同じ位置である。そのサイズは、ステップS103にて生成された補正部分領域と同じである。前述と同様に、学習部分領域と学習補正部分領域のペア(学習ペア)は、一対一に対応している必要はない。一つの学習補正部分領域と、複数の学習部分領域とがペア(グループ)になっていてもよい。 Subsequently, in step S202, the learning unit 102a acquires a plurality of learning pairs from the learning images acquired in step S201. A learning pair consists of a learning partial area (learning area) and a learning correction partial area. The learning correction partial area is obtained from the image in which the out-of-focus image is deformed, and its size is the same as the partial area of the photographed image obtained in step S102. The training sub-region is obtained from an image in which no deformation of the out-of-focus image has occurred, and the center of the training sub-region is at the same position in the image as the center of the training correction sub-region. Its size is the same as the corrected partial area generated in step S103. As described above, pairs of learning partial areas and learning correction partial areas (learning pairs) do not need to correspond one-to-one. One learning correction partial area and a plurality of learning partial areas may be paired (grouped).

続いてステップS203において、補正部102aは、複数の学習ペア(学習部分領域と学習補正部分領域)から、学習情報を学習によって取得(生成)する。学習では、焦点外れ像を補正するネットワーク構造と同じネットワーク構造を使用する。本実施例では、図1に示されるネットワーク構造に対して学習補正部分領域を入力し、その出力結果と学習部分領域との誤差を算出する。この誤差が最小となるように、例えば誤差逆伝播法(Backpropagation)などを用いて、第1乃至N+1層で用いる複数のフィルタのそれぞれの係数や加算する定数(学習情報)を更新して最適化する。各フィルタの係数および定数の初期値は任意に設定することができ、例えば乱数から決定される。または、各層ごとに初期値を事前学習するAuto Encoderなどのプレトレーニングを行ってもよい。Auto Encoderの詳細は、非特許文献4に説明されている。 Subsequently, in step S203, the correction unit 102a acquires (generates) learning information from a plurality of learning pairs (learning partial areas and learning correction partial areas) through learning. Training uses the same network structure that corrects out-of-focus images. In this embodiment, a learning correction partial area is input to the network structure shown in FIG. 1, and the error between the output result and the learning partial area is calculated. In order to minimize this error, for example, using the error backpropagation method, etc., the coefficients of the multiple filters used in the 1st to N+1 layers and the constants to be added (learning information) are updated and optimized. do. The initial values of the coefficients and constants of each filter can be arbitrarily set, and are determined from random numbers, for example. Alternatively, pre-training such as Auto Encoder that pre-learns initial values for each layer may be performed. Details of the Auto Encoder are described in Non-Patent Document 4.

学習ペアの全てをネットワーク構造へ入力し、それら全ての情報を使って学習情報を更新する手法をバッチ学習と呼ぶ。ただし、この学習方法は、学習ペアの数が増えるにつれて計算負荷が膨大になる。逆に、学習情報の更新に一つの学習ペアのみを使用し、更新ごとに異なる学習ペアを使用する学習手法をオンライン学習と呼ぶ。この手法は、学習ペアが増えても計算量が増大しないが、一つの学習ペアに存在するノイズの影響を大きく受ける。このため、これら2つの手法の中間に位置するミニバッチ法を用いて学習することが好ましい。ミニバッチ法は、全学習ペアの中から少数を抽出し、それらを用いて学習情報の更新を行う。次の更新では、異なる小数の学習ペアを抽出して使用する。これを繰り返すことにより、バッチ学習とオンライン学習の不利な点を小さくすることができ、高い補正効果を得やすくなる。 A method of inputting all learning pairs into a network structure and updating learning information using all the information is called batch learning. However, this learning method has a huge computational load as the number of learning pairs increases. Conversely, a learning method in which only one learning pair is used to update learning information and a different learning pair is used for each update is called online learning. Although this method does not increase the amount of calculation even if the number of learning pairs increases, it is greatly affected by noise that exists in one learning pair. Therefore, it is preferable to learn using the mini-batch method, which is located between these two methods. The mini-batch method extracts a small number of pairs from all learning pairs and uses them to update learning information. In the next update, we will extract and use a different fractional training pair. By repeating this process, the disadvantages of batch learning and online learning can be reduced, making it easier to obtain a high correction effect.

続いてステップS204において、補正部102aは、学習された学習情報を出力する。本実施例において、学習情報は記憶部103に記憶される。以上の処理により、高精度に焦点外れ像を補正するための学習情報を学習することができる。 Subsequently, in step S204, the correction unit 102a outputs learned information. In this embodiment, the learning information is stored in the storage unit 103 . Through the above processing, learning information for correcting an out-of-focus image can be learned with high precision.

また、以上の処理に加えて、CNNの性能を向上させる工夫を併用してもよい。例えば、ロバスト性の向上のためネットワークの各層において、ドロップアウト(Dropout)やダウンサンプリングであるプーリング(pooling)を行ってもよい。または、学習精度の向上のため、学習画像の画素の平均値を0、分散を1に正規化し、隣接する画素の冗長性をなくすZCAホワイトニング(ZCA whitening)などを併用してもよい。ドロップアウトおよびZCAホワイトニングの詳細はそれぞれ、非特許文献5および非特許文献6に説明されている。 Also, in addition to the above processing, a device for improving the performance of the CNN may be used together. For example, in order to improve robustness, pooling, which is dropout or downsampling, may be performed in each layer of the network. Alternatively, in order to improve the learning accuracy, ZCA whitening, which normalizes the average value of the pixels of the learning image to 0 and the variance to 1 to eliminate the redundancy of adjacent pixels, may be used together. Details of dropout and ZCA whitening are described in Non-Patent Documents 5 and 6, respectively.

本実施例によれば撮影画像から高精度に焦点外れ像(焦点外れ像の変形)を補正することが可能な撮像装置を提供することができる。 According to this embodiment, it is possible to provide an imaging apparatus capable of correcting an out-of-focus image (deformation of an out-of-focus image) from a captured image with high accuracy.

次に、本発明の実施例2における画像処理システムについて説明する。施例の画像処理システムにおいて、焦点外れ像(焦点外れ像の変形)を補正する画像処理装置と、撮影画像を取得する撮像装置、および、学習を行うサーバが個別に設けられている。また本実施例では、焦点外れ像(焦点外れ像領域)の大きさを判定することにより、使用する学習情報を切り替える。焦点外れ像領域の大きさに応じて、焦点外れ像の補正処理に使用する学習情報を個別に学習して使用することにより、より高精度な焦点外れ像の補正が可能となる。 Next, an image processing system according to Embodiment 2 of the present invention will be described. In the image processing system of the embodiment, an image processing device that corrects an out-of-focus image (deformation of the out-of-focus image), an imaging device that acquires a captured image, and a server that performs learning are provided separately. Further, in this embodiment, the learning information to be used is switched by determining the size of the out-of-focus image (out-of-focus image region). By individually learning and using the learning information used for the correction processing of the out-of-focus image according to the size of the out-of-focus image area, the out-of-focus image can be corrected with higher accuracy.

図6および図7を参照して、本実施例における画像処理システムについて説明する。図6は、画像処理システム200のブロック図である。図7は、画像処理システム200の外観図である。図6および図7に示されるように、画像処理システム200は、撮像装置300、画像処理装置301、サーバ305、表示装置308、記録媒体309、および、出力装置310を備えて構成される。 The image processing system in this embodiment will be described with reference to FIGS. 6 and 7. FIG. FIG. 6 is a block diagram of the image processing system 200. As shown in FIG. FIG. 7 is an external view of the image processing system 200. As shown in FIG. As shown in FIGS. 6 and 7, the image processing system 200 includes an imaging device 300, an image processing device 301, a server 305, a display device 308, a recording medium 309, and an output device 310. FIG.

撮像装置300の基本構成は、焦点外れ像の補正と学習情報の学習に関する画像処理部を除いて、図2を参照して説明した撮像装置100と同様である。撮像装置300を用いて撮影された撮影画像(入力画像)は、画像処理装置301に設けられた記憶部302に記憶される。画像処理装置301は、ネットワーク304と有線または無線で接続されており、ネットワーク304を介してサーバ305にアクセスすることができる。サーバ305は、撮影画像から焦点外れ像を補正するための学習情報を学習する学習部307と、学習情報を記憶する記憶部306とを有する。画像処理装置301に設けられた補正部303(画像処理部)は、サーバ305の記憶部306からネットワーク304を介して学習情報を取得し、撮影画像の焦点外れ像を補正する。補正部303により焦点外れ像が補正された画像等の出力画像は、表示装置308、記録媒体309、および、出力装置310の少なくとも一つに出力される。表示装置308は、例えば液晶ディスプレイやプロジェクタである。ユーザは、表示装置308を介して、処理途中の画像を確認しながら作業を行うことができる。記録媒体309は、例えば半導体メモリ、ハードディスク、ネットワーク上のサーバである。出力装置310は、例えばプリンタである。画像処理装置301は、必要に応じて現像処理やその他の画像処理を行う機能を有してもよい。 The basic configuration of the image pickup apparatus 300 is the same as that of the image pickup apparatus 100 described with reference to FIG. 2, except for an image processing unit related to correction of out-of-focus images and learning of learning information. A captured image (input image) captured using the imaging device 300 is stored in the storage unit 302 provided in the image processing device 301 . The image processing apparatus 301 is connected to a network 304 by wire or wirelessly, and can access a server 305 via the network 304 . The server 305 has a learning unit 307 that learns learning information for correcting an out-of-focus image from a captured image, and a storage unit 306 that stores the learning information. A correction unit 303 (image processing unit) provided in the image processing apparatus 301 acquires learning information from the storage unit 306 of the server 305 via the network 304 and corrects an out-of-focus image of the captured image. An output image such as an image whose out-of-focus image has been corrected by the correction unit 303 is output to at least one of the display device 308 , the recording medium 309 , and the output device 310 . The display device 308 is, for example, a liquid crystal display or a projector. The user can work while checking the image in the middle of processing via the display device 308 . A recording medium 309 is, for example, a semiconductor memory, a hard disk, or a server on a network. The output device 310 is, for example, a printer. The image processing apparatus 301 may have a function of performing development processing and other image processing as necessary.

次に、図8を参照して、焦点外れ像の補正処理について説明する。図8は、焦点外れ像の補正処理を示すフローチャートである。図8の各ステップは、主に、画像処理装置301の補正部303(画像処理部)により実行される。 Next, correction processing for an out-of-focus image will be described with reference to FIG. FIG. 8 is a flow chart showing an out-of-focus image correction process. Each step in FIG. 8 is mainly executed by the correction unit 303 (image processing unit) of the image processing apparatus 301 .

まずステップS301において、補正部303は、記憶部302から、撮影画像(入力画像)を取得する。続いてステップS302において、補正部303は、撮影画像に含まれる焦点外れ像領域の大きさを判定する。焦点外れ像領域の大きさとは、像面上のピントずれ量および絞り値に応じて変動する焦点外れ像が生じている領域の大きさである。本実施例では、これらの量を画素サイズで除すことで画素数に換算する。焦点外れ像領域の大きさを判定する方法として、以下に3つの例を示す。 First, in step S<b>301 , the correction unit 303 acquires a captured image (input image) from the storage unit 302 . Subsequently, in step S302, the correction unit 303 determines the size of the out-of-focus image area included in the captured image. The size of an out-of-focus image area is the size of an area in which an out-of-focus image is generated that varies according to the amount of defocus on the image plane and the aperture value. In this embodiment, these amounts are converted to the number of pixels by dividing them by the pixel size. Three examples of how to determine the size of the out-of-focus image area are given below.

第1の例は、ピント位置が異なる複数の画像を用いる方法である。焦点外れ像領域の大きさは像面上のピントずれ量に応じて変化するため、ピント位置が異なる撮影をすることで焦点外れ像領域の大きさが異なる画像を取得することができる。また、複数の画像から、部分領域ごとに最もコントラストが高くなる画像を選択すると、画像全域でピントが合ったパンフォーカス画像を得ることができる。そのパンフォーカス画像と補正を行う撮影画像とを比較することで、ピントずれによって大きく輝度変化している領域として、焦点外れ像領域を検出することができる。また部分領域ごとに、ボケ量と距離情報との相関を得ることが可能であるため、一般的にDFD(Depth from Defocus)として知られている手法により、部分領域ごとに被写体距離を算出することができる。被写体距離に基づいて像面上のピントずれ量を見積もることが可能であるため、前記手法による被写体距離と絞り値とに基づいて焦点外れ像領域の大きさを見積もることができる。 A first example is a method using a plurality of images with different focus positions. Since the size of the out-of-focus image area changes according to the amount of defocus on the image plane, images with different sizes of the out-of-focus image area can be obtained by photographing at different focal positions. Further, by selecting an image with the highest contrast for each partial area from a plurality of images, a deep focus image in which the entire image is in focus can be obtained. By comparing the pan-focus image with the photographed image to be corrected, an out-of-focus image area can be detected as an area in which the brightness is greatly changed due to defocus. Further, since it is possible to obtain the correlation between the blur amount and the distance information for each partial area, the subject distance can be calculated for each partial area by a method generally known as DFD (Depth from Defocus). can be done. Since the amount of defocus on the image plane can be estimated based on the subject distance, the size of the out-of-focus image area can be estimated based on the subject distance and the aperture value obtained by the above method.

第2の例は、絞り値が異なる複数の画像を用いる方法である。焦点外れ像領域の大きさは絞り値に応じて変化するため、絞り値が異なる撮影をすることで焦点外れ像領域の大きさが異なる画像を取得することができる。また、複数の画像から、部分領域ごとに最もコントラストが高くなる画像を選択すると、画像全域でピントが合ったパンフォーカス画像を得ることができる。そのパンフォーカス画像と補正を行う撮影画像とを比較することで、ピントずれにより大きく輝度変化している領域として、焦点外れ像領域を検出することができる。また部分領域ごとに、ボケ量と距離情報との相関を得ることが可能であるため、一般的にDFD(Depth from Defocus)として知られている手法により、部分領域ごとに被写体距離を算出することができる。被写体距離に基づいて像面上のピントずれ量を見積もることが可能であるため、前記手法による被写体距離と絞り値とに基づいて焦点外れ像領域の大きさを見積もることができる。 A second example is a method using a plurality of images with different aperture values. Since the size of the out-of-focus image area changes according to the aperture value, images with different sizes of the out-of-focus image area can be obtained by photographing with different aperture values. Further, by selecting an image with the highest contrast for each partial area from a plurality of images, a deep focus image in which the entire image is in focus can be obtained. By comparing the pan-focus image with the photographed image to be corrected, an out-of-focus image area can be detected as an area in which the brightness is greatly changed due to defocus. Further, since it is possible to obtain the correlation between the blur amount and the distance information for each partial area, the subject distance can be calculated for each partial area by a method generally known as DFD (Depth from Defocus). can be done. Since the amount of defocus on the image plane can be estimated based on the subject distance, the size of the out-of-focus image area can be estimated based on the subject distance and the aperture value obtained by the above method.

第3の例は、被写体距離(被写体距離情報)を用いる方法である。被写体距離に基づいて像面上のピントずれ量を見積もることが可能であるため、後述する手法により被写体距離と絞り値とに基づいて焦点外れ像領域の大きさを見積もることができる。被写体距離情報は、例えば、撮像装置300を多眼構成とすることで、ステレオ原理により距離情報を取得することができる。また、既存のTOF装置等の測距ユニットを別途備えることで、被写体距離情報を取得することもできる。 A third example is a method using subject distance (subject distance information). Since the amount of defocus on the image plane can be estimated based on the subject distance, the size of the out-of-focus image area can be estimated based on the subject distance and the aperture value by a method described later. The object distance information can be acquired according to the stereo principle, for example, by configuring the imaging device 300 with a multi-view configuration. In addition, object distance information can be acquired by separately providing a distance measuring unit such as an existing TOF device.

なお、画像の位置に応じて焦点外れ像領域の大きさが変わる場合があるため、撮影画像内の複数の位置に対して大きさを判定し、部分領域の位置に応じて学習情報を切り替えてもよい。 Since the size of the out-of-focus image area may change depending on the position of the image, the size is determined for multiple positions in the captured image, and the learning information is switched according to the position of the partial area. good too.

続いてステップS303において、補正部303は、ステップS302にて判定された焦点外れ像領域の大きさに基づいて、使用するネットワーク構造と学習情報、および、部分領域のサイズを決定する。本実施例において、補正部303は、図1に示されるCNNを利用して焦点外れ像を補正する。焦点外れ像領域が部分領域のサイズよりも大きいと、補正対象の被写体の情報が欠落してしまうため、高精度な焦点外れ像の補正を行うことができない。また、CNNでは各層でフィルタをコンボリューションして焦点外れ像を補正するため、それらのフィルタが影響する範囲を合わせた範囲が、撮影画像の焦点外れ像領域より小さいと、焦点外れ像を正しく補正することができない。例えば、全層数が2で、第1層のフィルタサイズが5×5、第2層のフィルタサイズが3×3である場合、ある画素の焦点外れ像の補正に使用できる範囲は、この画素を中心とした7×7画素である。このため、このネットワーク構造では、焦点外れ像領域の大きさが7画素以下になっていない場合、焦点外れ像を高精度に補正することができない。したがって、焦点外れ像領域の大きさに基づいて、ある画素の焦点外れ像の補正に使用される範囲(各層のフィルタのサイズに応じて決定される)を決定することが好ましい。 Subsequently, in step S303, the correction unit 303 determines the network structure and learning information to be used, and the size of the partial region based on the size of the out-of-focus image region determined in step S302. In this embodiment, the corrector 303 corrects the out-of-focus image using the CNN shown in FIG. If the out-of-focus image area is larger than the size of the partial area, the information of the subject to be corrected is lost, and thus the out-of-focus image cannot be corrected with high accuracy. In addition, since CNN corrects out-of-focus images by convolving filters in each layer, if the total range affected by these filters is smaller than the out-of-focus image area of the captured image, the out-of-focus image can be correctly corrected. Can not do it. For example, if the total number of layers is 2, the filter size of the first layer is 5×5, and the filter size of the second layer is 3×3, then the range that can be used to correct the out-of-focus image of a pixel is 7×7 pixels centered on . Therefore, in this network structure, the out-of-focus image cannot be corrected with high accuracy unless the size of the out-of-focus image area is 7 pixels or less. Therefore, the size of the out-of-focus image area is preferably used to determine the range (determined by the size of the filters in each layer) used to correct the out-of-focus image of a pixel.

より詳細には、以下の条件式(4)を満足するように、各層のフィルタのサイズを決定することが好ましい。 More specifically, it is preferable to determine the filter size of each layer so as to satisfy the following conditional expression (4).

Figure 0007129229000004
Figure 0007129229000004

条件式(4)において、dは撮影画像(入力画像)の画素に対する焦点外れ像領域の大きさであり、焦点外れ像領域の1次元方向における長さを画素数で表している。N+1は全層数である。s(m=1~N+1)は、第m線型変換で使用するフィルタのサイズ(第m線型変換(m=1~N+1)のそれぞれにおけるフィルタの1次元サイズ)である。第m線型変換で複数のサイズのフィルタが混合して使用される場合、sは最大のフィルタサイズである。条件式(4)の上限は、ある画素の焦点外れ像の補正に使用できる範囲が、焦点外れ像領域の大きさ以上であることを示している。一方、条件式(4)の下限は、理論的に超えることができない。 In conditional expression (4), d is the size of the out-of-focus image area with respect to the pixels of the captured image (input image), and represents the length of the out-of-focus image area in the one-dimensional direction by the number of pixels. N+1 is the total number of layers. s m (m=1 to N+1) is the size of the filter used in the mth linear transform (the one-dimensional size of the filter in each of the mth linear transforms (m=1 to N+1)). If a mixture of multiple size filters is used in the m -th linear transform, sm is the maximum filter size. The upper limit of conditional expression (4) indicates that the range that can be used for correcting an out-of-focus image of a certain pixel is greater than or equal to the size of the out-of-focus image area. On the other hand, theoretically, the lower limit of conditional expression (4) cannot be exceeded.

ネットワーク構造は、各層で使用するフィルタのサイズだけでなく、一つの層で使用されるフィルタの数や層数なども含む。焦点外れ像を高精度に補正するには、焦点外れ像領域が大きいほど層数やフィルタの数を増やす必要がある。学習情報は、焦点外れ像領域の大きさごとに学習されており、その中から撮影画像に含まれる焦点外れ像領域の大きさに対応した学習情報を使用する。これにより、より精度の高い焦点外れ像の補正が可能となる。なお、学習の詳細に関しては後述する。 The network structure includes not only the size of filters used in each layer, but also the number of filters used in one layer and the number of layers. In order to correct the out-of-focus image with high accuracy, it is necessary to increase the number of layers and the number of filters as the out-of-focus image area increases. The learning information is learned for each size of the out-of-focus image area, and among them, the learning information corresponding to the size of the out-of-focus image area included in the captured image is used. This makes it possible to correct an out-of-focus image with higher accuracy. The details of learning will be described later.

続いてステップS304において、補正部303は、撮影画像から部分領域(撮影画像の少なくとも一部の領域)を取得する。続いてステップS305において、補正部303は、ステップS303にて決定された学習情報に基づいて、補正部分領域を生成する。続いてステップS306において、補正部303は、撮影画像のうち所定の領域(部分領域)の全てに対して焦点外れ像の補正処理が完了したか否かを判定する。所定の領域の全てに対して焦点外れ像の補正が完了した場合、ステップS307へ進む。一方、焦点外れ像の補正が完了していない領域(部分領域)が残っている場合、ステップS304へ戻り、補正部303は、まだ焦点外れ像が補正されていない部分領域(新たな部分領域)を撮影画像から取得する。ステップS307において、補正部303は、焦点外れ像が補正された画像を出力する。 Subsequently, in step S304, the correction unit 303 acquires a partial area (at least a partial area of the captured image) from the captured image. Subsequently, in step S305, the correction unit 303 generates a correction partial area based on the learning information determined in step S303. Subsequently, in step S306, the correction unit 303 determines whether or not the out-of-focus image correction processing has been completed for all predetermined regions (partial regions) of the captured image. If the out-of-focus image correction has been completed for the entire predetermined area, the process proceeds to step S307. On the other hand, if there remains an area (partial area) for which the out-of-focus image correction has not been completed, the process returns to step S304, and the correction unit 303 selects a partial area (new partial area) for which the out-of-focus image has not yet been corrected. is obtained from the captured image. In step S307, the correction unit 303 outputs an image in which the out-of-focus image has been corrected.

なお、撮影画像中の位置に応じて焦点外れ像領域の大きさが大きく異なる場合、補正部303は、ステップS304をステップS302、S303の前に実行することが好ましい。このとき補正部303は、ステップS302、S303において、撮影画像の局所領域に対して焦点外れ像領域の大きさを取得し、対応する学習情報などを取得する。 Note that if the size of the out-of-focus image area varies greatly depending on the position in the captured image, the correction unit 303 preferably executes step S304 before steps S302 and S303. At this time, in steps S302 and S303, the correction unit 303 acquires the size of the out-of-focus image area for the local area of the captured image, and acquires the corresponding learning information.

次に、サーバ305の学習部307により行われる学習情報の学習に関して説明する。本実施例において、学習部307は、焦点外れ像領域の大きさに応じて異なる学習情報を学習する。学習方法は、図5を参照して実施例1にて説明した方法と基本的に同様であるが、学習画像の用意の仕方によりその前処理が異なる。 Next, learning of learning information performed by the learning unit 307 of the server 305 will be described. In this embodiment, the learning unit 307 learns different learning information according to the size of the out-of-focus image area. The learning method is basically the same as the method described in the first embodiment with reference to FIG. 5, but the preprocessing differs depending on how the learning images are prepared.

まず、焦点外れ像の変形(変形した焦点外れ像の形状)が異なる学習画像をシミュレーションにより生成する場合に関して説明する。この場合、焦点外れ像領域の大きさを設定して焦点外れ像の変形が生じていない画像から焦点外れ像の変形が生じている画像を生成し、一対の学習画像を得る。学習部307は、取得した学習画像に対してステップS201乃至S204を実行し、その後、異なる焦点外れ像領域の大きさに対して同様の手順を繰り返す。 First, a case will be described in which learning images with different deformations of out-of-focus images (shapes of deformed out-of-focus images) are generated by simulation. In this case, by setting the size of the out-of-focus image area, an image in which the out-of-focus image is not deformed is generated from an image in which the out-of-focus image is not deformed, and a pair of learning images are obtained. The learning unit 307 performs steps S201 to S204 on the acquired training images, and then repeats the same procedure for different sizes of out-of-focus image regions.

次に、焦点外れ像の変形が生じている画像から焦点外れ像の変形が生じていない画像を求めて、学習画像を生成する場合に関して説明する。この場合、焦点外れ像の変形が生じていない画像を求める際に焦点外れ像領域の大きさが求まるため、これにより学習画像を複数のグループに分ける。グループ分けは画像単位で行うことができる。1枚の焦点外れ像の変形が生じている画像内で焦点外れ像領域の大きさが変化している場合、画像を分割してグループ分けを行ってもよい。各グループは焦点外れ像領域の大きさが近いものが含まれているため、グループごとにステップS201乃至S204を実行して、学習情報を生成する。 Next, a case will be described in which learning images are generated by obtaining an image in which an out-of-focus image is not deformed from an image in which an out-of-focus image is deformed. In this case, since the size of the out-of-focus image area is obtained when obtaining an image in which deformation of the out-of-focus image does not occur, the training images are divided into a plurality of groups. Grouping can be performed on an image-by-image basis. If the size of the out-of-focus image area changes in the image in which the deformation of one out-of-focus image occurs, the image may be divided and grouped. Since each group includes out-of-focus image regions having similar sizes, steps S201 to S204 are executed for each group to generate learning information.

本実施例によれば、撮影画像から高精度に焦点外れ像(焦点外れ像の変形)を補正することが可能な画像処理システムを提供することができる。 According to this embodiment, it is possible to provide an image processing system capable of correcting an out-of-focus image (deformation of an out-of-focus image) from a captured image with high accuracy.

次に、本発明の実施例3における撮像装置について説明する。本実施例の撮像装置は、撮影画像(入力画像)から焦点外れ像の変形(変形した焦点外れ像の形状)を推定する。なお、本実施例における撮像装置の構成および外観は、図2および図3を参照して実施例1にて説明した撮像装置100と同様である。ただし本実施例の撮像装置には、画像処理部として、補正部102bに代えて推定部が設けられている。 Next, an imaging apparatus according to Embodiment 3 of the present invention will be described. The imaging apparatus of this embodiment estimates the deformation of the out-of-focus image (the shape of the deformed out-of-focus image) from the captured image (input image). The configuration and appearance of the imaging apparatus according to this embodiment are the same as those of the imaging apparatus 100 described in Embodiment 1 with reference to FIGS. However, in the imaging apparatus of this embodiment, an estimation unit is provided as an image processing unit instead of the correction unit 102b.

図9を参照して、撮影画像(入力画像)から焦点外れ像の変形を推定する処理について説明する。図9は、焦点外れ像の変形の推定処理を示すフローチャートである。図9の各ステップは、主に、画像処理部102の推定部により実行される。 Processing for estimating deformation of an out-of-focus image from a captured image (input image) will be described with reference to FIG. FIG. 9 is a flow chart showing a process of estimating deformation of an out-of-focus image. Each step in FIG. 9 is mainly executed by the estimation unit of the image processing unit 102 .

まずステップS401において、画像処理部102(推定部)は、撮影画像(入力画像)と学習情報とを取得する。学習情報の学習に関しては後述する。この学習により、撮影画像の部分領域と部分領域に生じている焦点外れ像の変形とを結び付ける学習情報が取得されている。続いてステップS402において、推定部は、撮影画像から、焦点外れ像の変形を推定するための部分領域を取得する。本実施例において、推定部は、部分領域に含まれる画素(例えば中心画素)に焦点外れ像の変化が生じているか否かを、その周辺画素(部分領域に含まれている画素)の情報も利用して推定する。 First, in step S401, the image processing unit 102 (estimating unit) acquires a captured image (input image) and learning information. Learning of learning information will be described later. Through this learning, learning information is obtained that links the partial area of the captured image and the deformation of the out-of-focus image occurring in the partial area. Subsequently, in step S402, the estimation unit acquires a partial area for estimating deformation of the out-of-focus image from the captured image. In this embodiment, the estimating unit determines whether or not a change in an out-of-focus image has occurred in a pixel included in the partial area (for example, the central pixel), and also includes information on peripheral pixels (pixels included in the partial area). Estimate using

続いてステップS403において、推定部は、ステップS401にて取得した学習情報に基づいて、焦点外れ像の変形を推定する。本実施例において、推定部は、図10に示されるネットワーク構造を使用して推定を行う。図10は、本実施例における焦点外れ像の変形を推定するネットワーク構造を示す図である。図10において、中間データ410の生成までの工程は、図1を参照して実施例1で説明した工程と同様であるため、それらの説明を省略する。すなわち、図10の部分領域401、フィルタ402、第1変換部分領域403、フィルタ404、および、中間データ410はそれぞれ、図1の部分領域201、フィルタ202、第1変換部分領域203、フィルタ204、および、中間データ210に相当する。 Subsequently, in step S403, the estimation unit estimates deformation of the out-of-focus image based on the learning information acquired in step S401. In this embodiment, the estimator uses the network structure shown in FIG. 10 to perform the estimation. FIG. 10 is a diagram showing a network structure for estimating deformation of an out-of-focus image in this embodiment. In FIG. 10, the processes up to the generation of the intermediate data 410 are the same as the processes described in the first embodiment with reference to FIG. 1, so description thereof will be omitted. That is, the partial area 401, the filter 402, the first transformation partial area 403, the filter 404, and the intermediate data 410 in FIG. and intermediate data 210 .

本実施例では、第N+1層における第N+1線型変換として、フルコネクション411を実行する。フルコネクション411は、入力される中間データ410の全信号の線型結合をとる。この際、各信号にかかる係数と加算される定数は、学習情報によって決定される。また、係数と定数は複数種類が存在し、それぞれの係数と定数に対して線型結合が計算され、複数の結果が出力される。フルコネクション411で出力された複数の値は、活性化関数によって変換され(第N+1非線型変換)、ソフトマックス412に入力される。ソフトマックス412は、以下の式(5)で表されるソフトマックス関数を計算する。 In this embodiment, the full connection 411 is executed as the (N+1)th linear transformation in the (N+1)th layer. The full connection 411 linearly combines all signals of the input intermediate data 410 . At this time, coefficients applied to each signal and constants to be added are determined by learning information. In addition, there are multiple types of coefficients and constants, and linear combinations are calculated for each of the coefficients and constants, and multiple results are output. A plurality of values output by the full connection 411 are transformed by the activation function (N+1th nonlinear transformation) and input to the softmax 412 . Softmax 412 computes the softmax function expressed in Equation (5) below.

Figure 0007129229000005
Figure 0007129229000005

式(5)において、ベクトルxは第N+1非線型変換で出力された複数の値を成分とする列ベクトル、ベクトルwは学習情報から決定される係数を成分とした列ベクトルである。ベクトルwの右肩に付いたTは、転置を表す。式(5)によって、部分領域401に生じている焦点外れ像の変形が、分布413a~413d(413e以降は省略)のいずれであるかの確率を求めることができる。ここで分布とは、部分領域に焦点外れ像の変形が存在するか否かを示したものであり、分布413aは大きなリングボケ、分布413bは小さなリングボケ、分布413c、413dは口径食による周辺部の変形をそれぞれ示している。式(5)のKは分布の総数、jとkは分布の番号を示すインデックスである。 In equation (5), vector x is a column vector whose components are a plurality of values output by the N+1th nonlinear transformation, and vector w is a column vector whose components are coefficients determined from learning information. The T on the right shoulder of the vector w represents transposition. From equation (5), it is possible to obtain the probability of which of the distributions 413a to 413d (413e and after) the deformation of the out-of-focus image occurring in the partial area 401 belongs to. Here, the distribution indicates whether or not deformation of the out-of-focus image exists in the partial area. Each deformation is shown. K in Equation (5) is the total number of distributions, and j and k are indices indicating distribution numbers.

続いて、図9のステップS404において、推定部は、撮影画像のうち所定の領域(部分領域)の全てに対して焦点外れ像の変形の推定が完了したか否かを判定する。所定の領域の全てに対して推定が完了した場合、ステップS405へ進む。一方、推定が完了していない領域(部分領域)が残っている場合、ステップS402へ戻り、推定部は、まだ焦点外れ像の変形が推定されていない部分領域(新たな部分領域)を撮影画像から取得する。 Subsequently, in step S404 of FIG. 9, the estimation unit determines whether or not the estimation of the deformation of the out-of-focus image has been completed for all of the predetermined regions (partial regions) of the captured image. If the estimation has been completed for all of the predetermined regions, the process proceeds to step S405. On the other hand, if there remains an area (partial area) for which the estimation has not been completed, the process returns to step S402, and the estimating unit selects a partial area (new partial area) for which the deformation of the out-of-focus image has not yet been estimated. Get from

ステップS405において、推定部は、所定の領域内の各部分領域における焦点外れ像の変形の推定結果を出力する。焦点外れ像の変形の推定結果は、焦点外れ像の変形が生じた光学系(結像光学系)の撮影状態を解析するためや、撮影画像から焦点外れ像を補正するため等に用いることができる。焦点外れ像を補正する場合、ディープラーニング以外の手法を用いてもよい。以上の処理により、焦点外れ像の変形が生じている撮影画像から、焦点外れ像の変形を高精度に推定することができる。 In step S405, the estimation unit outputs an estimation result of the deformation of the out-of-focus image in each partial area within the predetermined area. The estimated deformation of the out-of-focus image can be used to analyze the shooting conditions of the optical system (imaging optical system) in which the deformation of the out-of-focus image occurs, and to correct the out-of-focus image from the captured image. can. Techniques other than deep learning may be used to correct out-of-focus images. With the above processing, the deformation of the out-of-focus image can be estimated with high accuracy from the photographed image in which the out-of-focus image is deformed.

次に、図11を参照して、本実施例における学習情報の生成に関して説明する。図11は、学習情報の学習を示すフローチャートである。図11の各ステップは、主に、画像処理部102の学習部102aにより行われる。ただし本実施例はこれに限定されるものではなく、学習情報の学習は、撮像装置100とは別の装置(演算装置)に設けられた学習部で行ってもよい。本実施例では、実施例1と同様に、撮像装置100の学習部102aが学習情報を学習する場合について説明する。 Next, generation of learning information in this embodiment will be described with reference to FIG. FIG. 11 is a flowchart showing learning of learning information. Each step in FIG. 11 is mainly performed by the learning unit 102 a of the image processing unit 102 . However, the present embodiment is not limited to this, and learning of learning information may be performed by a learning unit provided in a device (arithmetic device) different from the imaging device 100 . In this embodiment, as in the first embodiment, a case where the learning unit 102a of the imaging device 100 learns the learning information will be described.

まずステップS501において、学習部102aは、学習画像を取得する。本実施例では、焦点外れ像の変形が生じていない画像に対してシミュレーションを用いて口径食のよる焦点外れ像の変形を付与した画像を学習画像とする。学習画像は単数でも複数でもよい。ただし、様々な大きさや形状の焦点外れ像の変形を精度よく推定するには、異なる口径食による焦点外れ像の変形が学習画像に含まれている必要がある。 First, in step S501, the learning unit 102a acquires a learning image. In the present embodiment, an image obtained by applying deformation of an out-of-focus image due to vignetting using a simulation to an image having no deformation of the out-of-focus image is used as a learning image. The training image may be singular or plural. However, to accurately estimate the deformation of out-of-focus images of various sizes and shapes, the training images should include the deformations of the out-of-focus images due to different vignetting.

続いてステップS502において、学習部102aは、ステップS501にて取得した学習画像から、複数の学習ペアを取得する。本実施例において、学習ペアは、学習画像(焦点外れ像の変形が生じている画像)の部分領域(学習用変形部分領域)、および、この部分領域に作用している分布に関する情報である。分布に関する情報とは、複数の変形分布のうち特定の分布を示す番号である。複数の分布は、図10に示される分布413a~413d(413e以降は省略)であり、これらは事前に用意されて記憶部103に記憶されている。 Subsequently, in step S502, the learning unit 102a acquires a plurality of learning pairs from the learning images acquired in step S501. In this embodiment, a learning pair is a partial area (learning deformed partial area) of a learning image (an image in which an out-of-focus image is deformed) and information about the distribution acting on this partial area. Information about distribution is a number indicating a specific distribution among a plurality of deformation distributions. The plurality of distributions are distributions 413a to 413d (413e and subsequent ones are omitted) shown in FIG.

続いてステップS503において、学習部102aは、学習ペア(変形分布に関する情報と学習用変形部分領域)に基づいて、学習情報を生成する。学習情報の生成には、図10のネットワーク構造が用いられる。続いてステップS504において、学習部102aは、生成された学習情報を出力する。本実施例において、実施例2と同様に、焦点外れ像領域の大きさごとに学習情報を用意してもよい。 Subsequently, in step S503, the learning unit 102a generates learning information based on the learning pair (information on deformation distribution and deformation partial area for learning). The network structure of FIG. 10 is used for generating learning information. Subsequently, in step S504, the learning unit 102a outputs the generated learning information. In this embodiment, similarly to the second embodiment, learning information may be prepared for each size of the out-of-focus image area.

本実施例によれば、撮影画像から高精度に焦点外れ像の変形を推定することが可能な撮像装置を提供することができる。 According to this embodiment, it is possible to provide an imaging apparatus capable of estimating deformation of an out-of-focus image with high accuracy from a captured image.

(その他の実施例)
本発明は、上述の実施例の1以上の機能を実現するプログラムを、ネットワーク又は記憶媒体を介してシステム又は装置に供給し、そのシステム又は装置のコンピュータにおける1つ以上のプロセッサーがプログラムを読出し実行する処理でも実現可能である。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現可能である。
(Other examples)
The present invention supplies a program that implements one or more functions of the above-described embodiments to a system or apparatus via a network or a storage medium, and one or more processors in the computer of the system or apparatus reads and executes the program. It can also be realized by processing to It can also be implemented by a circuit (for example, ASIC) that implements one or more functions.

各実施例によれば、撮影画像から高精度に焦点外れ像の変形を推定または補正することが可能な画像処理方法、画像処理装置、撮像装置、プログラム、および、記憶媒体を提供することができる。 According to each embodiment, it is possible to provide an image processing method, an image processing device, an imaging device, a program, and a storage medium capable of estimating or correcting deformation of an out-of-focus image from a captured image with high precision. .

以上、本発明の好ましい実施例について説明したが、本発明はこれらの実施例に限定されたものではなく、その要旨の範囲内で様々な変形、及び変更が可能である。 Although preferred embodiments of the present invention have been described above, the present invention is not limited to these embodiments, and various modifications and changes are possible within the scope of the gist.

102 画像処理部
102b、303 補正部(画像処理部)
103、302 記憶部
301 画像処理装置
102 image processing unit 102b, 303 correction unit (image processing unit)
103, 302 Storage unit 301 Image processing device

Claims (17)

力画像の少なくとも一部の領域を取得する工程と、
口径食または収差の影響による焦点外れ像の変形に関して予め学習された学習情報を取得する工程と、
前記学習情報を用いて前記領域に含まれる焦点外れ像の変形を推定または補正する工程と、を有し、
記推定または補正する工程は、Nを2以上の整数、nを1からNまでの整数とするとき、
前記領域に対して、前記学習情報に基づく複数の線型関数のそれぞれによる第n線型変換と、非線型関数による第n非線型変換とをnが1からNになるまで順に実行することで中間データを生成する工程と、
前記中間データに対して、前記学習情報に基づく少なくとも一つの線型関数による第N+1線型変換を実行する工程と、を含むことを特徴とする画像処理方法。
obtaining at least a partial region of an input image;
obtaining pre-learned learning information regarding deformation of the out-of-focus image due to vignetting or aberration effects ;
using the learned information to estimate or correct deformation of out-of-focus images contained in the region;
In the estimating or correcting step, when N is an integer of 2 or more and n is an integer from 1 to N,
intermediate data by sequentially performing n-th linear transformation by each of a plurality of linear functions based on the learning information and n-th nonlinear transformation by a nonlinear function on the region until n is from 1 to N; and
an image processing method, comprising: performing an N+1-th linear transformation on the intermediate data using at least one linear function based on the learning information.
前記入力画像において焦点外れ像の変形が生じている焦点外れ像領域の大きさを取得する工程を更に有し、
前記領域の大きさまたは前記学習情報は、前記焦点外れ像領域の大きさに基づいて決定されることを特徴とする請求項1に記載の画像処理方法。
further comprising obtaining a size of an out-of-focus image region in the input image where the out-of-focus image deformation occurs;
2. The image processing method of claim 1, wherein the size of the region or the learning information is determined based on the size of the out-of-focus image region.
前記焦点外れ像領域の大きさは、前記入力画像とは異なる絞り値またはピント位置の画像を用いて算出されることを特徴とする請求項2に記載の画像処理方法。 3. The image processing method according to claim 2, wherein the size of the out-of-focus image area is calculated using an image with an aperture value or focus position different from that of the input image. 前記入力画像は理想的な焦点外れ像の形状から変形した焦点外れ像を含み
記推定または補正する工程において、前記入力画像に含まれる焦点外れ像の変形を推定する、または、前記入力画像に含まれる焦点外れ像の形状を前記理想的な焦点外れ像の形状に近づけるように補正することを特徴とする請求項1乃至3のいずれか1項に記載の画像処理方法。
the input image includes an out-of-focus image deformed from an ideal out-of-focus image shape;
In the estimating or correcting step, the deformation of the out-of-focus image included in the input image is estimated, or the shape of the out-of-focus image included in the input image is approximated to the ideal shape of the out-of-focus image. 4. The image processing method according to any one of claims 1 to 3, wherein the correction is performed as follows.
前記理想的な焦点外れ像は、光学系の口径食または収差の影響がない状態で取得された焦点外れ像であり
記入力画像は、前記口径食または前記収差の影響により前記理想的な焦点外れ像から変形した焦点外れ像を含むことを特徴とする請求項4に記載の画像処理方法。
The ideal out-of-focus image is an out-of-focus image acquired without the effects of vignetting or aberrations of the optical system ,
5. The image processing method according to claim 4, wherein said input image includes an out-of-focus image deformed from said ideal out-of-focus image due to the effect of said vignetting or said aberration.
前記第n線型変換(n=1~N)のそれぞれは、前記学習情報に基づく複数のフィルタの各々とのコンボリューションを含むことを特徴とする請求項1乃至5のいずれか一項に記載の画像処理方法。 6. The method according to any one of claims 1 to 5, wherein each of the n-th linear transformations (n=1 to N) includes convolution with each of a plurality of filters based on the learning information. Image processing method. 記第N+1線型変換は、前記学習情報に基づくフィルタとのコンボリューションを含むことを特徴とする請求項6に記載の画像処理方法。 7. The image processing method according to claim 6, wherein said (N+1)th linear transformation includes convolution with a filter based on said learning information. 前記入力画像において焦点外れ像の変形が生じている焦点外れ像領域の大きさを取得する工程を更に有し、
前記第n線型変換(n=1~N)および前記第N+1線型変換のそれぞれにおける前記フィルタのサイズは、前記焦点外れ像領域の大きさに基づいて決定されることを特徴とする請求項7に記載の画像処理方法。
further comprising obtaining a size of an out-of-focus image region in the input image where the out-of-focus image deformation occurs;
8. The method of claim 7, wherein the size of the filter in each of the nth linear transformation (n=1 to N) and the N+1th linear transformation is determined based on the size of the out-of-focus image area. The described image processing method.
前記入力画像において焦点外れ像の変形が生じている焦点外れ像領域の大きさを取得する工程を更に有し、
前記入力画像の画素に対する前記焦点外れ像領域の大きさをd、前記第n線型変換(n=1~N)および前記第N+1線型変換のそれぞれにおける前記フィルタの1次元サイズをs(m=1~N+1)とするとき、
Figure 0007129229000006

なる条件式を満足することを特徴とする請求項7または8に記載の画像処理方法。
further comprising obtaining a size of an out-of-focus image region in the input image where the out-of-focus image deformation occurs;
d is the size of the out-of-focus image area for pixels of the input image, and s m (m= 1 to N+1),
Figure 0007129229000006

9. The image processing method according to claim 7, wherein the following conditional expression is satisfied.
前記学習情報は、焦点外れ像の変形の状態が異なり、かつ同一の被写体が存在する少なくとも一対の学習画像を用いて学習された情報であることを特徴とする請求項1乃至9のいずれか1項に記載の画像処理方法。 10. The learning information according to any one of claims 1 to 9, wherein the learning information is information learned using at least a pair of learning images in which the deformation state of the out-of- focus image is different and the same subject is present. 2. The image processing method according to item 1. 前記一対の学習画像は、焦点外れ像の変形が生じている画像と、焦点外れ像の変形が生じていない画像と、を含むことを特徴とする請求項10に記載の画像処理方法。 11. The image processing method according to claim 10, wherein the pair of training images includes an image in which an out-of-focus image is deformed and an image in which an out-of- focus image is not deformed. 前記学習画像のうち焦点外れ像の変形が生じていない画像は、前記同一の被写体を異なる絞り値またはピント位置で撮影した画像であることを特徴とする請求項11に記載の画像処理方法。 12. The image according to claim 11, wherein the images in which deformation of the out-of- focus image does not occur among the learning images are images obtained by photographing the same subject at different aperture values or different focus positions. Processing method. 前記学習画像は、シミュレーションにより生成された画像であることを特徴とする請求項10乃至12のいずれか1項に記載の画像処理方法。 13. The image processing method according to any one of claims 10 to 12, wherein the learning image is an image generated by simulation. 口径食または収差の影響による焦点外れ像の変形に関する学習情報を記憶する記憶部と、
前記学習情報を用いて入力画像の少なくとも一部の領域における焦点外れ像の変形を推定または補正する画像処理部と、を有し、
前記画像処理部は、Nを2以上の整数、nを1からNまでの整数とするとき、
前記領域に対して、前記学習情報に基づく複数の線型関数のそれぞれによる第n線型変換と、非線型関数による第n非線型変換とをnが1からNになるまで順に実行することで中間データを生成し、
前記中間データに対して、前記学習情報に基づく少なくとも一つの線型関数による第N+1線型変換を実行する、ことを特徴とする画像処理装置。
a storage unit for storing learned information about deformation of the out-of-focus image due to vignetting or aberration effects ;
an image processing unit that estimates or corrects deformation of the out-of- focus image in at least a partial region of the input image using the learning information;
In the image processing unit, when N is an integer of 2 or more and n is an integer from 1 to N,
intermediate data by sequentially performing n-th linear transformation by each of a plurality of linear functions based on the learning information and n-th nonlinear transformation by a nonlinear function on the region until n is from 1 to N; to generate
An image processing apparatus, wherein the intermediate data is subjected to an (N+1)th linear transformation using at least one linear function based on the learning information.
被写体空間の像を入力画像として取得する撮像部と、
請求項14に記載の画像処理装置と、を有することを特徴とする撮像装置。
an imaging unit that acquires an image of an object space as an input image;
An imaging apparatus comprising: the image processing apparatus according to claim 14 .
請求項1乃至13のいずれか1項に記載の画像処理方法をコンピュータに実行させることを特徴とするプログラム。 A program for causing a computer to execute the image processing method according to any one of claims 1 to 13. 請求項16に記載のプログラムを記憶していることを特徴とする記憶媒体。 17. A storage medium storing the program according to claim 16.
JP2018109126A 2018-06-07 2018-06-07 Image processing method, image processing device, imaging device, program, and storage medium Active JP7129229B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2018109126A JP7129229B2 (en) 2018-06-07 2018-06-07 Image processing method, image processing device, imaging device, program, and storage medium
PCT/JP2019/020641 WO2019235258A1 (en) 2018-06-07 2019-05-24 Image processing method, image processing device, imaging apparatus, program, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2018109126A JP7129229B2 (en) 2018-06-07 2018-06-07 Image processing method, image processing device, imaging device, program, and storage medium

Publications (3)

Publication Number Publication Date
JP2019212139A JP2019212139A (en) 2019-12-12
JP2019212139A5 JP2019212139A5 (en) 2021-07-26
JP7129229B2 true JP7129229B2 (en) 2022-09-01

Family

ID=68770832

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2018109126A Active JP7129229B2 (en) 2018-06-07 2018-06-07 Image processing method, image processing device, imaging device, program, and storage medium

Country Status (2)

Country Link
JP (1) JP7129229B2 (en)
WO (1) WO2019235258A1 (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003256771A (en) 2002-03-06 2003-09-12 Nippon Telegr & Teleph Corp <Ntt> In-scene character imaging method and device therefor, and in-scene character imaging program and recording medium with the program recorded thereon
JP2009020844A (en) 2007-07-13 2009-01-29 Morpho Inc Method for processing image data and imaging apparatus
JP2009069996A (en) 2007-09-11 2009-04-02 Sony Corp Image processing device and image processing method, recognition device and recognition method, and program
JP2010045819A (en) 2000-02-28 2010-02-25 Eastman Kodak Co Face detecting camera and method
WO2018037521A1 (en) 2016-08-25 2018-03-01 キヤノン株式会社 Image processing method, image processing apparatus, image capture apparatus, image processing program, and storage medium
JP2018055516A (en) 2016-09-30 2018-04-05 キヤノン株式会社 Image processing method, image processing apparatus, imaging apparatus, image processing program, and storage medium
JP2018084982A (en) 2016-11-24 2018-05-31 キヤノン株式会社 Image processing apparatus, image processing method, and program

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010045819A (en) 2000-02-28 2010-02-25 Eastman Kodak Co Face detecting camera and method
JP2003256771A (en) 2002-03-06 2003-09-12 Nippon Telegr & Teleph Corp <Ntt> In-scene character imaging method and device therefor, and in-scene character imaging program and recording medium with the program recorded thereon
JP2009020844A (en) 2007-07-13 2009-01-29 Morpho Inc Method for processing image data and imaging apparatus
JP2009069996A (en) 2007-09-11 2009-04-02 Sony Corp Image processing device and image processing method, recognition device and recognition method, and program
WO2018037521A1 (en) 2016-08-25 2018-03-01 キヤノン株式会社 Image processing method, image processing apparatus, image capture apparatus, image processing program, and storage medium
JP2018055516A (en) 2016-09-30 2018-04-05 キヤノン株式会社 Image processing method, image processing apparatus, imaging apparatus, image processing program, and storage medium
JP2018084982A (en) 2016-11-24 2018-05-31 キヤノン株式会社 Image processing apparatus, image processing method, and program

Also Published As

Publication number Publication date
WO2019235258A1 (en) 2019-12-12
JP2019212139A (en) 2019-12-12

Similar Documents

Publication Publication Date Title
US10354369B2 (en) Image processing method, image processing apparatus, image pickup apparatus, and storage medium
CN110858871B (en) Image processing method, image processing apparatus, imaging apparatus, lens apparatus, storage medium, and image processing system
JP2018084982A (en) Image processing apparatus, image processing method, and program
JP6910780B2 (en) Image processing method, image processing device, imaging device, image processing program, and storage medium
JP6478496B2 (en) Imaging apparatus and control method thereof
US11508038B2 (en) Image processing method, storage medium, image processing apparatus, learned model manufacturing method, and image processing system
TWI507808B (en) Image capturing apparatus
JP2014006388A (en) Imaging apparatus, and its control method and program
JP2020036310A (en) Image processing method, image processing apparatus, imaging apparatus, lens device, program, storage medium, and image processing system
US20220368877A1 (en) Image processing method, image processing apparatus, storage medium, manufacturing method of learned model, and image processing system
JP2019074777A (en) Image processing method, image processing apparatus, and imaging apparatus
US10084978B2 (en) Image capturing apparatus and image processing apparatus
JP7146461B2 (en) Image processing method, image processing device, imaging device, program, and storage medium
JP7191588B2 (en) Image processing method, image processing device, imaging device, lens device, program, and storage medium
JP7129229B2 (en) Image processing method, image processing device, imaging device, program, and storage medium
JP7009219B2 (en) Image processing method, image processing device, image pickup device, image processing program, and storage medium
US11080832B2 (en) Image processing method, image processing apparatus, imaging apparatus, and storage medium
JP2019068378A (en) High resolution imaging apparatus
JP2018133064A (en) Image processing apparatus, imaging apparatus, image processing method, and image processing program
JP5344647B2 (en) Image processing method, image processing apparatus, and image processing program
JP2020057373A (en) Image processing method, image processing device, image capturing device, program, recording medium, image processing system, and method of producing trained model
WO2020118093A1 (en) Neural network focusing for imaging systems
JP2019139694A (en) Image processing method, image processor, imaging apparatus, image processing program, and storage medium
US20230128856A1 (en) Image processing method, storage medium, image processing apparatus, manufacturing method of trained model, and image processing system
CN117956278A (en) Automatic focusing method and device

Legal Events

Date Code Title Description
A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210526

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20210526

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20220719

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20220822

R151 Written notification of patent or utility model registration

Ref document number: 7129229

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151