[go: up one dir, main page]

JP4438363B2 - Image processing apparatus and image processing program - Google Patents

Image processing apparatus and image processing program Download PDF

Info

Publication number
JP4438363B2
JP4438363B2 JP2003325507A JP2003325507A JP4438363B2 JP 4438363 B2 JP4438363 B2 JP 4438363B2 JP 2003325507 A JP2003325507 A JP 2003325507A JP 2003325507 A JP2003325507 A JP 2003325507A JP 4438363 B2 JP4438363 B2 JP 4438363B2
Authority
JP
Japan
Prior art keywords
image
dust
value
image processing
map
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.)
Expired - Fee Related
Application number
JP2003325507A
Other languages
Japanese (ja)
Other versions
JP2004220553A5 (en
JP2004220553A (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 JP2003325507A priority Critical patent/JP4438363B2/en
Publication of JP2004220553A publication Critical patent/JP2004220553A/en
Publication of JP2004220553A5 publication Critical patent/JP2004220553A5/ja
Application granted granted Critical
Publication of JP4438363B2 publication Critical patent/JP4438363B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/403Edge-driven scaling; Edge-based scaling

Landscapes

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

Description

本発明は、電子カメラ等で撮影した画像データにおいて、ゴミ等の影響を除去する画像処理装置に関する。   The present invention relates to an image processing apparatus that removes the influence of dust or the like in image data taken with an electronic camera or the like.

従来、ビデオカメラの製造時に光学系に混入したゴミの影響を補正するため、事前に各絞り値毎の白パターンを撮影して補正情報を記録しておく技術が、特開平9−51459号公報に開示されている。また、コピー機の分野では常に変化する可能性のあるゴミ対策として、原稿読み取り前に均一な反射面を有する白基準データを取り込んで、ゴミ検出する技術が、特開平10−294870号公報や特開平11−27475号公報に開示されている。さらに、スキャナー分野では、この白基準データの代わりの役割を果たすものとして、赤外光センサーを備え、可視光データと同時に透過率データを得て、フィルム欠陥による透過率の減衰信号を得る方法が、USP6,195,161号に開示されている。   Conventionally, in order to correct the influence of dust mixed in an optical system during the manufacture of a video camera, a technique for photographing a white pattern for each aperture value and recording correction information in advance is disclosed in Japanese Patent Laid-Open No. 9-51459. Is disclosed. Further, as a countermeasure against dust that may change constantly in the field of copying machines, a technique for detecting dust by taking in white reference data having a uniform reflecting surface before reading a document is disclosed in Japanese Patent Laid-Open No. 10-294870 and other special techniques. This is disclosed in Japanese Utility Model Publication No. 11-27475. Furthermore, in the scanner field, as a substitute for this white reference data, there is a method of providing an infrared light sensor, obtaining transmittance data simultaneously with visible light data, and obtaining a transmittance attenuation signal due to film defects. U.S. Pat. No. 6,195,161.

特開平9−51459号公報JP-A-9-51459 特開平10−294870号公報Japanese Patent Laid-Open No. 10-294870 特開平11−27475号公報Japanese Patent Laid-Open No. 11-27475 USP6,195,161号USP 6,195,161

しかし、従来のカメラでは、製造時に光学部品に付着した固定ゴミを対象としていたに過ぎず、使用頻度や時間の経過に伴って変化するゴミは考慮されてこなかった。今日普及し始めた交換レンズ方式の一眼レフカメラでは、特に撮像素子前部の光学部品がむき出しのため、時間的に変化するゴミの写り込みが大きな問題となりやすい。   However, conventional cameras are only intended for fixed dust adhered to optical components during manufacturing, and dust that changes with the frequency of use or the passage of time has not been taken into account. In an interchangeable lens type single-lens reflex camera that has begun to spread today, the reflection of dust that changes with time tends to be a big problem, especially because the optical components at the front of the image sensor are exposed.

他方、コピー機やスキャナーでは本スキャンの前あるいは同時にゴミデータを取得して時間的に変化のあるゴミに対応している。しかし、カメラとは構造が異なって、固定距離にある原稿やフィルム面に対して一様な照明手段を有しており、更に完全に均一な反射面を備えたり、新たに赤外線照明手段を設けたりすることによって透過率データを得るのは比較的容易にできる。しかしながら、電子カメラでは製造時検査以外はそのような完全な一様面の透過率データを得にくいのが普通である。   On the other hand, in a copier or a scanner, dust data is acquired before or at the same time as the main scan to deal with dust having a temporal change. However, the structure is different from the camera, and it has a uniform illumination means for the original or film surface at a fixed distance, and it has a completely uniform reflection surface or a new infrared illumination means. By doing so, it is relatively easy to obtain transmittance data. However, it is usually difficult for electronic cameras to obtain such complete uniform surface transmittance data except for inspection during manufacturing.

また、コピー機、スキャナーは基本的に固定光学系であり、光学系の変化によりゴミが変化することを考慮する必要性がない。一方、従来のビデオカメラでは絞り値以外の光学的条件が変化することには対応していない。   Further, the copying machine and the scanner are basically fixed optical systems, and there is no need to consider that dust changes due to changes in the optical system. On the other hand, conventional video cameras do not cope with changes in optical conditions other than the aperture value.

請求項1の発明は、光学系を通して撮像素子により撮影され、平方根特性とは異なる非線形階調処理が施された画像を入力する画像入力手段と、入力された画像内において、着目画素の値と該着目画素を含む所定範囲内の複数の画素の値の平均値とに基づいて、画像内に生じた光路途中の欠陥の投影像に関する欠陥情報を作成する欠陥情報作成手段とを備え、欠陥情報作成手段は、画像ファイル内のタグ情報を利用して入力画像に施されているガンマ処理の方式を特定し、これに基づいて生成した逆ガンマカーブを用いて、入力画像の階調を一旦線形階調に戻した上で、更に平方根特性の非線形階調に変換し、平方根特性の非線形階調空間において画像内のエッジ部を検出し、検出したエッジ部に基づいて平坦部領域を抽出し、抽出した平坦部領域の情報に基づいて、画像内の平坦性が保証された領域について、平均値を算出することによって欠陥情報を作成することを特徴とする。
請求項2の発明は、請求項1に記載の画像処理装置において、線形階調に戻された階調空間において、着目画素の値と該着目画素を含む所定範囲内の複数の画素の値の平均値との相対比を算出して欠陥情報を作成することを特徴とする。
請求項3の発明は、請求項2に記載の画像処理装置において、欠陥情報作成手段で作成した相対比の逆数値を、線形階調に戻された階調空間において対応する画素の値に掛け算して欠陥を補正する欠陥補正手段をさらに備えることを特徴とする。
請求項4の発明は、請求項1〜3のいずれか一項に記載の画像処理装置において、画像入力手段は、JPEG、JPEG2000、またはTIFFへの圧縮処理がなされた圧縮画像に対しては該圧縮を解凍してから入力することを特徴とする。
請求項5の発明は、請求項1〜4のいずれかに記載の画像処理装置の機能をコンピュータに実行させることを特徴とする
According to the first aspect of the present invention, there is provided image input means for inputting an image photographed by an image sensor through an optical system and subjected to nonlinear gradation processing different from the square root characteristic, and a value of a pixel of interest in the input image. Defect information creating means for creating defect information relating to a projected image of a defect in the middle of an optical path generated in an image based on an average value of a plurality of pixels within a predetermined range including the target pixel; and defect information The creation means specifies the gamma processing method applied to the input image using the tag information in the image file, and uses the inverse gamma curve generated based on this to temporarily linearize the gradation of the input image. After returning to the gradation, it is further converted into a non-linear gradation with a square root characteristic, an edge part in the image is detected in the non-linear gradation space with the square root characteristic, and a flat part region is extracted based on the detected edge part, Extracted flat Based on the information of the area, the area where the flatness is assured in the image, characterized by creating a defect information by calculating the average value.
According to a second aspect of the present invention, in the image processing device according to the first aspect, in the gradation space returned to the linear gradation, the value of the target pixel and the values of a plurality of pixels within a predetermined range including the target pixel are obtained. Defect information is created by calculating a relative ratio with an average value.
According to a third aspect of the present invention, in the image processing apparatus according to the second aspect, the inverse value of the relative ratio created by the defect information creating means is multiplied by the value of the corresponding pixel in the gradation space returned to the linear gradation. And a defect correcting means for correcting the defect.
According to a fourth aspect of the present invention, in the image processing apparatus according to any one of the first to third aspects, the image input means applies the compression processing to a compressed image that has been compressed into JPEG, JPEG2000, or TIFF. It is characterized by inputting after decompressing the compression.
The invention of claim 5 is characterized in that to perform the functions of the image processing apparatus according to claim 1 to the computer.

本発明によれば、電子カメラ等で撮影された画像が最終出力用に非線形階調処理がなされていても、適切に且つ、光学系の状態に左右されずにゴミ等の欠陥をきれいに除去できる。   According to the present invention, even if an image photographed with an electronic camera or the like is subjected to nonlinear gradation processing for final output, defects such as dust can be removed neatly without being influenced by the state of the optical system. .

−第1の実施の形態−
(電子カメラおよびパーソナルコンピュータの構成)
図1は、交換レンズ方式の一眼レフ電子スチルカメラ(以下、電子カメラと言う)の構成を示す図である。電子カメラ1は、カメラ本体2とマウント式交換レンズからなる可変光学系3を有する。可変光学系3は、内部にレンズ4と絞り5を有する。レンズ4は複数の光学レンズ群から構成されるが、図では代表して1枚のレンズで表し、そのレンズ4の位置を主瞳位置と言う(以下、単に瞳位置と言う)。可変光学系3は、ズームレンズであってもよい。瞳位置は、レンズ種やズームレンズのズーム位置によって決まる値である。焦点距離によって変わることもある。
-First embodiment-
(Configuration of electronic camera and personal computer)
FIG. 1 is a diagram illustrating a configuration of an interchangeable lens type single-lens reflex electronic still camera (hereinafter referred to as an electronic camera). The electronic camera 1 has a variable optical system 3 including a camera body 2 and a mount type interchangeable lens. The variable optical system 3 has a lens 4 and a diaphragm 5 inside. Although the lens 4 is composed of a plurality of optical lens groups, in the figure, it is represented by a single lens, and the position of the lens 4 is referred to as a main pupil position (hereinafter simply referred to as the pupil position). The variable optical system 3 may be a zoom lens. The pupil position is a value determined by the lens type and the zoom position of the zoom lens. May vary depending on focal length.

カメラ本体2は、シャッター6、光学フィルタやカバーガラスなどの光学部品7、撮像素子8を有する。可変光学系3は、カメラ本体2のマウント部9に対して着脱可能である。また、可変光学系3は、マウント部9を介して、瞳位置に関する情報、絞り値に関する情報等の光学的パラメータを電子カメラ1の制御部17(図2)に送信する。絞り値は、例えばF2.8〜F22まで変化する。   The camera body 2 includes a shutter 6, an optical component 7 such as an optical filter or a cover glass, and an image sensor 8. The variable optical system 3 can be attached to and detached from the mount portion 9 of the camera body 2. Further, the variable optical system 3 transmits optical parameters such as information on the pupil position and information on the aperture value to the control unit 17 (FIG. 2) of the electronic camera 1 via the mount unit 9. The aperture value changes from F2.8 to F22, for example.

符号10は、撮像素子8前部の光学部品7の表面に付着したゴミを示す。可変光学系3の絞り値や瞳位置を変化させて、撮影画像に写り込んだゴミ影の変化を評価する実験を行った結果、以下の2つの事実が判った。
(1)絞り値によってゴミ影の大きさと光の透過率が変わる。
(2)レンズの瞳位置によってゴミ位置がずれる。
この2つの実験事実から固定位置に付着したゴミであっても、レンズの撮影条件(絞り値と瞳位置)が変化する度にゴミの写り込み方が変化していることがわかる。このような可変な光学系に対して、ゴミの影響を除去する手法を以下に示す。
Reference numeral 10 denotes dust adhering to the surface of the optical component 7 in front of the image sensor 8. As a result of an experiment for changing the aperture value and pupil position of the variable optical system 3 and evaluating the change of dust shadows reflected in the photographed image, the following two facts were found.
(1) The size of dust shadow and the light transmittance change depending on the aperture value.
(2) The dust position shifts depending on the pupil position of the lens.
From these two experimental facts, it can be seen that even if the dust is attached to the fixed position, the way the dust is reflected changes every time the photographing condition (aperture value and pupil position) of the lens changes. A technique for removing the influence of dust on such a variable optical system will be described below.

図2は、電子カメラ1のブロック図とPC(パーソナルコンピュータ)31および周辺装置を示す図である。PC31は、画像処理装置として機能し、電子カメラ1から画像データを取得し後述するゴミの影響除去処理をする。   FIG. 2 is a block diagram of the electronic camera 1, a PC (personal computer) 31, and a peripheral device. The PC 31 functions as an image processing apparatus, acquires image data from the electronic camera 1, and performs dust influence removal processing described later.

電子カメラ1は、可変光学系3、光学部品7、シャッター6(図2では図示省略)、撮像素子8、アナログ信号処理部12、A/D変換部13、タイミング制御部14、画像処理部15、操作部16、制御部17、メモリ18、圧縮/伸長部19、表示画像生成部20、モニタ21、メモリカード用インターフェース部22、外部インターフェース部23を備える。   The electronic camera 1 includes a variable optical system 3, an optical component 7, a shutter 6 (not shown in FIG. 2), an image sensor 8, an analog signal processing unit 12, an A / D conversion unit 13, a timing control unit 14, and an image processing unit 15. , An operation unit 16, a control unit 17, a memory 18, a compression / decompression unit 19, a display image generation unit 20, a monitor 21, a memory card interface unit 22, and an external interface unit 23.

撮像素子8は、可変光学系3を通して被写体を撮像し、撮像された被写体像に対応する画像信号(撮像信号)を出力する。撮像素子8は、複数の画素から構成される矩形形状の撮像領域を有し、各画素に蓄積された電荷に対応するアナログ信号である画像信号を、画素単位で順次、アナログ信号処理部12に出力する。撮像素子8は、例えば単板式カラーCCDなどで構成される。アナログ信号処理部12は、内部にCDS(相関2重サンプリング)回路や、AGC(オートゲインコントロール)回路などを有し、入力された画像信号に対して所定のアナログ処理を行う。A/D変換部13は、アナログ信号処理部12で処理されたアナログ信号をデジタル信号に変換する。タイミング制御部14は、制御部17により制御され、撮像素子8、アナログ信号処理部12、A/D変換部13、画像処理部15の各動作のタイミングを制御する。   The imaging element 8 images a subject through the variable optical system 3 and outputs an image signal (imaging signal) corresponding to the captured subject image. The imaging element 8 has a rectangular imaging region composed of a plurality of pixels, and sequentially outputs image signals, which are analog signals corresponding to the charges accumulated in the pixels, to the analog signal processing unit 12 in units of pixels. Output. The image sensor 8 is composed of, for example, a single-plate color CCD. The analog signal processing unit 12 includes a CDS (correlated double sampling) circuit, an AGC (auto gain control) circuit, and the like, and performs predetermined analog processing on the input image signal. The A / D conversion unit 13 converts the analog signal processed by the analog signal processing unit 12 into a digital signal. The timing control unit 14 is controlled by the control unit 17 and controls the timing of each operation of the image sensor 8, the analog signal processing unit 12, the A / D conversion unit 13, and the image processing unit 15.

メモリカード用インターフェース部22は、メモリカード(カード状のリムーバブルメモリ)30とのインターフェースをとる。外部インターフェース部23は、所定のケーブルや無線伝送路を介してPC31等の外部装置とのインターフェースをとる。操作部16は、レリーズボタンやモード切り換え用の選択ボタン等に相当する。モニタ21は、各種メニューを表示したり、撮像素子8で撮像した被写体像やメモリカードに格納された画像データに基づく再生画像を表示したりする。操作部16の出力は制御部17に接続され、モニタ21には表示画像生成部20の出力が接続される。画像処理部15は、例えば、画像処理専用の1チップ・マイクロプロセッサで構成される。   The memory card interface unit 22 interfaces with a memory card (card-like removable memory) 30. The external interface unit 23 interfaces with an external device such as the PC 31 via a predetermined cable or wireless transmission path. The operation unit 16 corresponds to a release button, a mode switching selection button, or the like. The monitor 21 displays various menus and displays a subject image captured by the image sensor 8 and a reproduced image based on image data stored in a memory card. The output of the operation unit 16 is connected to the control unit 17, and the output of the display image generation unit 20 is connected to the monitor 21. The image processing unit 15 is composed of, for example, a one-chip microprocessor dedicated to image processing.

A/D変換部13、画像処理部15、制御部17、メモリ18、圧縮/伸長部19、表示画像生成部20、メモリカード用インターフェース部22、外部インターフェース部23は、バス24を介して相互に接続されている。   The A / D conversion unit 13, the image processing unit 15, the control unit 17, the memory 18, the compression / decompression unit 19, the display image generation unit 20, the memory card interface unit 22, and the external interface unit 23 are mutually connected via a bus 24. It is connected to the.

PC31には、モニタ32やプリンタ33等が接続されており、CD−ROM34に記録されたアプリケーションプログラムが予めインストールされている。また、PC31は、不図示のCPU、メモリ、ハードディスクの他に、メモリカード30とのインターフェースをとるメモリカード用インターフェース部(不図示)や所定のケーブルや無線伝送路を介して電子カメラ1等の外部装置とのインターフェースをとる外部インターフェース部(不図示)を備える。   A monitor 32, a printer 33, and the like are connected to the PC 31, and an application program recorded on the CD-ROM 34 is installed in advance. In addition to a CPU, a memory, and a hard disk (not shown), the PC 31 includes a memory card interface unit (not shown) that interfaces with the memory card 30, an electronic camera 1, etc. via a predetermined cable or wireless transmission path. An external interface unit (not shown) that interfaces with an external device is provided.

図2のような構成の電子カメラ1において、操作部16を介し、操作者によって撮影モードが選択されてレリーズボタンが押されると、制御部17は、タイミング制御部14を介して、撮像素子8、アナログ信号処理部12、A/D変換部13に対するタイミング制御を行う。撮像素子8は、可変光学系3により撮像領域に結像された光学像に対応する画像信号を生成する。その画像信号は、アナログ信号処理部12で所定のアナログ信号処理が行われ、アナログ処理後画像信号としてA/D変換部13へ出力される。A/D変換部13では、アナログ処理後の画像信号をデジタル化し、画像データとして、画像処理部15に供給する。   In the electronic camera 1 configured as shown in FIG. 2, when the shooting mode is selected by the operator via the operation unit 16 and the release button is pressed, the control unit 17 causes the image sensor 8 to operate via the timing control unit 14. The timing control is performed on the analog signal processing unit 12 and the A / D conversion unit 13. The imaging element 8 generates an image signal corresponding to the optical image formed in the imaging area by the variable optical system 3. The image signal is subjected to predetermined analog signal processing in the analog signal processing unit 12, and is output to the A / D conversion unit 13 as an image signal after analog processing. The A / D conversion unit 13 digitizes the analog-processed image signal and supplies it to the image processing unit 15 as image data.

本実施の形態の電子カメラ1では、撮像素子8において、単板式カラー撮像素子の最も代表的なR(赤)、G(緑)、B(青)のカラーフィルタがベイア配列されている場合を例にとり、画像処理部15に供給される画像データはRGB表色系で示されるものとする。画像データを構成する各々の画素には、RGBの何れか1つの色成分の色情報が存在する。ここで、撮像素子8を構成する1つの光電変換素子を画素と言うが、この画素に対応した画像データの1単位も画素と言う。また、画像も複数の画素から構成される概念である。   In the electronic camera 1 of the present embodiment, the image sensor 8 has a case where the most representative R (red), G (green), and B (blue) color filters of a single-plate color image sensor are arranged in a Bayer array. For example, it is assumed that the image data supplied to the image processing unit 15 is represented in the RGB color system. Each pixel constituting the image data has color information of any one of RGB color components. Here, one photoelectric conversion element constituting the image sensor 8 is referred to as a pixel, and one unit of image data corresponding to this pixel is also referred to as a pixel. An image is also a concept composed of a plurality of pixels.

画像処理部15は、このような画像データに対し、補間、階調変換や輪郭強調などの画像処理を行う。このような画像処理が完了した画像データは、必要に応じて、圧縮/伸長部19で所定の圧縮処理が施され、メモリカード用インターフェース部22を介してメモリカード30に記録される。画像処理が完了した画像データは、圧縮処理を施さずにメモリカード30に記録してもよい。   The image processing unit 15 performs image processing such as interpolation, gradation conversion, and contour enhancement on such image data. The image data that has undergone such image processing is subjected to predetermined compression processing by the compression / decompression unit 19 as necessary, and is recorded in the memory card 30 via the memory card interface unit 22. Image data for which image processing has been completed may be recorded on the memory card 30 without being subjected to compression processing.

画像処理が完了した画像データは、メモリカード30を介してPC31に提供される。外部インターフェース23および所定のケーブルや無線伝送路を介してPC31に提供してもよい。画像処理が完了した画像データは、補間処理が完了し、各画素にはRGBのすべての色成分の色情報が存在するものとする。   The image data for which image processing has been completed is provided to the PC 31 via the memory card 30. It may be provided to the PC 31 via the external interface 23 and a predetermined cable or wireless transmission path. It is assumed that the image data for which image processing has been completed has undergone interpolation processing, and color information of all RGB color components is present in each pixel.

(ゴミの影響除去処理)
次に、撮影した各画像データにおいて、ゴミの影響を除去する処理について説明する。第1の実施の形態では、補正対象画像内でゴミ検出し、除去する方法を示す。光路途中に含まれるゴミは一般にぼけており、通常のエッジ検出フィルタに掛からない程度のシミが多数含まれる。ゴミは大きなゴミから小さなゴミまで種々あり、F値依存性が大きい。小さなゴミは絞り込んだ状態でもこのようにぼけた状況にあり、開放側では消滅している。一方、大きなごみは開放側でこのようにぼけた状況にある。この性質を利用して第1の実施形態では、一様照明の参照画像なしに、補正対象画像自身の中からゴミを自己抽出し、自己補正する方式を採用する。
(Dust removal process)
Next, processing for removing the influence of dust in each captured image data will be described. In the first embodiment, a method for detecting and removing dust in a correction target image will be described. The dust contained in the middle of the optical path is generally blurred, and includes many spots that are not covered by a normal edge detection filter. There are various types of garbage ranging from large garbage to small garbage, and the F value dependency is large. Small garbage is in such a blurred state even when it is narrowed down, and disappears on the open side. On the other hand, large garbage is in such a blurred state on the open side. Using this property, the first embodiment employs a method of self-extracting dust from a correction target image itself and performing self-correction without a reference image with uniform illumination.

ゴミの自己抽出は、後述するカーネルを使って透過率データを得る。正確なゴミの透過率信号を得るには平坦部でカーネルを使用する必要があり、平坦部を検出するためまず初めにエッジフィルタで補正対象画像の画像構造を調べる。ここで平坦部とは、画像内で部分的に一様な領域のことをいう。本実施の形態では、グラデーションやレンズの周辺減光を含む完全に一様ではない青空、一様に近い壁面なども一様な領域として検出される。また、一様な領域として検出された平坦部の画像にグラデーションやシェーディングなどが含まれていても、透過率を計算する際、グラデーションやシェーディングなどによる影響を受けないような演算がなされる。   In the self-extraction of dust, transmittance data is obtained using a kernel described later. In order to obtain an accurate dust transmittance signal, it is necessary to use a kernel in the flat portion. First, in order to detect the flat portion, the image structure of the correction target image is examined using an edge filter. Here, the flat portion refers to a partially uniform region in the image. In the present embodiment, a completely non-uniform blue sky including a gradation and a peripheral darkening of the lens, a nearly uniform wall surface, and the like are also detected as a uniform region. Even if the flat portion image detected as a uniform region includes gradation, shading, etc., the calculation is performed so as not to be affected by gradation, shading, etc. when calculating the transmittance.

(電子カメラ側の動作)
図3は、第1の実施の形態における、電子カメラ1側の撮影手順について説明する図である。1)瞳位置P1、絞り値A1で通常撮影301を行い、補正対象画像データ1を出力する。2)瞳位置P2、絞り値A2で通常撮影302を行い、補正対象画像データ2を出力する。3)瞳位置P3、絞り値A3で通常撮影303を行い、補正対象画像データ3を出力する。4)瞳位置P4、絞り値A4で通常撮影304を行い、補正対象画像データ4を出力する。すなわち、電子カメラ1を撮影したい被写体に向けた撮影を行い(通常撮影)、補正対象画像を得る。ここで、画像データを出力するとは、メモリカード30に記録したり、外部インターフェース23を介してPC31に直接出力したりすることを言う。
(Operation on the electronic camera side)
FIG. 3 is a diagram for describing a photographing procedure on the electronic camera 1 side in the first embodiment. 1) Normal photographing 301 is performed at the pupil position P1 and the aperture value A1, and the correction target image data 1 is output. 2) Normal photographing 302 is performed at the pupil position P2 and the aperture value A2, and the correction target image data 2 is output. 3) Normal photographing 303 is performed at the pupil position P3 and the aperture value A3, and the correction target image data 3 is output. 4) The normal photographing 304 is performed at the pupil position P4 and the aperture value A4, and the correction target image data 4 is output. In other words, the electronic camera 1 performs photographing (normal photographing) toward a subject to be photographed to obtain a correction target image. Here, outputting image data means recording on the memory card 30 or directly outputting to the PC 31 via the external interface 23.

(画像処理装置側動作)
電子カメラ1で撮影された画像データは、所定の画像処理がなされた後PC31に提供される。PC31では、補正対象画像データを使用して、ゴミの影響除去処理を行う。PC31は、ゴミの影響除去処理を行う画像処理装置と言ってもよい。補正対象画像データはベイヤ配列のRGB補間処理は済んだ状態でPC31に入力される。
(Image processing device side operation)
Image data captured by the electronic camera 1 is provided to the PC 31 after predetermined image processing. The PC 31 performs dust removal processing using the correction target image data. The PC 31 may be said to be an image processing apparatus that performs dust removal processing. The correction target image data is input to the PC 31 after the Bayer array RGB interpolation processing is completed.

図4は、画像処理装置であるPC31で行う処理のフローチャートを示す図である。ステップS29では圧縮画像の解凍処理を行う。ステップS30では、逆ガンマ補正を行う。ステップS31では、輝度面の生成を行う。ステップS32では、輝度面のガンマ補正、エッジ抽出フィルタ処理、閾値判定により、エッジマップの生成を行う。ステップS33では、エッジマップに暗黒部を追加処理をする。ステップS34では、エッジマップの拡大処理をする。ステップS35では、平坦マップへの変換を行う。ステップS36では、自己ゲイン抽出処理を行う。ステップS37では、自己ゲイン補正処理を行う。以下、各ステップの詳細について説明する。   FIG. 4 is a diagram illustrating a flowchart of processing performed by the PC 31 that is the image processing apparatus. In step S29, the compressed image is decompressed. In step S30, inverse gamma correction is performed. In step S31, a luminance plane is generated. In step S32, an edge map is generated by gamma correction of the luminance plane, edge extraction filter processing, and threshold determination. In step S33, a dark portion is added to the edge map. In step S34, the edge map is enlarged. In step S35, conversion to a flat map is performed. In step S36, a self gain extraction process is performed. In step S37, self-gain correction processing is performed. Details of each step will be described below.

圧縮画像解凍処理
ステップS29においては、圧縮されたままの状態では後述する逆ガンマ補正や本題のゴミ影響除去処理が行えないため、扱う画像形式に応じて圧縮画像の解凍処理を行う。例えば、JPEGやJPEG2000のように非可逆圧縮された画像やTIFFなどのオプション機能で可逆圧縮された画像については、解凍処理が必要となる。
Compressed Image Decompression Process In step S29, since the inverse gamma correction described later and the dust effect removal process of the main subject cannot be performed in the compressed state, the decompression process of the compressed image is performed according to the image format to be handled. For example, decompression processing is required for an image that has been irreversibly compressed, such as JPEG or JPEG 2000, and an image that has been reversibly compressed with an optional function such as TIFF.

逆ガンマ補正
ステップS30において逆ガンマ補正を行う。通例、8ビット出力されたJPEG画像やTIFF画像は、階調のガンマ処理がなされている。これらは、後述する平方根型の特性とは少し異なり、ゴミと画像内エッジとの分離の目的には最適ではないため、一旦線形階調に戻す。このとき、カメラや外部アプリケーションソフト内で行われたガンマ処理の方式が、JPEGやTIFF等の各ファイル内のタグに記載して埋め込んであり、このタグ情報を利用して逆ガンマ補正カーブを生成するものとする。非線形階調の入力信号をx((0≦x≦xmax)、線形階調の出力信号をy(0≦y≦ymax)とし、次式(1)を使用し、線形階調への変換を行う。この変換は各R,G、B成分についてそれぞれ行う。

Figure 0004438363
Inverse gamma correction In step S30, inverse gamma correction is performed. Usually, a JPEG image or a TIFF image output as 8 bits is subjected to gradation gamma processing. These are slightly different from the square root type characteristics described later, and are not optimal for the purpose of separating dust and in-image edges. At this time, the gamma processing method performed in the camera or external application software is embedded in a tag in each file such as JPEG or TIFF, and a reverse gamma correction curve is generated using this tag information. It shall be. The input signal of the nonlinear gradation is x ((0 ≦ x ≦ xmax), the output signal of the linear gradation is y (0 ≦ y ≦ ymax), and the conversion to the linear gradation is performed using the following equation (1). This conversion is performed for each of the R, G, and B components.
Figure 0004438363

ここで、ガンマ補正とは、ガンマ曲線つまり入出力の関係を変化させて、画像の濃淡を修正する方法で、画像の濃度の変化の仕方を変えることによって、明るさ、調子、色のバランスなどを調整できる。各カメラメーカーは画像ごとにいろいろな絵作りを実現させるために、複数のガンマ曲線を用意し、ハイコントラスト、ノーマルコントラスト、ローコントラストなどのモードを設けてユーザーに選択させたり、画像に応じてカメラが自動で選択するようにしている。これらのガンマ曲線は、入力信号yの区間ごとに定義されていたり、ルックアップテーブルで定義されていたりして、一義的に全区間に渡って1つの式で表すことはできないが、一般的に1つの式でその役割を表す場合、式(33)のように表すこともある。絵作り用に用意されているガンマ曲線はこれから大きくずれていることがよくあるため、本処理は重要となる。なお、分かりやすく説明するために式(33)の場合を例に取れば、式(33)でγの値が1のときに入力信号と出力信号が正比例することを表す。

Figure 0004438363
Here, gamma correction is a method that modifies the density of the image by changing the relationship between the input and output of the gamma curve, that is, the brightness, tone, color balance, etc. Can be adjusted. Each camera maker prepares multiple gamma curves to create various pictures for each image, and sets the mode such as high contrast, normal contrast, low contrast, etc., and allows the user to select the camera according to the image Is automatically selected. These gamma curves are defined for each section of the input signal y or are defined by a look-up table and cannot be uniquely expressed by one expression over the entire section. When the role is represented by one formula, it may be represented by formula (33). This process is important because the gamma curve prepared for making a picture often deviates greatly from this. For ease of explanation, the case of equation (33) is taken as an example, and when the value of γ is 1 in equation (33), it represents that the input signal and the output signal are directly proportional.
Figure 0004438363

本実施の形態において処理される逆ガンマ補正とは、種々予め用意されたガンマ曲線を各画像ごとに用いられた曲線に合わせて式(1)の処理を行うことをいうが、式(33)を用いて例にとると図5に示すγ=0.3とした時の非線形の入出力関係を図6に示すγ=1とした線形の入出力関係に戻すことをいう。   The inverse gamma correction processed in the present embodiment means that the processing of equation (1) is performed by matching various gamma curves prepared in advance with the curve used for each image. For example, the nonlinear input / output relationship when γ = 0.3 shown in FIG. 5 is returned to the linear input / output relationship shown in FIG. 6 where γ = 1.

3)輝度面の生成
ステップS31では、輝度面の生成を行う。補正対象画像データの各画素[i,j]について、次の式(2)を使用して、線形階調のRGB信号から線形階調の輝度信号Yを生成する。[i,j]は画素の位置を示す。
Y[i,j]=(R[i,j]+2*G[i,j]+B[i,j])/4 ...(2)
RGB各面で個別に解析することも可能であるが、基本的にゴミ影の影響は信号の減衰を生じるのみで、色成分に関係ない。従って、ここでは全ての情報を有効に使いつつ、ランダムノイズの影響を低減させることが可能な輝度成分への変換を行っている。また、そうすることにより、RGB3面から輝度成分単面だけの解析で済み、高速化が図れる。輝度成分生成比率は上記に限らず、R:G:B=0.3:0.6:0.1等であってもよい。
3) Generation of luminance plane In step S31, a luminance plane is generated. For each pixel [i, j] of the correction target image data, a linear gradation luminance signal Y is generated from the linear gradation RGB signal using the following equation (2). [i, j] indicates the position of the pixel.
Y [i, j] = (R [i, j] + 2 * G [i, j] + B [i, j]) / 4 ... (2)
Although it is possible to individually analyze each of the R, G, and B surfaces, basically, the influence of dust shadows only causes signal attenuation and is not related to color components. Therefore, here, conversion to a luminance component that can reduce the influence of random noise while effectively using all information is performed. In addition, by doing so, it is only necessary to analyze the luminance component single surface from the RGB3 surface, and the speed can be increased. The luminance component generation ratio is not limited to the above, and may be R: G: B = 0.3: 0.6: 0.1 or the like.

4)エッジマップの生成
ステップS32においては、エッジ抽出フィルタを輝度面に掛けて、補正対象画像内の平坦部とエッジ部の分離を行う。光路途中に含まれるゴミの画像内への写り込みは非常にコントラストの低いゴミ影となって現れるため、従来技術のようなエッジ抽出フィルタで検出されない場合が多い。この事実を逆に利用すると、エッジ抽出フィルタで抽出されるエッジ部は、ゴミではなく基本的に画像内のエッジであると多くの箇所で仮定できる。この画像内のエッジとゴミとの区別を更によくするために初めに輝度面に対する階調補正処理を行う。
4) Generation of edge map In step S32, the edge extraction filter is applied to the luminance plane to separate the flat portion and the edge portion in the correction target image. Reflection of dust contained in the optical path in the image appears as dust shadow with very low contrast, and is often not detected by an edge extraction filter as in the prior art. If this fact is used in reverse, it can be assumed in many places that the edge portion extracted by the edge extraction filter is basically an edge in the image, not dust. In order to further distinguish between edges and dust in the image, first, gradation correction processing is performed on the luminance plane.

4−1)輝度面のガンマ補正
補正対象画像が線形階調(γ=1)のまま入力されて、上述の輝度面が生成されているものとする。このとき、入力信号をY(0≦Y≦Ymax)、出力信号をY'(0≦Y'≦Y'max)、γ=0.5とし、例えば次式(3)のような階調変換を施す。

Figure 0004438363
ここで、図7はγ=0.5としたときの非線形階調の入力信号と出力信号の関係を示す図である。なお、上記式(3)はべき乗関数になっている。また、γ=0.5は、べき乗関数が平方根関数となっている。このように式(3)が平方根となるような特性により補正を行うことを、ここでは平方根型のガンマ補正と呼ぶ。 4-1) Gamma correction of luminance plane It is assumed that the correction target image is input with linear gradation (γ = 1) and the above-described luminance plane is generated. At this time, the input signal is Y (0 ≦ Y ≦ Ymax), the output signal is Y ′ (0 ≦ Y ′ ≦ Y′max), and γ = 0.5. For example, gradation conversion as in the following equation (3) Apply.
Figure 0004438363
Here, FIG. 7 is a diagram illustrating the relationship between the input signal and the output signal of the non-linear gradation when γ = 0.5. The above equation (3) is a power function. Further, when γ = 0.5, the power function is a square root function. In this way, the correction based on the characteristic that Equation (3) becomes the square root is referred to as square root type gamma correction.

この変換は、低輝度側の中間調のコントラストを上げ、高輝度側のコントラストを下げる処理である。すなわち、ゴミ影は暗いところでは目立ちにくく明るいところで目立つため、明るいところのゴミ影のコントラストはこの変換によって下がり、一方の通常の画像エッジは主に中間調に分布するため相対的にコントラストを上げている。したがって、ゴミ影と通常エッジのコントラストの分離度が良くなる。さらにY'の量子ゆらぎに起因するショットノイズを全階調にわたって均一に扱えるように変換するには、誤差伝播則から考えてγ=0.5にとるのが最もよい。ここで2)の逆ガンマ処理とこの平方根型のガンマ補正を1つの階調変換処理としてまとめても等価である。   This conversion is a process of increasing the halftone contrast on the low luminance side and decreasing the contrast on the high luminance side. In other words, dust shadows are not noticeable in dark places and are conspicuous in bright places, so the contrast of dust shadows in bright places is reduced by this conversion. Yes. Accordingly, the degree of separation between the dust shadow and the normal edge contrast is improved. Further, in order to convert shot noise caused by the quantum fluctuation of Y ′ so that it can be handled uniformly over all gradations, it is best to set γ = 0.5 in view of the error propagation law. Here, the reverse gamma processing of 2) and the square root type gamma correction are equivalent to one tone conversion processing.

4−2)エッジ抽出フィルタ処理
次に、ガンマ補正のなされた輝度面Y'に対して、図8および次式(4)によるエッジ抽出フィルタを掛ける。各画素のエッジ抽出成分をYH[i,j]とする。
YH[i,j]={|Y'[i-1,j]-Y'[i,j]|+|Y'[i+1,j]-Y'[i,j]|
+|Y'[i,j-1]-Y'[i,j]|+|Y'[i,j+1]-Y'[i,j]|
+|Y'[i-1,j-1]-Y'[i,j]|+|Y'[i+1,j+1]-Y'[i,j]|
+|Y'[i-1,j+1]-Y'[i,j]|+|Y'[i+1,j-1]-Y'[i,j]|
+|Y'[i-2,j-1]-Y'[i,j]|+|Y'[i+2,j+1]-Y'[i,j]|
+|Y'[i-2,j+1]-Y'[i,j]|+|Y'[i+2,j-1]-Y'[i,j]|
+|Y'[i-1,j-2]-Y'[i,j]|+|Y'[i+1,j+2]-Y'[i,j]|
+|Y'[i-1,j+2]-Y'[i,j]|+|Y'[i+1,j-2]-Y'[i,j]|
+|Y'[i-3,j]-Y'[i,j]|+|Y'[i+3,j]-Y'[i,j]|
+|Y'[i,j-3]-Y'[i,j]|+|Y'[i,j+3]-Y'[i,j]|
+|Y'[i-3,j-3]-Y'[i,j]|+|Y'[i+3,j+3]-Y'[i,j]|
+|Y'[i-3,j+3]-Y'[i,j]|+|Y'[i+3,j-3]-Y'[i,j]|}/24 ...(4)
ここで、上記フィルタは、画像本来のエッジ部ができるだけ全て抽出されるように、複数の相関距離をもつ絶対値差分をあらゆる方向から漏れなく集めるように設計されている。
4-2) Edge Extraction Filter Processing Next, the edge extraction filter according to FIG. 8 and the following equation (4) is applied to the luminance surface Y ′ subjected to gamma correction. Let YH [i, j] be the edge extraction component of each pixel.
YH [i, j] = {| Y '[i-1, j] -Y' [i, j] | + | Y '[i + 1, j] -Y' [i, j] |
+ | Y '[i, j-1] -Y' [i, j] | + | Y '[i, j + 1] -Y' [i, j] |
+ | Y '[i-1, j-1] -Y' [i, j] | + | Y '[i + 1, j + 1] -Y' [i, j] |
+ | Y '[i-1, j + 1] -Y' [i, j] | + | Y '[i + 1, j-1] -Y' [i, j] |
+ | Y '[i-2, j-1] -Y' [i, j] | + | Y '[i + 2, j + 1] -Y' [i, j] |
+ | Y '[i-2, j + 1] -Y' [i, j] | + | Y '[i + 2, j-1] -Y' [i, j] |
+ | Y '[i-1, j-2] -Y' [i, j] | + | Y '[i + 1, j + 2] -Y' [i, j] |
+ | Y '[i-1, j + 2] -Y' [i, j] | + | Y '[i + 1, j-2] -Y' [i, j] |
+ | Y '[i-3, j] -Y' [i, j] | + | Y '[i + 3, j] -Y' [i, j] |
+ | Y '[i, j-3] -Y' [i, j] | + | Y '[i, j + 3] -Y' [i, j] |
+ | Y '[i-3, j-3] -Y' [i, j] | + | Y '[i + 3, j + 3] -Y' [i, j] |
+ | Y '[i-3, j + 3] -Y' [i, j] | + | Y '[i + 3, j-3] -Y' [i, j] |} / 24 ... (Four)
Here, the filter is designed to collect absolute value differences having a plurality of correlation distances from all directions without omission so that all the original edge portions of the image are extracted as much as possible.

4−3)閾値判定
次式(5)(6)により、エッジ抽出成分YHを閾値判定して、エッジ部か平坦部かの分類を行い、結果をエッジマップEDGE[i,j]に出力する。閾値Th1は255階調に対して1〜5程度の値をとる。エッジ部の上に存在するゴミ影は、基本的にゴミ影がエッジ部の振動する信号に埋もれてしまって目立たないためゴミ除去の不要な領域である。
if YH[i,j]>Th1 EDGE[i,j]=1(エッジ部) ...(5)
else EDGE[i,j]=0(平坦部) ...(6)
以上のように、エッジ検出で検出されなかった領域を平坦部という。
4-3) Threshold Determination The edge extraction component YH is determined as a threshold by the following equations (5) and (6), the edge portion or the flat portion is classified, and the result is output to the edge map EDGE [i, j]. . The threshold value Th1 takes a value of about 1 to 5 for 255 gradations. The dust shadow existing on the edge portion is an area that does not require dust removal because the dust shadow is basically buried in the vibration signal of the edge portion and is not noticeable.
if YH [i, j]> Th1 EDGE [i, j] = 1 (edge part) ... (5)
else EDGE [i, j] = 0 (flat part) ... (6)
As described above, a region not detected by edge detection is called a flat portion.

上記のように、4−1)で階調変換を行って階調間の重み付けを変え、4−3)で全階調にわたって一定の閾値Th1で閾値判定を行っている。しかし、ほぼ同等な効果は、線形階調のままでエッジ抽出を行い、輝度レベルに応じた閾値を設定して、閾値判定を行うようにしても可能である。   As described above, gradation conversion is performed in 4-1) to change the weighting between gradations, and threshold determination is performed with a constant threshold Th1 over all gradations in 4-3). However, almost the same effect can be obtained by performing edge extraction while maintaining the linear gradation, and setting a threshold value according to the luminance level and performing threshold determination.

5)エッジマップに暗黒部を追加
エッジマップは、後述するゲインマップ抽出をしてはいけない領域を表す。エッジ領域の他に、ゲインマップ抽出するのが危険な領域が暗い領域(暗黒部)である。暗黒部は、S/Nが悪いため相対ゲインを抽出しても信頼性が低い。更に暗黒部上に存在するゴミ影はほとんど目立たないのでゴミ除去する必要性がない。したがって、ステップS33において、暗い領域も次式(7)によりエッジマップに追加する。閾値Th2は、255線形階調に対しておよそ20以下の値に設定するものとする。模式的にこの操作を「EDGE'=EDGE+DARK」と記述すると分かりやすい。
if Y[i,j]≦Th2 EDGE[i,j]=1 ...(7)
5) Adding a dark portion to the edge map The edge map represents a region where gain map extraction described later should not be performed. In addition to the edge region, a region that is dangerous to extract a gain map is a dark region (dark portion). In the dark area, the S / N is poor, so the reliability is low even if the relative gain is extracted. Further, dust shadows existing on the dark part are hardly noticeable, so there is no need to remove dust. Therefore, in step S33, a dark region is also added to the edge map by the following equation (7). The threshold value Th2 is set to a value of about 20 or less for 255 linear gradations. This operation can be easily understood by describing this operation as “EDGE '= EDGE + DARK”.
if Y [i, j] ≦ Th2 EDGE [i, j] = 1 ... (7)

6)エッジマップの拡大処理
後述する8−1)においては、平坦部内で局所平均を取る範囲(2a+1)x(2b+1)画素の中心値と平均値の相対比を比較して透過率マップを生成する。従って、ステップS34において事前にエッジ部がこのカーネル内に入らないように、次式(8)により、エッジ部の(2a+1)x(2b+1)画素拡大処理を行う。m=1,2,...,a、n=1,2,...,bである。
if EDGE[i,j]=1 EDGE[i±m,j±n]=1 ...(8)
6) Enlargement processing of edge map In 8-1) to be described later, the relative ratio between the center value of the range (2a + 1) x (2b + 1) pixels in which the local average is taken in the flat portion and the average value is transmitted. Generate a rate map. Accordingly, in step S34, (2a + 1) x (2b + 1) pixel enlargement processing of the edge portion is performed by the following equation (8) so that the edge portion does not enter the kernel in advance. m = 1,2, ..., a, n = 1,2, ..., b.
if EDGE [i, j] = 1 EDGE [i ± m, j ± n] = 1 ... (8)

7)平坦マップへの変換
ステップS35において、次式(9)(10)により、エッジマップEDGE[i,j]を平坦マップFLAT[i,j]に変換する。ビット反転によって達成される。平坦マップが示す平坦領域は、(2a+1)x(2b+1)画素で構成されるゲインマップ抽出カーネルが補正対象画像内で自己抽出してよい領域を表す。
if EDGE[i,j]=0 FLAT[i,j]=1(平坦部) ...(9)
else FLAT[i,j]=0(エッジ部) ...(10)
7) Conversion to flat map In step S35, the edge map EDGE [i, j] is converted to the flat map FLAT [i, j] by the following equations (9) and (10). Achieved by bit inversion. The flat region indicated by the flat map represents a region that may be self-extracted in the correction target image by the gain map extraction kernel formed of (2a + 1) x (2b + 1) pixels.
if EDGE [i, j] = 0 FLAT [i, j] = 1 (flat part) ... (9)
else FLAT [i, j] = 0 (edge part) ... (10)

8)自己ゲイン抽出
ステップS36において、以下の処理からなるFLAT[i,j]=1の領域に対する透過率マップの生成(ゲインマップ抽出)を行う。
8) Self-Gain Extraction In step S36, a transmittance map is generated (gain map extraction) for the area of FLAT [i, j] = 1, which consists of the following processing.

8−1)局所的規格化処理(自己ゲイン抽出処理)
平坦マップが示す平坦領域は必ずしも完全に一様なものでない。このような平坦領域に対して、局所的な画素値の規格化(正規化)処理を行って、FLAT[i,j]=1の領域の各画素の透過率信号T[i,j]を、次式(11)を使用して算出する。すなわち、着目画素[i,j]の値とこの画素を含む局所範囲の画素平均値との相対比を各々の画素についてとる。そして、FLAT[i,j]=0の領域は全てT[i,j]=1に設定する。これにより平坦領域データに含まれるグラデーション、シェーディング等の不均一性はアルゴリズム的に問題なく排除され、肝心のゴミ影による透過率の低下のみを抽出することができる。このようにして求めた画像全面の透過率を透過率マップ(ゲインマップ)と言う。透過率マップは、補正対象画像の平坦部領域の欠陥情報を示すものである。なお、画素値とは、各画素における色成分の色信号(色情報)や輝度信号(輝度情報)の値である。例えば、1バイトで表される場合、0〜255の値を取る。

Figure 0004438363
8-1) Local normalization processing (self gain extraction processing)
The flat area indicated by the flat map is not necessarily completely uniform. For such flat regions, local pixel value normalization (normalization) processing is performed, and the transmittance signal T [i, j] of each pixel in the region of FLAT [i, j] = 1 is obtained. , Using the following equation (11). That is, the relative ratio between the value of the pixel of interest [i, j] and the average pixel value in the local range including this pixel is determined for each pixel. And all the areas of FLAT [i, j] = 0 are set to T [i, j] = 1. As a result, nonuniformities such as gradation and shading included in the flat area data are eliminated without any problem in terms of algorithm, and only a decrease in transmittance due to dust shadows can be extracted. The transmittance of the entire image obtained in this way is called a transmittance map (gain map). The transmittance map indicates defect information on the flat area of the correction target image. The pixel value is a value of a color signal (color information) or a luminance signal (luminance information) of a color component in each pixel. For example, when represented by 1 byte, it takes a value from 0 to 255.
Figure 0004438363

ここで、局所平均を取る範囲(2a+1)x(2b+1)画素は、最大に想定されるゴミ径より大きめにとる。理想的には面積的にゴミ影よりも3倍程度以上の広さを取れば、正確な透過率データが得られる。aは着目画素[i,j]を中心に左右に広がる画素数、bは着目画素[i,j]を中心に上下に広がる画素数を示す。例えば、撮像素子8の画素ピッチを12umとし、撮像面とゴミ付着面との距離を1.5mmとすると、絞り値F22のとき、巨大なゴミの直径は15画素程度、絞り値F4のとき、巨大なゴミの直径は40画素程度となる。従って、a=40、b=40とし、局所平均を取る範囲は81×81画素範囲のように設定するとよい。また、数百万画素クラスのセンサーであれば、101×101画素の固定でもよい。これらは一例であり、他の画素数による画素範囲であってもよい。   Here, the range (2a + 1) × (2b + 1) pixels for which the local average is taken is set to be larger than the maximum assumed dust diameter. Ideally, if the area is about 3 times larger than the dust shadow, accurate transmittance data can be obtained. a represents the number of pixels extending left and right around the pixel of interest [i, j], and b represents the number of pixels extending up and down around the pixel of interest [i, j]. For example, if the pixel pitch of the image sensor 8 is 12 um and the distance between the imaging surface and the dust adhesion surface is 1.5 mm, when the aperture value is F22, the diameter of the huge dust is about 15 pixels and the aperture value is F4. The diameter of huge garbage is about 40 pixels. Therefore, it is preferable to set a = 40, b = 40, and set the local average range as an 81 × 81 pixel range. Further, if the sensor is in the millions of pixels class, it may be fixed at 101 × 101 pixels. These are only examples, and may be pixel ranges based on other numbers of pixels.

ゴミ影は絞り値に大きく依存し、小さなゴミは絞りを開けるとすぐに消滅するが、大きなゴミは絞りを開放側にしても影は薄くなりながらも大きな面積を占めることがある。撮像素子の画素ピッチ幅にもよるが、開放側で数十画素に渡って丸いゴミ影ができる場合があり、そのときは非常に広い範囲で局所平均をとる必要性が出る。そのため、処理を高速化する場合は、間引いた画素で代表して処理しても問題ない。   The dust shadow greatly depends on the aperture value, and the small dust disappears as soon as the aperture is opened. However, the large dust may occupy a large area even though the shadow is thin even when the aperture is opened. Depending on the pixel pitch width of the image sensor, there may be a case where a round dust shadow is formed over several tens of pixels on the open side, and in that case, it becomes necessary to take a local average over a very wide range. Therefore, in order to increase the processing speed, there is no problem even if the processing is representatively performed with thinned pixels.

この(2a+1)x(2b+1)画素の範囲で相対比を演算する処理を、局所的規格化処理(自己ゲイン抽出処理)と呼ぶ。(2a+1)x(2b+1)画素の範囲で相対化演算するフィルタのことを、ゲイン抽出カーネルと呼んでもよい。図9は、輝度面に対して局所的規格化処理を施した様子を示す図である。図9(a)は、輝度面内のある横方向に並ぶ画素の輝度信号を示す図である。符号41と符号42は、ゴミにより輝度信号が低下していることを示す。図9(b)は、図9(a)の輝度信号に対して、上述した局所的規格化処理を施して得られた図である。すなわち、局所的な範囲で画素値の規格化処理を行ったものである。符号43、44は、図9(a)の符号41、42に対応し、ゴミが存在する個所の透過率を示す。このように、一様面データに含まれるグラデーション、シェーディング等の不均一性は排除され、ゴミ影による透過率の低下のみを抽出することができる。これにより、ゴミの位置と透過率の程度が同時に分かる。   The processing for calculating the relative ratio in the range of (2a + 1) x (2b + 1) pixels is called local normalization processing (self gain extraction processing). A filter that performs a relativization operation in the range of (2a + 1) x (2b + 1) pixels may be called a gain extraction kernel. FIG. 9 is a diagram illustrating a state in which the local normalization process is performed on the luminance surface. FIG. 9A is a diagram illustrating luminance signals of pixels arranged in a horizontal direction in the luminance plane. Reference numerals 41 and 42 indicate that the luminance signal is reduced due to dust. FIG. 9B is a diagram obtained by performing the above-described local normalization processing on the luminance signal of FIG. 9A. That is, pixel value normalization processing is performed in a local range. Reference numerals 43 and 44 correspond to the reference numerals 41 and 42 in FIG. 9A, and indicate the transmittance of the places where dust exists. In this way, nonuniformities such as gradation and shading included in the uniform surface data are eliminated, and only a decrease in transmittance due to dust shadows can be extracted. Thereby, the position of the dust and the degree of transmittance can be known at the same time.

8−2)透過率マップの統計解析
前述の透過率マップに含まれるゴミ情報とランダムノイズを区別するため、前述の局所的規格化処理により得られた透過率マップの画像全面について、平均値Mを次式(12)により求め、標準偏差σを次式(13)により求める統計解析を行う。なお、Nx,Nyは、x方向、y方向の総画素数を表す。

Figure 0004438363
Figure 0004438363
8-2) Statistical analysis of transmittance map Average M for the entire image of the transmittance map obtained by the above-mentioned local normalization processing in order to distinguish dust information and random noise included in the aforementioned transmittance map. Is obtained from the following equation (12), and the standard deviation σ is obtained from the following equation (13). Nx and Ny represent the total number of pixels in the x and y directions.
Figure 0004438363
Figure 0004438363

8−3)閾値判定
基本的に透過率マップに占めるゴミ信号の面積的な割合は十分に小さく、8−2)で統計解析した結果は、透過率信号の量子論的揺らぎに伴うランダムノイズ(ショットノイズ)を評価していると考えられる。図9における符号45部分を拡大した符号46は、この細かいランダムノイズがある様子を示している。透過率マップのヒストグラムをとると、平均値M(Mはほぼ1に近い値)を中心に標準偏差σの正規分布した形となる。図10は、透過率マップのヒストグラムを示す図である。この揺らぎの範囲はゴミ影による透過率の変化を受けていないと考えられるため、強制的に透過率を1に設定してよい。すなわち、次の条件(14)(15)により閾値判定を行う。
if |T[i,j]-M|≦3σ then T[i,j]=1 ...(14)
else T[i,j]=T[i,j] ...(15)
8-3) Threshold determination Basically, the area ratio of the dust signal in the transmittance map is sufficiently small, and the statistical analysis result in 8-2) shows that the random noise associated with the quantum fluctuation of the transmittance signal ( It is thought that shot noise) is being evaluated. Reference numeral 46 obtained by enlarging the reference numeral 45 in FIG. 9 shows a state in which there is this fine random noise. When a histogram of the transmittance map is taken, a normal distribution with a standard deviation σ centering on an average value M (M is a value close to 1) is obtained. FIG. 10 is a diagram showing a histogram of the transmittance map. Since it is considered that the fluctuation range is not subjected to a change in transmittance due to dust shadows, the transmittance may be forcibly set to 1. That is, threshold determination is performed under the following conditions (14) and (15).
if | T [i, j] -M | ≦ 3σ then T [i, j] = 1 ... (14)
else T [i, j] = T [i, j] ... (15)

正規分布するランダムデータは、±3σの範囲を集めれば99.7%になるので、ほぼ正確にランダムノイズの影響を除外することができる。±3σから外れる透過率は、ほとんど統計的な誤差では説明できない異常な信号であり、ゴミ影による透過率の低下による現象を表していると考えられる。この異常部分は、ゴミ影の場合、通常1より小さな値となる。   Since the normally distributed random data is 99.7% if the range of ± 3σ is collected, the influence of random noise can be excluded almost accurately. The transmittance deviating from ± 3σ is an abnormal signal that can hardly be explained by statistical errors, and is considered to represent a phenomenon caused by a decrease in transmittance due to dust shadows. This abnormal portion is usually a value smaller than 1 in the case of dust shadows.

しかし、割合は少ないが1より大きな値を示すものもある。これはゴミ影の影響ではなく、オプティカルローパスフィルタ等の脈理(屈折率の不均一)で生じた欠陥が入射光を強めあったり弱めあったりする干渉縞を起こした場合などに見られる現象である。これにより、光路途中に含まれるゴミ以外の光学部材の欠陥検出にもこの方法は利用することができる。また、撮像素子内の画素欠陥の影響もこの手法で判別可能である。ゴミは、撮像素子8に近い方がボケずに残りやすいが、撮影レンズ上のゴミが相当ボケて写り込んだ場合でも精度よく判別可能である。   However, there are some which show a value larger than 1 although the ratio is small. This is not the effect of dust shadows, but is a phenomenon seen when defects caused by striae (non-uniform refractive index) of optical low-pass filters cause interference fringes that make incident light stronger or weaker. is there. Thereby, this method can also be used for detecting defects of optical members other than dust contained in the optical path. Further, the influence of pixel defects in the image sensor can also be determined by this method. Although dust is more likely to remain near the image sensor 8 without being blurred, it can be accurately determined even when dust on the photographing lens is reflected with considerable blur.

なお、ゴミ影の影響のみを取り除く場合は、以下の条件(16)(17)(18)により閾値判定するとよい。
if |T[i,j]-M|≦3σ then T[i,j]=1 ...(16)
else if T[i,j]>1 T[i,j]=1 ...(17)
else T[i,j]=T[i,j] ...(18)
判定に使う平均値Mは常に1に近い値をとるため、1に置き換えてもよい。
When only the influence of dust shadows is removed, the threshold value may be determined according to the following conditions (16), (17), and (18).
if | T [i, j] -M | ≦ 3σ then T [i, j] = 1 ... (16)
else if T [i, j]> 1 T [i, j] = 1 ... (17)
else T [i, j] = T [i, j] ... (18)
Since the average value M used for determination always takes a value close to 1, it may be replaced with 1.

このようにして、欠陥の画素位置を表すマップ情報(T=1か否かで判断)と、欠陥の度合いを表す透過率情報の2種類の欠陥情報が同時に得られることになる。なお、上述の透過率マップは局所的な相対ゲインを表していることからゲインマップと呼んでもよい。   In this way, two types of defect information, map information (determined based on whether T = 1) or not, and transmittance information representing the degree of defect, can be obtained at the same time. Note that the transmittance map described above may be referred to as a gain map because it represents a local relative gain.

通常、ゴミ等の欠陥検出は、エッジ検出用の微分フィルタで行う。しかし、光路途中のゴミを対象とする場合、光学的にぼけるため非常に周辺とのコントラストが低いゴミ影となって現れる。このような場合、微分フィルタでは非常に感度が悪くほとんど検知できないことが多い。しかし、上記説明したように、透過率の統計的性質を用いた判定法を用いると、非常に高感度のゴミ検出が可能となり、目的の光路途中の異物による影響補正が可能となる。   Usually, a defect such as dust is detected by a differential filter for edge detection. However, when dust in the middle of the optical path is targeted, it appears as a dust shadow with very low contrast with the surroundings due to optical blurring. In such a case, the differential filter is very insensitive and can hardly be detected. However, as described above, when a determination method using the statistical property of transmittance is used, it is possible to detect dust with very high sensitivity, and it is possible to correct the influence of foreign matter in the target optical path.

9)自己ゲイン補正
ステップS37では、自己ゲイン補正を行う。上記のように求めた透過率マップを使用して補正対象画像データの補正を行う。補正対象画像データのR,G,B値各々に対して、式(19)(20)(21)で示すように、透過率信号の逆数を掛け算してゲイン補正を行う。
R[i,j]=R[i.j]/T[i,j] ...(19)
G[i,j]=G[i.j]/T[i,j] ...(20)
B[i,j]=B[i.j]/T[i,j] ...(21)
9) Self-Gain Correction In step S37, self-gain correction is performed. The correction target image data is corrected using the transmittance map obtained as described above. As shown in equations (19), (20), and (21), gain correction is performed by multiplying the R, G, and B values of the correction target image data by the reciprocal of the transmittance signal.
R [i, j] = R [ij] / T [i, j] ... (19)
G [i, j] = G [ij] / T [i, j] ... (20)
B [i, j] = B [ij] / T [i, j] ... (21)

これにより、ゴミ影による輝度の低下をきれいに補正できる。加えて、補正の必要性のない所は透過率マップが閾値判定されているため、余計な補正を行わないようにできる。すなわち、ゴミのない箇所の透過率Tにはランダムノイズの影響が取り除かれているので、RGB信号のノイズが増幅される心配がない。   As a result, a decrease in luminance due to dust shadows can be neatly corrected. In addition, it is possible to prevent unnecessary correction since the transmittance map is subjected to threshold determination in places where there is no need for correction. That is, since the influence of random noise is removed from the transmittance T of the dust-free portion, there is no concern that the noise of the RGB signal is amplified.

10)ガンマ補正
このように線形階調でゴミの透過率分だけゲイン補正されたR,G、B成分に対し、ステップS38にてユーザーがすぐに画像確認できるように元の非線形階調特性に戻す変換を次式(34)により行う。
x'=γ(y) ...(34)
10) Gamma correction For the R, G, and B components that have been gain-corrected for the dust transmittance in the linear gradation as described above, the original nonlinear gradation characteristics are restored so that the user can immediately confirm the image in step S38. The conversion to be returned is performed by the following equation (34).
x '= γ (y) ... (34)

以上のように、第1の実施の形態では、ゴミ対策用の特別な機構を備えていない普通の電子カメラでも、任意の時刻に撮影した最終出力用にガンマ処理がなされた画像を適切に補正することができる。さらに、一様面の基準画像データがなくても、補正対象画像自身のゴミを自己抽出して補正することができる。すなわち、1つの撮影画像内で上記したように平坦性が保証できる所定の条件を満たす領域を抽出する。抽出した同一の領域を基準画像としかつ補正対象画像とする。また、可変光学系の影響を全く加味する必要性がない。特に、膨大な数を占める小さなゴミ影の除去に威力を発揮する。   As described above, in the first embodiment, even with an ordinary electronic camera that does not have a special mechanism for preventing dust, an image that has been subjected to gamma processing for final output taken at an arbitrary time is appropriately corrected. can do. Further, even if there is no uniform plane reference image data, dust in the correction target image itself can be self-extracted and corrected. That is, a region that satisfies a predetermined condition that can guarantee flatness as described above is extracted from one captured image. The extracted same area is set as a reference image and a correction target image. Further, there is no need to take into account the influence of the variable optical system. In particular, it is effective in removing small dust shadows that occupy a huge number.

−第2の実施の形態−
第2の実施の形態では、ゴミ情報を得るための基準画像を一度だけ撮影し、ゴミ位置に関する情報を利用しながら、透過率マップは基準画像からではなく、第1の実施の形態のように補正対象画像自身から自己抽出する方式を採用したものである。第1の実施の形態では、エッジマップ抽出において大きなゴミはエッジとして抽出されてしまい、補正がなされない場合が生じるが、第2の実施の形態は、このような第1の実施の形態の不具合にも対処するものである。すなわち、第1の実施の形態による信頼性の高い透過率マップの生成方法を利用しながら、若干ユーザーの負荷はかかるが、ゴミ参照用に一日から一月に一回程度一様な基準画像を撮影した画像を利用して、ゴミ除去性能を更に上げる方式である。
-Second Embodiment-
In the second embodiment, a reference image for obtaining dust information is photographed only once, and the transmittance map is not based on the reference image but using information on the dust position, as in the first embodiment. A method of self-extraction from the correction target image itself is adopted. In the first embodiment, in the edge map extraction, large dust is extracted as an edge, and correction may not be performed. However, the second embodiment is a defect of the first embodiment. It will also deal with. That is, while using the method for generating a highly reliable transmittance map according to the first embodiment, it is slightly burdened on the user, but a standard image that is uniform once a day to one month for dust reference. This is a method for further improving the dust removal performance by using an image obtained by shooting.

基準画像は、完全に一様な白基準データではなく、青空、一様に近い壁面、グレーチャート、無地の紙面などを撮影して代用するものとする。この場合の基準データは、レンズの周辺減光や被写体のグラデーション、撮像素子のシェーディングなどが含まれていてもよい。基準データは、実際に身近な場所で容易に撮影できる状況で取得できる場合を想定しており、厳密な一様性は要求せず、画像処理側のアルゴリズムで一様なものに変換する。基準画像と補正対象画像の光学的条件(瞳位置、F値)の違いは画像処理側で対応する。   The reference image is not a completely uniform white reference data, but a blue sky, a nearly uniform wall surface, a gray chart, a plain paper surface, or the like is photographed and used instead. The reference data in this case may include lens peripheral light reduction, subject gradation, image sensor shading, and the like. It is assumed that the reference data can be acquired in a situation where it can be easily photographed at a location that is actually familiar, and does not require strict uniformity, and is converted into a uniform one by an algorithm on the image processing side. Differences in optical conditions (pupil position, F value) between the reference image and the correction target image are dealt with on the image processing side.

なお、電子カメラ1および画像処理装置としてのPC31の構成は、第1の実施の形態と同様であるので、その説明を省略する。   Note that the configurations of the electronic camera 1 and the PC 31 as the image processing apparatus are the same as those in the first embodiment, and a description thereof will be omitted.

(電子カメラ側動作)
図11は、第2の実施の形態における、電子カメラ1側の撮影手順について説明する図である。1)瞳位置P0、絞り値A0で一様面撮影201を行い、基準画像データ0を出力する。2)瞳位置P1、絞り値A1で通常撮影202を行い、補正対象画像データ1を出力する。3)瞳位置P2、絞り値A2で通常撮影203を行い、補正対象画像データ2を出力する。4)瞳位置P3、絞り値A3で通常撮影204を行い、補正対象画像データ3を出力する。すなわち、まず、電子カメラ1を空や壁面に向けて一様な面の撮影を行い(一様面撮影)、その後、電子カメラ1を撮影したい被写体に向けて随時撮影する(通常撮影)。
(Operation on the electronic camera side)
FIG. 11 is a diagram for explaining a photographing procedure on the electronic camera 1 side in the second embodiment. 1) Uniform plane photography 201 is performed at the pupil position P0 and the aperture value A0, and the reference image data 0 is output. 2) The normal photographing 202 is performed at the pupil position P1 and the aperture value A1, and the correction target image data 1 is output. 3) The normal photographing 203 is performed at the pupil position P2 and the aperture value A2, and the correction target image data 2 is output. 4) The normal photographing 204 is performed at the pupil position P3 and the aperture value A3, and the correction target image data 3 is output. That is, first, the electronic camera 1 is photographed with a uniform surface facing the sky or a wall surface (uniform surface photographing), and then the electronic camera 1 is photographed as needed toward the subject to be photographed (normal photographing).

ここで、基準画像の絞り値A0は、可変光学系3に用意された可変な範囲の中で最も絞り込んだ状態で撮影するものとする。最も絞り込んだ絞り値は、標準的なレンズでは例えばF22程度である。一方、補正対象画像の絞り値は、基準画像と同じか、それより開放側であるものとする。   Here, it is assumed that the aperture value A0 of the reference image is taken in a state in which the aperture is most narrowed in a variable range prepared in the variable optical system 3. The most narrowed aperture value is, for example, about F22 for a standard lens. On the other hand, it is assumed that the aperture value of the correction target image is the same as that of the reference image or closer to the open side.

一様面撮影は、ゴミの付着状態が変化しないかぎり省くことができる。一様面撮影の挿入回数が多いに越したことはないが、通常は一日一回程度のデータでもあれば、有効なゴミデータになりうる。一様面撮影を行うか否かの判断は、撮影者に委ねられる。しかし、先に行った一様面撮影があまりにも時間的に離れている場合は、その一様面撮影による基準データは信頼性に欠ける場合も生じる。従って、通常撮影から所定時間内の一様面撮影の基準画像データのみを使用するようにしてもよい。また、必ずしも一様面撮影を先に行う必要はない。後に行った一様面撮影の基準画像データを使用してもよい。一様面撮影が、通常撮影の前後に複数ある場合は、時間的に最も近い一様面撮影の基準画像データを使用するようにしてもよい。あるいは、新規付着ゴミの可能性を気にするのであれば、撮影前後の2番目に近いものまでの中からどちらかを選択するようにしてもよい。   Uniform surface photography can be omitted as long as the state of dust adhesion does not change. Although the number of insertions of uniform plane photography has never been too many, data that is usually only once a day can be effective garbage data. The determination as to whether or not to perform uniform plane imaging is left to the photographer. However, if the previously performed uniform plane imaging is too far in time, the reference data obtained by the uniform plane imaging may be unreliable. Therefore, only the reference image data for uniform plane imaging within a predetermined time from normal imaging may be used. Further, it is not always necessary to perform uniform plane imaging first. You may use the reference image data of the uniform surface photography performed later. When there are a plurality of uniform plane imaging before and after the normal imaging, the reference image data of the uniform plane imaging that is closest in time may be used. Alternatively, if you are concerned about the possibility of newly attached dust, you may select one from the second closest one before and after photographing.

(画像処理装置側動作)
図12は、画像処理装置であるPC31で行う処理のフローチャートを示す図である。
(Image processing device side operation)
FIG. 12 is a diagram illustrating a flowchart of processing performed by the PC 31 that is the image processing apparatus.

<基準画像に対する処理>
1)圧縮画像解凍処理
基準画像のファイルが圧縮されている場合、ステップS39の圧縮画像解凍処理において、第1の実施の形態の1)で補正対象画像に対して行った方法と同様に解凍処理を行う。
<Processing for reference image>
1) Compressed image decompression process When the standard image file is compressed, the decompression process is performed in the compressed image decompression process in step S39 in the same manner as the method performed on the correction target image in 1) of the first embodiment. I do.

2)逆ガンマ補正
基準画像の階調が線形階調ではなく、ガンマ補正のなされた非線形階調の場合、ステップS40において、第1の実施の形態の2)で補正対象画像に対して行った方法と同様に逆ガンマ補正を行う。
2) Inverse gamma correction When the gradation of the reference image is not a linear gradation but a non-linear gradation subjected to a gamma correction, the correction is performed on the image to be corrected in step S40 in 2) of the first embodiment. Reverse gamma correction is performed in the same way as the method.

3)輝度面の生成
ステップS41の輝度面の生成は、第1の実施の形態の3)で補正対象画像に対して行った方法と同様である。
3) Generation of Luminance Surface The generation of the luminance surface in step S41 is the same as the method performed on the correction target image in 3) of the first embodiment.

4)透過率マップの生成
ステップS42では、以下の手順に従って透過率マップの生成を行う。
4−1)局所的規格化処理(ゲイン抽出処理)
基準画像データは、上述したように必ずしも完全に一様なものでない。従って、生成した輝度面も完全に一様ではない。このような輝度面に対して、第1の実施の形態の8−1)において平坦領域のみに対して行った式(11)の処理をここでは全ての画素に対して行う。これにより、各画素の透過率信号T[i,j]を算出する。
4) Generation of transmittance map In step S42, a transmittance map is generated according to the following procedure.
4-1) Local normalization processing (gain extraction processing)
As described above, the reference image data is not necessarily completely uniform. Therefore, the generated luminance surface is not completely uniform. For such a luminance surface, the processing of Expression (11) performed for only the flat region in 8-1) of the first embodiment is performed for all the pixels here. Thereby, the transmittance signal T [i, j] of each pixel is calculated.

4−2)透過率マップのローパス処理
透過率マップのローパス処理は選択可能としてもよいが、大部分で効果があるのでこの処理を入れておくのが好ましい。透過率信号T[i,j]には、輝度信号の量子論的揺らぎに伴うランダムノイズが含まれているため、透過率が1に近いレベルで微妙にゴミ影の影響が残っている領域は、そのランダム性のため以下に続く4−4)の閾値判定を行うと、斑にゴミ影を抽出することがある。それを防ぐため、次式(22)によるローパスフィルタによりゴミ影の集団化を行うとやや見栄えがよくなる。
T[i,j]={4*T[i,j]
+2*(T[i-1,j]+T[i+1,j]+T[i,j-1]+T[i,j+1])
+1*(T[i-1,j-1]+T[i-1,j+1]+T[i+1,j-1]+T[i+1,j+1])}/16 ...(22)
4-2) Low-pass processing of transmittance map The low-pass processing of the transmittance map may be selectable, but it is preferable to include this processing because it is most effective. Since the transmittance signal T [i, j] includes random noise associated with the quantum fluctuation of the luminance signal, there is a region where the influence of dust shadows remains slightly at a level where the transmittance is close to 1. Because of the randomness, if the threshold determination in 4-4) is performed, dust shadows may be extracted from the spots. In order to prevent this, when the dust shadows are grouped by the low-pass filter according to the following equation (22), the appearance is slightly improved.
T [i, j] = {4 * T [i, j]
+ 2 * (T [i-1, j] + T [i + 1, j] + T [i, j-1] + T [i, j + 1])
+ 1 * (T [i-1, j-1] + T [i-1, j + 1] + T [i + 1, j-1] + T [i + 1, j + 1])} / 16 ... (22)

4−3)透過率マップの統計解析
透過率マップの統計解析は、第1の実施の形態の8−2)で行った方法と同様である。
4-3) Statistical analysis of transmittance map Statistical analysis of the transmittance map is the same as the method performed in 8-2) of the first embodiment.

4−4)閾値判定
閾値判定は、第1の実施の形態の8−3)で行った方法と同様である。
4-4) Threshold Determination The threshold determination is the same as the method performed in 8-3) of the first embodiment.

5)透過率マップの瞳位置変換
ステップS43では、透過率マップの瞳位置変換を行う。基準画像と補正対処画像の瞳位置が相互に異なっているとき、基準画像のゴミ位置を、補正対象画像の瞳位置から見たときに出現すると予測されるゴミ位置に瞳位置変換する。図13は、瞳位置が変化するとゴミ影の位置が変化する様子を示す図である。図13(a)は、瞳位置とゴミと撮像素子8の撮像面との関係を示す図である。図13(b)は、瞳位置の変化に伴い撮像面上でゴミ影が移動している様子を示す図である。
5) Pupil position conversion of transmittance map In step S43, the pupil position of the transmittance map is converted. When the pupil positions of the reference image and the corrected image are different from each other, the pupil position of the reference image is converted into a dust position predicted to appear when viewed from the pupil position of the correction target image. FIG. 13 is a diagram illustrating how the dust shadow position changes as the pupil position changes. FIG. 13A is a diagram illustrating the relationship between the pupil position, dust, and the imaging surface of the imaging device 8. FIG. 13B is a diagram illustrating a state in which dust shadows are moving on the imaging surface with changes in the pupil position.

図13から明らかなように、瞳位置が異なると画像内に写り込むゴミの位置は、光軸51すなわち画像の中心から動径方向にずれる。ここで、画像内の光軸51から距離rの位置にあるゴミが、動径方向にずれる量Δrを見積もる。基準画像の瞳位置をP0、補正対象画像の瞳位置をP0'、撮像面から距離lの位置にゴミが付着しているとすると、Δrは、次式(23)により計算することができる。

Figure 0004438363
ただし、距離lは光学部品の厚みを空気中の光路長に換算した値である。 As apparent from FIG. 13, when the pupil position is different, the position of dust reflected in the image is shifted in the radial direction from the optical axis 51, that is, the center of the image. Here, the amount Δr of dust deviated in the radial direction from the optical axis 51 in the image is estimated. Assuming that the pupil position of the reference image is P0, the pupil position of the correction target image is P0 ′, and dust is attached at a distance l from the imaging surface, Δr can be calculated by the following equation (23).
Figure 0004438363
However, the distance l is a value obtained by converting the thickness of the optical component into an optical path length in the air.

基準画像の透過率マップT[i,j]を、極座標[r,θ]上で次式(24)により[r',θ]に変位させ、座標[i,j]上の透過率マップT'[i,j]に変換する。

Figure 0004438363
ずれ量Δrは、光軸51から距離が遠くになるに従い大きくなる。実際の画像の周辺部では、瞳位置の値によっては数十画素に及ぶこともある。 The transmittance map T [i, j] of the reference image is displaced to [r ′, θ] by the following equation (24) on the polar coordinates [r, θ], and the transmittance map T on the coordinates [i, j] 'Convert to [i, j].
Figure 0004438363
The shift amount Δr increases as the distance from the optical axis 51 increases. In the periphery of an actual image, it may reach several tens of pixels depending on the value of the pupil position.

6)透過率マップのF値変換
ステップS44では、透過率マップのF値変換を行う。基準画像と補正対処画像の絞り値が相互に異なっているとき、基準画像のゴミ径と透過率を、補正対象画像のより開放側絞り値でのゴミ径と透過率にF値変換する。図14は、絞り値であるF値が変化するとゴミ影の大きさが変化する様子を示す図である。図14(a)は、F値が大きい場合、図14(b)は、F値が小さい場合を示す。図14から明らかなように、F値の定義式(F=焦点距離/レンズの有効口径)を、相似関係にある撮像面からゴミ付着位置までの距離lとゴミ広がりΓに当てはめると次式(25)が成立する。

Figure 0004438363
6) F value conversion of transmittance map In step S44, F value conversion of the transmittance map is performed. When the aperture values of the reference image and the corrected image are different from each other, the dust diameter and the transmittance of the reference image are converted into an F value into the dust diameter and the transmittance of the correction target image at the more open aperture value. FIG. 14 is a diagram illustrating how the size of the dust shadow changes when the F value, which is the aperture value, changes. FIG. 14A shows a case where the F value is large, and FIG. 14B shows a case where the F value is small. As is clear from FIG. 14, when the definition formula of the F value (F = focal length / effective aperture of the lens) is applied to the distance l from the imaging surface having a similar relationship to the dust adhesion position and the dust spread Γ, the following formula ( 25) is established.
Figure 0004438363

lを撮像素子の画素ピッチa[mm/pixel]で割り算すると、ゴミ径は画素数で表記できる。このようにして、絞りがF値のとき、点像のゴミは幅Γの大きさに広がることが予測できる。   When l is divided by the pixel pitch a [mm / pixel] of the image sensor, the dust diameter can be expressed by the number of pixels. In this way, it can be predicted that the dust in the point image spreads to the size of the width Γ when the stop has the F value.

一方、その点像の分布関数は、絞り値内で開口したレンズの各入射角度から均等に点像ゴミに光を当ててゴミ影を広げていると考えられるので、完全に一様な広がりを持つ関数と想定してよい。したがって、F値変換には、フィルタ幅Γ画素で表される一様なローパスフィルタ処理を掛けることによって、ゴミ径と透過率を正確に予測するF値変換が可能となる。ローパスフィルタは直径がΓの円形状の非分離型フィルタが普通と考えられるが、処理の高速化を念頭に、縦Γ、横Γの正方状の分離型フィルタでも問題ない。   On the other hand, the distribution function of the point image is considered to spread the dust shadow by applying light to the point image dust evenly from each incident angle of the lens opened within the aperture value. You can assume that it has a function. Therefore, the F value conversion can be performed to accurately predict the dust diameter and the transmittance by applying a uniform low-pass filter process represented by a filter width Γ pixel. As the low-pass filter, a circular non-separable filter having a diameter of Γ is considered to be normal, but there is no problem with a vertical Γ and horizontal Γ square separated filter in consideration of speeding up the processing.

例えば、l=0.5mm、a=5μm/pixelの場合にF22の透過率マップを、F16、F11、F8、F5.6、F4に変換する場合に当てはめると、正方状の分離型フィルタの一次元フィルタ係数は図15のような形式に表される。図15の一次元フィルタ係数を使用して、縦横それぞれフィルタリングをする。なお、絞り値F16の一次元フィルタ係数は、両端に0.5の係数を持ち、7つの係数を有する。これは、偶数幅の広がりを着目画素を中心に左右上下に均等に広がる奇数幅の範囲でフィルタリングをするためである。図16は、絞り値F16フィルタを2次元フィルタで表した図である。   For example, when l = 0.5 mm and a = 5 μm / pixel, the transmission map of F22 is converted to F16, F11, F8, F5.6, and F4. The original filter coefficient is represented in a format as shown in FIG. Using the one-dimensional filter coefficient of FIG. Note that the one-dimensional filter coefficient of the aperture value F16 has a coefficient of 0.5 at both ends and seven coefficients. This is because the even-width spread is filtered in an odd-width range that spreads evenly in the horizontal and vertical directions around the pixel of interest. FIG. 16 is a diagram illustrating the aperture value F16 filter as a two-dimensional filter.

上記の変換処理を行うことにより、基準画像の透過率マップは、補正対象画像の瞳位置、F値の状態の透過率マップに変換される。すなわち、基準画像の透過率マップは、補正対象画像が撮影される光学的条件下で生成される透過率マップと等価な透過率マップが生成される。   By performing the above conversion process, the transmittance map of the reference image is converted into a transmittance map in the pupil position and F value states of the correction target image. That is, the transmittance map equivalent to the transmittance map generated under the optical condition where the correction target image is captured is generated as the transmittance map of the reference image.

7)透過率マップの閾値判定
ステップS45では、透過率マップの閾値判定を行う。透過率マップのF値変換が行われた場合は、ローパスフィルタ処理によりほとんどゴミ影が消滅しかかっている透過率1に近い画素が多数発生する。これらを鮮明なゴミ影と区別するため、次式(26)(27)により再度閾値判定を行う。ここで、4)の「透過率マップの生成」過程で算出した標準偏差値σを再度利用する。瞳位置、F値変換された透過率マップをT'[i,j]で表す。
if |T'[i,j]-1|≦3σ then T'[i,j]=1 ...(26)
else T'[i,j]=T'[i,j] ...(27)
7) Determination of threshold value of transmittance map In step S45, the threshold value of the transmittance map is determined. When the F value conversion of the transmittance map is performed, a number of pixels close to the transmittance 1 in which dust shadows are almost disappearing are generated by the low-pass filter process. In order to distinguish these from clear dust shadows, threshold determination is performed again using the following equations (26) and (27). Here, the standard deviation value σ calculated in the “transmission map generation” process of 4) is used again. The pupil position and the transmittance map after F-number conversion are represented by T ′ [i, j].
if | T '[i, j] -1 | ≦ 3σ then T' [i, j] = 1 ... (26)
else T '[i, j] = T' [i, j] ... (27)

8)ゴミマップへの変換
ステップS46では、次式(28)(29)により透過率マップを2値化してゴミマップdmap[i,j]に変換する。
if T'[i,j]<1 dmap[i,j]=1 ...(28)
else dmap[i,j]=0 ...(29)
ここで式(28)の判定は、もう少し余裕をもたせてT'[i,j]<0.95のように判定してもよい。
8) Conversion to dust map In step S46, the transmittance map is binarized by the following equations (28) and (29) and converted to a dust map dmap [i, j].
if T '[i, j] <1 dmap [i, j] = 1 ... (28)
else dmap [i, j] = 0 ... (29)
Here, the determination of Expression (28) may be made such that T ′ [i, j] <0.95 with a little more margin.

9)ゴミマップの拡大処理
ステップS47では、次式(30)により瞳位置変換で想定される誤差分だけゴミマップを拡大しておくことにより、許容誤差内の領域にはゴミが含まれるようなゴミマップにする。ここでは、例えば±3画素の誤差を見込む。m=1,2,3、n=1,2,3である。
if dmap[i,j]=1 dmap[i±m,j±n]=1 ...(30)
9) Dust Map Enlarging Process In step S47, the dust map is enlarged by the error assumed in the pupil position conversion by the following equation (30), so that the area within the allowable error includes dust. Make a garbage map. Here, for example, an error of ± 3 pixels is expected. m = 1,2,3 and n = 1,2,3.
if dmap [i, j] = 1 dmap [i ± m, j ± n] = 1 ... (30)

<補正対象画像に対する処理>
1)圧縮画像解凍処理
ステップS49の圧縮画像の解凍処理は、第1の実施の形態の1)と同様である。
<Processing for correction target image>
1) Compressed image decompression process The decompressed image decompression process in step S49 is the same as 1) of the first embodiment.

2)逆ガンマ補正
ステップS50の逆ガンマ補正は、第1の実施の形態の2)と同様である。
2) Inverse gamma correction The inverse gamma correction in step S50 is the same as 2) in the first embodiment.

3)輝度面の生成
ステップS51の輝度面の生成は、第1の実施の形態の3)と同様である。
3) Generation of Luminance Surface The generation of the luminance surface in step S51 is the same as 3) of the first embodiment.

4)エッジマップ生成
ステップS52のエッジマップの生成は、第1の実施の形態の4)と同様である。
4) Edge map generation The generation of the edge map in step S52 is the same as 4) of the first embodiment.

5)エッジマップに暗黒部を追加
ステップS53のエッジマップに暗黒部を追加する処理は、第1の実施の形態の5)と同様である。模式的にこの操作を「EDGE'=EDGE+DARK」と記述すると分かりやすい。
5) Add dark part to edge map The process of adding the dark part to the edge map in step S53 is the same as 5) of the first embodiment. This operation can be easily understood by describing this operation as “EDGE '= EDGE + DARK”.

6)エッジマップからゴミ領域を除外
ステップS54では、エッジマップからゴミ領域を除外する。ゴミ影の多くはコントラストが低いためエッジ抽出されないが、中には大きなゴミでコントラストの高いものがあり、エッジ抽出されてしまうことがある。特に絞り込んで撮影された補正対象画像内で幾つかのゴミ影に発生する。これらのゴミ影がエッジ領域としてゲイン抽出領域の指定から外れることを防ぐため、ステップS46で求めたゴミマップ情報を利用して、次式(31)によりゴミ位置を強制的にエッジ部から除外する処理を行う。ここで、あまり大きくエッジ領域を削ることを防ぐため、ステップS47のゴミマップの拡大処理を行う前のゴミマップを利用することにする。模式的にこの操作を「EDGE''=EDGE+DARK-DUST」と記述すると分かりやすい。
if dmap[i,j]=1 EDGE[i,j]=0 ...(31)
6) Excluding the dust region from the edge map In step S54, the dust region is excluded from the edge map. Most of the dust shadows are not extracted because the contrast is low. However, some of the dust shadows are large dust and have high contrast, and the edges may be extracted. In particular, it occurs in some dust shadows in the correction target image photographed with narrowing down. In order to prevent these dust shadows from deviating from the designation of the gain extraction region as an edge region, the dust position is forcibly excluded from the edge portion by the following equation (31) using the dust map information obtained in step S46. Process. Here, in order to prevent the edge region from being cut off too much, the dust map before the dust map enlargement process in step S47 is used. This operation can be easily understood by describing this operation as “EDGE '' = EDGE + DARK-DUST”.
if dmap [i, j] = 1 EDGE [i, j] = 0 ... (31)

7)エッジマップの拡大処理
ステップS55のエッジマップの拡大処理は、第1の実施の形態のステップS34と同様である。
7) Edge Map Enlargement Process The edge map enlargement process in step S55 is the same as step S34 in the first embodiment.

8)平坦マップへの変換
ステップS56の平坦マップへの変換は、第1の実施の形態のステップS35と同様である。
8) Conversion to flat map The conversion to the flat map in step S56 is the same as step S35 in the first embodiment.

9)自己ゲイン抽出領域の特定
ステップS57では、自己ゲイン抽出領域の特定をする。平坦部でかつゴミ領域と特定されている領域に限定して、ゴミ除去を行うのが補正対象画像の誤った補正を防ぐ観点から最も合理的である。したがって、この両条件を満たす領域情報を次式(32)により求め平坦マップに代入する。すなわち、FLATとdmapに両方に1のフラグが立っている場合のみFLAT=1となり、それ以外はFLAT=0となる。
FLAT[i,j]=FLAT[i,j]*dmap[i,j] ...(32)
9) Identification of self gain extraction region In step S57, the self gain extraction region is identified. It is most reasonable from the viewpoint of preventing erroneous correction of the correction target image to perform dust removal only on a flat part and an area specified as a dust area. Therefore, area information that satisfies both conditions is obtained by the following equation (32) and substituted into the flat map. That is, FLAT = 1 only when 1 is set in both FLAT and dmap, and FLAT = 0 otherwise.
FLAT [i, j] = FLAT [i, j] * dmap [i, j] ... (32)

10)自己ゲイン抽出
ステップS58の自己ゲイン抽出は、第1の実施の形態とは異なり、局所的規格化処理(ゲイン抽出処理)のみ行う。それ以降の透過率マップの統計解析と閾値処理によるゴミ領域限定処理は、前述した「9)自己ゲイン抽出領域の特定」の処理により既にゴミ近傍に限定されているので不要である。局所的規格化処理(ゲイン抽出処理)は、第1の実施の形態と同様である。このように、ステップS47の処理によって瞳位置変換精度の誤差分だけゴミ周辺にゲイン抽出領域を広げてゴミ探索することにより、漏れなくゴミ抽出することが可能となる。
10) Self-Gain Extraction Unlike the first embodiment, the self-gain extraction in step S58 is performed only for the local normalization process (gain extraction process). Subsequent statistical analysis of the transmittance map and dust region limitation processing by threshold processing are unnecessary because they are already limited to the vicinity of dust by the processing of “9) Identification of self-gain extraction region” described above. The local normalization process (gain extraction process) is the same as that in the first embodiment. As described above, by performing the dust search by expanding the gain extraction area around the dust by the error of the pupil position conversion accuracy by the process of step S47, dust can be extracted without omission.

ここで自己抽出した透過率マップに対してローパス処理を行う。T[i,j]の自己抽出した全領域に、本実施の形態で基準画像に対して行った処理と同様なローパス処理をして、T[i,j]に含まれる画素[i,j]のゆらぎ成分を除去する。本実施の形態では、ゴミ位置の局所領域のみに限定して、統計解析による閾値処理を介さないで、自己ゲイン抽出による自己ゲイン補正を行うので、このローパス処理は重要な処理となる。すなわち、ローパス処理前は画素値と透過率値T[i,j]が同じ方向にゆらいでいるため、ローパス処理をしないで後述の自己ゲイン補正すると、画像はその局所領域のみ全体的にのっぺりとなりやすい。そこで、T[i,j]のゆらぎ成分を取り除いてやれば、画素値が持つゆらぎ成分を失わずに済み、周辺部との粒状性の連続性が保てるようになる。これは、特に高感度画像のような乱雑性が多い場合に威力を発揮する。ここで、ローパスフィルタは、基準画像に対するものよりももう少し強めに設計してもかまわないし、ローパスフィルタの影響を受けやすい大きなゴミ部分(T[i,j]の値が1に比べかなり小さい所)だけはローパスフィルタ処理を外すようにしても構わない。   Here, low-pass processing is performed on the self-extracted transmittance map. Low-pass processing similar to the processing performed on the reference image in the present embodiment is performed on all self-extracted regions of T [i, j], and the pixels [i, j included in T [i, j] ] Of the fluctuation component. In the present embodiment, the low-pass process is an important process because the self-gain correction is performed by extracting the self-gain without limiting the threshold value process by statistical analysis only to the local region of the dust position. That is, the pixel value and the transmittance value T [i, j] fluctuate in the same direction before the low-pass processing, so if self-gain correction described later is performed without performing the low-pass processing, the image is entirely covered only in the local region. Cheap. Therefore, if the fluctuation component of T [i, j] is removed, the fluctuation component of the pixel value is not lost, and the continuity of graininess with the peripheral portion can be maintained. This is particularly effective when there is a lot of randomness such as a high-sensitivity image. Here, the low-pass filter may be designed to be a little stronger than that for the reference image, and a large dust portion that is easily affected by the low-pass filter (where T [i, j] is considerably smaller than 1). However, the low-pass filter process may be removed.

11)自己ゲイン補正
ステップS59の自己ゲイン補正は、第1の実施の形態のステップS37と同様である。基準画像の透過率マップの瞳位置変換精度が悪くても、補正対象画像自身からゴミの透過率情報を抽出するので、全くずれのないきれいな補正が可能となる。なお、自己ゲインの抽出は、ステップS57で特定された自己ゲイン抽出領域に限って行われる。従って、補正処理もこの範囲に限ってのみ行われ、処理の負荷が軽減される。
11) Self-gain correction The self-gain correction in step S59 is the same as step S37 in the first embodiment. Even if the pupil position conversion accuracy of the transmittance map of the reference image is poor, the dust transmittance information is extracted from the correction target image itself, so that clean correction without any deviation can be performed. The self-gain extraction is performed only in the self-gain extraction area specified in step S57. Therefore, the correction process is performed only within this range, and the processing load is reduced.

12)ガンマ補正
ステップS60のガンマ補正は、第1の実施の形態のステップS38と同様である。
12) Gamma correction The gamma correction in step S60 is the same as step S38 in the first embodiment.

以上のように、第2の実施の形態では、基準画像のゴミマップ情報を有効に利用することによって、最終出力用にガンマ処理がなされた補正対象画像内の大きなゴミから小さなゴミまであらゆるゴミを漏れなく自己抽出することが可能となる。また、基準画像の透過率マップの瞳位置変換精度が悪い場合においても問題なくゴミの自己抽出が可能となる。さらに、基準画像撮影の撮影者の負荷は非常に小さくて済む。   As described above, in the second embodiment, by effectively using the dust map information of the reference image, it is possible to remove all dust from large dust to small dust in the correction target image that has been subjected to gamma processing for final output. Self-extraction is possible without leakage. In addition, even when the pupil position conversion accuracy of the transmittance map of the reference image is poor, dust can be self-extracted without any problem. Further, the burden on the photographer for the reference image photographing can be very small.

上記説明した第1の実施の形態および第2の実施の形態の画像処理装置では、電子カメラで任意の使用時刻、任意の使用条件で撮影した最終出力用にガンマ処理がなされた画像において生じたゴミ等の影響による黒染み等の欠陥を、適切に補正し、高品質な画像を再現することができる。   In the image processing apparatuses according to the first embodiment and the second embodiment described above, an image is generated in an image that has been subjected to gamma processing for final output that has been taken with an electronic camera at an arbitrary use time and an arbitrary use condition. It is possible to appropriately correct a defect such as a black stain due to the influence of dust or the like and reproduce a high-quality image.

なお、上記第2の実施の形態では、透過率マップを作成するのに、撮影者が一様に近いと考える基準画像を撮影して、その撮影した基準画像に局所的規格処理等を施して透過率マップを作成していた。しかし、撮影者が一様に近いと考える基準画像に小さな模様等がある場合もある。これは、基本的に被写体をボカして撮影することで対処できる。例えば、紙をレンズの最短撮影距離よりも至近位置において撮影したりすればよい。たとえ、小さな模様があっても(2a+1)x(2b+1)サイズのゲイン抽出カーネルより広い範囲でゆるやかに変化する像にボケれば十分に目的を達成することのできる一様に近い基準画像になり得る。   In the second embodiment, in order to create the transmittance map, a reference image that the photographer thinks is almost uniform is photographed, and the photographed reference image is subjected to local standard processing or the like. A transmission map was created. However, there may be a small pattern or the like in the reference image that the photographer thinks is almost uniform. This can be dealt with by basically shooting the subject with a blur. For example, the paper may be photographed at a position closer than the shortest photographing distance of the lens. Even if there is a small pattern, it is almost uniform enough to achieve the purpose if it blurs to an image that changes slowly over a wide range than the gain extraction kernel of (2a + 1) x (2b + 1) size Can be a reference image.

また、上記第2の実施の形態では、ステップS57で自己ゲイン抽出領域の特定をし、ステップS58では限定された範囲で補正を行うようにした。このように補正範囲をゴミ領域を含む周辺範囲(近傍領域)に限定する手法は、上記第1の実施の形態において適用することも可能である。第1の実施の形態では、求められた透過率マップからゴミを特定し、その周辺領域を求めればよい。   In the second embodiment, the self-gain extraction region is specified in step S57, and correction is performed in a limited range in step S58. Thus, the method of limiting the correction range to the peripheral range (neighboring region) including the dust region can also be applied in the first embodiment. In the first embodiment, dust may be identified from the obtained transmittance map and its peripheral area may be obtained.

また、上記実施の形態では、画像圧縮形式としてJPEG、JPEG2000、TIFFのオプション機能を例に挙げて説明したが、ZIPなど、その他あらゆる画像圧縮形式に対しても適用が可能である。また、上記実施の形態では、ガンマ補正により非線形階調に変換された8ビット出力のJPEG,TIFF画像を例に挙げて説明したが、8ビットのBMP、PICT、PNGなどの非線形階調データや16ビットのTIFFにおける非線形階調データなど、その他あらゆる非線形階調データに対してもガンマ特性が特定できるようになっていれば適用可能である。   In the above-described embodiment, the JPEG, JPEG2000, and TIFF optional functions have been described as examples of the image compression format. However, the present invention can be applied to any other image compression format such as ZIP. In the above embodiment, an example of an 8-bit output JPEG or TIFF image converted into a non-linear gradation by gamma correction has been described as an example, but non-linear gradation data such as 8-bit BMP, PICT, or PNG, The present invention is applicable to any other non-linear gradation data such as non-linear gradation data in 16-bit TIFF as long as the gamma characteristic can be specified.

また、上記実施の形態では、ベイア配列のRGB表色系の例を説明したが、最終的に補間処理がなされるものであれば、カラーフィルタの配置方法には全く依存しないことは言うまでもない。また、他の表色系(例えば補色表色系)であっても同様である。   In the above embodiment, an example of the RGB color system of the Bayer array has been described, but it goes without saying that it does not depend on the color filter arrangement method at all as long as interpolation processing is finally performed. The same applies to other color systems (for example, complementary color systems).

また、上記実施の形態では、交換レンズ方式の一眼レフ電子スチルカメラの例を説明したが、必ずしもこの内容に限定する必要はない。非交換レンズ方式のカメラにも本発明は適用できる。瞳位置や絞り値は、適宜公知な手法で取得すればよい。   In the above embodiment, an example of an interchangeable lens type single-lens reflex electronic still camera has been described. However, the present invention is not necessarily limited to this content. The present invention can also be applied to a non-interchangeable lens type camera. What is necessary is just to acquire a pupil position and an aperture value by a well-known method suitably.

また、上記実施の形態では、電子スチルカメラ1で撮影した画像データを処理する例を説明したが、必ずしもこの内容に限定する必要はない。本発明は、動画を扱うビデオカメラで撮影した画像データにも適用できる。また、カメラつき携帯電話などで撮影した画像データにも適用できる。さらに、コピー機やスキャナー等にも適用できる。すなわち、撮像素子を使用して撮像したあらゆる画像データに対して、本発明を適用することができる。   In the above-described embodiment, an example in which image data captured by the electronic still camera 1 is processed has been described. However, the present invention is not necessarily limited to this content. The present invention can also be applied to image data taken by a video camera that handles moving images. It can also be applied to image data taken with a camera-equipped mobile phone. Furthermore, it can be applied to a copying machine, a scanner, and the like. That is, the present invention can be applied to any image data captured using an image sensor.

また、上記実施の形態では、電子カメラ1で撮影した画像データをPC(パソコン)31で処理してゴミの影響を除去する例を説明したが、必ずしもこの内容に限定する必要はない。電子カメラ1上で、そのようなプログラムを備えてもよい。また、プリンターや投影装置などにそのようなプログラムを備えてもよい。すなわち、画像データを扱うあらゆる装置に、本発明は適用することができる。   In the above-described embodiment, an example in which image data captured by the electronic camera 1 is processed by the PC (personal computer) 31 to remove the influence of dust has been described. However, the present invention is not necessarily limited to this content. Such a program may be provided on the electronic camera 1. Further, such a program may be provided in a printer, a projection device, or the like. That is, the present invention can be applied to any apparatus that handles image data.

PC31で実行するプログラムは、CD−ROMなどの記録媒体やインターネットなどのデータ信号を通じて提供することができる。図17はその様子を示す図である。PC31は、CD−ROM34を介してプログラムの提供を受ける。また、PC31は通信回線401との接続機能を有する。コンピュータ402は上記プログラムを提供するサーバーコンピュータであり、ハードディスク403などの記録媒体にプログラムを格納する。通信回線401は、インターネット、パソコン通信などの通信回線、あるいは専用通信回線などである。コンピュータ402はハードディスク403を使用してプログラムを読み出し、通信回線401を介してプログラムをPC31に送信する。すなわち、プログラムをデータ信号として搬送波にのせて、通信回線401を介して送信する。このように、プログラムは、記録媒体や搬送波などの種々の形態のコンピュータ読み込み可能なコンピュータプログラム製品として供給できる。   The program executed on the PC 31 can be provided through a recording medium such as a CD-ROM or a data signal such as the Internet. FIG. 17 is a diagram showing this state. The PC 31 receives a program via the CD-ROM 34. Further, the PC 31 has a connection function with the communication line 401. A computer 402 is a server computer that provides the program, and stores the program in a recording medium such as a hard disk 403. The communication line 401 is a communication line such as the Internet or personal computer communication, or a dedicated communication line. The computer 402 reads the program using the hard disk 403 and transmits the program to the PC 31 via the communication line 401. That is, the program is transmitted as a data signal on a carrier wave via the communication line 401. Thus, the program can be supplied as a computer-readable computer program product in various forms such as a recording medium and a carrier wave.

交換レンズ方式の電子カメラの構成を示す図である。It is a figure which shows the structure of the electronic camera of an interchangeable lens system. 電子カメラのブロック図とパーソナルコンピュータ(PC)および周辺装置を示す図である。1 is a block diagram of an electronic camera, a personal computer (PC), and a peripheral device. 第1の実施の形態における、電子カメラ側の撮影手順について説明する図である。It is a figure explaining the imaging | photography procedure on the electronic camera side in 1st Embodiment. 第1の実施の形態における、PCで行う処理のフローチャートを示す図である。It is a figure which shows the flowchart of the process performed by PC in 1st Embodiment. γ=0.3の時のガンマ曲線Gamma curve when γ = 0.3 γ=1の時のガンマ曲線Gamma curve when γ = 1 γ=0.5の時のガンマ曲線Gamma curve when γ = 0.5 エッジ抽出フィルタを示す図である。It is a figure which shows an edge extraction filter. 輝度面に対して局所的規格化処理を施した様子を示す図である。It is a figure which shows a mode that the local normalization process was performed with respect to the luminance surface. 透過率マップのヒストグラムを示す図である。It is a figure which shows the histogram of a transmittance | permeability map. 第1の実施の形態における、電子カメラ側の撮影手順について説明する図である。It is a figure explaining the imaging | photography procedure on the electronic camera side in 1st Embodiment. 第2の実施の形態における、PCで行う処理のフローチャートを示す図である。It is a figure which shows the flowchart of the process performed by PC in 2nd Embodiment. 瞳位置が変化するとゴミ影の位置が変化する様子を示す図である。It is a figure which shows a mode that the position of a dust shadow changes when a pupil position changes. 絞り値であるF値が変化するとゴミ影の大きさが変化する様子を示す図である。It is a figure which shows a mode that the magnitude | size of a dust shadow changes when F value which is an aperture value changes. 各絞り値に対する一次元フィルタ係数を示す図である。It is a figure which shows the one-dimensional filter coefficient with respect to each aperture value. 絞り値F16における透過率マップに変換するフィルタを2次元フィルタで表した図である。It is the figure which represented the filter converted into the transmittance | permeability map in aperture value F16 with the two-dimensional filter. 第2の実施の形態における、PCで行う処理のフローチャートを示す図である。It is a figure which shows the flowchart of the process performed by PC in 2nd Embodiment.

符号の説明Explanation of symbols

1 電子カメラ
2 カメラ本体
3 可変光学系
4 レンズ
5 絞り
6 シャッター
7 光学部品
8 撮像素子
9 マウント部
12 アナログ信号処理部
13 A/D変換部
14 タイミング制御部
15 画像処理部
16 操作部
17 制御部
18 メモリ
19 圧縮/伸長部
20 表示画像生成部
21、32 モニタ
22 メモリカード用インタフェース部
23 外部インタフェース部
24 バス
30 メモリカード
31 PC(パーソナルコンピュータ)
33 プリンタ
34 CD−ROM
DESCRIPTION OF SYMBOLS 1 Electronic camera 2 Camera main body 3 Variable optical system 4 Lens 5 Aperture 6 Shutter 7 Optical component 8 Imaging element 9 Mount part 12 Analog signal processing part 13 A / D conversion part 14 Timing control part 15 Image processing part 16 Operation part 17 Control part DESCRIPTION OF SYMBOLS 18 Memory 19 Compression / decompression part 20 Display image generation part 21, 32 Monitor 22 Memory card interface part 23 External interface part 24 Bus 30 Memory card 31 PC (personal computer)
33 Printer 34 CD-ROM

Claims (5)

光学系を通して撮像素子により撮影され、平方根特性とは異なる非線形階調処理が施された画像を入力する画像入力手段と、
前記入力された画像内において、着目画素の値と該着目画素を含む所定範囲内の複数の画素の値の平均値とに基づいて、前記画像内に生じた光路途中の欠陥の投影像に関する欠陥情報を作成する欠陥情報作成手段とを備え、
前記欠陥情報作成手段は、画像ファイル内のタグ情報を利用して前記入力画像に施されているガンマ処理の方式を特定し、これに基づいて生成した逆ガンマカーブを用いて、前記入力画像の階調を一旦線形階調に戻した上で、更に平方根特性の非線形階調に変換し、前記平方根特性の非線形階調空間において画像内のエッジ部を検出し、前記検出したエッジ部に基づいて平坦部領域を抽出し、前記抽出した平坦部領域の情報に基づいて、前記画像内の平坦性が保証された領域について、前記平均値を算出することによって前記欠陥情報を作成することを特徴とする画像処理装置。
Image input means for inputting an image captured by an image sensor through an optical system and subjected to nonlinear gradation processing different from the square root characteristic;
In the input image, based on the value of the target pixel and the average value of the values of a plurality of pixels within a predetermined range including the target pixel, a defect related to the projected image of the defect in the middle of the optical path generated in the image A defect information creating means for creating information,
The defect information creating means specifies a gamma processing method applied to the input image using tag information in an image file, and uses an inverse gamma curve generated based on the gamma processing method to identify the input image. After the gradation is once returned to the linear gradation, it is further converted into a non-linear gradation having a square root characteristic, and an edge portion in the image is detected in the non-linear gradation space having the square root characteristic, and based on the detected edge portion The defect information is created by calculating a mean value for a region in which flatness is guaranteed in the image based on the extracted information on the flat portion region. An image processing apparatus.
請求項1に記載の画像処理装置において、
前記欠陥情報作成手段は、前記線形階調に戻された階調空間において、着目画素の値と該着目画素を含む所定範囲内の複数の画素の値の平均値との相対比を算出して前記欠陥情報を作成することを特徴とする画像処理装置。
The image processing apparatus according to claim 1.
The defect information creating means calculates a relative ratio between the value of the pixel of interest and the average value of a plurality of pixels within a predetermined range including the pixel of interest in the gradation space returned to the linear gradation. An image processing apparatus that creates the defect information.
請求項2に記載の画像処理装置において、
前記欠陥情報作成手段で作成した相対比の逆数値を、前記線形階調に戻された階調空間において対応する画素の値に掛け算して欠陥を補正する欠陥補正手段をさらに備えることを特徴とする画像処理装置。
The image processing apparatus according to claim 2,
It further comprises defect correction means for correcting the defect by multiplying the inverse value of the relative ratio created by the defect information creation means by the value of the corresponding pixel in the gradation space returned to the linear gradation. An image processing apparatus.
請求項1〜3のいずれか一項に記載の画像処理装置において、
前記画像入力手段は、JPEG、JPEG2000、またはTIFFへの圧縮処理がなされた圧縮画像に対しては該圧縮を解凍してから入力することを特徴とする画像処理装置。
In the image processing device according to any one of claims 1 to 3,
An image processing apparatus, wherein the image input means inputs a compressed image that has been compressed into JPEG, JPEG2000, or TIFF after decompressing the compressed image.
請求項1〜4のいずれかに記載の画像処理装置の機能をコンピュータに実行させるための画像処理プログラム。
An image processing program for causing a computer to execute the function of the image processing apparatus according to claim 1.
JP2003325507A 2002-12-27 2003-09-18 Image processing apparatus and image processing program Expired - Fee Related JP4438363B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003325507A JP4438363B2 (en) 2002-12-27 2003-09-18 Image processing apparatus and image processing program

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2002379721 2002-12-27
JP2003325507A JP4438363B2 (en) 2002-12-27 2003-09-18 Image processing apparatus and image processing program

Publications (3)

Publication Number Publication Date
JP2004220553A JP2004220553A (en) 2004-08-05
JP2004220553A5 JP2004220553A5 (en) 2006-09-14
JP4438363B2 true JP4438363B2 (en) 2010-03-24

Family

ID=32911256

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003325507A Expired - Fee Related JP4438363B2 (en) 2002-12-27 2003-09-18 Image processing apparatus and image processing program

Country Status (1)

Country Link
JP (1) JP4438363B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018072312A (en) * 2016-10-24 2018-05-10 株式会社デンソーテン Device and method for detecting deposit

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006006373A1 (en) 2004-07-07 2006-01-19 Nikon Corporation Image processor and computer program product
US8073278B2 (en) * 2005-12-27 2011-12-06 Nittoh Kogaku K.K. Image processing device
JP2008245121A (en) * 2007-03-28 2008-10-09 National Univ Corp Shizuoka Univ Imaging apparatus and image sensor device
US8244057B2 (en) 2007-06-06 2012-08-14 Microsoft Corporation Removal of image artifacts from sensor dust
US8654217B2 (en) 2008-05-14 2014-02-18 Nikon Corporation Device and method for detecting dust on an image sensor
JP2011029710A (en) * 2009-07-21 2011-02-10 Nikon Corp Image processor, image processing program, and imaging apparatus
CN101964873B (en) 2009-07-21 2014-08-20 株式会社尼康 Image processing device, image processing program, and imaging device
JP2012173943A (en) * 2011-02-21 2012-09-10 Nikon Corp Device and program for image processing

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018072312A (en) * 2016-10-24 2018-05-10 株式会社デンソーテン Device and method for detecting deposit

Also Published As

Publication number Publication date
JP2004220553A (en) 2004-08-05

Similar Documents

Publication Publication Date Title
JP4186699B2 (en) Imaging apparatus and image processing apparatus
JP4466015B2 (en) Image processing apparatus and image processing program
EP1583356B1 (en) Image processing device and image processing program
JP6833415B2 (en) Image processing equipment, image processing methods, and programs
JP2015156615A (en) Image processing system, image processing method, control program, and recording medium
JP5084366B2 (en) IMAGING DEVICE AND IMAGING DEVICE CONTROL METHOD
JP4419479B2 (en) Image processing apparatus and image processing program
JP4438363B2 (en) Image processing apparatus and image processing program
JP4466017B2 (en) Image processing apparatus and image processing program
JP2004282686A (en) Imaging apparatus
JP4466016B2 (en) Image processing apparatus and image processing program
JP5882644B2 (en) Image processing apparatus, control method thereof, and program
JP2001197354A (en) Digital image pickup device and image restoring method
JP2012003454A (en) Image processing apparatus, imaging device and image processing program
JP2016051982A (en) Image processing system, camera, and image processing program
JP2007158830A (en) Image pickup device and image pickup device control method
JP2015192338A (en) Image processing device and image processing program
JP6348883B2 (en) Image capturing apparatus, image capturing method, and computer program
JP2015233202A (en) Image processing apparatus, image processing method, and program
JP2011135379A (en) Imaging apparatus, imaging method and program
JP4426009B2 (en) Image processing method and apparatus, and recording medium
JP2010067125A (en) Image processing apparatus, method for processing image, and program
JP2017116606A (en) Focus adjustment device, imaging device and program
JP2004159087A (en) Scanner system and image processing program
JP2019176486A (en) Image processing device and image processing program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060712

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060727

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20090513

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20090519

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090717

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20090717

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20090825

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20091013

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

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

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

Free format text: PAYMENT UNTIL: 20130115

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Ref document number: 4438363

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

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

Free format text: PAYMENT UNTIL: 20130115

Year of fee payment: 3

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

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

Free format text: PAYMENT UNTIL: 20130115

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20140115

Year of fee payment: 4

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

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees