Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP5083574B2 - Image processing apparatus and program - Google Patents
[go: Go Back, main page]

JP5083574B2 - Image processing apparatus and program - Google Patents

Image processing apparatus and program Download PDF

Info

Publication number
JP5083574B2
JP5083574B2 JP2010043004A JP2010043004A JP5083574B2 JP 5083574 B2 JP5083574 B2 JP 5083574B2 JP 2010043004 A JP2010043004 A JP 2010043004A JP 2010043004 A JP2010043004 A JP 2010043004A JP 5083574 B2 JP5083574 B2 JP 5083574B2
Authority
JP
Japan
Prior art keywords
image
unit
brightness
detection area
detection
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
JP2010043004A
Other languages
Japanese (ja)
Other versions
JP2011182116A (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.)
Nikon Corp
Original Assignee
Nikon Corp
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 Nikon Corp filed Critical Nikon Corp
Priority to JP2010043004A priority Critical patent/JP5083574B2/en
Priority to EP10170159A priority patent/EP2287807A1/en
Priority to US12/839,621 priority patent/US8665347B2/en
Priority to CN201010234441.XA priority patent/CN101964873B/en
Publication of JP2011182116A publication Critical patent/JP2011182116A/en
Application granted granted Critical
Publication of JP5083574B2 publication Critical patent/JP5083574B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Studio Devices (AREA)

Description

本発明は、画像の異物を検出する画像処理装置およびプログラムに関する。   The present invention relates to an image processing apparatus and a program for detecting foreign matter in an image.

デジタルカメラなどの撮像装置では、撮像光路上に配置された光学フィルタ等の光学部材に異物が付着し、付着した異物により撮像画像に画像欠陥が発生する場合がある。このような問題を解決するための従来技術としては、例えば、撮影画像の輝度データに基づいて画像に写りこんだ異物を検出し、当該異物を除去する画像処理装置が提案されている(特許文献1等参照)。   In an imaging apparatus such as a digital camera, foreign matter may adhere to an optical member such as an optical filter disposed on the imaging optical path, and an image defect may occur in a captured image due to the attached foreign matter. As a conventional technique for solving such a problem, for example, there has been proposed an image processing apparatus that detects a foreign substance reflected in an image based on luminance data of a captured image and removes the foreign substance (Patent Document). 1 etc.).

特開2004−220553号公報JP 2004-220553 A

しかしながら、従来技術では、撮影画像に写りこんだ異物の検出精度が不十分な場合があり、誤検出が発生する場合があった。また、従来技術は、特定領域の輝度変化が、異物の写りこみによるものであるか否かを判別することが難しいという問題を有している。   However, in the prior art, the detection accuracy of a foreign object reflected in a captured image may be insufficient, and erroneous detection may occur. Further, the conventional technique has a problem that it is difficult to determine whether or not the luminance change in the specific area is due to the reflection of a foreign object.

本発明は、このような実状に鑑みてなされ、その目的は、画像の異物を精度良く検出する画像処理装置および画像処理プログラムを提供することである。   The present invention has been made in view of such a situation, and an object thereof is to provide an image processing apparatus and an image processing program for accurately detecting a foreign object in an image.

上記目的を達成するために、本発明に係る画像処理装置は、
撮影画像が入力される画像入力部(28)と、
前記撮影画像内の検出領域の明るさに対応する明るさ情報、及び、前記検出領域の彩度に対応する彩度情報を用いて、前記検出領域が前記撮影画像に写りこんだ異物に対応する部分であるか否かを判断する判断部(48)とを含み、前記判断部は、前記明るさ情報を用いて前記検出領域が前記異物に対応する部分であるか否かを判断した後、前記彩度情報を用いて前記検出領域が前記異物に対応する部分であるか否かを判断する。
In order to achieve the above object, an image processing apparatus according to the present invention provides:
An image input unit (28) for inputting a captured image;
Using the brightness information corresponding to the brightness of the detection area in the captured image and the saturation information corresponding to the saturation of the detection area, the detection area corresponds to a foreign object reflected in the captured image. A determination unit (48) for determining whether or not it is a part, and after the determination unit determines whether or not the detection region is a part corresponding to the foreign object using the brightness information, Using the saturation information, it is determined whether or not the detection area is a portion corresponding to the foreign matter.

また、例えば、前記判断部は、前記検出領域の彩度に対応する第1彩度情報と、前記検出領域の周辺の領域の彩度に対応する第2彩度情報との差異が予め定められた範囲であるとき、前記検出領域が前記異物に対応する部分であると判断してもよい。   In addition, for example, the determination unit determines in advance a difference between the first saturation information corresponding to the saturation of the detection region and the second saturation information corresponding to the saturation of the region around the detection region. If it is within the range, the detection area may be determined to be a portion corresponding to the foreign matter.

また、例えば、前記判断部は、前記検出領域の彩度に対応する第1彩度情報と、前記検出領域の周辺の領域の彩度に対応する第2彩度情報との差異が予め定められた範囲でないとき、前記検出領域が前記異物に対応する部分でないと判断してもよい。   In addition, for example, the determination unit determines in advance a difference between the first saturation information corresponding to the saturation of the detection region and the second saturation information corresponding to the saturation of the region around the detection region. If it is not within the range, it may be determined that the detection area is not a part corresponding to the foreign matter.

また、例えば、前記判断部は、前記検出領域の明るさと、前記検出領域の周辺の領域の明るさとの勾配を用いて前記検出領域が前記異物に対応する部分であるか否かを判断してもよい。   In addition, for example, the determination unit determines whether the detection region is a portion corresponding to the foreign object by using a gradient between the brightness of the detection region and the brightness of a region around the detection region. Also good.

また、例えば、前記判断部は、前記検出領域の彩度に対応する第1彩度情報と、前記検出領域の周辺の領域の彩度に対応する第2彩度情報との比を用いて前記検出領域が前記異物に対応する部分であるか否かを判断してもよい。   In addition, for example, the determination unit uses the ratio between the first saturation information corresponding to the saturation of the detection region and the second saturation information corresponding to the saturation of the region around the detection region. It may be determined whether or not the detection region is a portion corresponding to the foreign matter.

また、例えば、前記判断部は、前記検出領域の周辺の領域の明るさに対応する第2明るさ情報が、予め定められた範囲でないとき、前記検出領域が前記異物に対応する部分でないと判断してもよい。   Further, for example, the determination unit determines that the detection area is not a part corresponding to the foreign object when the second brightness information corresponding to the brightness of the area around the detection area is not a predetermined range. May be.

また、例えば、前記判断部は、前記検出領域の周辺の領域の明るさの標準偏差が、予め定められた範囲でないとき、前記検出領域が前記異物に対応する部分でないと判断してもよい。   Further, for example, the determination unit may determine that the detection area is not a part corresponding to the foreign object when a standard deviation of brightness of the area around the detection area is not in a predetermined range.

本発明に係るプログラムは、
コンピュータに、
撮影画像を入力する手順と、
前記撮影画像の明るさ情報を算出する手順と、
前記撮影画像の彩度情報を算出する手順と、
前記明るさ情報と前記彩度情報を用いて、前記画像に写り込んだ異物に関する異物情報を検出する手順と、を実行させる。
The program according to the present invention is:
On the computer,
The procedure to input the shot image,
A procedure for calculating brightness information of the captured image;
A procedure for calculating saturation information of the captured image;
And a procedure for detecting foreign matter information related to the foreign matter reflected in the image using the brightness information and the saturation information.

また、本発明の第2の観点に係るプログラムは、
コンピュータに、
撮影画像を入力する手順と、
前記撮影画像内の検出領域の明るさに対応する明るさ情報、及び、前記検出領域の彩度に対応する彩度情報を用いて、前記検出領域が前記撮影画像に写りこんだ異物に対応する部分であるか否かを判断する手順と、を実行させる。
A program according to the second aspect of the present invention is:
On the computer,
The procedure to input the shot image,
Using the brightness information corresponding to the brightness of the detection area in the captured image and the saturation information corresponding to the saturation of the detection area, the detection area corresponds to a foreign object reflected in the captured image. And a procedure for determining whether or not it is a part.

なお上述の説明では、本発明をわかりやすく説明するために実施形態を示す図面の符号に対応づけて説明したが、本発明は、これに限定されるものではない。後述の実施形態の構成を適宜改良してもよく、また、少なくとも一部を他の構成物に代替させてもよい。さらに、その配置について特に限定のない構成要件は、実施形態で開示した配置に限らず、その機能を達成できる位置に配置することができる。 In the above description, in order to explain the present invention in an easy-to-understand manner, the description is made in association with the reference numerals of the drawings showing the embodiments. However, the present invention is not limited to this. The configuration of the embodiment described later may be improved as appropriate, or at least a part of the configuration may be replaced with another component. Further, the configuration requirements that are not particularly limited with respect to the arrangement are not limited to the arrangement disclosed in the embodiment, and can be arranged at a position where the function can be achieved.

図1は、本発明の一実施形態に係る画像処理装置を含むカメラの概略断面図である。FIG. 1 is a schematic sectional view of a camera including an image processing apparatus according to an embodiment of the present invention. 図2は、図1に示すカメラの全体ブロック図である。FIG. 2 is an overall block diagram of the camera shown in FIG. 図3Aは、本実施形態に係る画像処理装置で実行される画像処理演算の一例における前半部分を表すフローチャートである。FIG. 3A is a flowchart illustrating the first half of an example of the image processing calculation executed by the image processing apparatus according to the present embodiment. 図3Bは、本実施形態に係る画像処理装置で実行される画像処理演算の一例における後半部分を表すフローチャートである。FIG. 3B is a flowchart illustrating the latter half of an example of the image processing calculation executed by the image processing apparatus according to the present embodiment. 図4は、ゲインマップの作成過程を表した概念図である。FIG. 4 is a conceptual diagram showing the process of creating a gain map. 図5は、本実施形態に係る画像処理装置における異物検出レベルの調整過程を表した概念図である。FIG. 5 is a conceptual diagram showing a foreign matter detection level adjustment process in the image processing apparatus according to the present embodiment. 図6は、本実施形態に係る画像処理装置において算出される画像等を表した概念図である。FIG. 6 is a conceptual diagram showing images and the like calculated in the image processing apparatus according to the present embodiment. 図7は、本実施形態の第2実施形態に係る画像処理装置を含むコンピュータのブロック図である。FIG. 7 is a block diagram of a computer including an image processing apparatus according to the second embodiment of the present embodiment.

第1実施形態
図1は、本発明の一実施形態に係る画像処理装置を備えるカメラ10の概略図である。カメラ10は、光学系16等が備えられるレンズ鏡筒部14と、撮像素子22等が備えられるカメラ本体部12を含む。本実施形態では、画像処理装置を備える機器として、レンズ鏡筒部14がカメラ本体部12に着脱自在に取り付けられるレンズ交換式カメラを例に説明するが、本実施形態に係る画像処理装置が備えられる機器はこれに限定されない。例えば、レンズ鏡筒部14とカメラ本体部12が一体であるカメラや、ビデオカメラ、携帯電話、画像データ等を処理できるPC(パーソナルコンピュータ)等であってもよい。
First Embodiment FIG. 1 is a schematic view of a camera 10 including an image processing apparatus according to an embodiment of the present invention. The camera 10 includes a lens barrel portion 14 provided with an optical system 16 and the like, and a camera body portion 12 provided with an imaging element 22 and the like. In the present embodiment, an example of an apparatus including an image processing apparatus will be described, which is an interchangeable lens camera in which the lens barrel section 14 is detachably attached to the camera body section 12, but the image processing apparatus according to the present embodiment is provided. The equipment to be used is not limited to this. For example, a camera in which the lens barrel unit 14 and the camera body unit 12 are integrated, a video camera, a mobile phone, a PC (personal computer) that can process image data, or the like may be used.

図1に示すカメラ本体部12には、シャッター18、光学フィルタ20および撮像素子22等が備えられる。シャッター18は、光学系16から撮像素子22へ向かう撮影光を遮蔽および通過させることによって、露光時間を調整する。また、光学フィルタ20は、撮像に際して偽色(色モアレ)等の発生を防止する光学ローパスフィルタ等によって構成される。   The camera body 12 shown in FIG. 1 includes a shutter 18, an optical filter 20, an image sensor 22 and the like. The shutter 18 adjusts the exposure time by shielding and passing photographing light from the optical system 16 toward the image sensor 22. The optical filter 20 is configured by an optical low-pass filter or the like that prevents the occurrence of false colors (color moire) during imaging.

撮像素子22は、光学系16によって導かれた光を光電変換することによって、画像データを取得することができる。しかしながら、図1に示すように、撮影光の光路上にあって撮影光を透過する光学フィルタ20等の部材にゴミ等の異物24が付着している場合、撮像素子22によって取得される画像データのなかに、ゴミ等の異物24の影響を受けた画素が含まれる場合がある。異物24の影響を受けた画素としては、例えば、異物24によって撮影光の透過が阻害された結果、色(明度等)が、本来の撮影光の色から変化した画素等が含まれる。本実施形態にかかるカメラ10は、後述のように、異物24の影響を受けた画素を検出する画像処理を行うことができる。また、カメラ10は、後述のように、異物24の影響を受けた画素を含む撮影画像について、異物24の影響を軽減もしくは除去する画像処理を行うことができる。   The image sensor 22 can acquire image data by photoelectrically converting the light guided by the optical system 16. However, as shown in FIG. 1, when foreign matter 24 such as dust adheres to a member such as the optical filter 20 that is on the optical path of the imaging light and transmits the imaging light, the image data acquired by the imaging element 22 In some cases, pixels affected by the foreign matter 24 such as dust are included. The pixels affected by the foreign matter 24 include, for example, pixels whose color (lightness, etc.) has changed from the original color of the photographing light as a result of the passage of photographing light being blocked by the foreign matter 24. As will be described later, the camera 10 according to the present embodiment can perform image processing for detecting pixels affected by the foreign matter 24. In addition, as described later, the camera 10 can perform image processing for reducing or removing the influence of the foreign matter 24 on the captured image including the pixels affected by the foreign matter 24.

図2は、図1に示すカメラ10に備えられる画像処理装置の構成を示す概略ブロック図である。カメラ10は、図1に示す撮像素子22等を含む撮影部26と、撮影部26等で撮影された撮影画像に対して画像処理を行う画像処理装置を含む。カメラ10に搭載される画像処理装置は、画像変換部115、画像入力部28、記憶部30、操作信号入力部32、撮影条件信号入力部34、表示部36および演算部38等を含む。   FIG. 2 is a schematic block diagram showing the configuration of the image processing apparatus provided in the camera 10 shown in FIG. The camera 10 includes a photographing unit 26 including the image sensor 22 shown in FIG. 1 and an image processing device that performs image processing on a photographed image photographed by the photographing unit 26 and the like. The image processing apparatus mounted on the camera 10 includes an image conversion unit 115, an image input unit 28, a storage unit 30, an operation signal input unit 32, an imaging condition signal input unit 34, a display unit 36, a calculation unit 38, and the like.

画像入力部28には、撮影部26で撮影された撮影画像が、画像データの形で入力される。撮影画像は、例えばRGBデータ等であるが、撮影画像のデータ形式は特に限定されない。画像入力部28は、入力された撮影画像を、演算部38に出力する。演算部38は、画像入力部28を介して入力された撮影画像について、画像処理を行う。なお、画像入力部28には、撮影部26で撮影された撮影画像だけでなく、その他の撮影装置で撮影された撮影画像が入力されてもよい。また、演算部38が画像処理を行う撮影画像としては、撮影部26で撮影された撮影画像に限られず、その他の撮影装置で撮影された撮影画像を含む。   The image input unit 28 receives the captured image captured by the imaging unit 26 in the form of image data. The captured image is RGB data, for example, but the data format of the captured image is not particularly limited. The image input unit 28 outputs the input captured image to the calculation unit 38. The computing unit 38 performs image processing on the captured image input via the image input unit 28. Note that the image input unit 28 may receive not only a photographed image photographed by the photographing unit 26 but also a photographed image photographed by another photographing apparatus. In addition, the captured image on which the calculation unit 38 performs image processing is not limited to the captured image captured by the capturing unit 26, and includes captured images captured by other imaging devices.

さらに、画像入力部28には、光学系16による像を光電変換して得られた撮影画像だけでなく、画像変換部115によって、撮影画像にγ補正等を施した画像処理済みの撮影画像も入力される。画像変換部115は、例えば、光学系16による像を光電変換して得られた撮影画像に対して、γ補正等の画像処理や、保存形式の変更や、データの圧縮処理等を施す。これにより、画像変換部115は、撮影画像が液晶等の表示装置に表示された際に、より鮮やかに表示されたり、より自然な色合いに表示されるように、撮影画像を補正することができる。また、画像変換部115が撮影画像を圧縮することによって、カメラ10は、不図示のメモリカード等に、より多くの撮影画像を保存させることができる。撮影画像変換部115が撮影画像に対して施す画像処理には、線形補正と、非線形補正が含まれる。   Further, the image input unit 28 includes not only a photographed image obtained by photoelectrically converting an image obtained by the optical system 16 but also a photographed image that has been subjected to image processing in which the photographed image is subjected to γ correction by the image conversion unit 115. Entered. For example, the image conversion unit 115 performs image processing such as γ correction, change of a storage format, data compression processing, and the like on a captured image obtained by photoelectrically converting an image obtained by the optical system 16. Accordingly, the image conversion unit 115 can correct the captured image so that the captured image is displayed more vividly or in a more natural color when the captured image is displayed on a display device such as a liquid crystal display. . Further, as the image conversion unit 115 compresses the captured image, the camera 10 can store more captured images in a memory card (not shown) or the like. Image processing performed on the captured image by the captured image conversion unit 115 includes linear correction and nonlinear correction.

演算部38は、情報算出部46、異物判断部48および異物画像補正部50を含む。情報算出部46は、撮影画像を分析し、撮影画像の色等に関するデータを算出することができる。異物判断部48は、情報算出部46で算出されたデータを用いて、所定の検出領域が、撮影画像に写りこんだゴミ等の異物に対応する部分であるか否かを判断することができる。さらに、異物画像補正部50は、異物判断部48による判断に基づいて、撮影画像に写りこんだ異物に対応する部分を特定し、異物の影響を低減する画像処理を、撮影画像に対して施すことができる。また、異物画像補正部50は、情報算出部46で算出されたデータを用いて、異物の影響を低減する画像処理を行うことができる。   The calculation unit 38 includes an information calculation unit 46, a foreign matter determination unit 48, and a foreign matter image correction unit 50. The information calculation unit 46 can analyze the captured image and calculate data regarding the color of the captured image. Using the data calculated by the information calculation unit 46, the foreign matter determination unit 48 can determine whether or not the predetermined detection area is a portion corresponding to foreign matter such as dust reflected in the captured image. . Further, the foreign object image correcting unit 50 identifies a part corresponding to the foreign object reflected in the captured image based on the determination by the foreign object determining unit 48, and performs image processing for reducing the influence of the foreign object on the captured image. be able to. In addition, the foreign object image correction unit 50 can perform image processing that reduces the influence of the foreign object, using the data calculated by the information calculation unit 46.

情報算出部46は、明るさ情報算出部54と、彩度情報算出部56と、色相情報算出部58と、明るさ勾配情報算出部60と、領域算出部62を有する。情報算出部46に含まれる各算出部54,56,58,60,62は、撮影画像に対して演算処理を行い、算出部54,56,58,60,62ごとに異なるデータを算出する。   The information calculation unit 46 includes a brightness information calculation unit 54, a saturation information calculation unit 56, a hue information calculation unit 58, a brightness gradient information calculation unit 60, and a region calculation unit 62. The calculation units 54, 56, 58, 60 and 62 included in the information calculation unit 46 perform arithmetic processing on the captured image, and calculate different data for each of the calculation units 54, 56, 58, 60 and 62.

明るさ情報算出部54は、撮影画像の明るさに対応する明るさ情報を算出する。明るさ情報算出部54が算出する明るさ情報は、撮影画像の輝度情報であってもよく、撮影画像の明度情報であっても良く、輝度情報と明度情報の両方であってもよい。   The brightness information calculation unit 54 calculates brightness information corresponding to the brightness of the captured image. The brightness information calculated by the brightness information calculation unit 54 may be brightness information of the captured image, brightness information of the captured image, or both brightness information and brightness information.

明るさ情報算出部54は、例えば以下の式(1)を用いて、撮影画像における各画素のRGB値から各画素の輝度値Yを算出する。   The brightness information calculation unit 54 calculates the luminance value Y of each pixel from the RGB value of each pixel in the captured image using, for example, the following equation (1).

Figure 0005083574
Figure 0005083574

また、明るさ情報算出部54は、画素の輝度値Yから、撮影画像に対応する輝度平面を生成する。したがって、明るさ情報算出部54が算出する輝度情報は、各画素の輝度値Yや、各画素の位置および輝度値Yによって構成される輝度平面を含む。   Also, the brightness information calculation unit 54 generates a brightness plane corresponding to the captured image from the brightness value Y of the pixel. Therefore, the luminance information calculated by the brightness information calculation unit 54 includes the luminance value Y of each pixel, and the luminance plane constituted by the position and luminance value Y of each pixel.

明るさ情報算出部54は、輝度情報の代わりに、あるいは輝度情報とあわせて、明度情報を算出してもよい。明度情報は、RGBデータをHSV変換することによって得られる。HSV変換は、RGBデータを色相(Hue)、彩度(Saturation)および明度(Value)に変換するものである。撮影画像における各画素の明度値V、色相値H、および彩度値Sは、各画素のRGB値から、以下の式(2−1)〜式(2−10)によって求めることができる。   The brightness information calculation unit 54 may calculate the brightness information instead of the brightness information or together with the brightness information. The brightness information is obtained by HSV conversion of RGB data. HSV conversion converts RGB data into hue (Hue), saturation (Saturation), and lightness (Value). The brightness value V, hue value H, and saturation value S of each pixel in the captured image can be obtained from the RGB values of each pixel by the following formulas (2-1) to (2-10).

Figure 0005083574
Figure 0005083574

なお、式(2−3)〜(2−5)で変換された結果、H<0の時には、Hに2πを加える。また、Vmax=0の時は、S=0,H=不定となる。   Note that when H <0 as a result of conversion by the equations (2-3) to (2-5), 2π is added to H. When Vmax = 0, S = 0 and H = undefined.

明るさ情報算出部54は、上記の式(2−1)および(2−6)を用いて、撮影画像における各画素のRGB値から各画素の明度値Vを算出する。また、明るさ情報算出部54は、画素の明度値Vから、撮影画像平面に対応する明度平面を生成する。したがって、明るさ情報算出部54が算出する明度情報は、各画素の明度値Vや、各画素の位置および明度値Vによって構成される明度平面を含む。   The brightness information calculation unit 54 calculates the brightness value V of each pixel from the RGB value of each pixel in the captured image using the above equations (2-1) and (2-6). Also, the brightness information calculation unit 54 generates a brightness plane corresponding to the captured image plane from the brightness value V of the pixel. Therefore, the brightness information calculated by the brightness information calculation unit 54 includes the brightness value V of each pixel, and the brightness plane constituted by the position and brightness value V of each pixel.

彩度情報算出部56は、撮影画像の彩度に対応する彩度情報を算出する。彩度情報算出部56は、例えば上記の式(2−2)、(2−6)および(2−7)を用いて、撮影画像における各画素のRGB値から、各画素の彩度値Sを算出する。また、彩度情報算出部56は、画素の彩度値Sから、撮影画像平面に対応する彩度平面を生成する。したがって、彩度情報算出部56が算出する彩度情報は、各画素の彩度値Sや、各画素の位置および彩度値Sによって構成される彩度平面を含む。   The saturation information calculation unit 56 calculates saturation information corresponding to the saturation of the captured image. The saturation information calculation unit 56 uses, for example, the above equations (2-2), (2-6), and (2-7) to calculate the saturation value S of each pixel from the RGB value of each pixel in the captured image. Is calculated. Further, the saturation information calculation unit 56 generates a saturation plane corresponding to the captured image plane from the saturation value S of the pixel. Therefore, the saturation information calculated by the saturation information calculation unit 56 includes the saturation value S of each pixel, and the saturation plane constituted by the position and saturation value S of each pixel.

色相情報算出部58は、撮影画像の色相に対応する色相情報を算出する。色相情報算出部58は、例えば上記の式(2−3)〜(2−5)および(2−6)〜(2−10)を用いて、撮影画像における各画素のRGB値から、各画素の色相値Hを算出する。また、色相情報算出部58は、画素の色相値Hから、撮影画像平面に対応する色相平面を生成する。したがって、色相情報算出部58が算出する色相情報は、各画素の色相値Hや、各画素の位置および色相値Hによって構成される色相平面を含む。   The hue information calculation unit 58 calculates hue information corresponding to the hue of the captured image. The hue information calculation unit 58 uses, for example, the above equations (2-3) to (2-5) and (2-6) to (2-10) to calculate each pixel from the RGB value of each pixel in the captured image. Is calculated. Also, the hue information calculation unit 58 generates a hue plane corresponding to the captured image plane from the hue value H of the pixel. Therefore, the hue information calculated by the hue information calculation unit 58 includes the hue value H of each pixel and the hue plane formed by the position and hue value H of each pixel.

明るさ勾配情報算出部60は、明るさ情報算出部54で算出された輝度平面や明度平面から、撮影画像の明るさの勾配に対応する明るさ勾配情報を算出する。明るさ勾配情報算出部60で算出される明るさ勾配情報としては、輝度勾配情報や明度勾配情報が挙げられる。   The brightness gradient information calculation unit 60 calculates brightness gradient information corresponding to the brightness gradient of the captured image from the brightness plane and the brightness plane calculated by the brightness information calculation unit 54. The brightness gradient information calculated by the brightness gradient information calculation unit 60 includes brightness gradient information and brightness gradient information.

この場合、明るさ勾配情報算出部60は、逆γ補正部40によって逆γ補正された輝度平面や明度平面から、明るさ勾配情報を算出することが好ましい。撮影画像は、表示装置等にあわせてγ補正された状態で保存されていることが多いため、画像入力部28を介して演算部38に入力される撮影画像についても、γ補正が施されている可能性が高い。したがって、逆γ補正部40が輝度平面や明度平面を逆γ補正することによって、これらの明るさ情報を、RAWデータが有する本来の明るさ情報に近づけることが可能である。   In this case, it is preferable that the brightness gradient information calculation unit 60 calculates the brightness gradient information from the luminance plane and the brightness plane that have been subjected to inverse γ correction by the inverse γ correction unit 40. Since the captured image is often stored in a state of being γ-corrected according to the display device or the like, the captured image input to the calculation unit 38 via the image input unit 28 is also subjected to γ correction. There is a high possibility. Therefore, when the inverse γ correction unit 40 performs inverse γ correction on the luminance plane and the brightness plane, the brightness information can be brought close to the original brightness information that the RAW data has.

逆γ補正前の輝度平面および明度平面をYP1,VP1とし、逆γ補正後の輝度平面および明度平面をYP2,VP2とすると、逆γ補正部40で行われる逆γ補正は、以下の式(3−1),(3−2)で表される。   If the luminance plane and lightness plane before reverse γ correction are YP1 and VP1, and the luminance plane and lightness plane after reverse γ correction are YP2 and VP2, the reverse γ correction performed by the reverse γ correction unit 40 is expressed by the following formula ( 3-1) and (3-2).

Figure 0005083574
Figure 0005083574

明るさ勾配情報算出部60は、例えば明度平面VP2から、撮影画像内の各位置(画素)における明度勾配値Vgrad(i,j)を算出する。明るさ勾配情報算出部60は、明度平面VP2に対して、縦方向、横方向の微分フィルタをかけ、縦方向の差分Δyf(i,j)および横方向の差分Δxf(i,j)を算出し、算出された差分を用いて、各位置の明度勾配値Vgrad(i,j)を算出する。明度平面VP2に含まれる各画素の明度値VをV(i,j)とすると、明度勾配値Vgrad(i,j)は、以下の式(4−1)〜(4−3)によって算出される。   The brightness gradient information calculation unit 60 calculates the brightness gradient value Vgrad (i, j) at each position (pixel) in the captured image, for example, from the brightness plane VP2. The brightness gradient information calculation unit 60 applies vertical and horizontal differential filters to the brightness plane VP2 to calculate a vertical difference Δyf (i, j) and a horizontal difference Δxf (i, j). Then, the brightness gradient value Vgrad (i, j) at each position is calculated using the calculated difference. When the lightness value V of each pixel included in the lightness plane VP2 is V (i, j), the lightness gradient value Vgrad (i, j) is calculated by the following equations (4-1) to (4-3). The

Figure 0005083574
Figure 0005083574

なお、式(4−1)〜(4−3)におけるiは、画素の横方向の位置を表しており、jは、画素の縦方向の位置を表している。明るさ勾配情報算出部60は、各位置の明度勾配値Vgrad(i,j)から、撮影画像平面に対応する明度勾配平面を生成する。したがって、明るさ勾配情報算出部60が算出する明度勾配情報には、明度勾配値Vgrad(i,j)や明度勾配平面が含まれる。   Note that i in the expressions (4-1) to (4-3) represents the position in the horizontal direction of the pixel, and j represents the position in the vertical direction of the pixel. The brightness gradient information calculation unit 60 generates a brightness gradient plane corresponding to the captured image plane from the brightness gradient value Vgrad (i, j) at each position. Therefore, the lightness gradient information calculated by the lightness gradient information calculation unit 60 includes a lightness gradient value Vgrad (i, j) and a lightness gradient plane.

また、明るさ勾配情報算出部60は、明度勾配情報に代えて、あるいは明度勾配情報に加えて、輝度平面YP2から、輝度勾配情報を算出することができる。輝度勾配情報には、輝度勾配値Ygrad(i,j)や輝度勾配平面が含まれる。輝度勾配情報の算出方法は、上述した明度勾配情報と同様である。   Further, the brightness gradient information calculation unit 60 can calculate the brightness gradient information from the brightness plane YP2 instead of the brightness gradient information or in addition to the brightness gradient information. The luminance gradient information includes a luminance gradient value Ygrad (i, j) and a luminance gradient plane. The method of calculating the brightness gradient information is the same as the brightness gradient information described above.

領域算出部62は、異物が写りこんでいるか否かを検出するための検出領域を算出する。領域算出部62は、例えば明るさ勾配情報算出部60で算出された明るさ勾配情報を用いて、検出領域を算出することができる。   The area calculation unit 62 calculates a detection area for detecting whether or not a foreign object is reflected. The region calculation unit 62 can calculate the detection region using the brightness gradient information calculated by the brightness gradient information calculation unit 60, for example.

検出領域は、撮影画像の一部であれば特に限定されないが、異物が写りこんでいる可能性が高い領域を、検出領域とすることが好ましい。ここで、明るさ勾配情報算出部60において算出された明度勾配平面において、被写体エッジに相当する部分や異物が写りこんでいる部分は、明度勾配値Vgrad(i,j)が相対的に大きい傾向にある。それに対して、空や被写体の内部などに対応する部分は、明度勾配値Vgrad(i,j)が相対的に小さい傾向にある。   The detection area is not particularly limited as long as it is a part of the photographed image, but an area where a foreign object is likely to be reflected is preferably set as the detection area. Here, in the lightness gradient plane calculated by the lightness gradient information calculation unit 60, the lightness gradient value Vgrad (i, j) tends to be relatively large in a portion corresponding to the subject edge or a portion in which a foreign object is reflected. It is in. On the other hand, the brightness gradient value Vgrad (i, j) tends to be relatively small in a portion corresponding to the sky or the inside of the subject.

そこで、本実施形態に係る領域算出部62は、明度勾配平面を二値化した二値化画像を算出し、明度勾配値Vgrad(i,j)が高い画素が連結している連結領域を、検出領域とすることができる。すなわち、領域算出部62は、明度勾配平面に対して所定の閾値を設定し、その閾値より高い明度勾配値を有する画素の値を「1」に置き換え、その閾値より低い明度勾配値を有する画素の値を「0」に置き換えることによって、二値化画像を算出する。   Therefore, the region calculation unit 62 according to the present embodiment calculates a binarized image obtained by binarizing the lightness gradient plane, and a connected region in which pixels having a high lightness gradient value Vgrad (i, j) are connected is obtained. It can be a detection region. That is, the region calculation unit 62 sets a predetermined threshold for the lightness gradient plane, replaces the value of a pixel having a lightness gradient value higher than the threshold with “1”, and has a lightness gradient value lower than the threshold By substituting the value of “0” with “0”, a binarized image is calculated.

さらに、領域算出部62は、算出された二値化画像から、値が「1」である画素を抽出し、値が「1」である画素を検出領域とする。領域算出部62は、値が「1」である画素同士が連結していれば、それらの画素の集まりを、一つの検出領域として特定する。反対に、領域算出部62は、値が「1」である1つの画素集合が、値が「1」である他の画素集合に対して、値が「1」である画素によって連結されていなければ、これらの2つの領域を、別の検出領域として特定する。   Furthermore, the area calculation unit 62 extracts pixels having a value “1” from the calculated binarized image, and sets the pixels having a value “1” as a detection area. If the pixels having the value “1” are connected to each other, the region calculation unit 62 specifies a group of these pixels as one detection region. On the other hand, the area calculation unit 62 requires that one pixel set having a value “1” is connected to another pixel set having a value “1” by pixels having a value “1”. For example, these two areas are specified as different detection areas.

領域算出部62は、上述のように、明度勾配平面から検出領域を算出してもよいが、それ以外にも、明るさ情報算出部54で算出された輝度勾配平面から、検出領域を算出することもできる。領域算出部62は、明度勾配平面と同様に、輝度勾配平面から二値化画像を算出することによって、検出領域を算出することができる。   As described above, the area calculation unit 62 may calculate the detection area from the brightness gradient plane, but in addition to that, the area calculation unit 62 calculates the detection area from the luminance gradient plane calculated by the brightness information calculation unit 54. You can also Similar to the lightness gradient plane, the region calculation unit 62 can calculate the detection region by calculating a binarized image from the luminance gradient plane.

異物判断部48は、情報算出部46で算出された各情報を用いて、それぞれの検出領域が、撮影画像に写りこんだ異物に対応する部分であるか否かを判断する。異物判断部48は、第1判断部64、第2判断部66、第3判断部68および第4判断部70を含む。第1〜第4判断部64〜70は、互いに異なる判断基準を用いて、判断の対象となっている検出領域が、撮影画像に写りこんだ異物に対応する部分であるか否かを判断する。   Using the information calculated by the information calculation unit 46, the foreign object determination unit 48 determines whether each detection area is a part corresponding to a foreign object reflected in the captured image. The foreign matter determination unit 48 includes a first determination unit 64, a second determination unit 66, a third determination unit 68, and a fourth determination unit 70. The first to fourth determination units 64 to 70 determine whether or not the detection area to be determined is a portion corresponding to a foreign object reflected in the captured image using different determination criteria. .

第1判断部64は、判断の対象となっている検出領域の大きさに基づいて、その検出領域が、画像に写りこんだ異物に対応する部分であるか否かを判断する。本実施形態に係る画像処理装置において、異物判断部48における判断の対象となる検出領域およびその大きさは、明るさ勾配情報算出部60で算出された明るさ勾配情報を用いて、領域算出部62で算出される。したがって、例えば領域算出部62が輝度勾配平面から検出領域を算出している場合、第1判断部64は、各画素の輝度勾配値等の情報を用いて判断を行う。また、領域算出部62が明度勾配平面から検出領域を算出している場合、第1判断部64は、各画素の明度勾配値等の情報を用いて判断を行う。   The first determination unit 64 determines whether or not the detection area is a part corresponding to a foreign object reflected in the image, based on the size of the detection area to be determined. In the image processing apparatus according to the present embodiment, the detection region to be determined by the foreign matter determination unit 48 and the size thereof are determined using the brightness gradient information calculated by the brightness gradient information calculation unit 60. 62. Therefore, for example, when the region calculation unit 62 calculates the detection region from the luminance gradient plane, the first determination unit 64 makes a determination using information such as the luminance gradient value of each pixel. When the area calculation unit 62 calculates the detection area from the lightness gradient plane, the first determination unit 64 makes a determination using information such as the lightness gradient value of each pixel.

第1判断部64は、領域算出部62で算出された検出領域の大きさが所定の範囲であれば、その検出領域は画像に写りこんだ異物に対応する部分であると、判断することができる。また、第1判断部64は、領域算出部62で算出された検出領域の大きさが、所定の範囲を超えて大きいか、あるいは所定の範囲より小さければ、その検出領域は画像に写りこんだ異物に対応する部分ではないと、判断することができる。   If the size of the detection region calculated by the region calculation unit 62 is within a predetermined range, the first determination unit 64 can determine that the detection region is a portion corresponding to a foreign object reflected in the image. it can. The first determination unit 64 reflects the detection region in the image if the size of the detection region calculated by the region calculation unit 62 is larger than the predetermined range or smaller than the predetermined range. It can be determined that the portion does not correspond to a foreign object.

第1判断部64において異物が写りこんだ領域であると判定される大きさの範囲は、撮影画像の大きさや撮影条件等に応じて設定されるが、例えば下限値は25画素、上限値は300画素とすることができる。   The range of the size determined by the first determination unit 64 to be a region where a foreign object is reflected is set according to the size of the captured image, the shooting conditions, etc. For example, the lower limit value is 25 pixels and the upper limit value is It can be 300 pixels.

第2判断部66は、検出領域の彩度に対応する彩度情報を用いて、その検出領域が画像に写りこんだ異物に対応する部分であるか否かを、判断する。第2判断部66は、彩度情報算出部56で算出された彩度値S、および彩度平面を用いて、その検出領域が画像に写りこんだ異物に対応する部分であるか否かを、判断する。本実施形態に係る第2判断部66は、検出領域の彩度に対応する第1彩度情報と、検出領域の周辺の領域の彩度に対応する第2彩度情報との差異を調査する。第2判断部66は、第1彩度情報と第2彩度情報との差異が予め定められた範囲にあるとき、判断の対象となっている検出領域が異物に対応する部分であると判断する。また、第2判断部66は、第1彩度情報と第2彩度情報との差異が予め定められた範囲でないとき、判断の対象となっている検出領域が異物に対応する部分でないと判断してもよい。   The second determination unit 66 uses the saturation information corresponding to the saturation of the detection area to determine whether or not the detection area is a part corresponding to a foreign object reflected in the image. The second determination unit 66 uses the saturation value S calculated by the saturation information calculation unit 56 and the saturation plane to determine whether or not the detection region is a part corresponding to a foreign object reflected in the image. ,to decide. The second determination unit 66 according to the present embodiment investigates a difference between the first saturation information corresponding to the saturation of the detection region and the second saturation information corresponding to the saturation of the region around the detection region. . When the difference between the first saturation information and the second saturation information is within a predetermined range, the second determination unit 66 determines that the detection area that is the determination target is a portion corresponding to a foreign object. To do. Further, when the difference between the first saturation information and the second saturation information is not in a predetermined range, the second determination unit 66 determines that the detection area to be determined is not a part corresponding to a foreign object. May be.

ここで、第1彩度情報は、例えば、検出領域に含まれる画素の彩度値Sの平均値とすることができる。また、第2彩度情報は、検出領域の周辺の領域の画素の彩度値Sの平均値とすることができる。なお、検出領域の周辺の領域は、例えば、検出領域の周辺を当該検出領域の外周に接触しながら取り囲む領域であって、検出領域と同程度の面積を有する領域であると規定することができる。   Here, the first saturation information can be an average value of the saturation values S of the pixels included in the detection region, for example. Further, the second saturation information can be an average value of the saturation values S of the pixels in the area around the detection area. The region around the detection region can be defined as, for example, a region that surrounds the periphery of the detection region while being in contact with the outer periphery of the detection region, and has a similar area to the detection region. .

第2判断部66が、判断の対象となる検出領域を、異物が写りこんだ領域であると判断する数値範囲は特に限定されない。また、異物が写りこんだ領域であると判断する数値範囲は、彩度値Sの差の大きさ(絶対値)で規定されていてもよく、第1彩度情報と第2彩度情報の値の比で規定されていてもよい。   The numerical range in which the second determination unit 66 determines that the detection area to be determined is an area in which a foreign object is reflected is not particularly limited. In addition, the numerical value range that is determined to be a region in which a foreign object is reflected may be defined by the magnitude (absolute value) of the difference between the saturation values S. The first saturation information and the second saturation information It may be defined by a ratio of values.

例えば、第2判断部66は、検出領域に含まれる画素の彩度値Sの平均値S1が、検出領域の周辺の領域の画素の彩度値Sの平均値S2の0.95〜2倍である場合に、判断の対象となる検出領域を異物が写りこんだ領域であると判断する。ゴミではなく、被写体として画像に写っている像は、彩度情報に強く情報を残し、その反対に、異物が写りこんだ像は、彩度にほとんど影響を残さないからである。したがって、検出領域にゴミが写りこんでいなければ、第1彩度情報と第2彩度情報の差異は大きく、その反対に、検出領域にゴミが写りこんでいれば、第1彩度情報と第2彩度情報の差異は小さい。   For example, the second determination unit 66 determines that the average value S1 of the saturation values S of the pixels included in the detection area is 0.95 to 2 times the average value S2 of the saturation values S of the pixels in the surrounding area of the detection area. If it is, it is determined that the detection area to be determined is an area in which foreign matter is reflected. This is because an image reflected in an image as a subject instead of dust leaves strong information in the saturation information, and conversely, an image in which a foreign object is reflected has little effect on the saturation. Therefore, if dust does not appear in the detection area, the difference between the first saturation information and the second saturation information is large, and conversely, if dust appears in the detection area, the first saturation information. The difference between the second saturation information and the second saturation information is small.

第2判断部66は、上述のように彩度情報を用いて判断を行うだけでなく、それに加えて、検出領域の明るさに対応する明るさ情報を用いて、その検出領域が画像に写りこんだ異物に対応する部分であるか否かを、判断してもよい。明るさ情報を用いて判断を行う場合、第2判断部66は、明るさ情報算出部54で算出された明度値V、および明度平面を用いて、その検出領域が画像に写りこんだ異物に対応する部分であるか否かを、判断することができる。また、第2判断部66は、明るさ情報算出部54で算出された輝度値Y、および輝度平面を用いて、その検出領域が画像に写りこんだ異物に対応する部分であるか否かを、判断してもよい。   The second determination unit 66 not only uses the saturation information as described above, but also uses the brightness information corresponding to the brightness of the detection area to capture the detection area in the image. It may be determined whether or not the portion corresponds to a foreign object. When the determination is made using the brightness information, the second determination unit 66 uses the brightness value V calculated by the brightness information calculation unit 54 and the brightness plane to detect a foreign object whose detection area is reflected in the image. It can be determined whether or not it is a corresponding part. In addition, the second determination unit 66 uses the luminance value Y calculated by the brightness information calculation unit 54 and the luminance plane to determine whether or not the detection region is a part corresponding to a foreign object reflected in the image. You may judge.

本実施形態に係る第2判断部66は、例えば、検出領域の明度に対応する第1明度情報と、検出領域の周辺の領域の明度に対応する第2明度情報との差異を調査する。第2判断部66は、第1明度情報と第2明度情報との差異が予め定められた範囲にないとき、判断の対象となっている検出領域が異物に対応する部分であると判断する。   For example, the second determination unit 66 according to the present embodiment investigates a difference between the first lightness information corresponding to the lightness of the detection area and the second lightness information corresponding to the lightness of the area around the detection area. When the difference between the first lightness information and the second lightness information is not within a predetermined range, the second determination unit 66 determines that the detection area to be determined is a part corresponding to a foreign object.

ここで、第1明度情報は、例えば、検出領域に含まれる画素の明度値Vの平均値とすることができる。また、第2明度情報は、検出領域の周辺の領域の画素の明度値Vの平均値とすることができる。例えば、第2判断部66は、検出領域に含まれる画素の明度値Vの平均値V1が、検出領域の周辺の領域の画素の明度値Vの平均値V2の0.975倍未満である場合に、判断の対象となる検出領域を異物が写りこんだ領域であると判断する。異物の写りこみは、彩度や色相にほとんど影響を残さないが、明るさに強く情報を残すからである。   Here, the first brightness information can be, for example, an average value of the brightness values V of the pixels included in the detection region. Further, the second brightness information can be an average value of the brightness values V of the pixels in the area around the detection area. For example, the second determination unit 66 determines that the average value V1 of the brightness values V of the pixels included in the detection area is less than 0.975 times the average value V2 of the brightness values V of the pixels around the detection area. In addition, it is determined that the detection area to be determined is an area in which foreign matter is reflected. This is because the reflection of a foreign object has little effect on the saturation and hue, but leaves strong information on brightness.

さらに、第2判断部66は、彩度情報を用いた判断に加えて、検出領域の色相に対応する色相情報を用いて、その検出領域が画像に写りこんだ異物に対応する部分であるか否かを、判断してもよい。色相情報を用いて判断を行う場合、第2判断部66は、色相情報算出部58で算出された色相値H、および色相平面を用いて、その検出領域が画像に写りこんだ異物に対応する部分であるか否かを、判断することができる。   Further, in addition to the determination using the saturation information, the second determination unit 66 uses the hue information corresponding to the hue of the detection area to determine whether the detection area corresponds to a foreign object reflected in the image. It may be determined whether or not. When the determination is performed using the hue information, the second determination unit 66 uses the hue value H calculated by the hue information calculation unit 58 and the hue plane to correspond to a foreign object whose detection area is reflected in the image. It can be determined whether it is a part.

本実施形態に係る第2判断部66は、例えば、検出領域の色相に対応する第1色相情報と、検出領域の周辺の領域の色相に対応する第2色相情報との差異を調査する。第2判断部66は、第1色相情報と第2色相情報との差異が予め定められた範囲であるとき、判断の対象となっている検出領域が異物に対応する部分であると判断する。   For example, the second determination unit 66 according to the present embodiment investigates the difference between the first hue information corresponding to the hue of the detection area and the second hue information corresponding to the hue of the area around the detection area. When the difference between the first hue information and the second hue information is in a predetermined range, the second determination unit 66 determines that the detection area to be determined is a part corresponding to a foreign object.

ここで、第1色相情報は、例えば、検出領域に含まれる画素の色相値Hの平均値とすることができる。また、第2色相情報は、検出領域の周辺の領域の画素の色相値Hの平均値とすることができる。例えば、第2判断部66は、検出領域に含まれる画素の色相値Hの平均値H1が、検出領域の周辺の領域の画素の色相値Hの平均値H2の0.94〜1.06倍である場合に、判断の対象となる検出領域を異物が写りこんだ領域であると判断する。ゴミではなく、被写体として画像に写っている像は、色相情報に強く情報を残し、その反対に、異物が写りこんだ像は、色相にほとんど影響を残さないからである。   Here, the first hue information can be, for example, an average value of the hue values H of the pixels included in the detection region. Further, the second hue information can be an average value of the hue values H of the pixels in the area around the detection area. For example, the second determination unit 66 determines that the average value H1 of the hue values H of the pixels included in the detection area is 0.94 to 1.06 times the average value H2 of the hue values H of the pixels around the detection area. If it is, it is determined that the detection area to be determined is an area in which foreign matter is reflected. This is because an image reflected in an image as a subject instead of dust leaves strong information in the hue information, and conversely, an image in which a foreign object is reflected has little influence on the hue.

第3判断部68は、検出領域の周辺の領域の明るさに対応する第2明度情報等が、予め定められた範囲でないとき、判断の対象となっている検出領域が異物に対応する部分でないと判断する。また、第3判断部68は、検出領域の周辺の領域の明度に対応する第2明度情報が、予め定められた範囲にあるとき、判断の対象となっている検出領域が異物に対応する部分であると判断する。第3判断部68が用いる明るさ情報としては、検出領域の周辺の領域の画素の明度値Vの平均値である第2明度情報や、検出領域の周辺の領域の画素の輝度値Yの平均値である第2輝度情報等が挙げられる。   When the second brightness information corresponding to the brightness of the surrounding area of the detection area is not in a predetermined range, the third determination unit 68 is not the part corresponding to the foreign object. Judge. In addition, when the second brightness information corresponding to the brightness of the area around the detection area is within a predetermined range, the third determination unit 68 is a part where the detection area to be determined corresponds to a foreign object. It is judged that. The brightness information used by the third determination unit 68 includes second brightness information, which is an average value of the brightness values V of the pixels around the detection area, and an average of the brightness values Y of the pixels around the detection area. Second luminance information that is a value can be used.

例えば、第3判断部68は、検出領域の周辺の領域に含まれる画素の明度値Vの平均値V2が、60以下である場合には、前記検出領域が異物に対応する部分でないと判断する。検出領域の周辺の領域の明るさが所定の値より低い場合は、たとえ検出領域に異物が写りこんでいたとしても、異物の写りこみが画像に与える影響が小さいと考えられるからである。   For example, when the average value V2 of the brightness values V of the pixels included in the peripheral area of the detection area is 60 or less, the third determination unit 68 determines that the detection area is not a part corresponding to a foreign object. . This is because, when the brightness of the area around the detection area is lower than a predetermined value, even if a foreign object is reflected in the detection area, it is considered that the influence of the reflection of the foreign object on the image is small.

第4判断部70は、検出領域の周辺の領域における明るさの標準偏差が、予め定められた範囲でないとき、判断の対象となっている検出領域が異物に対応する部分でないと判断する。また、第4判断部70は、検出領域の周辺の領域における明るさの標準偏差が、予め定められた範囲であるとき、判断の対象となっている検出領域が異物に対応する部分でないと判断する。ここで、検出領域の周辺の領域における明るさの標準偏差としては、検出領域の周辺の領域の画素の明度値Vの標準偏差や、検出領域の周辺の領域の画素の輝度値Yの標準偏差が挙げられる。   The fourth determination unit 70 determines that the detection area to be determined is not a part corresponding to a foreign object when the standard deviation of brightness in the area around the detection area is not in a predetermined range. The fourth determination unit 70 determines that the detection area to be determined is not a part corresponding to a foreign object when the standard deviation of brightness in the area around the detection area is a predetermined range. To do. Here, as the standard deviation of the brightness in the area around the detection area, the standard deviation of the brightness value V of the pixel in the area around the detection area and the standard deviation of the luminance value Y of the pixel in the area around the detection area Is mentioned.

例えば、第4判断部70は、検出領域の周辺の領域に含まれる画素の明度値V(i,j)と、検出領域の周辺の領域に含まれる画素の明度値V(i,j)の平均値V2から、検出領域の周辺の領域における明るさの標準偏差Vstdを、以下の式(5)を用いて算出する。   For example, the fourth determination unit 70 calculates the brightness value V (i, j) of pixels included in the area around the detection area and the brightness value V (i, j) of pixels included in the area around the detection area. From the average value V2, the standard deviation Vstd of the brightness in the area around the detection area is calculated using the following equation (5).

Figure 0005083574
Figure 0005083574

なお、式(5)におけるnは、検出領域の周辺の領域に含まれる画素数である。第4判断部70において、検出領域に異物が写りこんでいるか否かを判断するための閾値は、撮影画像の撮影条件によって適宜設定される。例えば、第4判断部70は、検出領域の周辺の領域における明るさの標準偏差Vstdが、0.6以上である場合は、その検出領域は画像に写りこんだ異物に対応する部分ではないと、判断することができる。検出領域の周辺の領域における明るさの標準偏差が大きい場合は、検出領域における高い明度勾配値または輝度勾配値が、異物の写りこみによるものではなく、被写体光によるものである可能性が高いからである。   Note that n in Expression (5) is the number of pixels included in the area around the detection area. In the fourth determination unit 70, a threshold value for determining whether or not a foreign object is reflected in the detection area is appropriately set depending on the shooting condition of the shot image. For example, when the standard deviation Vstd of the brightness in the area around the detection area is 0.6 or more, the fourth determination unit 70 does not correspond to the foreign object reflected in the image. Can be judged. If the standard deviation of brightness in the surrounding area of the detection area is large, it is likely that the high brightness gradient value or luminance gradient value in the detection area is due to subject light, not due to reflection of foreign matter. It is.

第4判断部70は、検出領域の周辺の領域に含まれる画素の輝度値Yから、検出領域の周辺の領域における明るさの標準偏差を算出しても良い。第4判断部70は、輝度情報から算出した標準偏差を用いた場合でも、明度情報から標準偏差を算出した場合と同様に、判断の対象となっている検出領域が異物に対応する部分であるか否かを判断することができる。   The fourth determination unit 70 may calculate the standard deviation of the brightness in the area around the detection area from the luminance value Y of the pixels included in the area around the detection area. Even in the case where the standard deviation calculated from the luminance information is used, the fourth determination unit 70 is a portion corresponding to the foreign object in the detection area to be determined as in the case where the standard deviation is calculated from the brightness information. It can be determined whether or not.

上述のように、異物判断部48に含まれる第1〜第4判断部64〜70は、それぞれ独立に、判断の対象となる検出領域が画像に写りこんだ異物に対応する部分であるか否かを判断することができる。異物判断部48は、第1〜第4判断部64〜70の判断結果を、すべて検出修正部44および異物画像補正部50に出力することができる。また、異物判断部48は、第1〜第4判断部64〜70の判断結果を用いて、各検出領域に異物が写りこんでいるか否かを総合的に判断し、総合的な判断結果を、検出修正部44および異物画像補正部50に出力してもよい。   As described above, the first to fourth determination units 64 to 70 included in the foreign object determination unit 48 independently determine whether or not the detection region to be determined is a part corresponding to the foreign object reflected in the image. Can be determined. The foreign matter determination unit 48 can output all the determination results of the first to fourth determination units 64 to 70 to the detection correction unit 44 and the foreign matter image correction unit 50. Further, the foreign matter determination unit 48 comprehensively determines whether or not a foreign matter is reflected in each detection region using the determination results of the first to fourth determination units 64 to 70, and determines the comprehensive determination result. Alternatively, the data may be output to the detection correction unit 44 and the foreign object image correction unit 50.

例えば、異物判断部48は、1以上の第1〜第4判断部64〜70が、判断の対象となっている検出領域は異物に対応する部分でないと判断した場合は、判断の対象となっている検出領域は異物に対応する部分でないという総合判断を行う。あるいは、異物判断部48は、すべての第1〜第4判断部64〜70が、判断の対象となっている検出領域が異物に対応する部分であると判断した場合は、判断の対象となっている検出領域が異物に対応する部分であるという総合判断を行う。   For example, when one or more of the first to fourth determination units 64 to 70 determine that the detection area to be determined is not a part corresponding to the foreign object, the foreign object determination unit 48 is a determination target. A comprehensive determination is made that the detected area is not a part corresponding to a foreign object. Alternatively, the foreign matter determination unit 48 becomes a determination target when all the first to fourth determination units 64 to 70 have determined that the detection area to be determined is a portion corresponding to a foreign object. A comprehensive determination is made that the detected area is a portion corresponding to a foreign object.

異物画像補正部50は、異物判断部48での判断結果や、情報算出部46で算出されたデータを用いて、撮影画像に写りこんだ異物に対応する部分に対して、異物の影響を低減する補正を行う。また、異物画像補正部50は、異物判断部48での判断結果の代わりに、検出修正部44によって修正された判断結果である修正結果に基づき、撮影画像から異物の影響を低減する補正を行っても良い。   The foreign object image correcting unit 50 reduces the influence of the foreign object on the part corresponding to the foreign object reflected in the photographed image using the determination result of the foreign object determining unit 48 and the data calculated by the information calculating unit 46. Make corrections. The foreign object image correcting unit 50 performs correction to reduce the influence of the foreign object from the captured image based on the correction result that is the determination result corrected by the detection correcting unit 44 instead of the determination result in the foreign object determining unit 48. May be.

検出修正部44は、操作信号入力部32を介して演算部38に入力された操作信号に応じて、異物判断部48の判断を修正することができる。例えば、検出修正部44は、異物判断部48の第1〜第4判断部64〜70で使用される閾値のうち、少なくとも一つを、操作信号に応じて変更する。これにより、検出修正部44は、検出領域が異物に対応する部分であるか否かを再判断し、異物判断部48の判断を修正できる。   The detection correction unit 44 can correct the determination of the foreign matter determination unit 48 in accordance with the operation signal input to the calculation unit 38 via the operation signal input unit 32. For example, the detection correction unit 44 changes at least one of the threshold values used in the first to fourth determination units 64 to 70 of the foreign object determination unit 48 according to the operation signal. Thereby, the detection correction part 44 can judge again whether the detection area | region is a part corresponding to a foreign material, and can correct the judgment of the foreign material determination part 48. FIG.

図5は、検出修正部44による判断の修正過程を表した概念図である。図5は、領域算出部62で算出された検出領域を、検出領域の大きさと、検出領域内外の明度比(第1明度情報と第2明度情報の比)とに応じてプロットしたものである。図5における丸印98および三角印96は、それぞれ1つの検出領域に対応する。なお、丸印98は、検出修正部44によって異物に対応する部分であると再判断される検出領域に対応している。また、三角印96は、検出修正部44によって異物に対応する部分でないと再判断される検出領域に対応している。   FIG. 5 is a conceptual diagram showing the correction process of determination by the detection correction unit 44. FIG. 5 is a plot of the detection area calculated by the area calculation unit 62 in accordance with the size of the detection area and the lightness ratio inside and outside the detection area (the ratio between the first lightness information and the second lightness information). . Each of the circle mark 98 and the triangle mark 96 in FIG. 5 corresponds to one detection area. Note that the circle 98 corresponds to a detection region in which the detection correction unit 44 re-determines that the portion corresponds to a foreign object. Further, the triangle mark 96 corresponds to a detection area in which the detection correction unit 44 re-determines that the portion does not correspond to a foreign object.

図5に示す例では、図2に示す検出修正部44が、第1判断部64で行われた判断(検出領域の大きさによる判断)と、第2判断部66で行われた判断(検出領域の明度と検出領域の周辺の領域の明度との差異に基づく判断)とを修正する。検出修正部44は、操作信号に基づいて、検出領域の大きさに関する閾値C1や、検出領域内外の明度比に関する閾値C2を変更することができる。検出領域の大きさに関する閾値C1や、検出領域内外の明度比に関する閾値C2が、検出感度に大きな影響を有するからである。   In the example illustrated in FIG. 5, the detection correction unit 44 illustrated in FIG. 2 performs the determination performed by the first determination unit 64 (determination based on the size of the detection region) and the determination performed by the second determination unit 66 (detection). Correction based on the difference between the brightness of the area and the brightness of the area around the detection area). The detection correction unit 44 can change the threshold value C1 related to the size of the detection region and the threshold value C2 related to the brightness ratio inside and outside the detection region based on the operation signal. This is because the threshold value C1 relating to the size of the detection region and the threshold value C2 relating to the brightness ratio inside and outside the detection region have a great influence on the detection sensitivity.

ここで、図5において三角印96および丸印98で表される検出領域は、矢印111で示す左上方向にプロットされているものほど、撮影画像により顕著な影響を与えている異物に対応する部分であると考えられる。なぜなら、検出領域が大きく、かつ、周辺領域に対する明度の差異が大きい(明度比(第1明度情報/第2明度情報)が小さい)検出領域ほど、目立ち易いからである。反対に、矢印113で示す右下方向にプロットされている検出領域ほど、撮影画像に与える影響が少ないと考えられる。異物と判断される検出領域の大きさが小さく、周辺領域に対する明度の差異が小さいものほど、目立ちにくいからである。   Here, in the detection region represented by the triangle mark 96 and the circle mark 98 in FIG. 5, the portion corresponding to the foreign substance that has a more significant effect on the photographed image as it is plotted in the upper left direction indicated by the arrow 111. It is thought that. This is because a detection area having a larger detection area and a larger lightness difference with respect to the surrounding area (lightness ratio (first lightness information / second lightness information) is smaller) is more conspicuous. On the contrary, it is considered that the detection region plotted in the lower right direction indicated by the arrow 113 has less influence on the captured image. This is because the smaller the detection area determined to be a foreign object and the smaller the difference in brightness with respect to the surrounding area, the less noticeable.

図2に示す検出修正部44は、入力部32からの操作信号に応じて図5に示す閾値C1を増加させる方向に変化させることによって、閾値C1より大きい検出領域のみを異物に対応する部分であると再判断し、異物の誤検出を低下させることができる。その反対に、検出修正部44は、入力部32からの操作信号に応じて図5に示す閾値C1を減少させる方向に変化させることによって、異物の検出もれを低下させることができる。また、検出修正部44は、操作信号に応じて閾値C2を増減させることによって、閾値C1の場合と同様に、検出感度を調整することができる。   The detection correction unit 44 shown in FIG. 2 changes only the detection region larger than the threshold C1 in the part corresponding to the foreign matter by changing the threshold C1 shown in FIG. It is possible to re-determine that there is a foreign object and reduce the false detection of foreign matter. On the other hand, the detection correction unit 44 can reduce the leakage of foreign matter by changing the threshold value C1 shown in FIG. 5 in the direction of decreasing according to the operation signal from the input unit 32. Moreover, the detection correction part 44 can adjust detection sensitivity similarly to the case of the threshold value C1, by increasing / decreasing the threshold value C2 according to an operation signal.

検出修正部44は、閾値C1と閾値C2の値を独立に変化させてもよいが、例えば閾値C1および閾値C2を変数とする所定の関数(一次関数等)を用いて、閾値C1と閾値C2とを1つのパラメータに従って変化させてもよい。検出修正部44が変更する閾値は、検出領域の大きさに関する閾値C1や、検出領域内外の明度比に関する閾値C2に限定されない。   The detection correction unit 44 may change the values of the threshold C1 and the threshold C2 independently. For example, a predetermined function (such as a linear function) having the threshold C1 and the threshold C2 as variables is used to detect the threshold C1 and the threshold C2. May be changed according to one parameter. The threshold value that is changed by the detection correction unit 44 is not limited to the threshold value C1 related to the size of the detection region and the threshold value C2 related to the brightness ratio inside and outside the detection region.

例えば、検出修正部44が変更する閾値は、第2判断部66の彩度値Sに関する閾値や、第2判断部66の輝度値Yに関する閾値や、第2判断部66の色相値Hに関する閾値や、第3判断部68における周辺領域の明度値Vに関する閾値や、第4判断部70における周辺領域の明るさの標準偏差Vstdに関する閾値であってもよい。また、検出修正部44は、領域算出部62における明度勾配値Vgrad(i,j)に関する閾値を変更することによって、情報算出部46および異物判断部48における算出結果および判断結果を変更してもよい。検出修正部44は、これらの閾値を変更して異物判断部48での判断結果を修正する。これによって、本実施形態に係る画像処理装置は、使用者の好みに合わせた異物検出を行うことができる。   For example, the threshold value changed by the detection correction unit 44 is the threshold value related to the saturation value S of the second determination unit 66, the threshold value related to the luminance value Y of the second determination unit 66, or the threshold value related to the hue value H of the second determination unit 66. Alternatively, it may be a threshold value related to the brightness value V of the surrounding area in the third determination unit 68 or a threshold value related to the standard deviation Vstd of the brightness of the surrounding area in the fourth determination unit 70. Further, even if the detection correction unit 44 changes the calculation result and the determination result in the information calculation unit 46 and the foreign matter determination unit 48 by changing the threshold value regarding the lightness gradient value Vgrad (i, j) in the region calculation unit 62. Good. The detection correction unit 44 corrects the determination result in the foreign matter determination unit 48 by changing these threshold values. Thereby, the image processing apparatus according to the present embodiment can perform foreign object detection according to the user's preference.

検出修正部44は、撮影画像に重ねて、異物判断部48での判断結果や、検出修正部44によって異物に対応する部分であると再判断される検出領域の位置を、表示部36に表示させてもよい。これによってカメラ10の使用者は、画像処理装置による異物の検出感度を視覚的に認識しながら、好みに応じた判断修正を、検出修正部44に実施させることができる。また、検出修正部44には、検出領域が異物に対応する部分であるか否かの判断を、撮影画像における検出領域の位置を使用者が直接指定して修正する操作信号が、入力されてもよい。これにより、検出修正部44は、より使用者の好みに応じた判断修正を行うことができる。   The detection correction unit 44 superimposes the captured image on the display unit 36 to display the determination result of the foreign matter determination unit 48 and the position of the detection area that is again determined by the detection correction unit 44 as a part corresponding to the foreign matter. You may let them. Accordingly, the user of the camera 10 can cause the detection / correction unit 44 to perform determination correction according to preference while visually recognizing the foreign substance detection sensitivity of the image processing apparatus. In addition, the detection correction unit 44 receives an operation signal for directly determining the position of the detection area in the photographed image and correcting the determination as to whether or not the detection area is a part corresponding to a foreign object. Also good. Thereby, the detection correction part 44 can perform judgment correction according to a user's liking more.

また、検出修正部44は、修正した判断基準である修正判断基準や、図5に示すような検出領域のデータに検出修正部44の判断を対応させたデータ(異物マップ)を、記憶部30に出力しても良い。修正判断基準には、上述の閾値C1と閾値C2の値が含まれる。また、検出領域のデータに検出修正部44の判断結果を対応させたデータは、図5に示すような検出領域の分類と、検出領域の大きさや明度比の値と、検出領域の位置が含まれる。記憶部30は、検出修正部44によって修正された修正判断基準や、検出領域のデータを記憶し、必要に応じて、判断基準変更部42に出力することができる。   Further, the detection / correction unit 44 stores a correction determination criterion, which is a corrected determination criterion, and data (foreign matter map) in which the determination of the detection / correction unit 44 is associated with the data of the detection region as shown in FIG. May be output. The correction criterion includes the above-described threshold C1 and threshold C2. Further, the data in which the determination result of the detection correction unit 44 is associated with the data of the detection area includes the classification of the detection area, the size of the detection area and the value of the brightness ratio, and the position of the detection area as shown in FIG. It is. The storage unit 30 can store the correction determination criteria corrected by the detection correction unit 44 and the data of the detection area, and can output them to the determination criterion change unit 42 as necessary.

判断基準変更部42は、修正判断基準に基づき、異物判断部48における第1〜第4判断部64〜68が判断を行う際の判断基準である初期判断基準を、変更することができる。判断基準変更部42は、異物判断部48の初期判断基準を、修正判断基準に近づけるように、変更することができる。   The determination criterion changing unit 42 can change the initial determination criterion, which is a determination criterion when the first to fourth determination units 64 to 68 in the foreign matter determination unit 48 make a determination, based on the correction determination criterion. The determination criterion changing unit 42 can change the initial determination criterion of the foreign matter determination unit 48 so as to approach the correction determination criterion.

初期判断基準は、検出修正部44の修正前において異物判断部48が行う判断に関する判断基準である。修正判断基準は、検出修正部44よる修正判断の際に用いられた判断基準である。したがって、判断基準変更部42は、異物判断部48の初期判断基準を、カメラ10の使用者の好みに近づけることができる。これにより、本実施形態に係る画像処理装置は、使用者の好みに応じた異物検出を効率的に行うことができる。なお、判断基準変更部42は、記憶部30に記憶された複数の修正判断基準の平均値を算出し、修正判断基準の平均値に基づいて、異物判断部48の初期判断基準を、変更してもよい。   The initial determination criterion is a determination criterion related to the determination performed by the foreign matter determination unit 48 before the correction by the detection correction unit 44. The correction determination criterion is a determination criterion used in the correction determination by the detection correction unit 44. Therefore, the determination criterion changing unit 42 can bring the initial determination criterion of the foreign matter determination unit 48 closer to the preference of the user of the camera 10. Thereby, the image processing apparatus according to the present embodiment can efficiently perform foreign object detection according to the user's preference. The determination criterion changing unit 42 calculates an average value of a plurality of correction determination criteria stored in the storage unit 30, and changes the initial determination criterion of the foreign matter determination unit 48 based on the average value of the correction determination criteria. May be.

また、判断基準変更部42は、検出領域のデータに検出修正部44の判断結果を対応させたデータを、複数回の判断にわたって蓄積した蓄積データを用いて、異物判断部48の初期判断基準を変更してもよい。例えば、判断基準変更部42は、異物に対応する部分であると判断された検出領域(図5の丸印98)の割合が、異物に対応する部分でないと判断された検出領域(図5の三角印96)の割合より大きい範囲を、異物マップの蓄積データから算出する。そして、判断基準変更部42は、異物マップの蓄積データから算出された範囲に基づいて、異物判断部48の初期判断基準を変更する。これにより、判断基準変更部42は、異物判断部48の初期判断基準を、カメラ10の使用者の好みに近づけることができる。   In addition, the determination criterion changing unit 42 sets the initial determination criterion of the foreign matter determination unit 48 by using the accumulated data obtained by accumulating the detection region data corresponding to the determination result of the detection correction unit 44 over a plurality of determinations. It may be changed. For example, the determination criterion changing unit 42 determines that the ratio of the detection area (circle 98 in FIG. 5) determined to be a part corresponding to a foreign object is not a part corresponding to the foreign object (FIG. 5). A range larger than the ratio of the triangle mark 96) is calculated from the accumulated data of the foreign matter map. Then, the determination criterion changing unit 42 changes the initial determination criterion of the foreign matter determination unit 48 based on the range calculated from the accumulated data of the foreign matter map. Thereby, the determination criterion changing unit 42 can bring the initial determination criterion of the foreign matter determination unit 48 closer to the preference of the user of the camera 10.

異物画像補正部50は、異物判断部48での判断や、検出修正部44によって修正された判断に基づき、撮影画像に写りこんだ異物に対応する部分に対して、異物の影響を低減する画像補正を行う。本実施形態に係る異物画像補正部50は、第1画像補正部74と、第2画像補正部76と、第3画像補正部78とを有する。   The foreign object image correcting unit 50 is an image that reduces the influence of the foreign object on the part corresponding to the foreign object reflected in the captured image based on the determination by the foreign object determining unit 48 or the determination corrected by the detection correcting unit 44. Make corrections. The foreign object image correction unit 50 according to the present embodiment includes a first image correction unit 74, a second image correction unit 76, and a third image correction unit 78.

第1画像補正部74は、明るさ情報算出部54で算出された明度情報を用いて、撮影画像に写りこんだ異物に対応する部分に対して、当該異物の影響を低減する第1補正を行うことができる。第1画像補正部74は、明るさ情報算出部54で算出された各画素の明度値Vおよび明度平面を用いて、第1画像補正を行う。   The first image correction unit 74 uses the brightness information calculated by the brightness information calculation unit 54 to perform a first correction for reducing the influence of the foreign matter on the part corresponding to the foreign matter reflected in the captured image. It can be carried out. The first image correction unit 74 performs the first image correction using the brightness value V and the brightness plane of each pixel calculated by the brightness information calculation unit 54.

第1画像補正部74は、局所的な明度値Vの規格化(正規化)処理を行って、補正対象となる検出領域について、明度透過率信号VT(i,j)を算出し、補正対象となる検出領域についての明度透過率マップ(明度ゲインマップ)を生成する。ここで、第1画像補正部74において補正対象となる検出領域は、異物判断部48または検出修正部44において、異物に対応する部分であると判断された検出領域である。   The first image correction unit 74 performs a normalization (normalization) process on the local lightness value V, calculates a lightness transmittance signal VT (i, j) for the detection area to be corrected, and performs the correction target. A lightness transmittance map (lightness gain map) is generated for the detection region. Here, the detection region to be corrected in the first image correction unit 74 is a detection region that is determined by the foreign matter determination unit 48 or the detection correction unit 44 as a portion corresponding to the foreign matter.

明度透過率信号VT(i,j)は、検出領域における着目画素(i,j)の明度値V(i,j)と、着目画素(i,j)を含む局所範囲の明度値の平均値との相対比を演算することによって算出される。本実施形態における第1画像補正部74は、以下の式(6)によって、明度透過率信号VT(i,j)を算出することができる。   The lightness transmittance signal VT (i, j) is an average value of the lightness value V (i, j) of the pixel of interest (i, j) in the detection region and the lightness value of the local range including the pixel of interest (i, j). It is calculated by calculating the relative ratio to. The first image correction unit 74 in the present embodiment can calculate the lightness transmittance signal VT (i, j) by the following equation (6).

Figure 0005083574
Figure 0005083574

式(6)において、αおよびβは、局所平均を取る範囲に相当する。αは、着目画素(i,j)を中心に左右に広がる画素数、βは着目画素(i,j)を中心に上下に広がる画素数を表している。明度透過率信号VT(i,j)の算出において、局所平均を取る範囲は、想定される異物写りこみ領域の3倍程度に設定することができるが、特に限定されない。例えば、第1画像補正部74は、明度透過率信号VT(i,j)の算出において、画素数αおよびβの値を、α=36〜55、β=36〜55とすることができる。   In Expression (6), α and β correspond to a range that takes a local average. α represents the number of pixels extending left and right around the pixel of interest (i, j), and β represents the number of pixels extending up and down around the pixel of interest (i, j). In the calculation of the lightness transmittance signal VT (i, j), the range for taking the local average can be set to about three times the assumed foreign object reflection region, but is not particularly limited. For example, in the calculation of the lightness transmittance signal VT (i, j), the first image correction unit 74 can set the values of the pixel numbers α and β to α = 36 to 55 and β = 36 to 55.

図4は、第1画像補正部74において行われる明度透過率マップの生成を説明した概念図である。図4(a)は、撮影画像の明度平面における左右方向の明度値Vの変化を表したものである。図4(a)に示す明度平面(曲線)81には、明度値Vが周辺部分に対して低く、明度勾配値Vgrad(i,j)が大きい落ち込み部82,84が存在する。図4(a)において、第1画像補正部74の補正対象となる検出領域は、落ち込み部82,84に対応する検出領域Aと検出領域Bである。   FIG. 4 is a conceptual diagram illustrating generation of a lightness transmittance map performed in the first image correction unit 74. FIG. 4A shows a change in the lightness value V in the left-right direction on the lightness plane of the photographed image. In the lightness plane (curve) 81 shown in FIG. 4A, there are dip portions 82 and 84 in which the lightness value V is lower than the peripheral portion and the lightness gradient value Vgrad (i, j) is large. In FIG. 4A, the detection areas to be corrected by the first image correction unit 74 are the detection areas A and B corresponding to the drop portions 82 and 84.

図2に示す第1画像補正部74は、図4(a)に示す明度平面(曲線)の検出領域Aに含まれる各画素と、検出領域Bに含まれる各画素について、明度透過率信号VT(i,j)を算出する。図4(b)は、図4(a)に示す明度平面(曲線)から算出された明度透過率マップを表している。図4(a)に示す明度平面における落ち込み部82,84は、局所的な規格化処理により、異物による明度低下のみが抽出され、図4(b)に示す明度透過率マップでは、明度透過率の落ち込み部82a,82bに置き換えられている。このようにして、第1画像補正部74は、異物に対応する部分であると判断された検出領域について、明度透過率マップを生成する。第1画像補正部74は、それぞれの検出領域についてゲインマップを生成することによって、第1画像補正の補正量である第1補正量(明度ゲイン)を、それぞれの検出領域ごとに独立に算出してもよい。   The first image correction unit 74 illustrated in FIG. 2 performs the lightness transmittance signal VT for each pixel included in the detection area A of the lightness plane (curve) illustrated in FIG. 4A and each pixel included in the detection area B. (I, j) is calculated. FIG. 4B shows a lightness transmittance map calculated from the lightness plane (curve) shown in FIG. In the lightness planes shown in FIG. 4A, the drop portions 82 and 84 in the lightness plane are extracted only by the lightness reduction due to the foreign matter by the local normalization process. In the lightness transmittance map shown in FIG. Are replaced by the sagging portions 82a and 82b. In this way, the first image correction unit 74 generates a lightness transmittance map for the detection region determined to be a part corresponding to a foreign object. The first image correction unit 74 generates a gain map for each detection region, thereby calculating a first correction amount (lightness gain) that is a correction amount for the first image correction independently for each detection region. May be.

さらに、第1画像補正部74は、各検出領域の位置情報と、各検出領域の明度透過率マップを用いて、撮影画像に写りこんだ異物に対応する部分について、異物の影響を低減もしくは除去する第1画像補正を実施する。第1画像補正部74は、検出領域に含まれる各画素の明度値V(i,j)に、明度透過率信号VT(i,j)の逆数を掛け算して、ゲイン補正を行う。すなわち、第1画像補正部74は、撮影画像に写りこんだ異物に対応する検出領域に含まれる画素の明度値Vをゲイン補正し、異物の写りこみによる明度の変化を低減もしくは除去する。例えば、第1画像補正部74は、以下の式(7)を用いて、補正された明度値VC(i,j)を算出する。   Further, the first image correction unit 74 uses the position information of each detection region and the lightness transmittance map of each detection region to reduce or eliminate the influence of the foreign matter on the part corresponding to the foreign matter reflected in the captured image. The first image correction is performed. The first image correction unit 74 performs gain correction by multiplying the lightness value V (i, j) of each pixel included in the detection region by the reciprocal of the lightness transmittance signal VT (i, j). That is, the first image correction unit 74 performs gain correction on the brightness value V of the pixel included in the detection area corresponding to the foreign object reflected in the captured image, and reduces or eliminates the change in brightness due to the reflection of the foreign object. For example, the first image correction unit 74 calculates the corrected brightness value VC (i, j) using the following equation (7).

Figure 0005083574
Figure 0005083574

このように、第1画像補正部74は、検出領域の明度値V(i,j)を、上述のゲイン補正された明度値VC(i,j)に置き換えることによって、撮影画像の明度平面を補正する。これにより、第1画像補正部74は、異物の写りこみによる明度の変化を、撮影画像から低減もしくは除去することができる。   In this way, the first image correction unit 74 replaces the brightness value V (i, j) of the detection area with the above-described gain-corrected brightness value VC (i, j), thereby changing the brightness plane of the captured image. to correct. Accordingly, the first image correction unit 74 can reduce or remove the change in brightness due to the reflection of foreign matter from the captured image.

第2画像補正部76は、彩度情報算出部56で算出された彩度情報を用いて、撮影画像に写りこんだ異物に対応する部分に対して、当該異物の影響を低減する第2画像補正を行うことができる。第2画像補正部76は、彩度情報算出部56で算出された各画素の彩度値Sおよび彩度平面を用いて、第2画像補正を行う。   The second image correction unit 76 uses the saturation information calculated by the saturation information calculation unit 56 to reduce the influence of the foreign matter on the portion corresponding to the foreign matter reflected in the captured image. Correction can be performed. The second image correction unit 76 performs second image correction using the saturation value S and the saturation plane of each pixel calculated by the saturation information calculation unit 56.

第2画像補正部76は、第1画像補正部74と同様に、局所的な彩度値Sの規格化(正規化)処理を行って、補正対象となる検出領域について、彩度透過率信号ST(i,j)を算出し、補正対象となる検出領域についての彩度透過率マップ(彩度ゲインマップ)を生成する。第2画像補正部76において補正対象となる検出領域は、第1画像補正部74と同様に、異物判断部48または検出修正部44において、異物に対応する部分であると判断された検出領域である。   Similar to the first image correction unit 74, the second image correction unit 76 performs a normalization (normalization) process on the local saturation value S, and a saturation transmittance signal is detected for the detection region to be corrected. ST (i, j) is calculated, and a saturation transmittance map (saturation gain map) for the detection area to be corrected is generated. Like the first image correction unit 74, the detection region to be corrected by the second image correction unit 76 is a detection region that is determined to be a part corresponding to the foreign material by the foreign material determination unit 48 or the detection correction unit 44. is there.

彩度透過率信号ST(i,j)の算出式は、式(6)における明度透過率信号VT(i,j)および明度値V(i,j)を、彩度透過率信号ST(i,j)および彩度値S(i,j)に置き換えたものを用いることができる。また、第2画像補正部76は、第1画像補正部74と同様に、異物に対応する部分であると判断された検出領域について、彩度透過率マップを生成する。第2画像補正部76は、それぞれの検出領域についてゲインマップを生成することによって、第2画像補正の補正量である第2補正量(彩度ゲイン)を、それぞれの検出領域ごとに独立に算出してもよい。   The equation for calculating the saturation transmittance signal ST (i, j) is the lightness transmittance signal VT (i, j) and the lightness value V (i, j) in Equation (6), and the saturation transmittance signal ST (i , J) and the saturation value S (i, j) can be used. Similarly to the first image correction unit 74, the second image correction unit 76 generates a saturation transmittance map for the detection area determined to be a part corresponding to a foreign object. The second image correction unit 76 generates a gain map for each detection region, thereby calculating a second correction amount (saturation gain) that is a correction amount for the second image correction independently for each detection region. May be.

第2画像補正部76は、第1画像補正部74と同様に、各検出領域の位置情報と、各検出領域の彩度透過率マップを用いて、撮影画像に写りこんだ異物に対応する部分について、異物の影響を低減もしくは除去する第2画像補正を実施する。第2画像補正部76は、検出領域に含まれる各画素の彩度値S(i,j)に、彩度透過率信号ST(i,j)の逆数を掛け算して、ゲイン補正を行う。例えば、第2画像補正部76は、以下の式(8)を用いて、補正された彩度値SC(i,j)を算出する。   Similarly to the first image correction unit 74, the second image correction unit 76 uses the position information of each detection region and the saturation transmittance map of each detection region to correspond to a foreign object reflected in the captured image. The second image correction for reducing or eliminating the influence of the foreign matter is performed. The second image correction unit 76 performs gain correction by multiplying the saturation value S (i, j) of each pixel included in the detection region by the reciprocal of the saturation transmittance signal ST (i, j). For example, the second image correction unit 76 calculates the corrected saturation value SC (i, j) using the following equation (8).

Figure 0005083574
Figure 0005083574

このように、第2画像補正部76は、検出領域の彩度値S(i,j)を、上述のゲイン補正された彩度値SC(i,j)に置き換えることによって、撮影画像の彩度平面を補正する。これにより、第2画像補正部76は、異物の写りこみによる彩度の変化を、撮影画像から低減もしくは除去することができる。 As described above, the second image correction unit 76 replaces the saturation value S (i, j) of the detection region with the above-described gain-corrected saturation value SC (i, j), thereby correcting the saturation of the captured image. Correct the degree plane. As a result, the second image correction unit 76 can reduce or remove the change in saturation due to the reflection of foreign matter from the captured image.

第3画像補正部78は、色相情報算出部58で算出された色相情報を用いて、撮影画像に写りこんだ異物に対応する部分に対して、当該異物の影響を低減する第3画像補正を行うことができる。第3画像補正部78は、色相情報算出部58で算出された各画素の色相値Hおよび色相平面を用いて、第3画像補正を行う。   The third image correction unit 78 uses the hue information calculated by the hue information calculation unit 58 to perform the third image correction that reduces the influence of the foreign matter on the portion corresponding to the foreign matter reflected in the captured image. It can be carried out. The third image correction unit 78 performs third image correction using the hue value H and the hue plane of each pixel calculated by the hue information calculation unit 58.

第3画像補正部78は、第1画像補正部74と同様に、局所的な色相値Hの規格化(正規化)処理を行って、補正対象となる検出領域について、色相透過率信号HT(i,j)を算出し、補正対象となる検出領域についての色相透過率マップ(色相ゲインマップ)を生成する。第3画像補正部78において補正対象となる検出領域は、第1画像補正部74と同様に、異物判断部48または検出修正部44において、異物に対応する部分であると判断された検出領域である。   Similar to the first image correction unit 74, the third image correction unit 78 performs a normalization (normalization) process of the local hue value H, and the hue transmittance signal HT ( i, j) is calculated, and a hue transmittance map (hue gain map) for the detection area to be corrected is generated. The detection region to be corrected in the third image correction unit 78 is a detection region that is determined to be a part corresponding to the foreign material in the foreign matter determination unit 48 or the detection correction unit 44, as in the first image correction unit 74. is there.

色相透過率信号HT(i,j)の算出式は、式(6)における明度透過率信号VT(i,j)および明度値V(i,j)を、色相透過率信号HT(i,j)および色相値H(i,j)に置き換えたものを用いることができる。また、第3画像補正部78は、第1画像補正部74と同様に、異物に対応する部分であると判断された検出領域について、色相透過率マップを生成する。第3画像補正部78は、それぞれの検出領域についてゲインマップを生成することによって、第3画像補正の補正量である第3補正量(色相ゲイン)を、それぞれの検出領域ごとに独立に算出してもよい。   The calculation formula of the hue transmittance signal HT (i, j) is the lightness transmittance signal VT (i, j) and the lightness value V (i, j) in the equation (6), and the hue transmittance signal HT (i, j). ) And hue value H (i, j) can be used. Similarly to the first image correction unit 74, the third image correction unit 78 generates a hue transmittance map for the detection area determined to be a part corresponding to a foreign object. The third image correction unit 78 generates a gain map for each detection region, thereby independently calculating a third correction amount (hue gain) that is a correction amount for the third image correction for each detection region. May be.

第3画像補正部78は、第1画像補正部74と同様に、各検出領域の位置情報と、各検出領域の色相透過率マップを用いて、撮影画像に写りこんだ異物に対応する部分について、異物の影響を低減もしくは除去する第3画像補正を実施する。第3画像補正部78は、検出領域に含まれる各画素の色相値H(i,j)に、色相透過率信号HT(i,j)の逆数を掛け算して、ゲイン補正を行う。例えば、第3画像補正部78は、以下の式(9)を用いて、補正された色相値HC(i,j)を算出する。   Similar to the first image correction unit 74, the third image correction unit 78 uses the positional information of each detection region and the hue transmittance map of each detection region for the part corresponding to the foreign matter reflected in the captured image. Then, the third image correction is performed to reduce or remove the influence of the foreign matter. The third image correction unit 78 performs gain correction by multiplying the hue value H (i, j) of each pixel included in the detection region by the reciprocal of the hue transmittance signal HT (i, j). For example, the third image correction unit 78 calculates the corrected hue value HC (i, j) using the following equation (9).

Figure 0005083574
Figure 0005083574

このように、第3画像補正部78は、検出領域の色相値H(i,j)を、上述のゲイン補正された色相値HC(i,j)に置き換えることによって、撮影画像の色相平面を補正する。これにより、第3画像補正部78は、異物の写りこみによる色相の変化を、撮影画像から低減もしくは除去することができる。   Thus, the third image correction unit 78 replaces the hue value H (i, j) of the detection area with the above-described gain-corrected hue value HC (i, j), thereby changing the hue plane of the captured image. to correct. As a result, the third image correction unit 78 can reduce or remove the change in hue due to the reflection of foreign matter from the captured image.

異物画像補正部50は、例えば色補正判断部52が、現在補正しようとしている撮影画像が、例えばJPEG画像のように、非線形補正が施されている画像であると判断した場合は、第1〜第3画像補正部74〜78による第1〜第3画像補正によって撮影画像を補正するHSV補正を行う。
第1〜第3画像補正部74〜78によるHSV補正は、撮影画像をHSV変換し、明度平面、彩度平面、色相平面のそれぞれについて別個にゲインマップを作成し、画像補正を行う。したがって、第1〜第3画像補正部74〜78によるHSV補正は、撮影画像の色が非線形補正を施されているような場合であっても、異物の写りこみによる色の変化を、周辺部分の色合いと高い整合性を保ちながら補正することができる。
For example, when the color correction determination unit 52 determines that the captured image that is currently being corrected is an image that has been subjected to nonlinear correction, such as a JPEG image, for example, HSV correction for correcting the captured image by the first to third image corrections by the third image correction units 74 to 78 is performed.
HSV correction by the first to third image correction units 74 to 78 performs HSV conversion on a captured image, separately creates a gain map for each of the lightness plane, the saturation plane, and the hue plane, and performs image correction. Therefore, the HSV correction by the first to third image correction units 74 to 78 is performed in such a manner that even if the color of the photographed image is subjected to nonlinear correction, the color change due to the reflection of the foreign matter is It is possible to correct the color tone while maintaining high consistency.

なお、異物画像補正部50は、例えば色補正判断部52が、現在補正しようとしている撮影画像が、例えばRAW画像のように、非線形補正が施されていない画像であると判断した場合は、一般的な輝度のみによる補正(明度のみによる補正でも良い)を行っても良い。   When the color correction determination unit 52 determines that the captured image that is currently being corrected is an image that has not been subjected to nonlinear correction, such as a RAW image, for example, Correction based only on the luminance (or correction based only on the brightness) may be performed.

一般的な輝度補正は、たとえば次のようにして行われる。局所的な輝度値Yの規格化(正規化)処理を行って、補正対象となる検出領域について、輝度透過率信号YT(i,j)を算出し、補正対象となる検出領域についての輝度透過率マップ(輝度ゲインマップ)を生成する。輝度透過率信号YT(i,j)の算出式は、式(6)における明度透過率信号VT(i,j)および明度値V(i,j)を、輝度透過率信号YT(i,j)および輝度値Y(i,j)に置き換えたものを用いることができる。   For example, general luminance correction is performed as follows. A local luminance value Y is normalized (normalized) to calculate a luminance transmittance signal YT (i, j) for the detection region to be corrected, and the luminance transmission for the detection region to be corrected. A rate map (luminance gain map) is generated. The calculation formula of the luminance transmittance signal YT (i, j) is the brightness transmittance signal VT (i, j) and the brightness value V (i, j) in the equation (6), and the luminance transmittance signal YT (i, j). ) And the luminance value Y (i, j) can be used.

検出領域に含まれる各画素のR値R(i,j)、G値G(i,j)およびB値B(i,j)のそれぞれに、輝度透過率信号YT(i,j)の逆数を掛け算して、ゲイン補正を行う。例えば、以下の式(10−1)〜(10−3)を用いて、補正されたR値RC(i,j)、G値GC(i,j)およびB値BC(i,j)を算出する。   Reciprocal of luminance transmittance signal YT (i, j) for each of R value R (i, j), G value G (i, j) and B value B (i, j) of each pixel included in the detection region The gain is corrected by multiplying by. For example, the corrected R value RC (i, j), G value GC (i, j), and B value BC (i, j) are calculated using the following equations (10-1) to (10-3). calculate.

Figure 0005083574
このように、検出領域に含まれる各画素のRGB値を、上述のゲイン補正されたR値RC(i,j)、G値GC(i,j)およびB値BC(i,j)に置き換える(一般的な輝度のみによる補正)ことによって、撮影画像を補正してもよい。
Figure 0005083574
In this way, the RGB value of each pixel included in the detection area is replaced with the above-described gain-corrected R value RC (i, j), G value GC (i, j), and B value BC (i, j). The captured image may be corrected by (correction using only general luminance).

なお、一般的な輝度のみによる補正では、式(10−1)〜(10−3)に示すように、輝度のゲインマップ(YT(i,j))のみを用いて補正を行っている。このため、非線形補正された画像に対して、一般的な輝度のみによる補正を行うと、補正後の画素におけるRGB値(RC(i,j),GC(i,j),BC(i,j))の何れかが、周辺部分の画素におけるRGB値から離れた値となり、補正痕が発生してしまう場合がある。   In general correction only by luminance, correction is performed using only the luminance gain map (YT (i, j)) as shown in equations (10-1) to (10-3). For this reason, if correction is performed only for general luminance on an image that has been nonlinearly corrected, the RGB values (RC (i, j), GC (i, j), BC (i, j) in the pixel after correction are corrected. )) Becomes a value far from the RGB values in the peripheral pixels, and correction marks may occur.

また、このような問題は、補正の対象となる撮影画像に強い非線形補正が施されている場合に起こりやすい。しかも撮影画像に対する非線形補正の方式は、カメラなどの撮影装置の機種毎に異なる場合もある。それに対して、本実施形態に係るHSV補正では、式(7)〜(9)に示すように、明度ゲインマップ、彩度ゲインマップおよび色相ゲインマップをそれぞれ生成して補正を行うので、ゲイン補正される画素は、周辺部分の画素に近い色に補正される。また、HSV補正によれば、補正対象となる撮影画像が非線形補正を施されているような場合であっても、補正後の撮影画像に補正痕が発生してしまう問題を防止でき、しかも補正対象となる画像の非線形補正の形式を問わない。すなわち、たとえばJPEG以外の非線形補正後の画像に対しても、本実施形態の効果が期待できる。   Such a problem is likely to occur when a strong non-linear correction is applied to a captured image to be corrected. In addition, the non-linear correction method for the photographed image may differ depending on the model of the photographing apparatus such as a camera. On the other hand, in the HSV correction according to the present embodiment, as shown in the equations (7) to (9), the brightness gain map, the saturation gain map, and the hue gain map are respectively generated and corrected. The corrected pixel is corrected to a color close to that of the peripheral pixel. Further, according to the HSV correction, even when the captured image to be corrected is subjected to nonlinear correction, it is possible to prevent a problem that a correction mark is generated on the corrected captured image, and to correct the correction. There is no limitation on the form of nonlinear correction of the target image. That is, for example, the effect of the present embodiment can be expected for an image after nonlinear correction other than JPEG.

なお、異物画像補正部50によるHSV補正は、第1〜第3画像補正部74〜78によって補正された明度平面、彩度平面および色相平面を組み合わせることによって補正後の撮影画像を生成しても良いが、第2画像補正部74または第3画像補正部78による画像補正を省略しても良い。すなわち、異物画像補正部50によるHSV補正では、彩度平面または色相平面のいずれか一方についてはゲイン補正を行わず、ゲイン補正していない彩度平面または色相平面を、補正後の明度平面等と組み合わせることによって、補正後の撮影画像を生成してもよい。   Note that the HSV correction by the foreign object image correcting unit 50 may generate a corrected captured image by combining the lightness plane, the saturation plane, and the hue plane corrected by the first to third image correcting units 74 to 78. The image correction by the second image correction unit 74 or the third image correction unit 78 may be omitted. That is, in the HSV correction by the foreign object image correction unit 50, gain correction is not performed for either the saturation plane or the hue plane, and the saturation plane or hue plane that has not been gain-corrected is used as the corrected brightness plane or the like. By combining them, a corrected captured image may be generated.

本実施形態では、第1画像補正部74を用いた明度による補正(輝度による補正も含む)に、第2画像補正部76を用いた彩度による補正を組み合わせることで、一般的な輝度のみの補正に比較して、特に非線形補正されている画像に対する異物除去補正の精度が向上する。また、本実施形態では、第1画像補正部74を用いた明度による補正(輝度による補正も含む)に、第3画像補正部78を用いた色相による補正を組み合わせることで、一般的な輝度のみの補正に比較して、特に非線形補正されている画像に対する異物除去補正の精度が向上する。   In the present embodiment, by combining correction by lightness using the first image correction unit 74 (including correction by luminance) with correction by saturation using the second image correction unit 76, only general luminance can be obtained. Compared with the correction, the accuracy of the foreign substance removal correction for an image that has been nonlinearly corrected is improved. Further, in the present embodiment, only general luminance is obtained by combining correction by brightness using the first image correction unit 74 (including correction by luminance) with correction by hue using the third image correction unit 78. Compared with this correction, the accuracy of the foreign matter removal correction for an image that has been nonlinearly corrected is improved.

なお、異物画像補正部50は、HSV補正において、第1〜第3画像補正に係る補正量である第1〜第3補正量を、検出領域ごとに独立に算出して行っても良い。検出領域ごとに補正量を算出することによって、本実施形態に係る画像処理装置は、撮影画像全体について補正量を計算する場合に比べて、演算量を抑制することができる。また、異物画像補正部50の第1画像補正部では、明度情報に代えて、輝度情報を用いて、画像補正を行ってもよいことはもちろんである。   In the HSV correction, the foreign object image correction unit 50 may calculate the first to third correction amounts, which are correction amounts related to the first to third image corrections, independently for each detection region. By calculating the correction amount for each detection region, the image processing apparatus according to the present embodiment can suppress the calculation amount as compared with the case where the correction amount is calculated for the entire captured image. Of course, the first image correction unit of the foreign object image correction unit 50 may perform image correction using luminance information instead of brightness information.

色補正判断部52は、異物画像補正部50において異物の影響を除去する補正の対象となっている撮影画像が、カメラ10における光学系16による像を光電変換して得られた撮影画像に対して非線形補正が施されたものであるか否かを判断する。色補正判断部52は、異物画像補正部50において異物の影響を除去する補正の対象となっている撮影画像が、非線形補正が施されたものであるか否かを判断し、異物画像補正部50に判断結果を出力する。   The color correction determination unit 52 applies to a captured image obtained by photoelectrically converting an image taken by the optical system 16 in the camera 10, which is a correction target for removing the influence of the foreign material in the foreign material image correcting unit 50. It is then determined whether or not nonlinear correction has been performed. The color correction determination unit 52 determines whether or not the captured image that is a correction target for removing the influence of the foreign matter in the foreign matter image correction unit 50 has been subjected to nonlinear correction, and the foreign matter image correction unit The determination result is output to 50.

異物画像補正部50は、現在補正しようとしている撮影画像が、色補正判断部52によって、非線形補正が施されたものであると判断されたとき、第1〜第3画像補正部74〜78による上述のHSV補正を行い、異物画像補正部50から異物の影響を減少させる補正を行う。その反対に、異物画像補正部50は、現在補正しようとしている撮影画像が、色補正判断部52によって、非線形補正が施されたものでないと判断されたとき、第1〜第3画像補正部74〜78による画像補正を行わず、一般的な輝度のみによる補正を行い、異物画像補正部50から異物の影響を減少させる補正を行ってもよい。   The foreign object image correcting unit 50 uses the first to third image correcting units 74 to 78 when the color correction determining unit 52 determines that the photographed image to be corrected has been subjected to nonlinear correction. The HSV correction described above is performed, and the foreign object image correction unit 50 performs correction to reduce the influence of the foreign object. On the contrary, the foreign object image correction unit 50 determines that the captured image to be corrected currently is not subjected to nonlinear correction by the color correction determination unit 52, and the first to third image correction units 74. The correction by only the general luminance may be performed without performing the image correction by ˜78, and the foreign object image correcting unit 50 may perform the correction to reduce the influence of the foreign object.

また、色補正判断部52は、異物画像補正部50において異物の影響を除去する補正の対象となっている撮影画像が施された非線形補正の強弱を判断するものであってもよい。色補正判断部52は、異物画像補正部50において異物の影響を除去する補正の対象となっている撮影画像が施された非線形補正の強弱を判断し、異物画像補正部50に判断結果を出力する。   In addition, the color correction determination unit 52 may determine the strength of nonlinear correction applied to the captured image that is a correction target for removing the influence of the foreign matter in the foreign matter image correction unit 50. The color correction determination unit 52 determines the level of nonlinear correction applied to the captured image that is a correction target for removing the influence of the foreign matter in the foreign matter image correction unit 50, and outputs the judgment result to the foreign matter image correction unit 50. To do.

この場合、異物画像補正部50は、現在補正しようとしている撮影画像が、色補正判断部52によって、強い非線系補正が施されたものであると判断されたとき、第1〜第3画像補正部74〜78による上述のHSV補正を行い、異物画像補正部50から異物の影響を減少させる補正を行う。その反対に、異物画像補正部50は、現在補正しようとしている撮影画像が、色補正判断部52によって、弱い非線形補正が施されたものであると判断されたとき、第1〜第3画像補正部78による画像補正を行わず、一般的な輝度のみによる補正を行い、異物画像補正部50から異物の影響を減少させる補正を行ってもよい。   In this case, the foreign object image correction unit 50 determines that the first to third images when the captured image to be corrected is determined to have been subjected to strong nonlinear correction by the color correction determination unit 52. The HSV correction described above is performed by the correction units 74 to 78, and the foreign image correction unit 50 performs correction to reduce the influence of the foreign material. On the contrary, the foreign object image correction unit 50 performs the first to third image corrections when the color correction determination unit 52 determines that the captured image to be corrected has been subjected to weak nonlinear correction. The correction by only the general luminance may be performed without performing the image correction by the unit 78, and the foreign image correction unit 50 may perform the correction to reduce the influence of the foreign material.

記憶部30は、検出修正部44によって修正された修正判断基準や、検出領域のデータや、撮影画像の撮影条件等を記憶する。記憶部30は、不揮発性メモリ等によって構成される。操作信号入力部32は、撮影画像に写りこんだ異物に対応する部分を特定するために使用者が行った操作に対応する操作信号が入力される入力部である。操作信号入力部32には、例えば、検出領域の大きさに関する閾値C1や、検出領域の内外の明度比に関する閾値C2など、異物判断部48の第1〜第4判断部64〜70で使用される閾値(判断基準)を、変更する旨の操作信号が入力される。   The storage unit 30 stores correction determination criteria corrected by the detection correction unit 44, detection area data, shooting conditions of captured images, and the like. The storage unit 30 is configured by a nonvolatile memory or the like. The operation signal input unit 32 is an input unit to which an operation signal corresponding to an operation performed by the user in order to specify a part corresponding to a foreign object reflected in a captured image. The operation signal input unit 32 is used by the first to fourth determination units 64 to 70 of the foreign object determination unit 48 such as a threshold value C1 regarding the size of the detection region and a threshold value C2 regarding the brightness ratio inside and outside the detection region. An operation signal for changing the threshold value (judgment criterion) is input.

操作信号入力部32は、例えばカメラ本体部12(図1参照)に備えられるボタンや、十字キーや、回転式セレクター等など、使用者が画像処理装置に操作信号を入力するためのユーザーインターフェースを含む。検出修正部44は、操作信号入力部32を介して演算部38に入力された操作信号に応じて、異物判断部48の判断を修正することができる。   The operation signal input unit 32 is a user interface for a user to input an operation signal to the image processing apparatus, such as a button, a cross key, and a rotary selector provided in the camera body unit 12 (see FIG. 1). Including. The detection correction unit 44 can correct the determination of the foreign matter determination unit 48 in accordance with the operation signal input to the calculation unit 38 via the operation signal input unit 32.

撮影条件信号入力部34には、異物判断部48において判断される撮影画像や、異物画像補正部50において画像補正が行われる撮影画像に関する撮影条件が入力される。撮影条件信号入力部34に入力される撮影条件には、例えば撮影画像を撮影したときの絞り値や撮影感度、撮影画像を撮影したときに使用した光学系の種類や焦点距離等が含まれる。   The imaging condition signal input unit 34 is input with imaging conditions relating to a captured image determined by the foreign matter determination unit 48 and a captured image on which image correction is performed by the foreign matter image correction unit 50. The shooting conditions input to the shooting condition signal input unit 34 include, for example, the aperture value and shooting sensitivity when shooting a shot image, the type of optical system used when shooting the shot image, the focal length, and the like.

検出修正部44は、撮影条件信号入力部34を介して入力された撮影条件に対応させて、修正した判断基準である修正判断基準や、図5に示すような異物マップに関するデータを、記憶部30に記憶させることができる。また、判断基準変更部42は、撮影条件に対応している修正判断基準に基づき、異物判断部48における第1〜第4判断部64〜70が判断を行う際の判断基準である初期判断基準を、撮影条件ごとに変更することができる。使用者の好みに応じた異物検出感度は、撮影条件に応じて変化する場合があり、撮影条件信号入力部34を含む画像処理装置は、異物判断部48の初期判断基準を、よりカメラ10の使用者の好みに近づけることができる。   The detection / correction unit 44 stores a correction determination criterion, which is a correction criterion corrected according to the imaging condition input via the imaging condition signal input unit 34, and data relating to the foreign matter map as shown in FIG. 30 can be stored. In addition, the determination criterion changing unit 42 is an initial determination criterion that is a criterion for determination by the first to fourth determination units 64 to 70 in the foreign matter determination unit 48 based on the correction determination criterion corresponding to the shooting condition. Can be changed for each shooting condition. The foreign object detection sensitivity according to the user's preference may change depending on the shooting conditions, and the image processing apparatus including the shooting condition signal input unit 34 uses the initial determination criterion of the foreign object determination unit 48 as a reference of the camera 10. The user's preference can be approached.

また、光学フィルタ20の特定の位置にある異物が付着し続けているような場合、撮影条件が同一であれば、撮影画像の決まった位置に、その異物が写りこみ続ける可能性が高い。したがって、撮影条件に応じて異物マップに関するデータを保存することによって、本実施形態に係る画像処理装置は、使用者が気になる異物の写りこみ位置を容易に特定することができる。   Further, in the case where foreign matter at a specific position of the optical filter 20 continues to adhere, if the photographing conditions are the same, there is a high possibility that the foreign matter will continue to appear in a predetermined position of the photographed image. Therefore, by storing the data related to the foreign matter map according to the shooting conditions, the image processing apparatus according to the present embodiment can easily specify the reflected position of the foreign matter that the user is interested in.

表示部36は、例えばカメラ本体部12(図1参照)に備えられる液晶表示装置等によって構成される。表示部36は、検出修正部44によって異物に対応する部分であると再判断される検出領域の位置を、撮影画像に重ねて表示することができる。   The display unit 36 is configured by, for example, a liquid crystal display device provided in the camera body 12 (see FIG. 1). The display unit 36 can display the position of the detection region that is re-determined as a part corresponding to the foreign substance by the detection correction unit 44 so as to overlap the captured image.

図3Aおよび図3Bは、図2に示すカメラ10において行われる画像処理演算の一例を表すフローチャートである。図3Aは、画像処理演算の前半部分を表しており、図3Bは、画像処理演算の後半部分を表している。図3Aおよび図3Bに示すように、画像処理演算には、ステップS003〜ステップS007を含む演算Iと、ステップS008〜ステップS011を含む演算IIと、ステップS012〜ステップS016を含む演算IIIと、ステップS017〜ステップS020を含む演算IVとが含まれる。   3A and 3B are flowcharts illustrating an example of the image processing calculation performed in the camera 10 illustrated in FIG. FIG. 3A shows the first half of the image processing calculation, and FIG. 3B shows the second half of the image processing calculation. As shown in FIGS. 3A and 3B, the image processing calculation includes calculation I including steps S003 to S007, calculation II including steps S008 to S011, calculation III including steps S012 to S016, and steps. And an operation IV including S017 to step S020.

演算Iでは、演算部38は、明るさ情報や彩度情報など、撮影画像の色に関する情報を算出する演算を実施する。演算IIでは、演算部38は、演算Iで算出された情報を用いて、異物が写りこんでいる位置など、撮影画像に写りこんだ異物に関する異物情報を算出する。また、演算IIでは、演算部38は、演算Iで算出された情報を用いて、撮影画像内の検出領域が、撮影画像内に写りこんだ異物に対応する部分であるか否かを判断する。   In the calculation I, the calculation unit 38 performs a calculation for calculating information regarding the color of the captured image, such as brightness information and saturation information. In the calculation II, the calculation unit 38 uses the information calculated in the calculation I to calculate foreign matter information related to the foreign matter reflected in the captured image, such as a position where the foreign matter is reflected. In the calculation II, the calculation unit 38 uses the information calculated in the calculation I to determine whether or not the detection area in the captured image is a part corresponding to a foreign object reflected in the captured image. .

演算IIIでは、演算部38は、操作信号入力部32を介して使用者の操作信号を入力し、入力された操作信号に応じて演算IIで行われた判断を修正する演算を行う。演算IVでは、演算部38は、演算IIまたは演算IIIでの判断結果に基づいて、異物が写りこんだ検出領域を特定した上で、演算Iで算出された情報を用いて、撮影画像に写りこんだ異物に対応する部分に対して、異物の影響を低減する画像補正を行う。演算IVでは、演算部38は、演算Iで算出された明るさ情報を用いて異物の影響を低減する第1画像補正(第1画像補正部74による画像補正)を行う。さらに、演算IVでは、演算Iで算出された彩度情報を用いて異物の影響を低減する第2画像補正(第2画像補正部76による画像補正)や、演算Iで算出された色相情報を用いて異物の影響を低減する第3画像補正(第3画像補正部78による画像補正)を行う。   In the calculation III, the calculation unit 38 inputs a user operation signal via the operation signal input unit 32, and performs a calculation to correct the determination made in the calculation II in accordance with the input operation signal. In the calculation IV, the calculation unit 38 specifies the detection area in which the foreign object is reflected based on the determination result in the calculation II or the calculation III, and then uses the information calculated in the calculation I to display the captured image. Image correction for reducing the influence of the foreign matter is performed on the portion corresponding to the foreign matter. In the calculation IV, the calculation unit 38 performs the first image correction (image correction by the first image correction unit 74) that reduces the influence of the foreign matter using the brightness information calculated in the calculation I. Further, in the calculation IV, the second image correction (image correction by the second image correction unit 76) for reducing the influence of the foreign matter using the saturation information calculated in the calculation I, and the hue information calculated in the calculation I are used. The third image correction (image correction by the third image correction unit 78) is used to reduce the influence of the foreign matter.

図2に示すカメラ10に搭載された画像処理装置は、図3Aに示すように、ステップS001において一連の画像処理演算を開始する。ステップS002では、画像入力部28を介して、撮影部26で撮影された撮影画像が、演算部38に入力される。   The image processing apparatus mounted on the camera 10 shown in FIG. 2 starts a series of image processing operations in step S001 as shown in FIG. 3A. In step S <b> 002, the captured image captured by the imaging unit 26 is input to the calculation unit 38 via the image input unit 28.

図6は、符号aで示す撮影画像の一部である撮影画像b(符号b)を一例に挙げて、図2に示すカメラ10において行われる画像処理演算を説明したものである。図3Aに示すステップS002では、撮影画像bが、演算部38に入力される。   FIG. 6 illustrates an image processing calculation performed in the camera 10 illustrated in FIG. 2 by taking a captured image b (reference symbol b), which is a part of the captured image indicated by the symbol a, as an example. In step S002 illustrated in FIG. 3A, the captured image b is input to the calculation unit 38.

図3Aに示すステップS003〜ステップS007では、図2に示す演算部38における情報算出部46が、撮影画像の色に関する情報を算出する。ステップS003では、情報算出部46の明るさ情報算出部54が、撮影画像の明るさに対応する明るさ情報を算出する。明るさ情報算出部54は、撮影画像の輝度平面を算出しても良いし、撮影画像の明度平面を算出してもよいが、図3Aに示すステップS003において、明るさ情報算出部54は、先述の式(2−1)および(2−6)を用いて明度平面を算出する。   In steps S003 to S007 shown in FIG. 3A, the information calculation unit 46 in the calculation unit 38 shown in FIG. 2 calculates information related to the color of the captured image. In step S003, the brightness information calculation unit 54 of the information calculation unit 46 calculates brightness information corresponding to the brightness of the captured image. The brightness information calculation unit 54 may calculate the luminance plane of the captured image or the brightness plane of the captured image. In step S003 shown in FIG. 3A, the brightness information calculation unit 54 The brightness plane is calculated using the above equations (2-1) and (2-6).

ステップS003では、情報算出部46の彩度情報算出部56が、先述の式(2−2)、(2−6)および(2−7)を用いて、彩度平面を算出する。また、ステップS005では、先述の式(2−3)〜(2−5)および(2−6)〜(2−10)を用いて、色相平面を算出する。   In step S003, the saturation information calculation unit 56 of the information calculation unit 46 calculates the saturation plane using the above-described equations (2-2), (2-6), and (2-7). In step S005, the hue plane is calculated using the above-described equations (2-3) to (2-5) and (2-6) to (2-10).

図6に示すように、ステップS003では、撮影画像bから、撮影画像bの明度平面d(符号d)が算出される。また、ステップS004では、撮影画像bから、撮影画像bの彩度平面(不図示)が算出される。さらに、ステップS005では、撮影画像bから、撮影画像bの色相平面cが算出される。   As shown in FIG. 6, in step S003, the brightness plane d (symbol d) of the captured image b is calculated from the captured image b. In step S004, a saturation plane (not shown) of the captured image b is calculated from the captured image b. In step S005, a hue plane c of the captured image b is calculated from the captured image b.

図3Aに示すステップS006では、情報算出部46の明るさ勾配情報算出部60が、撮影画像の明るさの勾配に対応する明るさ勾配情報を算出する。明るさ勾配情報算出部60は、撮影画像の輝度勾配平面を算出しても良いし、撮影画像の明度勾配平面を算出してもよいが、図3Aに示すステップS006において、明るさ勾配情報算出部60は、ステップS003で算出された明度平面のデータおよび先述の式(4)を用いて、明度勾配平面を算出する。   In step S006 shown in FIG. 3A, the brightness gradient information calculation unit 60 of the information calculation unit 46 calculates brightness gradient information corresponding to the brightness gradient of the captured image. The brightness gradient information calculation unit 60 may calculate the brightness gradient plane of the captured image or the brightness gradient plane of the captured image. In step S006 shown in FIG. 3A, the brightness gradient information calculation is performed. The unit 60 calculates the lightness gradient plane using the lightness plane data calculated in step S003 and the above-described equation (4).

図3Aに示すステップS007では、情報算出部46の領域算出部62が、検出領域を算出する。領域算出部62は、明るさ勾配情報算出部60において算出された明度勾配平面を用いて二値化画像を算出し、検出領域を算出する。領域算出部62は、閾値より高い明度勾配値を有する画素が連結した領域を、一つの検出領域として特定する。   In step S007 illustrated in FIG. 3A, the area calculation unit 62 of the information calculation unit 46 calculates a detection area. The area calculation unit 62 calculates a binarized image using the brightness gradient plane calculated by the brightness gradient information calculation unit 60, and calculates a detection area. The region calculation unit 62 identifies a region where pixels having a lightness gradient value higher than the threshold are connected as one detection region.

図6に示すように、ステップS006では、撮影画像bの明度平面d(符号d)から、撮影画像bの明度勾配平面e(符号e)が算出される。また、ステップS007では、明度勾配平面eから、二値化画像f(符号f)が算出される。   As shown in FIG. 6, in step S006, the brightness gradient plane e (symbol e) of the captured image b is calculated from the brightness plane d (symbol d) of the captured image b. In step S007, a binarized image f (symbol f) is calculated from the lightness gradient plane e.

図3Aに示すステップS008〜ステップS011では、図2に示す演算部38における異物判断部48が、情報算出部46で算出された情報を用いて、領域算出部62によって特定された各検出領域について、当該検出領域が異物に対応する部分であるか否かを判断する。   In step S008 to step S011 shown in FIG. 3A, the foreign matter determination unit 48 in the calculation unit 38 shown in FIG. 2 uses the information calculated by the information calculation unit 46 for each detection region specified by the region calculation unit 62. Then, it is determined whether or not the detection area is a part corresponding to the foreign matter.

図3Aに示すステップS008では、異物判断部48の第1判断部64が、判断の対象となっている検出領域の大きさに基づいて、その検出領域が、画像に写りこんだ異物に対応する部分であるか否かを判断する。第1判断部64は、二値化画像fを用いて、検出領域に含まれる画素の数等から検出領域の大きさを算出することができる。また第1判断部64は、二値化画像fに基づいて算出された検出領域の大きさが所定の範囲内になければ、判断の対象となっている検出領域は、異物に対応する部分でないと判断する。   In step S008 shown in FIG. 3A, the first determination unit 64 of the foreign object determination unit 48 corresponds to the foreign object reflected in the image based on the size of the detection area to be determined. It is determined whether it is a part. The first determination unit 64 can calculate the size of the detection region from the number of pixels included in the detection region using the binarized image f. Further, if the size of the detection area calculated based on the binarized image f is not within a predetermined range, the first determination unit 64 does not correspond to the foreign object. Judge.

図3Aに示すステップS009では、異物判断部48の第2判断部66が、検出領域の彩度に対応する彩度情報と、検出領域の色相に対応する色相情報と、検出領域の明度に対応する明度情報とを用いて、その検出領域が画像に写りこんだ異物に対応する部分であるか否かを、判断する。   In step S009 shown in FIG. 3A, the second determination unit 66 of the foreign matter determination unit 48 corresponds to the saturation information corresponding to the saturation of the detection region, the hue information corresponding to the hue of the detection region, and the brightness of the detection region. Using the brightness information to be determined, it is determined whether or not the detection area is a portion corresponding to a foreign object reflected in the image.

ステップS009において、第2判断部66は、まず、明るさ情報算出部54で算出された明度平面を用いて、検出領域の明度に対応する第1明度情報と、検出領域の周辺の領域の明度に対応する第2明度情報との差異を調査する。ステップS009において、第2判断部66は、検出領域に含まれる画素の明度値Vの平均値を第1明度情報とし、検出領域の周辺の領域に含まれる画素の明度値Vの平均値を第2明度情報とする。第2判断部66は、第1明度情報と第2明度情報の比が、予め定められた範囲内でないとき、判断の対象となっている検出領域は、異物に対応する部分でないと判断する。   In step S009, first, the second determination unit 66 uses the brightness plane calculated by the brightness information calculation unit 54, and the first brightness information corresponding to the brightness of the detection area and the brightness of the area around the detection area. The difference from the second lightness information corresponding to is investigated. In step S009, the second determination unit 66 uses the average value of the brightness values V of the pixels included in the detection area as the first brightness information, and determines the average value of the brightness values V of the pixels included in the surrounding area of the detection area. 2 brightness information. When the ratio between the first lightness information and the second lightness information is not within a predetermined range, the second determination unit 66 determines that the detection area to be determined is not a part corresponding to a foreign object.

次に、第2判断部66は、彩度情報算出部56で算出された彩度平面を用いて、検出領域の彩度に対応する第1彩度情報と、検出領域の周辺の領域の彩度に対応する第2彩度情報との差異を調査する。ステップS009において、第2判断部は、検出領域に含まれる画素の彩度値Sの平均値を第1彩度情報とし、検出領域の周辺の領域に含まれる画素の彩度値Sの平均値を第2彩度情報とする。第2判断部66は、第1彩度情報と第2彩度情報の比が、予め定められた範囲内でないとき、判断の対象となっている検出領域は、異物に対応する部分でないと判断する。   Next, the second determination unit 66 uses the saturation plane calculated by the saturation information calculation unit 56, and the first saturation information corresponding to the saturation of the detection region and the saturation of the region around the detection region. The difference from the second saturation information corresponding to the degree is investigated. In step S009, the second determination unit uses the average value of the saturation values S of the pixels included in the detection area as the first saturation information, and the average value of the saturation values S of the pixels included in the surrounding area of the detection area. Is the second saturation information. When the ratio between the first saturation information and the second saturation information is not within a predetermined range, the second determination unit 66 determines that the detection area to be determined is not a part corresponding to a foreign object. To do.

さらに、第2判断部66は、色相情報算出部58で算出された色相平面を用いて、検出領域の色相に対応する第1色相情報と、検出領域の周辺の領域の色相に対応する第2色相情報との差異を調査する。ステップS009において、第2判断部66は、検出領域に含まれる画素の色相値Hの平均値を第1色相情報とし、検出領域の周辺の領域に含まれる画素の色相値Sの平均値を第2色相情報とする。第2判断部66は、第1色相情報と第2色相情報の比が、予め定められた範囲内でないとき、判断の対象となっている検出領域は、異物に対応する部分でないと判断する。   Furthermore, the second determination unit 66 uses the hue plane calculated by the hue information calculation unit 58 to use the first hue information corresponding to the hue of the detection region and the second hue corresponding to the hue of the region around the detection region. Investigate differences from hue information. In step S009, the second determination unit 66 uses the average value of the hue values H of the pixels included in the detection area as the first hue information, and determines the average value of the hue values S of the pixels included in the area around the detection area as the first value. Two hue information is used. When the ratio between the first hue information and the second hue information is not within a predetermined range, the second determination unit 66 determines that the detection area to be determined is not a part corresponding to a foreign object.

図3Aに示すステップS010では、異物判断部48の第3判断部68が、検出領域の周辺の領域の明るさに対応する明るさ情報を用いて、その検出領域が、画像に写りこんだ異物に対応する部分であるか否かを判断する。第3判断部68は、明るさ情報算出部54で算出された明度平面を用いて、検出領域の周辺の領域の明度に対応する第2明度情報を算出する。第3判断部68は、第2判断部66と同様に、検出領域の周辺の領域に含まれる画素の明度値Vの平均値を第2明度情報とする。第3判断部68は、第2明度情報が、予め定められた範囲でないとき、判断の対象となっている検出領域が異物に対応する部分でないと判断する。   In step S010 shown in FIG. 3A, the third determination unit 68 of the foreign object determination unit 48 uses the brightness information corresponding to the brightness of the area around the detection area, and the detection area is reflected in the image. It is determined whether or not the portion corresponds to. The third determination unit 68 uses the brightness plane calculated by the brightness information calculation unit 54 to calculate second brightness information corresponding to the brightness of the area around the detection area. Similar to the second determination unit 66, the third determination unit 68 uses the average value of the lightness values V of the pixels included in the region around the detection region as the second lightness information. When the second brightness information is not in a predetermined range, the third determination unit 68 determines that the detection area that is the object of determination is not a part corresponding to a foreign object.

図3Aに示すステップS011では、異物判断部48の第4判断部70が、検出領域の周辺の領域の明るさの標準偏差から、その検出領域が、画像に写りこんだ異物に対応する部分であるか否かを判断する。第4判断部70は、明るさ情報算出部54で算出された明度平面及び先述の式(5)を用いて、検出領域の周辺の領域の明度の標準偏差を算出する。第4判断部70は、検出領域の周辺の領域の明るさの標準偏差が、予め定められた範囲でないとき、判断の対象となっている検出領域が異物に対応する部分でないと判断する。   In step S011 shown in FIG. 3A, the fourth determination unit 70 of the foreign object determination unit 48 determines that the detection area corresponds to the foreign object reflected in the image from the standard deviation of the brightness of the area around the detection area. Judge whether there is. The fourth determination unit 70 uses the brightness plane calculated by the brightness information calculation unit 54 and the above-described formula (5) to calculate the standard deviation of the brightness of the area around the detection area. The fourth determination unit 70 determines that the detection area to be determined is not a part corresponding to a foreign object when the standard deviation of the brightness of the area around the detection area is not in a predetermined range.

図6に示すように、ステップS008〜ステップS0012では、二値化画像fから、符号gで示される二値化画像gのように、異物に対応しない検出領域が除外され、異物が写りこんだ検出領域のみが抽出される。   As shown in FIG. 6, in steps S008 to S0012, a detection area that does not correspond to a foreign object is excluded from the binarized image f as in the binarized image g indicated by the symbol g, and the foreign object is reflected. Only the detection area is extracted.

なお、図3AのステップS008〜ステップS011に対応する判断は、撮影画像bに含まれる全ての検出領域について行っても良いが、ステップS009〜ステップS011に対応する判断は、直前のステップS009〜ステップS011において異物に対応する部分でないと判断されなかった領域のみについて行っても良い。異物判断部48は、ステップS008〜ステップS011のいずれにおいても異物に対応する部分でないと判断されなかった検出領域のみが、異物に対応する部分であると判断する。   Note that the determinations corresponding to steps S008 to S011 in FIG. 3A may be made for all detection regions included in the captured image b, but the determinations corresponding to steps S009 to S011 are the previous steps S009 to step S011. You may perform only about the area | region which was not judged as the part corresponding to a foreign material in S011. The foreign matter determination unit 48 determines that only the detection region that is not determined to be a portion corresponding to the foreign matter in any of steps S008 to S011 is a portion corresponding to the foreign matter.

また、異物判断部48は、1つの検出領域について、ステップS008からステップS011まで順番に判断を行った後に、他の1つの検出領域について、ステップS008からステップS011まで順番に判断を行っても良い。この場合において、1つの検出領域に関する判断は、ステップS008からステップS011に含まれるいずれか1つのステップにおいて、判断の対象となる検出領域が異物に対応する部分でないと判断された時点で、当該検出領域に対する残りの判断(ステップ)をスキップし、他の1つの検出領域についての判断を開始してもよい。この場合、異物判断部48は、ステップS011において判断の対象となった検出領域であって、ステップS011において異物に対応する部分でないと判断されなかった検出領域が、異物に対応する部分であると判断する。異物判断部48が、ステップS009からステップS011に対応する判断をスキップできるようにすることによって、画像処理装置は、異物判断部48における演算量を軽減できる。   In addition, the foreign matter determination unit 48 may sequentially determine from step S008 to step S011 for one detection area, and then sequentially determine from step S008 to step S011 for the other detection area. . In this case, the determination regarding one detection area is performed when it is determined in any one of the steps included in steps S008 to S011 that the detection area to be determined is not a part corresponding to a foreign object. The remaining determination (step) for the region may be skipped, and the determination for another detection region may be started. In this case, the foreign matter determination unit 48 determines that the detection region that is a determination target in step S011 and that is not determined to be a portion corresponding to the foreign matter in step S011 is a portion corresponding to the foreign matter. to decide. By enabling the foreign object determination unit 48 to skip the determinations corresponding to steps S009 to S011, the image processing apparatus can reduce the amount of calculation in the foreign object determination unit 48.

演算部38は、図3AのステップS007〜ステップS011を含む演算IIを終えた後に、図3BのステップS012〜ステップS016を含む演算IIIを実行する。なお、演算部38は、使用者の設定等に応じて、図3AのステップS007〜ステップS011を含む演算IIを終えた後に、演算IIIを行わず、図3BのステップS017〜ステップS020を含む演算IVを実行してもよい。   The calculation unit 38 performs the calculation III including the steps S012 to S016 in FIG. 3B after completing the calculation II including the steps S007 to S011 in FIG. 3A. The calculation unit 38 does not perform the calculation III after completing the calculation II including the steps S007 to S011 in FIG. 3A according to the setting of the user and the like, and performs the calculation including the steps S017 to S020 in FIG. 3B. IV may be performed.

図3Bに示すステップS012〜ステップS016では、演算部38の修正判断部44等が、操作信号入力部32を介して使用者の操作信号を入力し、入力された操作信号に応じてステップS008〜ステップステップS011で行われた判断を修正する演算を行う。   In step S012 to step S016 shown in FIG. 3B, the correction determination unit 44 of the calculation unit 38 inputs a user operation signal via the operation signal input unit 32, and steps S008 to S0 are performed according to the input operation signal. An operation for correcting the determination made in step S011 is performed.

図3Bに示すステップS012では、検出修正部44が、表示部36に、撮影画像に重ねて、異物判断部48での判断結果を表示させる。図6において符号hで示す画像のように、表示部36は、検出修正部44からの指示を受けて、撮影画像bに重ねて、異物判断部48において異物に対応する部分であると判断された検出領域を、他の検出領域と区別して表示する。符号hで示す画像では、領域算出部62で抽出された検出領域のうち、異物判断部48において異物に対応する部分であると判断された検出領域の位置のみが、3角形の図形を用いて表示されている。   In step S012 shown in FIG. 3B, the detection / correction unit 44 causes the display unit 36 to display the determination result of the foreign matter determination unit 48 on the captured image. As shown in the image indicated by symbol h in FIG. 6, the display unit 36 receives an instruction from the detection / correction unit 44 and is superposed on the captured image b and is determined to be a part corresponding to the foreign object by the foreign object determination unit 48. The detected area is displayed separately from other detected areas. In the image indicated by the symbol h, only the position of the detection region that is determined to be a part corresponding to the foreign material by the foreign material determination unit 48 among the detection regions extracted by the region calculation unit 62 uses a triangular figure. It is displayed.

図3Bに示すステップS013では、操作信号入力部32を介して、異物判断部48で行われた判断を修正するための操作信号が、演算部38の検出修正部44に入力される。ステップS013において、使用者は、表示部36に表示された判断結果を確認しながら、操作信号入力部32に含まれるユーザーインターフェースを操作して、異物判断部48に行われた判断を修正するための操作信号を入力することができる。   In step S013 shown in FIG. 3B, an operation signal for correcting the determination made by the foreign matter determination unit 48 is input to the detection correction unit 44 of the calculation unit 38 via the operation signal input unit 32. In step S013, the user operates the user interface included in the operation signal input unit 32 while correcting the determination result displayed on the display unit 36 to correct the determination made by the foreign matter determination unit 48. The operation signal can be input.

使用者は、異物判断部48の判断では異物の検出感度が低すぎると考えた場合には、異物判断部48で行われた判断より高い検出感度で再判断が行われるように、判定に使用される閾値を変更する操作信号を入力する。例えば、使用者は、検出領域の大きさに関する閾値C1(図6参照)を減少させるように変更する操作信号や、検出領域内外の明度比に関する閾値C2(図6参照)を増加させる(1に近づける)ように変更する操作信号を入力する。   When the user considers that the foreign matter detection unit 48 determines that the foreign matter detection sensitivity is too low, the user uses the judgment so that the determination is performed with a higher detection sensitivity than the judgment made by the foreign matter judgment unit 48. An operation signal for changing the threshold value is input. For example, the user increases an operation signal to be changed so as to decrease the threshold value C1 related to the size of the detection region (see FIG. 6) or a threshold value C2 related to the brightness ratio inside and outside the detection region (see FIG. 6). Input the operation signal to be changed.

その反対に、使用者は、異物判断部48の判断では異物の検出感度が高すぎると考えた場合には、異物判断部48で行われた判断より低い検出感度で再判断が行われるように、判定に使用される閾値を変更する操作信号を入力する。例えば、使用者は、検出領域の大きさに関する閾値C1(図6参照)を増加させるように変更する操作信号や、検出領域内外の明度比に関する閾値C2(図6参照)を減少させる(0に近づける)ように変更する操作信号を入力する。   On the other hand, if the user thinks that the foreign matter determination unit 48 determines that the foreign matter detection sensitivity is too high, the user can make a re-determination with a lower detection sensitivity than the determination made by the foreign matter determination unit 48. An operation signal for changing a threshold value used for determination is input. For example, the user decreases the operation signal to be changed so as to increase the threshold value C1 (see FIG. 6) related to the size of the detection region, or the threshold value C2 (see FIG. 6) related to the brightness ratio inside and outside the detection region (to 0). Input the operation signal to be changed.

図3Bに示すステップS014では、検出修正部44が、操作信号入力部32を介して演算部38に入力された操作信号に応じて、異物判断部48における判断で用いられた閾値を変更し、検出領域が異物に対応する部分であるか否かの再判断を行う。すなわち、ステップS014において、検出修正部44は、操作信号に応じて変更された閾値を用いて、異物判断部48における第1〜第4判断部64〜70で行われた判断を修正する。   In step S014 shown in FIG. 3B, the detection correction unit 44 changes the threshold value used in the determination in the foreign matter determination unit 48 in accordance with the operation signal input to the calculation unit 38 via the operation signal input unit 32. It is determined again whether or not the detection area is a part corresponding to a foreign object. That is, in step S014, the detection correction unit 44 corrects the determination made by the first to fourth determination units 64 to 70 in the foreign matter determination unit 48 using the threshold value changed according to the operation signal.

例えば、ステップS013において、検出領域の大きさに関する閾値C1(図6参照)を減少させる旨の操作信号が入力された場合、検出修正部44は、以下のようにして異物判断部48の判断を修正する。すなわち、検出修正部44は、操作信号に応じて第1判断部64における閾値C1を減少させた上で、異物判断部48に、ステップS008〜ステップS011を含む演算IIを再計算させる。検出修正部44は、再計算によって異物に対応する部分であると判定された検出領域を、異物に対応する部分であると再判断された検出領域であると認定する。   For example, in step S013, when an operation signal indicating that the threshold C1 (see FIG. 6) relating to the size of the detection area is to be reduced is input, the detection correction unit 44 performs the determination of the foreign matter determination unit 48 as follows. Correct it. That is, the detection correction unit 44 causes the foreign matter determination unit 48 to recalculate the calculation II including steps S008 to S011 after reducing the threshold C1 in the first determination unit 64 according to the operation signal. The detection correction unit 44 determines that the detection area determined to be a part corresponding to the foreign object by recalculation is the detection area re-determined to be the part corresponding to the foreign object.

図3Bに示すステップS015では、検出修正部44が、表示部36の表示を更新させる。すなわち、表示部36は、検出修正部44によって修正された判断に基づいて、ステップS014において異物に対応する部分であると再判断された検出領域を、撮影画像に重ねて表示する。   In step S015 shown in FIG. 3B, the detection correction unit 44 updates the display on the display unit 36. That is, based on the determination corrected by the detection correction unit 44, the display unit 36 displays the detection region that has been re-determined as a part corresponding to a foreign substance in step S014 over the captured image.

使用者は、ステップS015において更新された表示部36の表示を確認し、検出修正部44によって再判断された検出結果が適切であると考えた場合は、検出領域の再判断を終了する旨の操作信号を、カメラ10に入力する。この場合、検出修正部44は、ステップS016の処理を進める。また、使用者は、検出修正部44によって再判断された検出結果が不適切であると考えた場合は、検出修正部44に対して、検出領域の再判断をやり直す旨の操作信号を入力する。この場合、検出修正部44は、ステップS013〜ステップS15に係る処理をやり直す。   The user confirms the display of the display unit 36 updated in step S015, and if the detection result re-determined by the detection correction unit 44 is considered appropriate, the re-determination of the detection area is terminated. An operation signal is input to the camera 10. In this case, the detection correction unit 44 proceeds with the process of step S016. In addition, when the user thinks that the detection result redetermined by the detection correction unit 44 is inappropriate, the user inputs an operation signal to redo the detection area to the detection correction unit 44. . In this case, the detection correction unit 44 redoes the processing according to steps S013 to S15.

図3Bに示すステップS016では、検出修正部44は、再判断の際の閾値や、再判断において異物に対応する部分であると判断された検出領域の位置などを、記憶部30に出力する。記憶部30は、再判断の際の閾値や、異物に対応する部分であると判断された検出領域の位置などのデータを記憶し、必要に応じて、判断基準変更部42に対して、記憶したデータを出力できる。   In step S016 shown in FIG. 3B, the detection correction unit 44 outputs to the storage unit 30 the threshold value at the time of re-determination, the position of the detection area determined to be a part corresponding to the foreign object in the re-determination. The storage unit 30 stores data such as a threshold value at the time of redetermination and a position of a detection region determined to be a part corresponding to a foreign substance, and stores the data in the determination criterion changing unit 42 as necessary. Data can be output.

図3Bに示すステップS017〜ステップS020では、演算部38の異物画像補正部50が、明るさ情報算出部54で算出された情報を用いて、検出修正部44によって異物に対応する部分であると判断された検出領域について、撮影画像から異物の影響を低減する画像補正を行う。   In step S017 to step S020 shown in FIG. 3B, the foreign object image correction unit 50 of the calculation unit 38 is a part corresponding to a foreign object by the detection correction unit 44 using the information calculated by the brightness information calculation unit 54. For the determined detection area, image correction is performed to reduce the influence of foreign matter from the captured image.

ステップS017では、異物画像補正部50が、検出修正部44によって異物に対応する部分であると判断された検出領域を、撮影画像から異物の影響を低減する画像補正の対象領域であると特定する。ステップS018では、色補正判断部52が、現在補正しようとしている撮影画像が、画像変換部15等によって非線形補正が施されたものであるか否かを判断する。   In step S <b> 017, the foreign object image correction unit 50 identifies the detection area determined to be a part corresponding to the foreign object by the detection correction unit 44 as an image correction target area that reduces the influence of the foreign object from the captured image. . In step S018, the color correction determination unit 52 determines whether or not the captured image that is currently being corrected has been subjected to nonlinear correction by the image conversion unit 15 or the like.

ステップS018において、撮影画像が非線形補正を施されたものであると判断されたとき、ステップS019およびステップS020では、異物画像補正部50の第1〜第3画像補正部74〜78による画像補正が行われる。この場合、ステップS019では、異物画像補正部50の第1〜第3画像補正部74〜78が、明るさ情報算出部54で算出された明度情報と、彩度情報算出部56で算出された彩度情報と、色相情報算出部58で算出された色相情報を用いて、画像補正の対象領域についてゲインマップを生成する。異物画像補正部50の第1〜第3画像補正部74〜78は、情報算出部46で算出された情報と上述の式(6)を用いて、明度透過率マップ、彩度透過率マップおよび色相透過率マップを生成する。   When it is determined in step S018 that the captured image has been subjected to nonlinear correction, in steps S019 and S020, image correction by the first to third image correction units 74 to 78 of the foreign object image correction unit 50 is performed. Done. In this case, in step S019, the first to third image correction units 74 to 78 of the foreign object image correction unit 50 are calculated by the brightness information calculated by the brightness information calculation unit 54 and the saturation information calculation unit 56. Using the saturation information and the hue information calculated by the hue information calculation unit 58, a gain map is generated for the image correction target region. The first to third image correcting units 74 to 78 of the foreign object image correcting unit 50 use the information calculated by the information calculating unit 46 and the above-described equation (6), and the lightness transmittance map, the saturation transmittance map, and Generate a hue transmittance map.

ステップS020では、異物画像補正部50の第1〜第3画像補正部74〜78が、明度透過率マップ、彩度透過率マップおよび色相透過率マップと先述の式(7)〜(9)を用いて、撮影画像の明度平面、彩度平面および色相平面のゲイン補正を行う。さらに、異物画像補正部50は、第1〜第3画像補正部74〜78によってゲイン補正された明度平面、彩度平面および色相平面を組み合わせることによって補正後の撮影画像を生成する。   In step S020, the first to third image correction units 74 to 78 of the foreign object image correction unit 50 obtain the lightness transmittance map, the saturation transmittance map, the hue transmittance map, and the above-described equations (7) to (9). The gain correction is performed on the brightness plane, the saturation plane, and the hue plane of the captured image. Further, the foreign object image correction unit 50 generates a corrected captured image by combining the brightness plane, the saturation plane, and the hue plane that have been gain-corrected by the first to third image correction units 74 to 78.

ステップS018において、撮影画像が非線形補正を施されたものでないと判断されたとき、ステップS019およびステップS020では、一般的な輝度のみによる補正を行っても良い。   When it is determined in step S018 that the captured image is not subjected to non-linear correction, in step S019 and step S020, correction using only general luminance may be performed.

ステップS021では、ステップS020で生成された補正後の撮影画像の保存処理が行われた後、一連の画像処理演算を終了する。   In step S021, after the corrected captured image generated in step S020 is stored, a series of image processing operations are terminated.

上述のように、本実施形態に係る画像処理装置は、検出領域の明るさ情報と、検出領域の彩度情報を用いて、検出領域が撮影画像に写りこんだ異物に対応する部分であるか否かを判断する異物判断部48を有する。異物判断部48は、検出領域の明るさ情報だけでなく、彩度情報を用いて検出領域を判断するため、検出領域に異物が写りこんでいるか否かを正確に判断することができる。なぜなら、撮影画像に写りこんだ異物は、彩度や色相にはほとんど影響を残さないが、明るさに強く影響を残すという特徴を有するからである。また、異物の写りこみによる色変化を撮影画像の中から検出するためには、彩度情報と明るさ情報を組み合わせて判断を行うことが効果的であるからである。   As described above, the image processing apparatus according to the present embodiment uses the brightness information of the detection area and the saturation information of the detection area to determine whether the detection area corresponds to a foreign object reflected in the captured image. It has a foreign matter judgment unit 48 for judging whether or not. Since the foreign matter determination unit 48 determines not only the brightness information of the detection region but also the saturation information, the foreign matter determination unit 48 can accurately determine whether or not a foreign matter is reflected in the detection region. This is because the foreign matter reflected in the photographed image has a feature that it hardly affects the saturation and hue, but strongly affects the brightness. Moreover, in order to detect a color change due to the reflection of a foreign object from a photographed image, it is effective to make a determination by combining saturation information and brightness information.

なお、検出領域の明るさ情報および検出領域の彩度情報に加えて、検出領域の色相情報を用いて検出領域を判断することによって、本実施形態に係る画像処理装置は、検出領域に異物が写りこんでいるか否かをより正確に判断することができる。また、検出領域の周辺の領域の明るさの情報や、検出領域の周辺の領域における明るさの標準偏差を用いて判断することによって、本実施形態に係る画像処理装置は、検出領域に異物が写りこんでいるか否かをさらに正確に判断することができる。撮影画像における暗部や、明度のばらつきが大きい部分では、被写体エッジを誤って異物の移り込みによるエッジであると誤検出しやすいからである。また、これらの領域では、たとえ異物の移り込みによるエッジが存在していても、比較的目立ち難い。また、本実施形態に係る画像処理装置は、明るさ情報による判断を行った後に、彩度情報または色相情報による判断を行うことによって、彩度情報または色相情報を用いて、明るさ情報による判断を補足または検証することができる。   In addition to the brightness information of the detection area and the saturation information of the detection area, the image processing apparatus according to this embodiment determines the detection area using the hue information of the detection area. It is possible to more accurately determine whether or not the image is reflected. In addition, the image processing apparatus according to the present embodiment makes it possible to determine whether a foreign object is present in the detection area by determining the brightness information of the area around the detection area or the standard deviation of the brightness in the area around the detection area. It is possible to more accurately determine whether or not the image is reflected. This is because it is easy to mistakenly detect that the subject edge is an edge caused by the movement of a foreign object in a dark portion or a portion with a large variation in brightness in the captured image. Further, in these regions, even if there is an edge due to the transfer of foreign matter, it is relatively inconspicuous. In addition, the image processing apparatus according to the present embodiment performs the determination based on the brightness information using the saturation information or the hue information by performing the determination based on the saturation information or the hue information after performing the determination based on the brightness information. Can be supplemented or verified.

本実施形態に係る画像処理装置は、使用者による操作信号に基づいて、異物判断部48の判断を修正する検出修正部44を有する。したがって、本実施形態に係る画像処理装置は、使用者の好みに適合する検出レベルで、撮影画像に写りこんだ異物を検出することができる。また、検出修正部44による修正前後の検出結果を表示する表示部36を有するため、使用者が表示部36の表示を確認しながら検出レベルを調整することにより、異物の誤検出や検出漏れを防止することができる。   The image processing apparatus according to the present embodiment includes a detection correction unit 44 that corrects the determination of the foreign matter determination unit 48 based on an operation signal from the user. Therefore, the image processing apparatus according to the present embodiment can detect a foreign object reflected in a captured image at a detection level that matches the user's preference. In addition, since the display unit 36 displays the detection results before and after correction by the detection / correction unit 44, the user adjusts the detection level while checking the display on the display unit 36, thereby preventing erroneous detection or omission of foreign matter. Can be prevented.

また、本実施形態に係る画像処理装置は、検出修正部44による修正判断基準に基づき、異物判断部48における第1〜第4判断部64〜68が判断を行う際の判断基準である初期判断基準を変更する判断基準変更部42を有する。判断基準変更部42は、異物判断部48の初期判断基準を、カメラ10の使用者の好みに近づけることができるため、本実施形態に係る画像処理装置は、使用者の好みに応じた異物検出を効率的に行うことができる。なお、検出修正部44は、領域算出部62が二値化画像を生成する際の閾値を修正してもよく、判断基準変更部42は、領域算出部62が二値化画像を生成する際の閾値を変更してもよい。領域算出部62が二値化画像を生成する際の閾値を修正したり、その閾値をフィードバックすることによっても、本実施形態に係る画像処理装置は、異物検出感度を適切化することができる。   Further, the image processing apparatus according to the present embodiment is based on the correction determination criterion by the detection correction unit 44, and is an initial determination that is a determination criterion when the first to fourth determination units 64 to 68 in the foreign matter determination unit 48 make a determination. A judgment standard changing unit 42 for changing the standard is provided. Since the determination criterion changing unit 42 can bring the initial determination criterion of the foreign matter determination unit 48 closer to the user's preference of the camera 10, the image processing apparatus according to the present embodiment can detect foreign matter according to the user's preference. Can be performed efficiently. The detection correction unit 44 may correct the threshold value when the region calculation unit 62 generates a binarized image, and the determination criterion change unit 42 determines whether the region calculation unit 62 generates a binarized image. The threshold value may be changed. The image processing apparatus according to the present embodiment can also optimize the foreign matter detection sensitivity by correcting the threshold when the region calculation unit 62 generates the binarized image or feeding back the threshold.

本実施形態に係る画像処理装置は、明度ゲインマップによるゲイン補正に、彩度ゲインマップによるゲイン補正、および/または色相ゲインマップによるゲイン補正を加えることで、撮影画像に写りこんだ異物の影響を低減する画像補正を行う異物画像補正部50を有する。したがって、本実施形態に係る画像処理装置は、補正対象となる撮影画像が非線形補正を施されているような場合であっても、異物の写りこみによる色の変化を、周辺部分の色合いと高い整合性を保ちながら補正することができる。また、本実施形態に係る画像処理装置は、補正対象となる撮影画像が非線形補正を施されているような場合であっても、補正後の撮影画像に補正痕が発生してしまう問題を防止できる。   The image processing apparatus according to the present embodiment adds the gain correction using the saturation gain map and / or the gain correction using the hue gain map to the gain correction using the brightness gain map, thereby reducing the influence of foreign matter reflected in the captured image. It has a foreign object image correction unit 50 that performs image correction to be reduced. Therefore, the image processing apparatus according to the present embodiment has a high color change due to the reflection of a foreign object and the hue of the peripheral portion even when the captured image to be corrected is subjected to nonlinear correction. Corrections can be made while maintaining consistency. In addition, the image processing apparatus according to the present embodiment prevents the problem that correction marks are generated in the corrected captured image even when the captured image to be corrected is subjected to nonlinear correction. it can.

なお、上述の実施形態では、画像処理装置が搭載されたカメラ10を例に挙げて、撮像装置の説明を行ったが、画像処理装置を有する撮影装置はスチルカメラに限定されず、ビデオカメラや携帯電話等を含む。また、上述の画像処理を実行させるためのプログラムは、スチルカメラ、ビデオカメラ、携帯電話に搭載されたコンピュータを実行させるものに限定されず、その他の画像処理が可能なコンピュータを実行させるプログラムを含む。   In the above-described embodiment, the imaging apparatus has been described by taking the camera 10 equipped with the image processing apparatus as an example. However, the imaging apparatus having the image processing apparatus is not limited to a still camera, and a video camera, Includes mobile phones. The program for executing the above-described image processing is not limited to a program for executing a computer mounted on a still camera, a video camera, or a mobile phone, but includes a program for executing a computer capable of performing other image processing. .

第2実施形態
図7は、本発明の第2実施形態に係る画像処理装置を含むパソコンなどのコンピュータ120のブロック図である。コンピュータ120は、図2に示す撮像部26、操作信号入力部32、撮影条件信号入力部23および画像変換部115を含まず、その代わりに、図7に示すように、I/F(インターフェース)122および操作信号入力部124を含む。図7に示すコンピュータ120は、図2に示す撮像部26等以外の部分については、図2に示すカメラ10と同様の構成であるため、図2に示すカメラ10と同様の構成については、図2と同じ符号を付し、説明を省略する。
Second Embodiment FIG. 7 is a block diagram of a computer 120 such as a personal computer including an image processing apparatus according to a second embodiment of the present invention. The computer 120 does not include the imaging unit 26, the operation signal input unit 32, the imaging condition signal input unit 23, and the image conversion unit 115 illustrated in FIG. 2, but instead, as illustrated in FIG. 7, an I / F (interface). 122 and an operation signal input unit 124. The computer 120 shown in FIG. 7 has the same configuration as that of the camera 10 shown in FIG. 2 except for the imaging unit 26 and the like shown in FIG. The same reference numerals as in FIG.

コンピュータ120は、メモリカード、カメラ、携帯電話等と接続するためのI/F122を有している。コンピュータ120の画像入力部28には、I/F122や、コンピュータ120に内蔵される記憶部30から、撮影画像が入力される。図7に示す演算部38は、図2に示すカメラ10における演算部38と同様に、画像入力部28を介して入力された撮影画像について、画像処理を行う。なお、演算部38には、I/F122等を介して、撮影画像とともに、撮影条件等が入力されてもよい。演算部38は、その内部に存在する情報算出部46、異物判断部48および異物画像補正部50などを構成する専用回路であっても良いが、好ましくは、これらの機能を実現するためのプログラムが記憶してある記憶手段と、その記憶手段に記憶してあるプログラムを実行する中央情報処理装置(CPU)とで構成してある。   The computer 120 has an I / F 122 for connecting to a memory card, a camera, a mobile phone, or the like. A captured image is input to the image input unit 28 of the computer 120 from the I / F 122 or the storage unit 30 built in the computer 120. The calculation unit 38 illustrated in FIG. 7 performs image processing on the photographed image input via the image input unit 28, similarly to the calculation unit 38 in the camera 10 illustrated in FIG. It should be noted that shooting conditions and the like may be input to the calculation unit 38 along with the shot image via the I / F 122 or the like. The calculation unit 38 may be a dedicated circuit that constitutes the information calculation unit 46, the foreign matter determination unit 48, the foreign matter image correction unit 50, and the like existing therein, but preferably a program for realizing these functions. And a central information processing device (CPU) that executes a program stored in the storage means.

操作信号入力部124は、第1実施形態に係る操作信号入力部32と同様に、撮影画像に写りこんだ異物に対応する部分を特定するために使用者が行った操作に対応する操作信号が入力される入力部である。操作信号入力部124としては、例えばキーボード、マウス、タッチパッド等が挙げられるが、特に限定されない。   Similar to the operation signal input unit 32 according to the first embodiment, the operation signal input unit 124 receives an operation signal corresponding to an operation performed by the user in order to specify a part corresponding to the foreign object reflected in the captured image. An input unit to be input. Examples of the operation signal input unit 124 include a keyboard, a mouse, and a touch pad, but are not particularly limited.

コンピュータ120の演算部38は、画像入力部28を介して入力された撮影画像について、第1実施形態に係る演算部28と同様に、撮影画像に写りこんだ異物の検出や、撮影画像に写りこんだ異物の影響を低減する画像補正を行うことができる。したがって、このコンピュータ120に含まれる画像処理装置も、第1実施形態に係るカメラ10に搭載された画像処理装置と同様の効果を奏する。   As with the calculation unit 28 according to the first embodiment, the calculation unit 38 of the computer 120 detects a foreign object reflected in the shot image, and displays the shot image input through the image input unit 28 in the shot image. Image correction can be performed to reduce the influence of the foreign matter. Therefore, the image processing device included in the computer 120 also has the same effect as the image processing device mounted on the camera 10 according to the first embodiment.

10… カメラ
26… 撮影部
28… 画像入力部
32… 操作信号入力部
34,124… 操作条件信号入力部
36… 表示部
38… 演算部
42… 判断基準変更部
44… 検出修正部
46… 情報算出部
48… 異物判断部
50… 異物画像補正部
52… 色補正判断部
54… 明るさ情報算出部
56… 彩度情報算出部
58… 色相情報算出部
60… 明るさ勾配情報算出部
62… 領域検出部
64〜70… 第1〜第4判断部
74〜78… 第1〜第3画像補正部
115… 画像変換部
120… コンピュータ
DESCRIPTION OF SYMBOLS 10 ... Camera 26 ... Image pick-up part 28 ... Image input part 32 ... Operation signal input part 34,124 ... Operation condition signal input part 36 ... Display part 38 ... Calculation part 42 ... Judgment reference change part 44 ... Detection correction part 46 ... Information calculation Unit 48 ... Foreign matter determination unit 50 ... Foreign matter image correction unit 52 ... Color correction determination unit 54 ... Brightness information calculation unit 56 ... Saturation information calculation unit 58 ... Hue information calculation unit 60 ... Brightness gradient information calculation unit 62 ... Region detection Units 64-70 ... First to fourth determination units 74-78 ... First to third image correction units 115 ... Image conversion unit 120 ... Computer

Claims (8)

撮影画像が入力される画像入力部と、
前記撮影画像内の検出領域の明るさと、前記検出領域の周辺の領域の明るさとの差異が第1閾値より大きいと判断した後、前記検出領域の彩度に対応する第1彩度情報と、前記検出領域の周辺の領域の彩度に対応する第2彩度情報との差異が第2閾値より小さいと判断したとき、前記検出領域が異物に対応する部分であると判断する第1判断部と、
前記検出領域の周辺の領域の明るさの標準偏差が第3閾値より小さいと判断したとき、前記検出領域が前記異物に対応する部分であると判断する第2判断部と、
前記第1判断部及び前記第2判断部により前記検出領域が前記異物に対応する部分であると判断されたとき、前記検出領域の補正を行なう補正部とを含むことを特徴とする画像処理装置。
An image input unit for inputting a captured image;
After determining that the difference between the brightness of the detection area in the captured image and the brightness of the area around the detection area is greater than a first threshold, first saturation information corresponding to the saturation of the detection area; When the difference from the second saturation information corresponding to the saturation of the area around the detection area is determined to be smaller than the second threshold, the first determination is made to determine that the detection area is a part corresponding to a foreign object. And
A second determination unit that determines that the detection region is a portion corresponding to the foreign object when it is determined that a standard deviation of brightness of a region around the detection region is smaller than a third threshold;
An image processing apparatus comprising: a correction unit that corrects the detection area when the first determination unit and the second determination unit determine that the detection area corresponds to the foreign object. .
請求項1に記載された画像処理装置であって、
前記第1判断部は、前記検出領域の明るさと、前記検出領域の周辺の領域の明るさとの差異が前記第1閾値より大きくなく、または前記検出領域の彩度に対応する前記第1彩度情報と、前記検出領域の周辺の領域の彩度に対応する前記第2彩度情報との差異が前記第2閾値より小さくないと判断したとき前記検出領域が前記異物に対応する部分でないと判断することを特徴とする画像処理装置。
An image processing apparatus according to claim 1,
The first determination unit is configured such that the difference between the brightness of the detection area and the brightness of the surrounding area of the detection area is not greater than the first threshold or corresponds to the saturation of the detection area. When it is determined that the difference between the information and the second saturation information corresponding to the saturation of the area around the detection area is not smaller than the second threshold , the detection area is not a part corresponding to the foreign matter An image processing apparatus characterized by determining .
請求項1又は請求項2に記載された画像処理装置であって、
前記補正部は、前記第1判断部又は前記第2判断部により前記検出領域が前記異物に対応する部分でないと判断されたとき、前記検出領域を補正対象から除外することを特徴とする画像処理装置。
An image processing apparatus according to claim 1 or 2, wherein
The correction unit excludes the detection region from a correction target when the first determination unit or the second determination unit determines that the detection region is not a part corresponding to the foreign matter. apparatus.
請求項1から請求項3のいずれか1項に記載された画像処理装置であって、
前記第1判断部は、前記検出領域の明るさと、前記検出領域の周辺の領域の明るさとの勾配を用いて前記検出領域が前記異物に対応する部分であるか否かを判断することを特徴とする画像処理装置。
An image processing apparatus according to any one of claims 1 to 3, wherein
The first determination unit determines whether the detection region is a portion corresponding to the foreign object using a gradient between brightness of the detection region and brightness of a region around the detection region. An image processing apparatus.
請求項1から請求項4のいずれか1項に記載された画像処理装置であって、
前記第1判断部は、前記検出領域の彩度に対応する前記第1彩度情報と、前記検出領域の周辺の領域の彩度に対応する前記第2彩度情報との比を用いて前記検出領域が前記異物に対応する部分であるか否かを判断することを特徴とする画像処理装置。
The image processing apparatus according to any one of claims 1 to 4, wherein:
Wherein the first determination unit uses said first chroma information corresponding to the saturation of the detection region, the ratio of the second chroma information corresponding to the saturation of the region around of the detection area An image processing apparatus that determines whether a detection area is a portion corresponding to the foreign matter.
請求項1から請求項5のいずれか1項に記載された画像処理装置であって、
前記第1判断部は、前記検出領域の周辺の領域の明るさに対応する第2明るさ情報が、第4閾値より小さいとき、前記検出領域が前記異物に対応する部分でないと判断することを特徴とする画像処理装置。
An image processing apparatus according to any one of claims 1 to 5, wherein
The first determination unit determines that the detection area is not a part corresponding to the foreign object when the second brightness information corresponding to the brightness of the area around the detection area is smaller than a fourth threshold value. A featured image processing apparatus.
コンピュータに、
撮影画像を入力する手順と、
前記撮影画像内の検出領域の明るさと、前記検出領域の周辺の領域の明るさとの差異を算出する手順と、
前記検出領域の彩度に対応する第1彩度情報と、前記検出領域の周辺の領域の彩度に対応する第2彩度情報との差異を算出する手順と、
前記検出領域の周辺の領域の明るさの標準偏差を算出する手順と、
前記撮影画像内の前記検出領域の明るさと、前記検出領域の周辺の領域の明るさとの差異が第1閾値より大きいと判断した後、前記検出領域の彩度に対応する前記第1彩度情報と、前記検出領域の周辺の領域の彩度に対応する前記第2彩度情報との差異が第2閾値より小さいと判断したとき、前記検出領域が異物に対応する部分であると判断する第1判断手順と、
前記検出領域の周辺の領域の前記明るさの標準偏差が第3閾値より小さいと判断したとき、前記検出領域が前記異物に対応する部分であると判断する第2判断手順と、
前記第1判断手順及び前記第2判断手順により前記検出領域が前記異物に対応する部分であると判断されたとき、前記検出領域の補正を行なう手順と、を実行させるためのプログラム。
On the computer,
The procedure to input the shot image,
Calculating the difference between the brightness of the detection area in the captured image and the brightness of the area around the detection area ;
Calculating a difference between the first saturation information corresponding to the saturation of the detection region and the second saturation information corresponding to the saturation of a region around the detection region ;
Calculating the standard deviation of the brightness of the area around the detection area;
The first saturation information corresponding to the saturation of the detection area after determining that the difference between the brightness of the detection area in the captured image and the brightness of the area around the detection area is greater than a first threshold. And the second saturation information corresponding to the saturation of the area around the detection area is determined to be smaller than a second threshold value, it is determined that the detection area is a part corresponding to a foreign object. 1 judgment procedure;
A second determination procedure for determining that the detection area is a portion corresponding to the foreign object when it is determined that a standard deviation of the brightness of the area around the detection area is smaller than a third threshold;
A program for executing a procedure for correcting the detection area when it is determined by the first determination procedure and the second determination procedure that the detection area corresponds to the foreign matter .
コンピュータに、
撮影画像を入力する手順と、
前記撮影画像内の検出領域の明るさと、前記検出領域の周辺の領域の明るさとの差異が第1閾値より大きいと判断した後、前記検出領域の彩度に対応する第1彩度情報と、前記検出領域の周辺の領域の彩度に対応する第2彩度情報との差異が第2閾値より小さいと判断したとき、前記検出領域が異物に対応する部分であると判断する第1判断手順と、
前記検出領域の周辺の領域の明るさの標準偏差が第3閾値より小さいと判断したとき、前記検出領域が前記異物に対応する部分であると判断する第2判断手順と、
前記第1判断手順及び前記第2判断手順により前記検出領域が前記異物に対応する部分であると判断されたとき、前記検出領域の補正を行なう手順と、を実行させるためのプログラム。
On the computer,
The procedure to input the shot image,
After determining that the difference between the brightness of the detection area in the captured image and the brightness of the area around the detection area is greater than a first threshold, first saturation information corresponding to the saturation of the detection area; When the difference from the second saturation information corresponding to the saturation of the area around the detection area is determined to be smaller than the second threshold, the first determination is made to determine that the detection area is a part corresponding to a foreign object. Procedure and
A second determination procedure for determining that the detection area is a portion corresponding to the foreign object when it is determined that the standard deviation of the brightness of the area around the detection area is smaller than a third threshold;
A program for executing a procedure for correcting the detection area when it is determined by the first determination procedure and the second determination procedure that the detection area corresponds to the foreign matter .
JP2010043004A 2009-07-21 2010-02-26 Image processing apparatus and program Active JP5083574B2 (en)

Priority Applications (4)

Application Number Priority Date Filing Date Title
JP2010043004A JP5083574B2 (en) 2010-02-26 2010-02-26 Image processing apparatus and program
EP10170159A EP2287807A1 (en) 2009-07-21 2010-07-20 Image processing device, image processing program, and imaging device
US12/839,621 US8665347B2 (en) 2009-07-21 2010-07-20 Image processing device, image processing program, and imaging device computing brightness value and color phase value
CN201010234441.XA CN101964873B (en) 2009-07-21 2010-07-20 Image processing device, image processing program, and imaging device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010043004A JP5083574B2 (en) 2010-02-26 2010-02-26 Image processing apparatus and program

Publications (2)

Publication Number Publication Date
JP2011182116A JP2011182116A (en) 2011-09-15
JP5083574B2 true JP5083574B2 (en) 2012-11-28

Family

ID=44693177

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010043004A Active JP5083574B2 (en) 2009-07-21 2010-02-26 Image processing apparatus and program

Country Status (1)

Country Link
JP (1) JP5083574B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7210882B2 (en) * 2018-01-30 2023-01-24 株式会社デンソーテン Attached matter detection device and attached matter detection method
JP7110462B1 (en) 2021-09-17 2022-08-01 Ckd株式会社 Substrate hair inspection device and substrate hair inspection method
JP7760382B2 (en) * 2022-01-13 2025-10-27 株式会社トヨタプロダクションエンジニアリング Inspection support device and inspection support method

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3759842B2 (en) * 1998-09-17 2006-03-29 大日本スクリーン製造株式会社 Scratched part judging device, method and storage medium on image
US6233364B1 (en) * 1998-09-18 2001-05-15 Dainippon Screen Engineering Of America Incorporated Method and system for detecting and tagging dust and scratches in a digital image
JP4419479B2 (en) * 2003-08-29 2010-02-24 株式会社ニコン Image processing apparatus and image processing program
JP2008306442A (en) * 2007-06-07 2008-12-18 Nikon Corp Imaging device

Also Published As

Publication number Publication date
JP2011182116A (en) 2011-09-15

Similar Documents

Publication Publication Date Title
CN101964873B (en) Image processing device, image processing program, and imaging device
JP4186699B2 (en) Imaging apparatus and image processing apparatus
EP3213290B1 (en) Data processing apparatus, imaging apparatus and data processing method
US8150154B2 (en) Method and apparatus for correcting chromatic aberration of image
US8682068B2 (en) Image processing apparatus, image processing method, and program
RU2527198C2 (en) Image processing device and image processing device control method
JP6173156B2 (en) Image processing apparatus, imaging apparatus, and image processing method
US20150278996A1 (en) Image processing apparatus, method, and medium for generating color image data
WO2018176925A1 (en) Hdr image generation method and apparatus
US20120327259A1 (en) Image processing device, image processing method, image capturing device, and program
US20130064470A1 (en) Image processing apparatus and image processing method for reducing noise
JP6071419B2 (en) Image processing apparatus and image processing method
KR101600312B1 (en) Apparatus and method for processing image
JP6320053B2 (en) Image processing apparatus, image processing method, and computer program
JP5083574B2 (en) Image processing apparatus and program
JP7661980B2 (en) Information processing device and method
CN103039068A (en) Image processing device and image processing program
EP4106321B1 (en) Image processing method and apparatus, model training method and apparatus, and storage medium
JP5267484B2 (en) Image processing apparatus, photographing apparatus, and program
JP2011180757A (en) Image processor, image pickup device and program
KR100867049B1 (en) Image correction device and image correction method
JP2015233202A (en) Image processing apparatus, image processing method, and program
JP5402131B2 (en) Image processing apparatus and imaging apparatus
JP5750934B2 (en) Image processing apparatus and image processing program
JP2010079815A (en) Image correction device

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20120117

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120207

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120409

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20120409

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: 20120808

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20120821

R150 Certificate of patent or registration of utility model

Ref document number: 5083574

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20150914

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20150914

Year of fee payment: 3

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313113

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250