JP2014192859A - Color correction method, program, and device - Google Patents

Color correction method, program, and device Download PDF

Info

Publication number
JP2014192859A
JP2014192859A JP2013069332A JP2013069332A JP2014192859A JP 2014192859 A JP2014192859 A JP 2014192859A JP 2013069332 A JP2013069332 A JP 2013069332A JP 2013069332 A JP2013069332 A JP 2013069332A JP 2014192859 A JP2014192859 A JP 2014192859A
Authority
JP
Japan
Prior art keywords
color
image
curve
tone curve
approximate
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.)
Pending
Application number
JP2013069332A
Other languages
Japanese (ja)
Inventor
Mitsumi Miyashita
明珠 宮下
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.)
Kanazawa University NUC
Original Assignee
Kanazawa University NUC
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 Kanazawa University NUC filed Critical Kanazawa University NUC
Priority to JP2013069332A priority Critical patent/JP2014192859A/en
Publication of JP2014192859A publication Critical patent/JP2014192859A/en
Pending legal-status Critical Current

Links

Landscapes

  • Color Image Communication Systems (AREA)
  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a color correction method, etc., having excellent reproducibility of colors closer to actual colors.SOLUTION: The color correction method includes an image acquisition step S10, a tone curve generation step S11, and a correction step S12. The tone curve generation step S11 includes: a first sub-step S20 for plotting, for each of RGB color elements on two-dimensional coordinates, a set of pixel value and ideal value of a pixel targeted for a patch of multiple monochrome gradations on a color chart included in a first image and calculating an approximate linear line in the plot, and a second sub-step S21, etc., for setting a range including all sets in the plot by moving the calculated approximate linear line in parallel and calculating an approximate cubic curve using a set of pixel value and ideal value of a pixel targeted for a patch of multiple color gradations in the color chart so that the approximate cubic curve fits within the set range.

Description

本発明は、RGB(赤、緑及び青)の色要素で表現されるカラーのデジタル画像に対する色補正方法、プログラム及び装置に関する。   The present invention relates to a color correction method, program, and apparatus for color digital images expressed by RGB (red, green, and blue) color elements.

デジタルカメラ等の撮影によって、RGBの色要素で表現されるカラーのデジタル画像が得られる。ところが、カメラによる撮影では、太陽光やLED光等の光源の違い、カメラのレンズの特性にともなう色味の変化等により、実際の色とは違う記録がされてしまう。そのために、撮影によって得られたデジタル画像に対して色補正が行われる。   Color digital images represented by RGB color elements are obtained by photographing with a digital camera or the like. However, when shooting with a camera, recordings different from the actual color are recorded due to differences in light sources such as sunlight and LED light, and changes in color due to the characteristics of the camera lens. Therefore, color correction is performed on the digital image obtained by photographing.

デジタル画像に対する色補正は、編集者が主観に頼ってAdobe Photoshop(アドビシステムズ社の登録商標)等の写真編集ソフトを利用して、カラーバランス等を考慮して手動で調整することができる。このような手動による色補正は、客観性に欠け、実際の色への再現性に乏しい。   The color correction for the digital image can be manually adjusted in consideration of the color balance and the like using photo editing software such as Adobe Photoshop (registered trademark of Adobe Systems) depending on the subjectivity of the editor. Such manual color correction lacks objectivity and reproducibility to actual colors.

そのために、従来、被写体の撮影時に、カラーチャート(色見本)も一緒に撮影しておき、得られたデジタル画像に含まれるカラーチャートでの画素値を用いることで、デジタル画像を自動で色補正する技術が提案されている(例えば、特許文献1、2参照)。   Therefore, conventionally, when a subject is photographed, a color chart (color sample) is also photographed, and the pixel values in the color chart included in the obtained digital image are used to automatically correct the color of the digital image. The technique which performs is proposed (for example, refer patent document 1, 2).

特許文献1では、フィルムにカラーチャートと被写体を撮影しておく。そして、カラーチャートの各色票の色を正しい色に表示させるための係数を演算する。最後に、この係数を用いて被写体の画像データを補正する。これにより、撮影条件に拘らず、常に正しい色の画像を再現できるというものである。   In Patent Document 1, a color chart and a subject are photographed on a film. Then, a coefficient for displaying the color of each color chart of the color chart in a correct color is calculated. Finally, the image data of the subject is corrected using this coefficient. Thus, an image with a correct color can always be reproduced regardless of shooting conditions.

また、特許文献2では、カラーチャートの各パッチの理想RGB値を設定する。そして、撮影したカラーチャートの原画像のR値、G値、B値をそれぞれ表す第1〜第3のトーンカーブを設定する。さらに、各トーンカーブ上に変曲点を設定し、最適値導出手法を繰り返し使用し、変曲点を変位させてトーンカーブを変形し、一定の条件を満たすトーンカーブに基づき、目的画像を色変換する。これにより、デジタルカメラによって撮影された同一の被写体の画像の色を、撮影条件やカメラの種類によらずに、近似した色に再現できるというものである。   In Patent Document 2, an ideal RGB value for each patch of the color chart is set. Then, first to third tone curves representing the R value, G value, and B value of the original image of the photographed color chart are set. Furthermore, an inflection point is set on each tone curve, the optimal value derivation method is repeatedly used, the tone curve is deformed by displacing the inflection point, and the target image is colored based on the tone curve that satisfies a certain condition. Convert. Thereby, the color of the image of the same subject photographed by the digital camera can be reproduced to an approximate color regardless of the photographing condition and the type of camera.

特開平6−46448号公報Japanese Patent Laid-Open No. 6-46448 特開2002−281521号公報JP 2002-281521 A

しかしながら、上記特許文献1、2での色補正では、目的画像に対して、撮影条件やカメラの種類によらずに近似した色に再現できるものの、実際の色への再現性において必ずしも十分ではないと考えられる。それは、特許文献1ではグレースケールを他のカラーとして区別していないこと、特許文献2では白・黒という白飛びや黒つぶれによって同色内でも数値のばらつきが最も多いとされる2色に重点をおいて補正を行っているからである。   However, although the color correction described in Patent Documents 1 and 2 can reproduce the target image with an approximate color regardless of the shooting conditions and the type of camera, it is not always sufficient in reproducibility to an actual color. it is conceivable that. In Patent Document 1, the gray scale is not distinguished as another color, and in Patent Document 2, emphasis is placed on two colors that are considered to have the largest variation in numerical values even within the same color due to white and black skipping or blackout. This is because correction is performed in the above.

そこで、本発明は、このような問題に鑑みてなされたものであり、より実際の色への再現性に優れた色補正方法、プログラム及び装置を提供することを目的とする。   Accordingly, the present invention has been made in view of such problems, and an object thereof is to provide a color correction method, program, and apparatus that are more excellent in reproducibility to actual colors.

上記目的を達成するために、本発明に係る色補正方法の一形態は、RGB(赤、緑及び青)の色要素で表現されるカラーのデジタル画像に対する色補正方法であって、カラー及びモノクロの複数の階調のパッチから構成されるカラーチャートと共に被写体が撮影されて生成されたデジタル画像である第1画像を取得する画像取得ステップと、取得された前記第1画像に含まれるカラーチャートのパッチを構成する画素の画素値と当該画素の理想値とを用いて、前記RGBの色要素のそれぞれについて、前記第1画像の色を補正するのに用いられる第1トーンカーブを生成するトーンカーブ生成ステップと、生成された前記第1トーンカーブを用いて、前記第1画像を色補正する補正ステップとを含み、前記トーンカーブ生成ステップは、前記RGBの色要素のそれぞれについて、前記第1画像に含まれる前記カラーチャートにおけるモノクロの複数の階調のパッチを対象として画素の画素値と理想値との組を2次元座標上にプロットし、前記プロットにおける近似1次直線を算出する第1サブステップと、算出された前記近似1次直線を平行移動させることで、前記プロットにおけるすべての組が含まれる範囲を設定し、設定した範囲内に近似3次曲線が入るように、前記カラーチャートにおけるカラーの複数の階調のパッチを対象とした画素の画素値と理想値との組を用いた近似3次曲線を算出する第2サブステップと、算出された前記近似3次曲線を前記第1トーンカーブとして出力する第3サブステップとを含む。   In order to achieve the above object, one aspect of the color correction method according to the present invention is a color correction method for a color digital image expressed by RGB (red, green, and blue) color elements. An image acquisition step of acquiring a first image which is a digital image generated by photographing a subject together with a color chart composed of a plurality of gradation patches, and a color chart included in the acquired first image A tone curve for generating a first tone curve used for correcting the color of the first image for each of the RGB color elements, using the pixel value of the pixel constituting the patch and the ideal value of the pixel. A generation step; and a correction step for correcting the color of the first image using the generated first tone curve, wherein the tone curve generation step includes: For each color element of GB, a set of pixel values and ideal values of pixels is plotted on a two-dimensional coordinate for a plurality of monochrome patches in the color chart included in the first image, The first sub-step for calculating the approximate primary line in the plot and the calculated approximate primary line are translated to set a range that includes all the sets in the plot, and is approximated within the set range. A second sub-step of calculating an approximate cubic curve using a set of pixel values and ideal values of pixels for a plurality of color patches in the color chart so that a cubic curve is included; And a third sub-step of outputting the calculated approximate cubic curve as the first tone curve.

これにより、第1処理部によって、カラーチャートでのグレースケールを用いた近似1次直線が算出されるので、グレースケールでのカラーバランスを整えながら、全体の明るさを調整する色補正が可能になる。そして、第2処理部によって、グレースケールのすべての点(画素値と理想値との組)が含まれる範囲に曲線が入るように、カラーの点(画素値と理想値との組)を用いた近似3次曲線が算出されるので、第1処理部14aで整えられたカラーバランスを保ちながら誤差を小さくする色補正が可能になる。このようなグレースケールだけによる明るさの調整と、その結果を維持したうえでのカラーを用いた微調整の2段階によるトーンカーブの生成により、従来よりも実際の色への再現性に優れた色補正が可能になる。   As a result, the first processing unit calculates an approximate linear line using the gray scale in the color chart, so that it is possible to perform color correction that adjusts the overall brightness while adjusting the color balance in the gray scale. Become. Then, the second processing unit uses color points (a pair of pixel values and ideal values) so that a curve enters a range that includes all the points of gray scale (a pair of pixel values and ideal values). Since the approximated cubic curve is calculated, it is possible to perform color correction that reduces the error while maintaining the color balance adjusted by the first processing unit 14a. By creating a tone curve in two steps, brightness adjustment using only gray scale and fine adjustment using color while maintaining the result, the reproducibility to actual colors is better than before. Color correction is possible.

ここで、前記画像取得ステップではさらに、前記第1画像の生成における撮影と同じ撮影条件で被写体が撮影されて生成されたデジタル画像である少なくとも1つの第2画像を取得し、前記トーンカーブ生成ステップでは、前記第1画像に含まれるカラーチャートを用いて、前記色要素のそれぞれごとに、前記第2画像の色を補正するのに用いられる第2トーンカーブを生成し、前記補正ステップでは、生成された前記第2トーンカーブを用いて、前記第2画像を色補正してもよい。   Here, in the image acquisition step, at least one second image, which is a digital image generated by shooting a subject under the same shooting conditions as the shooting in the generation of the first image, is acquired, and the tone curve generation step Then, using the color chart included in the first image, a second tone curve used for correcting the color of the second image is generated for each of the color elements. The second image may be color corrected using the second tone curve.

これにより、カラーチャートと共に撮影されていないデジタル画像であっても、同様の色補正が可能になる。   This makes it possible to perform similar color correction even for digital images that have not been photographed together with a color chart.

また、前記第3サブステップでは、前記RGBの色要素のそれぞれについて、前記第2サブステップで算出された前記近似3次曲線における白飛び及び黒つぶれの割合が小さくなるように、前記近似3次曲線を前記2次元座標における前記理想値の軸方向にシフトさせ、得られた前記近似3次曲線を前記第1トーンカーブとして生成してもよい。より具体的には、前記第3サブステップでは、前記RGBの色要素のそれぞれに対する前記近似3次曲線における白飛び及び黒つぶれの割合の合計が最小となるように、前記RGBの色要素のそれぞれに対する前記近似3次曲線を同じようにシフトさせてもよい。   In the third sub-step, for each of the RGB color elements, the approximate cubic is such that the ratio of whiteout and blackout in the approximate cubic curve calculated in the second substep is small. A curve may be shifted in the axial direction of the ideal value in the two-dimensional coordinates, and the obtained approximate cubic curve may be generated as the first tone curve. More specifically, in the third sub-step, each of the RGB color elements is set such that the sum of the ratios of whiteout and blackout in the approximate cubic curve with respect to each of the RGB color elements is minimized. The approximate cubic curve for can be shifted in the same way.

これにより、第1トーンカーブにおける白飛び及び黒つぶれがある場合に、デジタル画像の明るい部分や暗い部分の色情報が損失してしまい、色補正によって実際の色に再現できないという不具合が回避される。つまり、カラーバランスを維持したまま、全体の明るさを調整することで色情報の損失を防ぐことができる。   As a result, in the case where there are whiteout and blackout in the first tone curve, the color information of the bright part and dark part of the digital image is lost, and the problem that the actual color cannot be reproduced by color correction is avoided. . That is, loss of color information can be prevented by adjusting the overall brightness while maintaining the color balance.

また、さらに、前記第1画像における前記カラーチャートの位置をユーザから取得するカラーチャート位置認識ステップを含み、前記第1画像に含まれる前記カラーチャートのパッチを構成する画素の画素値については、前記カラーチャート位置認識ステップで取得された位置に基づいて前記カラーチャートの前記第1画像における位置が特定され、特定された前記カラーチャートの位置と、予め定められた前記カラーチャートと前記パッチとの位置関係とを用いることで前記パッチの位置が特定され、特定された前記パッチの位置に基づいて前記パッチを構成する画素の画素値が特定されてもよい。   Further, the image processing method further includes a color chart position recognition step of acquiring the position of the color chart in the first image from a user, and the pixel values of the pixels constituting the patch of the color chart included in the first image are The position of the color chart in the first image is specified based on the position acquired in the color chart position recognition step, the position of the specified color chart, and the predetermined position of the color chart and the patch The position of the patch may be specified by using the relationship, and the pixel value of the pixel constituting the patch may be specified based on the specified position of the patch.

これにより、カラーチャートの位置を指示するだけで、個々のパッチの位置が認識されるので、個々のパッチの画素値を取得する処理が自動化される。   As a result, the position of each patch is recognized only by indicating the position of the color chart, and thus the process of acquiring the pixel value of each patch is automated.

なお、本発明は、以上のような色補正方法として実現できるだけでなく、色補正方法をコンピュータに実行させるプログラムとして実現したり、そのプログラムが格納されたCD−ROM等のコンピュータ読み取り可能な記録媒体として実現したり、プログラム及びそのプログラムを実行するCPU等によって実現される色補正装置として実現したりすることもできる。   The present invention can be realized not only as a color correction method as described above, but also as a program for causing a computer to execute the color correction method, or a computer-readable recording medium such as a CD-ROM storing the program. Or a color correction device realized by a program and a CPU that executes the program.

本発明に係る色補正方法、プログラム及び装置により、撮影によって得られたカラーのデジタル画像に対して、論理的かつ客観的に自動で色補正が実行され、従来よりも高い精度で実際の色が再現される。   The color correction method, program, and apparatus according to the present invention automatically and logically and objectively perform color correction on a color digital image obtained by photographing, so that an actual color can be obtained with higher accuracy than before. It is reproduced.

よって、デジタル画像の高精細化が進んできた今日における本発明の意義は極めて高い。   Therefore, the significance of the present invention in the present day when high definition of digital images has progressed is extremely high.

本発明の実施の形態で使用されるカラーチャートの例を示す図The figure which shows the example of the color chart used by embodiment of this invention 本発明の実施の形態における色補正の対象となるデジタル画像(写真)の例を示す図The figure which shows the example of the digital image (photograph) used as the object of the color correction in embodiment of this invention 図2の写真に写っているカラーチャートの各パッチの画素値と理想値との対応(点)をプロットした図A plot of the correspondence (points) between pixel values and ideal values of each patch in the color chart shown in the photograph of FIG. 図2の写真に写っているカラーチャートの24色のパッチの画素値と理想値との違いを示す図The figure which shows the difference between the pixel value of the 24 color patch of the color chart reflected in the photograph of FIG. 2, and an ideal value 図2の写真に写っているカラーチャートのグレースケールにおける色のバランスを示す図The figure which shows the color balance in the gray scale of the color chart reflected in the photograph of FIG. 本発明の実施の形態における色補正装置の機能構成を示すブロック図The block diagram which shows the function structure of the color correction apparatus in embodiment of this invention 同色補正装置によるカラーチャート及びパッチの位置認識処理を説明する図The figure explaining the position recognition process of the color chart and patch by the same color correction apparatus 同色補正装置の動作を示すフローチャートFlow chart showing the operation of the same color correction device 図8Aにおけるトーンカーブ生成ステップの詳細を示すフローチャートFIG. 8A is a flowchart showing details of the tone curve generation step. 同色補正装置の第1処理部によって算出された近似1次直線の例を示す図The figure which shows the example of the approximate primary straight line computed by the 1st process part of the same color correction apparatus 同色補正装置の第2処理部によって算出された近似3次曲線の例を示す図The figure which shows the example of the approximate cubic curve calculated by the 2nd process part of the same color correction apparatus 同色補正装置の第3処理部による処理の例を示す図The figure which shows the example of the process by the 3rd process part of the same color correction apparatus 同色補正装置によって補正された画像の分析結果を示す図The figure which shows the analysis result of the image correct | amended by the same color correction apparatus

(本発明の基礎となった知見)
本発明に係る色補正方法、プログラム及び装置の具体的な態様を説明する前に、まず、本発明の基礎となった知見を説明する。
(Knowledge that became the basis of the present invention)
Before describing specific aspects of the color correction method, program, and apparatus according to the present invention, first, knowledge that is the basis of the present invention will be described.

本発明者は、デジタルカメラで被写体と共に図1に示されるカラーチャートを撮影することで得られた4000万画素のデジタル画像(以下、デジタル画像を「写真」ともいう。)に含まれるカラーチャートのRGBのそれぞれにおける実際のRGB値(理想値)と写真のRGB値(画素値)との違いを分析した。分析に用いられた写真は、例えば、図2に示されるような写真である。なお、本明細書において、「実際の色(RGB値)」とは、現実の被写体及びカラーチャートの色(RBG値)、つまり、理想値を指す。ここで、RGB値(あるいは、画素値)は、各色の明度であり、本実施の形態では、0〜255までの256段階で表わされる。たとえば、3色すべてが0なら黒、すべてが255なら白となる。   The inventor of the present invention uses a digital camera that captures a color chart shown in FIG. 1 together with a subject to obtain a 40-megapixel digital image (hereinafter, the digital image is also referred to as a “photograph”). The difference between the actual RGB value (ideal value) and the RGB value (pixel value) of the photograph was analyzed. The photograph used for the analysis is, for example, a photograph as shown in FIG. In this specification, “actual color (RGB value)” refers to the color (RBG value) of an actual subject and a color chart, that is, an ideal value. Here, the RGB value (or pixel value) is the brightness of each color, and is expressed in 256 levels from 0 to 255 in the present embodiment. For example, if all three colors are 0, it is black, and if all three colors are 255, it is white.

なお、ここで使用したカラーチャートは、図1に示されるように、グレースケール6階調のパッチとR,G,Bのそれぞれ6階調を組み合わせて作られた18色のパッチ(合計24個のパッチ)から構成されるX−Rite社のものである。また、カラーチャートにおける実際のRGB値(理想値)は、カラーチャートに付随しているデータシートに記載されている値を使用した。デジタルカメラとして、PENTAX社の645Dを使用した。分析には、数値計算ソフトMATLAB(MathWorks社の登録商標)を用いた。   In addition, as shown in FIG. 1, the color chart used here is a patch of gray color with 6 gradations and 18 color patches made by combining 6 gradations of R, G, and B (a total of 24 patches). X-Rite Corporation. The actual RGB values (ideal values) in the color chart were the values described in the data sheet attached to the color chart. As a digital camera, PENTAX 645D was used. For the analysis, numerical calculation software MATLAB (registered trademark of MathWorks) was used.

図3は、RGBの色要素ごとに(図3の(a)は赤、図3の(b)は緑、図3の(c)青)、写真に写っているカラーチャートの各パッチを構成する画素の画素値と当該画素の理想値との対応(点)をプロットした図である。ここで、X軸は画素値、Y軸はその理想値である。RGBの色要素ごとに、合計24個のパッチに対応する24個の点がプロットされている。なお、一つのパッチを構成する画素の画素値は、代表値であり、例えば、当該パッチに属する複数の画素の画素値の平均である。以下、「一つのパッチを構成する画素の画素値(あるいは、単に「一つのパッチの画素値」)」とは、当該パッチの画素値の代表値を意味する。図3の(a)〜(c)のそれぞれにおいて示されている直線は、参考用の直線であり、X座標値とY座標値とが同じとなる点の集合である(以下、この直線を「理想直線」と呼ぶ)。写真の色が実際のカラーチャートの色と同じである場合には、上記点は、この直線上にプロットされることになる。   FIG. 3 shows each patch of the color chart shown in the photograph for each RGB color element ((a) in FIG. 3 is red, (b) in FIG. 3 is green, (c) blue in FIG. 3)). It is the figure which plotted correspondence (point) with the pixel value of a pixel to perform, and the ideal value of the pixel concerned. Here, the X axis is the pixel value, and the Y axis is the ideal value. For each RGB color element, 24 points corresponding to a total of 24 patches are plotted. In addition, the pixel value of the pixel which comprises one patch is a representative value, for example, is the average of the pixel value of the some pixel which belongs to the said patch. Hereinafter, “a pixel value of a pixel constituting one patch (or simply“ a pixel value of one patch ”)” represents a representative value of the pixel value of the patch. The straight lines shown in each of FIGS. 3A to 3C are reference straight lines, and are a set of points where the X coordinate value and the Y coordinate value are the same (hereinafter, this straight line is referred to as a straight line). Called "ideal straight line"). If the color of the photograph is the same as the color of the actual color chart, the points will be plotted on this straight line.

本図から、RGBのどの要素においても写真の画素値が理想値よりも低くなっており、全体に暗く(明度が低く)なっていることがわかる。また、3色を比較すると、青の方が各点の位置が理想直線に近いことから、全体として赤と緑の要素による違いが実際の色との違いを大きくしている要因ではないかと考えられる。しかし、赤と緑の点がほぼ一直線上に並んでいるのに対し、青の点の位置にはばらつきがあることから、とくに青は補正が難しいことがうかがえる。   From this figure, it can be seen that the pixel value of the photograph is lower than the ideal value in any element of RGB, and is dark overall (low brightness). Also, comparing the three colors, the position of each point in blue is closer to the ideal straight line, so the difference between the red and green elements as a whole may be a factor that increases the difference from the actual color. It is done. However, while the red and green dots are aligned in a straight line, the positions of the blue dots vary, indicating that blue is particularly difficult to correct.

ところで、グレースケール(モノクロの階調)によって、RGBの3要素での色のバランスを評価することができる。グレースケールは白と黒との混色で得られた色(白と黒自体も含む)であり、無彩色と同義である。無彩色とは彩度が0で、RGBで表現すると各要素の値がみな同じ(R値=G値=B値)でなければならない。以下の表1は、上記写真における6段階のグレースケールで見る色のバランスを示している。つまり、上記写真に写ったカラーチャートのモノクロにおける6種類のパッチごとに、RGB値(画素値)、及び、そのパッチにおけるRBG値の最大値と最小値との差が示されている。   By the way, the color balance of the three elements of RGB can be evaluated by the gray scale (monochrome gradation). The gray scale is a color obtained by mixing white and black (including white and black itself) and is synonymous with an achromatic color. An achromatic color has a saturation of 0, and when expressed in RGB, the values of each element must all be the same (R value = G value = B value). Table 1 below shows the color balance seen in the six-step gray scale in the above picture. That is, for each of the six types of patches in monochrome of the color chart shown in the photograph, the RGB value (pixel value) and the difference between the maximum value and the minimum value of the RBG value in the patch are shown.

表1では、どの色においても各要素の値は異なり、赤が低く、青が高くなっている。また、明度が低くなる(白から黒になる)につれて、その差は小さくなっていることがわかる。このことから、写真は全体に青みがかっており、その傾向は明るい部分ほど顕著であると言える。   In Table 1, the value of each element is different for any color, with red being low and blue being high. It can also be seen that the difference decreases as the brightness decreases (from white to black). From this, it can be said that the photograph is bluish as a whole, and the tendency is more prominent in the bright part.

図4は、RGBの色要素ごとに(図4の(a)及び(d)は赤、図4の(b)及び(e)は緑、図4の(c)及び(f)は青)、上記写真に写ったカラーチャートの24色のパッチにおける画素値と理想値との違いを示す図である。つまり、図4の(a)〜(c)は、それぞれ、図3の(a)〜(c)に対応する。ただし、図4の(a)〜(c)には、図3における理想直線に加えて、理想直線と平行する、24個の点から最小二乗法等によって定まる近似1次直線も描かれている。また、図4の(d)〜(f)は、画素値ごとの度数分布(100分率)を示すヒストグラムである。横軸は画素値を示し、縦軸は100分率を示す。   FIG. 4 shows each color element of RGB (FIGS. 4A and 4D are red, FIGS. 4B and 4E are green, and FIGS. 4C and 4F are blue). FIG. 10 is a diagram illustrating a difference between a pixel value and an ideal value in a patch of 24 colors of the color chart shown in the photograph. That is, (a) to (c) in FIG. 4 correspond to (a) to (c) in FIG. 3, respectively. However, in FIGS. 4A to 4C, in addition to the ideal straight line in FIG. 3, approximate linear lines determined by the least square method or the like from 24 points parallel to the ideal straight line are also drawn. . Also, (d) to (f) in FIG. 4 are histograms showing the frequency distribution (100 fraction) for each pixel value. The horizontal axis indicates the pixel value, and the vertical axis indicates the 100 fraction.

図4の(a)〜(c)から、次のことが分かる。図4の(a)〜(c)における近似1次直線と理想直線とは、いずれも、画素値と理想値とが等しい値を通る直線であることから、これら2本の直線間の距離から、明度による色のバランスと、実際と写真との明度を比較することができる。RGBの3要素すべてにおいて、理想直線よりも近似1次直線が上にあることから、全体的に写真の方が実際よりも暗いことがわかる。その程度については、実際と写真との差の平均値として表される。赤では約60、緑では約50、青では約27と3色で異なっている。また、24点の位置と近似1次直線の位置との関係について着目してみると、RBGの3要素すべてにおいて、画素値(明度)の低い範囲では近似1次直線より下に多くの点があり、画素値の高い範囲では近似1次直線より上に多く点がある。このことから、写真の暗い部分は実際よりもさらに暗くなっており、明るい部分は実際よりさらに明るくなっていると言える。   From (a) to (c) of FIG. Since the approximate primary straight line and the ideal straight line in FIGS. 4A to 4C are both straight lines through which the pixel value and the ideal value pass the same value, the distance between these two straight lines is calculated. It is possible to compare the color balance according to lightness and the lightness between actual and photograph. Since all of the three elements of RGB have an approximate primary line above the ideal line, it can be seen that the picture is darker than the actual one. The degree is expressed as an average value of the difference between actual and photograph. There are three colors, about 60 for red, about 50 for green, and about 27 for blue. When attention is paid to the relationship between the position of the 24 points and the position of the approximate primary line, in all three elements of the RBG, many points are below the approximate primary line in the low pixel value (lightness) range. There are many points above the approximate linear line in the high pixel value range. From this, it can be said that the dark part of the photograph is darker than the actual part, and the bright part is brighter than the actual part.

一方、図4の(d)〜(f)から、次のことが分かる。RGBの3要素すべてにおいて、いくつかのピークが見られるが、値の低い範囲と高い範囲ではその画素値が占める個数の割合(100分率)は限りなく0に近くなっている。ここで、色補正はカラーチャートにある色を元に行うので、その色が占める割合と、その割合から全体として誤差がどのくらいあるかを数値で示すと、次の通りである。つまり、カラーチャートの色が全体を占める割合は、赤が約11%、緑が15%、青が約12%となっている。写真全体に見る誤差は、赤で3.7、緑で1.5、青で6.5であった。図4の(a)〜(c)に示された誤差は、赤が約10.5、緑が約3.2、青が約4.6となっている。このことから、赤と緑については、図4の(a)、(b)の誤差よりも図4の(d)、(e)の誤差の方が約半分と小さくなっており、全体の占める割合が小さい値で誤差が大きく、占める割合が大きい値で誤差が小さいといえる。一方、青については、図4の(c)の誤差に比べて、図4の(f)の誤差が1.4倍に大きくなっており、これは逆に全体の占める割合が大きいところで誤差が大きいと考えられる。   On the other hand, the following can be understood from FIGS. Several peaks are observed in all three elements of RGB, but the ratio (100 fraction) of the number of pixel values in the low value range and the high value range is almost zero. Here, since the color correction is performed based on the color in the color chart, the ratio occupied by the color and the amount of error as a whole from the ratio are expressed numerically as follows. That is, the proportion of the color chart color is about 11% for red, 15% for green, and about 12% for blue. The errors seen in the entire photo were 3.7 for red, 1.5 for green, and 6.5 for blue. The errors shown in FIGS. 4A to 4C are about 10.5 for red, about 3.2 for green, and about 4.6 for blue. Therefore, for red and green, the errors in (d) and (e) in FIG. 4 are about half smaller than the errors in (a) and (b) in FIG. It can be said that the error is large when the ratio is small and the error is small when the ratio is large. On the other hand, for blue, the error of (f) of FIG. 4 is 1.4 times larger than the error of (c) of FIG. It is considered large.

図5は、上記写真に写ったカラーチャートのグレースケール(モノクロの6色のパッチ)における色のバランスを示す図である。ここで、上段(図5の(a)〜(f))、中段(図5の(g)〜(l))、下段(図5の(m)〜(r))は、それぞれ、R、G、Bの値であり、左から右に、白から黒に向かうグレースケールの6色に対応して区切られている。それぞれの図は各色で示した値の画素数がヒストグラム(横軸が画素値、縦軸が度数(100分率))で表示されている。本図から分かるように、どの色の要素においても値の幅は約20であり、そのピークは15%を超える正規分布の形をしている。このことから、同色でのばらつきが少なく、各色1点を代表値にすることが可能であることを裏付けている。また、それぞれの色を見ると、どの色においても各要素の値は異なり、赤が低く、青が高くなっている。その結果は、図4に示された実際と写真との差の平均値に現れた結果と同じである。また、明度が低くなる(白から黒になる)につれて、その差は小さくなっていることもわかる。   FIG. 5 is a diagram showing the color balance in the gray scale (monochrome six-color patch) of the color chart shown in the photograph. Here, the upper stage ((a) to (f) in FIG. 5), the middle stage ((g) to (l) in FIG. 5), and the lower stage ((m) to (r) in FIG. 5) are R, G and B values, which are separated from left to right and corresponding to six gray scale colors from white to black. In each figure, the number of pixels of the value indicated by each color is displayed as a histogram (the horizontal axis is the pixel value, and the vertical axis is the frequency (100 fraction)). As can be seen from the figure, the width of the value is about 20 for each color element, and its peak is in the form of a normal distribution exceeding 15%. This confirms that there is little variation in the same color and that one point of each color can be set as a representative value. In addition, when looking at each color, the value of each element is different in any color, with red being low and blue being high. The result is the same as the result shown in the average value of the difference between the actual image and the photograph shown in FIG. It can also be seen that the difference decreases as the brightness decreases (from white to black).

以上の分析結果から、写真の編集において、実際のカラーチャートの値に近づけるための色補正には、(1)全体の明るさ(どの色要素も明るくするが、その程度は赤、緑、青の順に小さくする)の調整、(2)(1)によって生じたカラーバランスを維持しながら誤差をできるだけ小さくする微調整(とくにR,Gにおいては全体で占める割合が大きい部分の誤差は小さかったので、その値を維持し、全体の占める割合の小さい値について誤差を小さくする)、という2つが必要であることがわかる。   From the above analysis results, when editing a photo, color correction to approximate the values of the actual color chart is as follows: (1) Overall brightness (all color elements are brightened, but the extent is red, green, blue (2) The fine adjustment to reduce the error as much as possible while maintaining the color balance caused by (1) (particularly in R and G, the error in the portion that occupied a large proportion was small) It is understood that the following two are necessary: maintaining the value and reducing the error with respect to the value with a small proportion of the whole).

以上の知見に基づいて、本発明者は、カラーのデジタル画像に対して、論理的かつ客観的に自動で色補正を行ない、従来よりも高い精度で実際の色を再現できる色補正方法、プログラム及び装置を考案したので、以下、その実施の形態について、図面を参照しながら説明する。なお、各図は、模式図であり、必ずしも厳密に図示したものではない。   Based on the above knowledge, the present inventor performs color correction automatically and logically and objectively on color digital images, and a color correction method and program capable of reproducing actual colors with higher accuracy than before. In the following, embodiments of the present invention will be described with reference to the drawings. Each figure is a schematic diagram and is not necessarily illustrated exactly.

また、以下で説明する実施の形態は、本発明に係る色補正方法、プログラム及び装置の一具体例を示すものである。以下の実施の形態で示される数値、構成要素、構成要素の配置位置及び接続形態などは一例であり、本発明に係る色補正方法、プログラム及び装置を限定する主旨ではない。また、以下の実施の形態における構成要素のうち、独立請求項に記載されていない構成要素については、任意の構成要素として説明される。   The embodiment described below shows a specific example of the color correction method, program, and apparatus according to the present invention. The numerical values, components, arrangement positions and connection forms of the components shown in the following embodiments are examples, and are not intended to limit the color correction method, program, and apparatus according to the present invention. In addition, among the constituent elements in the following embodiments, constituent elements that are not described in the independent claims are described as arbitrary constituent elements.

図6は、本発明の実施の形態における色補正装置10の機能構成を示すブロック図である。この色補正装置10は、RGBの色要素で表現されるカラーのデジタル画像(写真)に対して色補正を行う装置であって、入力部11、制御部12、表示部16、及び、記憶部17を備える。なお、本図には、写真を取得する先となるデータ源の例として、デジタルカメラ20も併せて図示されている。   FIG. 6 is a block diagram showing a functional configuration of the color correction apparatus 10 according to the embodiment of the present invention. The color correction device 10 is a device that performs color correction on a color digital image (photograph) expressed by RGB color elements, and includes an input unit 11, a control unit 12, a display unit 16, and a storage unit. 17. In the figure, a digital camera 20 is also shown as an example of a data source from which a photograph is acquired.

入力部11は、ユーザからの指示を取得する入力デバイスであり、例えば、マウス、キーボード等である。   The input unit 11 is an input device that acquires an instruction from the user, and is, for example, a mouse, a keyboard, or the like.

表示部16は、補正の前後における写真、色補正装置10で得られる分析結果等を表示するディスプレイであり、例えば、LCD等である。   The display unit 16 is a display that displays photographs before and after correction, analysis results obtained by the color correction apparatus 10, and the like, for example, an LCD.

記憶部17は、補正の前後における写真、一時的に発生するデータ等を格納するメモリであり、例えば、HDD(Hard Disk Drive)等の不揮発性メモリ等である。   The storage unit 17 is a memory that stores photographs before and after correction, data that is temporarily generated, and the like, for example, a nonvolatile memory such as an HDD (Hard Disk Drive).

制御部12は、デジタルカメラ20から取得した写真に対して色補正を行う処理部であり、画像取得部13、トーンカーブ生成部14、及び、補正部15を有する。この制御部12は、例えば、制御プログラムと、その制御プログラムを実行するCPU等を有するパーソナルコンピュータ(PC)によって実現される。具体的には、上述したMATLAB(MathWorks社の登録商標)を用いて色補正用プログラムを作成し、MATLAB(MathWorks社の登録商標)がインストールされたコンピュータで色補正用プログラムを実行することで実現してもよいし、作成した色補正用プログラムをMATLAB(MathWorks社の登録商標)のコンパイラを用いて独立したアプリケーションプログラムに変換し、変換後のアプリケーションプログラムを一般のコンピュータで実行することで実現してもよい。   The control unit 12 is a processing unit that performs color correction on a photograph acquired from the digital camera 20, and includes an image acquisition unit 13, a tone curve generation unit 14, and a correction unit 15. The control unit 12 is realized by, for example, a personal computer (PC) having a control program and a CPU that executes the control program. Specifically, it is realized by creating a color correction program using the above-mentioned MATLAB (registered trademark of MathWorks) and executing the color correction program on a computer on which MATLAB (registered trademark of MathWorks) is installed. Alternatively, the created color correction program is converted into an independent application program using a MATLAB (registered trademark of MathWorks), and the converted application program is executed on a general computer. May be.

画像取得部13は、カラー及びモノクロの複数のパッチから構成されるカラーチャートと共に被写体が撮影されて生成されたデジタル画像(写真)である第1画像を取得する。ここでは、画像取得部13は、デジタルカメラ20から写真を取得する。   The image acquisition unit 13 acquires a first image that is a digital image (photograph) generated by photographing a subject together with a color chart composed of a plurality of color and monochrome patches. Here, the image acquisition unit 13 acquires a photo from the digital camera 20.

トーンカーブ生成部14は、画像取得部13で取得された第1画像に含まれるカラーチャートのパッチを構成する画素の画素値と当該画素の理想値とを用いて、RGBの色要素のそれぞれについて、第1画像の色を補正するのに用いられる第1トーンカーブを生成する処理部であり、第1処理部14a、第2処理部14b及び第3処理部14cを有する。   The tone curve generation unit 14 uses the pixel values of the pixels constituting the patch of the color chart included in the first image acquired by the image acquisition unit 13 and the ideal values of the pixels for each of the RGB color elements. A processing unit that generates a first tone curve used to correct the color of the first image, and includes a first processing unit 14a, a second processing unit 14b, and a third processing unit 14c.

第1処理部14aは、RGBの色要素のそれぞれについて、画像取得部13で取得された第1画像に含まれるカラーチャートにおけるモノクロの複数の階調のパッチ(ここでは、6階調のパッチ)を対象として画素の画素値と理想値との組を2次元座標上にプロットし、そのプロットにおける近似1次直線を算出する。   The first processing unit 14a, for each of the RGB color elements, has a plurality of monochrome gradation patches (here, six gradation patches) in the color chart included in the first image acquired by the image acquisition unit 13. A set of pixel values and ideal values of pixels is plotted on a two-dimensional coordinate, and an approximate linear line in the plot is calculated.

第2処理部14bは、RGBの色要素のそれぞれについて、第1処理部14aで算出された近似1次直線を平行移動させることで、モノクロを対象とした第1処理部14aによるプロットのすべてが含まれる範囲を設定し、設定した範囲内に近似3次曲線が入るように、第1画像に含まれるカラーチャートにおけるカラーの複数の階調のパッチ(RGBのそれぞれにおける6階調のパッチ、つまり、合計18個のパッチ)を対象とした画素の画素値と理想値との組を用いた近似3次曲線を算出する。   The second processing unit 14b translates the approximate linear straight line calculated by the first processing unit 14a for each of the RGB color elements, so that all the plots by the first processing unit 14a for monochrome are processed. A plurality of color patches in the color chart included in the first image (six-tone patches in each of RGB, that is, a patch of each of RGB, that is, an approximate cubic curve is set within the set range. , An approximate cubic curve using a set of pixel values and ideal values of pixels for a total of 18 patches) is calculated.

第3処理部14cは、第2処理部14bで算出された近似3次曲線を第1トーンカーブとして出力する。このとき、オプション処理として、第3処理部14cは、RGBの色要素のそれぞれについて、第2処理部14bで算出された近似3次曲線における白飛び及び黒つぶれの割合が小さくなるように、その近似3次曲線を2次元座標における理想値の軸(ここでは、Y軸)方向にシフトさせ、得られた近似3次曲線を第1トーンカーブとして生成する。具体的には、第3処理部14cは、第2処理部14bで算出されたRGBの色要素のそれぞれに対する近似3次曲線における白飛び及び黒つぶれの割合の合計が最小となるように、それら3本の近似3次曲線を同じようにシフトさせることで、第1トーンカーブを生成する。   The third processing unit 14c outputs the approximate cubic curve calculated by the second processing unit 14b as a first tone curve. At this time, as an optional process, the third processing unit 14c is configured to reduce the ratio of overexposure and underexposure in the approximate cubic curve calculated by the second processing unit 14b for each of the RGB color elements. The approximate cubic curve is shifted in the direction of the ideal value axis (in this case, the Y axis) in the two-dimensional coordinates, and the obtained approximate cubic curve is generated as the first tone curve. Specifically, the third processing unit 14c is configured so that the sum of the ratio of overexposure and underexposure in the approximate cubic curve for each of the RGB color elements calculated by the second processing unit 14b is minimized. The first tone curve is generated by shifting the three approximate cubic curves in the same manner.

なお、「白飛び」とは、トーンカーブにおいて、補正前の値(画素値)が最大値(255)に満たないのに、補正後の値(補正値)が最大値(255)となってしまう領域をいう。また、「黒つぶれ」とは、トーンカーブにおいて、補正前の値(画素値)が最小値(0)より大きいのに、補正後の値(補正値)が最小値(0)となってしまう領域をいう。   Note that “out-of-white” means that the value before correction (pixel value) is less than the maximum value (255) in the tone curve, but the value after correction (correction value) is the maximum value (255). An area that ends up. Further, “blackout” means that the value before correction (pixel value) in the tone curve is larger than the minimum value (0), but the value after correction (correction value) becomes the minimum value (0). An area.

補正部15は、トーンカーブ生成部14で生成された第1トーンカーブを用いて、第1画像を色補正する。   The correction unit 15 corrects the color of the first image using the first tone curve generated by the tone curve generation unit 14.

なお、画像取得部13は、第1画像の生成における撮影と同じ撮影条件で被写体が撮影されて生成されたデジタル画像(写真)である少なくとも1つの第2画像を取得してもよい。これは複数の選択が可能である。このときには、トーンカーブ生成部14は、第1画像に含まれるカラーチャートを用いて、RGBの色要素のそれぞれごとに、第2画像の色を補正するのに用いられる第2トーンカーブを生成する。そして、補正部15は、トーンカーブ生成部14で生成された第2トーンカーブを用いて、第2画像を色補正する。これにより、カラーチャートが写っていない写真に対しても色補正が可能になる。ここで、第2トーンカーブは、基本的には、第1トーンカーブと同じものである。ただし、白飛び、黒つぶれを防ぐためのトーンカーブのシフト処理だけは、カラーチャートのない画像でその必要性とシフトの程度を決定する必要がある。つまり、トーンカーブをシフトする必要がある場合のみ、第1トーンカーブと第2トーンカーブとが異なることになる。そのために、第1トーンカーブに定数を加えて第2トーンカーブを生成するステップを追加すればよい。シフトの必要がない場合は定数が0で第1トーンカーブと第2トーンカーブが同じになるという仕組みである。   Note that the image acquisition unit 13 may acquire at least one second image that is a digital image (photograph) generated by shooting a subject under the same shooting conditions as the shooting in the generation of the first image. This can be selected multiple times. At this time, the tone curve generation unit 14 generates a second tone curve used to correct the color of the second image for each of the RGB color elements, using the color chart included in the first image. . Then, the correction unit 15 corrects the color of the second image using the second tone curve generated by the tone curve generation unit 14. As a result, color correction is possible even for a photograph in which a color chart is not shown. Here, the second tone curve is basically the same as the first tone curve. However, it is necessary to determine the necessity and the degree of shift for an image without a color chart only for the tone curve shift processing to prevent overexposure and blackout. That is, the first tone curve and the second tone curve are different only when the tone curve needs to be shifted. For this purpose, a step of generating a second tone curve by adding a constant to the first tone curve may be added. When no shift is necessary, the constant is 0 and the first tone curve and the second tone curve are the same.

なお、第1画像におけるカラーチャートの位置の認識については、入力部11から取得されるユーザの指示に基づいて行われる。このとき、第1画像に含まれるカラーチャートのパッチを構成する画素の画素値については、まず、ユーザから指示された位置に基づいてカラーチャートの第1画像における位置(ここでは、4隅の位置)が特定され、次に、特定されたカラーチャートの位置と、予め定められたカラーチャートと各パッチとの位置関係とを用いることで、各パッチの位置が特定され、最後に、特定された各パッチの位置に基づいて各パッチを構成する画素の画素値が特定される。   Note that the position of the color chart in the first image is recognized based on a user instruction acquired from the input unit 11. At this time, the pixel values of the pixels constituting the patch of the color chart included in the first image are first determined based on the position instructed by the user in the first image of the color chart (here, the positions of the four corners). ) Is specified, and then the position of each patch is specified by using the position of the specified color chart and the positional relationship between the predetermined color chart and each patch. Based on the position of each patch, the pixel values of the pixels constituting each patch are specified.

具体的には、図7のカラーチャートの表示例に示されるように、ユーザは、写真に写っているカラーチャートの4隅の十字をマウスでクリックする。これにより、カラーチャートの位置が認識される。なお、各パッチの境界周辺では、画素値にばらつきが見られるため、少し内側で切り抜き(図7における各パッチにおいて、4本の直線で囲まれる矩形領域内で切り抜き)、各色のRGB値を一つの画素で代表するのではなく、方眼分割されている各矩形領域内のすべての画素の画素値の平均をとり、その値を各パッチのRGB値(画素値)としている。これによって、カラーチャートの色情報がより正確に得ることができる。   Specifically, as shown in the color chart display example of FIG. 7, the user clicks the crosses at the four corners of the color chart shown in the photograph with the mouse. Thereby, the position of the color chart is recognized. Since pixel values vary around the boundary of each patch, clipping is performed slightly inside (cutting out within a rectangular area surrounded by four straight lines in each patch in FIG. 7), and RGB values of each color are unified. Instead of being represented by one pixel, the average of the pixel values of all the pixels in each rectangular area that is divided into squares is taken, and that value is used as the RGB value (pixel value) of each patch. Thereby, the color information of the color chart can be obtained more accurately.

次に、以上のように構成された本実施の形態における色補正装置10の動作(本発明に係る色補正方法)について説明する。   Next, the operation (color correction method according to the present invention) of the color correction apparatus 10 according to the present embodiment configured as described above will be described.

図8Aは、本実施の形態における色補正装置10の動作を示すフローチャートである。   FIG. 8A is a flowchart showing the operation of the color correction apparatus 10 in the present embodiment.

まず、画像取得部13は、第1画像としての写真を取得する(画像取得ステップS10)。具体的には、画像取得部13は、デジタルカメラ20で生成されたJPEG等の画像ファイルを、USBケーブル又はメモリカードを介して、取得し、補正の対象となる写真(図6の記憶部17に示される「原画像」)として、記憶部17に格納する。   First, the image acquisition unit 13 acquires a photograph as a first image (image acquisition step S10). Specifically, the image acquisition unit 13 acquires an image file such as JPEG generated by the digital camera 20 via a USB cable or a memory card, and a photograph to be corrected (the storage unit 17 in FIG. 6). Is stored in the storage unit 17 as “original image” shown in FIG.

そして、トーンカーブ生成部14は、画像取得部13で取得された第1画像に含まれるカラーチャートのパッチを構成する画素の画素値と当該画素の理想値とを用いて、RGBの色要素のそれぞれについて、第1画像の色を補正するのに用いられる第1トーンカーブを生成する(トーンカーブ生成ステップS11)。具体的には、トーンカーブ生成部14は、記憶部17に格納された写真(「原画像」)に写っているカラーチャートを用いて、第1トーンカーブを生成し、記憶部17に格納する(図6の記憶部17に示される「トーンカーブ」)。   Then, the tone curve generation unit 14 uses the pixel values of the pixels constituting the patch of the color chart included in the first image acquired by the image acquisition unit 13 and the ideal values of the pixels to calculate the RGB color elements. For each, a first tone curve used to correct the color of the first image is generated (tone curve generation step S11). Specifically, the tone curve generation unit 14 generates a first tone curve using a color chart shown in a photograph (“original image”) stored in the storage unit 17 and stores the first tone curve in the storage unit 17. ("Tone curve" shown in the storage unit 17 in FIG. 6).

最後に、補正部15は、トーンカーブ生成部14で生成された第1トーンカーブを用いて、第1画像を色補正する(補正ステップS12)。具体的には、補正部15は、記憶部17に格納されている写真(図6の記憶部17に示される「原画像」)と第1トーンカーブ(図6の記憶部17に示される「トーンカーブ」)とを用いて、写真に色補正を行い、補正後の写真を、「補正画像」として記憶部17に格納するとともに、表示部16に表示する。   Finally, the correction unit 15 performs color correction on the first image using the first tone curve generated by the tone curve generation unit 14 (correction step S12). Specifically, the correction unit 15 includes a photograph stored in the storage unit 17 (“original image” shown in the storage unit 17 in FIG. 6) and a first tone curve (“shown in the storage unit 17 in FIG. 6”. The color correction is performed on the photograph using the “tone curve”), and the corrected photograph is stored in the storage unit 17 as the “corrected image” and displayed on the display unit 16.

図8Bは、図8Aにおけるトーンカーブ生成ステップS11の詳細な手順を示すフローチャートである。   FIG. 8B is a flowchart showing a detailed procedure of the tone curve generation step S11 in FIG. 8A.

第1トーンカーブの生成では、まず、第1処理部14aは、RGBの色要素のそれぞれについて、画像取得部13で取得された第1画像に含まれるカラーチャートにおけるモノクロの複数の階調のパッチ(ここでは、6階調のパッチ)を対象として画素の画素値と理想値との組を2次元座標上にプロットし、そのプロットにおける近似1次直線を算出する(第1サブステップS20)。具体的には、第1処理部14aは、記憶部17から写真(「原画像」)を読み出し、その写真に写っているカラーチャートのグレースケールにおける6個のパッチを対象として、2次元座標(X軸が座標値、Y軸が理想値)上にプロットし、最小二乗法等を用いて、そのプロットの近似1次直線を算出する。   In the generation of the first tone curve, first, the first processing unit 14a, for each of the RGB color elements, patches of a plurality of monochrome gradations in the color chart included in the first image acquired by the image acquisition unit 13. A set of pixel values and ideal values of pixels is plotted on a two-dimensional coordinate target (here, a patch of 6 gradations), and an approximate linear line in the plot is calculated (first sub-step S20). Specifically, the first processing unit 14 a reads a photograph (“original image”) from the storage unit 17, and targets six patches in the gray scale of the color chart shown in the photograph as two-dimensional coordinates ( The X-axis is a coordinate value and the Y-axis is an ideal value), and an approximate linear line of the plot is calculated using a least square method or the like.

図9の(a)〜(c)は、それぞれ、RGBの色要素について第1処理部14aによって算出された近似1次直線の例を示す図である。なお、本図に示される近似1次直線は、上述したグレースケールの6個のパッチだけを対象として算出されているが、プロットされている点については、参考のために、カラーのパッチの18点を含む合計24点が図示されている。   FIGS. 9A to 9C are diagrams showing examples of approximate primary lines calculated by the first processing unit 14a for RGB color elements. Note that the approximate linear line shown in this figure is calculated for only the six gray scale patches described above, but the points plotted are 18 for color patches for reference. A total of 24 points including the points are shown.

グレースケールの理想値は、RGBの3要素すべての値が同じであることから、第1サブステップS20においてグレースケールのみを用いて近似1次直線を導き出すことにより、グレースケールでのカラーバランスを整えながら、全体の明るさを調整するトーンカーブ(近似1次直線)が生成される。   Since the ideal value of grayscale is the same for all three elements of RGB, the color balance in grayscale is adjusted by deriving an approximate linear line using only grayscale in the first sub-step S20. However, a tone curve (approximate linear line) for adjusting the overall brightness is generated.

次に、第2処理部14bは、RGBの色要素のそれぞれについて、第1処理部14aで算出された近似1次直線を平行移動させることで、モノクロを対象とした第1処理部14aによるプロットにおけるすべての組が含まれる範囲を設定し、設定した範囲内に近似3次曲線が入るように、第1画像に含まれるカラーチャートにおけるカラーの複数の階調のパッチ(RGBのそれぞれにおける6階調のパッチ、つまり、合計18個のパッチ)を対象とした画素の画素値と理想値との組を用いた近似3次曲線を算出する(第2サブステップS21)。   Next, the second processing unit 14b translates the approximate linear line calculated by the first processing unit 14a for each of the RGB color elements, thereby plotting by the first processing unit 14a for monochrome. A range including all pairs in the color chart is set, and a plurality of color patches (sixth floor in each of RGB) in the color chart included in the first image so that an approximate cubic curve is included in the set range. An approximate cubic curve using a set of pixel values and ideal values of pixels targeted for a tone patch (that is, a total of 18 patches) is calculated (second sub-step S21).

具体的には、第2処理部14bは、グレースケールのバランスを崩さないために、グレースケールの6点の範囲内で近似曲線(ここでは、近似3次曲線)を作る。そのために、図10に示されるように、まず、第2処理部14bは、第1処理部14aで算出された近似1次直線を平行移動させ、グレースケールの6点がすべて含まれる範囲を設定する(図10の点線)。そして、第2処理部14bは、その中に曲線が入るように残りのカラーの18点で、最小二乗法等を用いて、近似3次曲線を描く(図10の2本の点線で囲まれた範囲内に描かれた近似3次曲線)。なお、図10の(a)〜(c)は、それぞれ、RGBの色要素について第2処理部14bによって算出された近似3次曲線の例を示す図である。ここでは、プロットされている点については、グレースケールの6点だけが示されている。また、図10の(a)〜(c)のそれぞれにおける2本の点線で囲まれる範囲内には、近似1次直線と近似3次曲線とが図示されている。   Specifically, the second processing unit 14b creates an approximate curve (here, an approximate cubic curve) within a range of 6 points on the gray scale so as not to disturb the gray scale balance. For this purpose, as shown in FIG. 10, first, the second processing unit 14b translates the approximate linear line calculated by the first processing unit 14a to set a range that includes all six gray scale points. (Dotted line in FIG. 10). Then, the second processing unit 14b draws an approximate cubic curve using the least squares method or the like at the remaining 18 points of the color so that the curve is included therein (enclosed by the two dotted lines in FIG. 10). (Approximate cubic curve drawn within the range). 10A to 10C are diagrams illustrating examples of approximate cubic curves calculated by the second processing unit 14b for RGB color elements. Here, of the points plotted, only 6 points on the gray scale are shown. In addition, an approximate linear line and an approximate cubic curve are shown in a range surrounded by two dotted lines in each of FIGS.

なお、近似曲線について、より誤差を小さくするために、さらに高次の曲線を描くことも可能であるが、急激な値の変化による不自然さを防ぐために、3次曲線が好ましい。   In order to further reduce the error of the approximate curve, it is possible to draw a higher order curve, but a cubic curve is preferable in order to prevent unnaturalness due to a sudden change in value.

このように、第2サブステップS21では、第1サブステップS20で整えられたカラーバランスを保ちながら誤差(実際と写真との色の誤差)を小さくするトーンカーブ(近似3次曲線)が生成される。   As described above, in the second sub-step S21, a tone curve (approximate cubic curve) is generated that reduces the error (error of the color between the actual image and the photograph) while maintaining the color balance adjusted in the first sub-step S20. The

最後に、第3処理部14cは、第2処理部14bで算出されたRGBの色要素のそれぞれに対する近似3次曲線における白飛び及び黒つぶれの割合の合計が最小となるように、それら3本の近似3次曲線を同じようにシフトさせることで、第1トーンカーブを生成する(第3サブステップS22)。   Finally, the third processing unit 14c is configured so that the sum of the ratios of whiteout and blackout in the approximate cubic curve for each of the RGB color elements calculated by the second processing unit 14b is minimized. The first tone curve is generated by shifting the approximate cubic curve in the same manner (third sub-step S22).

トーンカーブが写真の値で0以上から始まる場合又は補正値が255以上となる場合は、白飛び又は黒つぶれの現象を起こす。こうした場合には、写真の明るい部分や暗い部分の色情報を損失することになり、写真を色補正によって実際の色に再現することはできない。このような場合は、カラーバランスを維持したまま、全体の明るさを調整することで色情報の損失を防ぐ必要がある。そのために、第3処理部14cは、R、G、Bの3要素において、第2処理部14bで算出された3本の近似3次曲線を同じように上下させ、白飛び及び黒つぶれになる割合の合計が最も小さくなる位置を計算し、その位置まで近似3次曲線をシフトさせ、得られた近似3次曲線を、最終的なトーンカーブ(第1トーンカーブ)として生成する。   When the tone curve starts from 0 or more with a photograph value, or when the correction value is 255 or more, a phenomenon of whiteout or blackout occurs. In such a case, the color information of the bright part and dark part of the photograph is lost, and the photograph cannot be reproduced with an actual color by color correction. In such a case, it is necessary to prevent loss of color information by adjusting the overall brightness while maintaining the color balance. For this purpose, the third processing unit 14c causes the three approximate cubic curves calculated by the second processing unit 14b to rise and fall in the same manner for the three elements R, G, and B, resulting in overexposure and underexposure. The position where the sum of the ratios becomes the smallest is calculated, the approximate cubic curve is shifted to that position, and the obtained approximate cubic curve is generated as the final tone curve (first tone curve).

図11の(a)〜(c)は、それぞれ、RGBの色要素についての第3処理部14cによる処理の例を示す図である。ここでは、第2処理部14bで算出された3本の近似3次曲線における白飛び及び黒つぶれになる割合の合計が最も小さくなるように、3本の近似3次曲線が下方にシフトされる様子が示されている。   (A) to (c) of FIG. 11 are diagrams illustrating examples of processing by the third processing unit 14c for RGB color elements. Here, the three approximate cubic curves are shifted downward so that the sum of the ratios of whiteout and blackout in the three approximate cubic curves calculated by the second processing unit 14b is minimized. The situation is shown.

このような第3サブステップS22における処理によって、カラーバランスを維持しながら、トーンカーブ(近似3次曲線)における白飛び及び黒つぶれの割合が削減され、明るさを適切に調整するトーンカーブ(第1トーンカーブ)が生成される。   By such processing in the third sub-step S22, while maintaining the color balance, the ratio of overexposure and underexposure in the tone curve (approximate cubic curve) is reduced, and the tone curve (the first curve) for appropriately adjusting the brightness. 1 tone curve) is generated.

図12は、本実施の形態における色補正装置10によって補正された画像の分析結果を示す図であり、補正前の分析結果を示す図4に対応する。つまり、図12の(a)〜(c)は、RGBの色要素ごとに、補正後の写真に写っているカラーチャートの各パッチを構成する画素の画素値と当該画素の理想値との対応(24個の点)をプロットした図であり、図12の(d)〜(f)は、画素値ごとの分布(100分率)を示すヒストグラムである。   FIG. 12 is a diagram showing the analysis result of the image corrected by the color correction apparatus 10 in the present embodiment, and corresponds to FIG. 4 showing the analysis result before correction. That is, (a) to (c) of FIG. 12 show the correspondence between the pixel values of the pixels constituting each patch of the color chart shown in the corrected photograph and the ideal values of the pixels for each RGB color element. FIG. 12 is a plot of (24 points), and (d) to (f) of FIG. 12 are histograms showing the distribution (100 fraction) for each pixel value.

図12の(a)〜(c)には、図4の(a)〜(c)と同様に、理想直線と、その理想直線と平行する24個の点の近似1次直線とが描かれているが、それら理想直線と近似1次直線とがほぼ重なっている。このことから、実際と補正後の写真のカラーチャートの値がほぼ同じであることがわかる。   12A to 12C, an ideal straight line and an approximate linear line of 24 points parallel to the ideal straight line are drawn, as in FIGS. 4A to 4C. However, these ideal straight lines and the approximate primary straight lines almost overlap. From this, it can be seen that the color chart values of the actual and corrected photographs are almost the same.

以下の表2は、数値で見た補正前と補正後の写真の分析結果を示している。   Table 2 below shows the analysis results of the photographs before and after the correction in terms of numerical values.

この表2には、「実際と写真との差の平均値」、「全体の明度を考慮しての実際と写真との差(誤差)」、及び、「写真全体に見る誤差」の3つの評価に関して、補正前の写真と補正後の写真での値が示されている。ここで、「実際と写真との差の平均値」は、24点それぞれにおいて実際のカラーチャートのRGB値から写真でのカラーチャートのRGB値を引いて差を出し、その合計を24で割ることで平均したものである。また、「全体の明度を考慮しての実際と写真との差(誤差)」は、次の手順で算出された値である。つまり、まず、写真でのカラーチャートのRGB値が実際のカラーチャートのRGB値と等しい直線に平行な24点における近似一次曲線(直線)を導き出す。これが写真のRGB値における全体の明度を考慮した理論値の集合である。そして、この直線を利用し、24点それぞれにおいて、理論値から写真のカラーチャートのRGB値の差をとり、その合計を24で割ることで平均する。また、「写真全体にみる誤差」は、次の手順で算出された値である。つまり、まず、24点それぞれにおいて、「全体の明度を考慮しての実際と写真との差(誤差)」での算出手順と同様に、理論値から写真のカラーチャートのRGB値の差をとる。同時に写真全体においてカラーチャートのRGB値と同じ値を示すピクセル数をカウントさせ、写真全体のピクセル数に対してその値がしめる割合を24色すべてにおいて計算する。そして、これら2つの要素をそれぞれ掛けて合計する。このようにして得られた値は、カラーチャートのRGB値と同じ値を示したピクセルのみの値であるため、写真全体(100%)に換算することで写真全体での誤差を表すと考えられる。   Table 2 shows three values: "average value of difference between actual and photograph", "difference (actual) between actual and photograph considering overall brightness", and "error seen in the entire photograph". Regarding the evaluation, the values in the photograph before and after the correction are shown. Here, “average value of difference between actual and photograph” is obtained by subtracting the RGB value of the color chart in the photograph from the RGB value of the actual color chart at 24 points, and dividing the total by 24. Is the average. The “difference (error) between the actual image and the photo in consideration of the overall brightness” is a value calculated by the following procedure. That is, first, an approximate linear curve (straight line) is derived at 24 points parallel to a straight line in which the RGB value of the color chart in the photograph is equal to the RGB value of the actual color chart. This is a set of theoretical values considering the overall brightness of the RGB values of the photograph. Then, using this straight line, at each of the 24 points, the RGB value of the color chart of the photograph is taken from the theoretical value, and the total is divided by 24 and averaged. Further, the “error in the entire photograph” is a value calculated by the following procedure. That is, first, at each of the 24 points, the difference between the RGB values of the color chart of the photograph is taken from the theoretical value, similarly to the calculation procedure of “difference (error) between the actual and the photograph considering the overall brightness”. . At the same time, the number of pixels showing the same value as the RGB value of the color chart in the entire photo is counted, and the ratio of the value to the number of pixels in the entire photo is calculated for all 24 colors. These two elements are multiplied and totaled. Since the value obtained in this way is a value of only the pixel showing the same value as the RGB value of the color chart, it is considered that an error in the entire photo is expressed by converting to the entire photo (100%). .

表2から分かるように、「実際と写真との差の平均値」については、本実施の形態の色補正によって、どの色要素とも格段に小さくなっている。また、「全体の明度を考慮しての実際と写真との差(誤差)」についても、本実施の形態の色補正によって、赤と緑は約3分の1にまで小さくなっている。青については、点にばらつきが見られ、それほど大きな改善は見られなかった。「写真全体に見る誤差」については、補正前の画像全体で占める割合が大きい部分の誤差はもともと小さかったので、数値の上では、本実施の形態の色補正による大きな変化は見られなかった。   As can be seen from Table 2, with respect to the “average value of the difference between actual and photograph”, all the color elements are remarkably reduced by the color correction of the present embodiment. Also, “difference (error) between actual and photograph taking the overall brightness into consideration” is also reduced to about one third of red and green by the color correction of the present embodiment. As for blue, there was variation in the points, and not much improvement. Regarding the “error seen in the entire photograph”, since the error of the portion where the ratio of the entire image before the correction is large was originally small, no significant change due to the color correction of the present embodiment was seen in the numerical value.

以下の表3は、補正後の写真における6段階のグレースケールで見る色のバランスを示しており、補正前の写真について同様の結果を示す表1に対応する。   Table 3 below shows the balance of colors seen on a gray scale in six levels in the photo after correction, and corresponds to Table 1 showing similar results for the photo before correction.

この表3では、表1と比較して、どの色も値の幅は断然に小さくなっており、白にいたっては0になっている。このことから、本実施の形態の色補正により、色のバランスが大きく改善されることがわかる。   In Table 3, as compared with Table 1, the range of values for all colors is remarkably smaller, and the value for white is 0. From this, it can be seen that the color balance is greatly improved by the color correction of the present embodiment.

なお、本実施の形態では、一つの写真についての分析結果が示されたが、他の写真についても、本実施の形態の色補正により、実際に近い色に補正され、色表現が格段に改善されることを確認している。   In this embodiment, the analysis result for one photo is shown, but other photos are also corrected to colors that are close to the actual color by the color correction of this embodiment, and the color expression is greatly improved. Make sure it will be.

以上のように、本実施の形態によれば、カラーチャートを入れて撮影したカラーのデジタル画像のすべてに対して、自動で色補正を行うことができる。また、同じ撮影条件で撮影することで、同じトーンカーブを利用して、カラーチャートが写っていない複数枚の画像を同時に色補正することも可能である。また、カラーチャートを元にした分析結果を表示することにより、画像のもつ色に関する特徴や誤差の傾向を知る目安にもなると考えられる。さらに、大事な情報を損失しないようにカラーバランスを維持しながらの明るさ調整が行えるので、用途によって使い分けることも可能である。   As described above, according to the present embodiment, it is possible to automatically perform color correction on all color digital images photographed with a color chart. In addition, by photographing under the same photographing conditions, it is possible to simultaneously perform color correction on a plurality of images on which a color chart is not captured, using the same tone curve. In addition, displaying the analysis result based on the color chart may serve as a standard for knowing the characteristics of the color and the error tendency of the image. Furthermore, the brightness can be adjusted while maintaining the color balance so that important information is not lost.

より詳しくは、本実施の形態における色補正装置10によれば、第1処理部14aによって、カラーチャートでのグレースケールを用いた近似1次直線が算出されるので、グレースケールでのカラーバランスを整えながら、全体の明るさを調整する色補正が可能になる。そして、第2処理部14bによって、グレースケールの6点がすべて含まれる範囲に曲線が入るように、カラーの18点を用いた近似3次曲線が算出されるので、第1処理部14aで整えられたカラーバランスを保ちながら誤差を小さくする色補正が可能になる。さらに、第3処理部14cによって、上記近似3次曲線におけるカラーバランスを維持しながら、近似3次曲線における白飛び及び黒つぶれの割合が小さくなるように近似3次曲線がシフトされるので、カラーバランスを維持しながら、明るさを適切に調整する色補正が可能になる。   More specifically, according to the color correction apparatus 10 in the present embodiment, the first processing unit 14a calculates an approximate linear line using the gray scale in the color chart, so that the color balance in the gray scale is adjusted. Color correction that adjusts the overall brightness while trimming is possible. Then, the second processing unit 14b calculates an approximate cubic curve using 18 color points so that the curve falls within a range including all 6 gray scale points. It is possible to perform color correction that reduces the error while maintaining the specified color balance. Furthermore, the approximate cubic curve is shifted by the third processing unit 14c so that the ratio of whiteout and blackout in the approximate cubic curve is reduced while maintaining the color balance in the approximate cubic curve. It is possible to perform color correction that appropriately adjusts brightness while maintaining balance.

これにより、撮影によって得られたカラーのデジタル画像に対して、論理的かつ客観的に自動で色補正が行われ、従来よりも高い精度で実際の色が再現される。   Thereby, color correction is automatically performed logically and objectively with respect to a color digital image obtained by photographing, and an actual color is reproduced with higher accuracy than before.

以上、本発明に係る色補正方法、プログラム及び装置の実施の形態について、実施の形態に基づいて説明したが、本発明は、この実施の形態に限定されるものではない。本発明の趣旨を逸脱しない限り、各種変形を実施の形態に施したもの、又は、実施の形態における構成要素を組み合わせて構築される別の形態も、本発明に含まれる。   As described above, the embodiments of the color correction method, the program, and the apparatus according to the present invention have been described based on the embodiments. However, the present invention is not limited to the embodiments. Unless it deviates from the meaning of the present invention, various modifications made to the embodiments or other forms constructed by combining the components in the embodiments are also included in the present invention.

たとえば、上記実施の形態では、色補正装置10は、白飛び及び黒つぶれを補正する第3処理部14cを備えたが、このような機能をもつ処理部を必ずしも備える必要はない。撮影によって得られた写真によっては、第2処理部14bで算出された近似3次曲線に白飛び及び黒つぶれが生じていない、あるいは、無視できる程度に白飛び及び黒つぶれの割合が少ない場合があるからである。よって、第3処理部14cは、第2処理部14bで算出された近似3次曲線における白飛び及び黒つぶれの量を特定し、その量が一定量以下である場合には、上記実施の形態で説明した近似3次曲線のシフト処理をすることなく、第2処理部14bで算出された近似3次曲線を最終的な補正用のトーンカーブとしてそのまま出力してもよい。   For example, in the above embodiment, the color correction apparatus 10 includes the third processing unit 14c that corrects overexposure and blackout, but it is not always necessary to include a processing unit having such a function. Depending on the photograph obtained by shooting, the approximate cubic curve calculated by the second processing unit 14b may not have whiteout and blackout, or the ratio of whiteout and blackout may be negligibly small. Because there is. Therefore, the third processing unit 14c specifies the amount of overexposure and blackout in the approximate cubic curve calculated by the second processing unit 14b. The approximate cubic curve calculated by the second processing unit 14b may be output as it is as the final tone curve for correction without performing the shift process of the approximate cubic curve described in the above.

また、上記実施の形態では、色補正装置10は、プログラムとそれを実行するプロセッサ等によってソフトウェア的に実現されたが、LSI等の専用の電子回路によってハードウェア的に実現されてもよい。   In the above-described embodiment, the color correction apparatus 10 is realized as software by a program and a processor that executes the program, but may be realized as hardware by a dedicated electronic circuit such as an LSI.

本発明は、RGB(赤、緑及び青)の色要素で表現されるカラーのデジタル画像に対する色補正方法、プログラム及び装置として、特に、論理的かつ客観的に自動で色補正を行う色補正方法等として、高精度の再現性が求められる、例えば、図書館や美術館の原資料や公文書などの長期保存のために情報を電子化して保存するデジタルアーカイブにおける写真の色補正プログラム等として、利用できる。   The present invention relates to a color correction method, program, and apparatus for color digital images expressed by RGB (red, green, and blue) color elements, and in particular, a color correction method that performs color correction automatically logically and objectively. For example, it can be used as a color correction program for photographs in digital archives that digitize and store information for long-term storage, such as library and art museum originals and official documents. .

10 色補正装置
11 入力部
12 制御部
13 画像取得部
14 トーンカーブ生成部
14a 第1処理部
14b 第2処理部
14c 第3処理部
15 補正部
16 表示部
17 記憶部
20 デジタルカメラ
DESCRIPTION OF SYMBOLS 10 Color correction apparatus 11 Input part 12 Control part 13 Image acquisition part 14 Tone curve production | generation part 14a 1st process part 14b 2nd process part 14c 3rd process part 15 Correction part 16 Display part 17 Storage part 20 Digital camera

Claims (7)

RGB(赤、緑及び青)の色要素で表現されるカラーのデジタル画像に対する色補正方法であって、
カラー及びモノクロの複数の階調のパッチから構成されるカラーチャートと共に被写体が撮影されて生成されたデジタル画像である第1画像を取得する画像取得ステップと、
取得された前記第1画像に含まれるカラーチャートのパッチを構成する画素の画素値と当該画素の理想値とを用いて、前記RGBの色要素のそれぞれについて、前記第1画像の色を補正するのに用いられる第1トーンカーブを生成するトーンカーブ生成ステップと、
生成された前記第1トーンカーブを用いて、前記第1画像を色補正する補正ステップとを含み、
前記トーンカーブ生成ステップは、前記RGBの色要素のそれぞれについて、
前記第1画像に含まれる前記カラーチャートにおけるモノクロの複数の階調のパッチを対象として画素の画素値と理想値との組を2次元座標上にプロットし、前記プロットにおける近似1次直線を算出する第1サブステップと、
算出された前記近似1次直線を平行移動させることで、前記プロットにおけるすべての組が含まれる範囲を設定し、設定した範囲内に近似3次曲線が入るように、前記カラーチャートにおけるカラーの複数の階調のパッチを対象とした画素の画素値と理想値との組を用いた近似3次曲線を算出する第2サブステップと、
算出された前記近似3次曲線を前記第1トーンカーブとして出力する第3サブステップとを含む
色補正方法。
A color correction method for digital images of colors expressed by RGB (red, green and blue) color elements,
An image acquisition step of acquiring a first image which is a digital image generated by photographing a subject together with a color chart composed of patches of a plurality of color and monochrome gradations;
The color of the first image is corrected for each of the RGB color elements using the pixel value of the pixel constituting the patch of the color chart included in the acquired first image and the ideal value of the pixel. A tone curve generating step for generating a first tone curve used for
A correction step of color correcting the first image using the generated first tone curve,
In the tone curve generation step, for each of the RGB color elements,
A set of pixel values and ideal values of pixels is plotted on two-dimensional coordinates for a plurality of monochrome gradation patches in the color chart included in the first image, and an approximate linear line in the plot is calculated. A first sub-step,
By moving the calculated approximate linear line in parallel, a range including all the sets in the plot is set, and a plurality of colors in the color chart are set so that an approximate cubic curve falls within the set range. A second sub-step of calculating an approximate cubic curve using a set of pixel values and ideal values of pixels for a patch of gray scale;
And a third substep of outputting the calculated approximate cubic curve as the first tone curve.
前記画像取得ステップではさらに、前記第1画像の生成における撮影と同じ撮影条件で被写体が撮影されて生成されたデジタル画像である少なくとも1つの第2画像を取得し、
前記トーンカーブ生成ステップでは、前記第1画像に含まれるカラーチャートを用いて、前記色要素のそれぞれごとに、前記第2画像の色を補正するのに用いられる第2トーンカーブを生成し、
前記補正ステップでは、生成された前記第2トーンカーブを用いて、前記第2画像を色補正する
請求項1記載の色補正方法。
The image acquisition step further acquires at least one second image, which is a digital image generated by shooting a subject under the same shooting conditions as the shooting in the generation of the first image,
In the tone curve generation step, using a color chart included in the first image, a second tone curve used to correct the color of the second image is generated for each of the color elements,
The color correction method according to claim 1, wherein in the correction step, the second image is color-corrected using the generated second tone curve.
前記第3サブステップでは、前記RGBの色要素のそれぞれについて、前記第2サブステップで算出された前記近似3次曲線における白飛び及び黒つぶれの割合が小さくなるように、前記近似3次曲線を前記2次元座標における前記理想値の軸方向にシフトさせ、得られた前記近似3次曲線を前記第1トーンカーブとして生成する
請求項1又は2記載の色補正方法。
In the third sub-step, for each of the RGB color elements, the approximate cubic curve is calculated so that the ratio of whiteout and blackout in the approximate cubic curve calculated in the second substep is small. The color correction method according to claim 1, wherein the approximate cubic curve obtained by shifting in the axial direction of the ideal value in the two-dimensional coordinates is generated as the first tone curve.
前記第3サブステップでは、前記RGBの色要素のそれぞれに対する前記近似3次曲線における白飛び及び黒つぶれの割合の合計が最小となるように、前記RGBの色要素のそれぞれに対する前記近似3次曲線を同じようにシフトさせる
請求項3記載の色補正方法。
In the third sub-step, the approximate cubic curve for each of the RGB color elements is such that the sum of the ratio of overexposure and blackout in the approximate cubic curve for each of the RGB color elements is minimized. The color correction method according to claim 3, wherein the colors are shifted in the same manner.
さらに、前記第1画像における前記カラーチャートの位置をユーザから取得するカラーチャート位置認識ステップを含み、
前記第1画像に含まれる前記カラーチャートのパッチを構成する画素の画素値については、前記カラーチャート位置認識ステップで取得された位置に基づいて前記カラーチャートの前記第1画像における位置が特定され、特定された前記カラーチャートの位置と、予め定められた前記カラーチャートと前記パッチとの位置関係とを用いることで前記パッチの位置が特定され、特定された前記パッチの位置に基づいて前記パッチを構成する画素の画素値が特定される
請求項1〜4のいずれか1項に記載の色補正方法。
And a color chart position recognizing step of acquiring a position of the color chart in the first image from a user,
For the pixel values of the pixels constituting the patch of the color chart included in the first image, the position of the color chart in the first image is specified based on the position acquired in the color chart position recognition step, The position of the patch is specified by using the position of the specified color chart and the predetermined positional relationship between the color chart and the patch, and the patch is determined based on the position of the specified patch. The color correction method according to claim 1, wherein a pixel value of a constituent pixel is specified.
RGB(赤、緑及び青)の色要素で表現されるカラーのデジタル画像に対する色補正のためのプログラムであって、
請求項1記載のステップをコンピュータに実行させるプログラム。
A program for color correction of a digital image of a color expressed by RGB (red, green and blue) color elements,
The program which makes a computer perform the step of Claim 1.
RGB(赤、緑及び青)の色要素で表現されるカラーのデジタル画像に対して色補正を行う色補正装置であって、
カラー及びモノクロの複数の階調のパッチから構成されるカラーチャートと共に被写体が撮影されて生成されたデジタル画像である第1画像を取得する画像取得部と、
取得された前記第1画像に含まれるカラーチャートのパッチを構成する画素の画素値と当該画素の理想値とを用いて、前記RGBの色要素のそれぞれについて、前記第1画像の色を補正するのに用いられる第1トーンカーブを生成するトーンカーブ生成部と、
生成された前記第1トーンカーブを用いて、前記第1画像を色補正する補正部とを備え、
前記トーンカーブ生成部は、前記RGBの色要素のそれぞれについて、
前記第1画像に含まれる前記カラーチャートにおけるモノクロの複数の階調のパッチを対象として画素の画素値と理想値との組を2次元座標上にプロットし、前記プロットにおける近似1次直線を算出する第1処理部と、
算出された前記近似1次直線を平行移動させることで、前記プロットにおけるすべての組が含まれる範囲を設定し、設定した範囲内に近似3次曲線が入るように、前記カラーチャートにおけるカラーの複数の階調のパッチを対象とした画素の画素値と理想値との組を用いた近似3次曲線を算出する第2処理部と、
算出された前記近似3次曲線を前記第1トーンカーブとして出力する第3処理部とを有する
色補正装置。
A color correction device that performs color correction on a color digital image expressed by RGB (red, green, and blue) color elements,
An image acquisition unit that acquires a first image that is a digital image generated by photographing a subject together with a color chart composed of patches of a plurality of color and monochrome gradations;
The color of the first image is corrected for each of the RGB color elements using the pixel value of the pixel constituting the patch of the color chart included in the acquired first image and the ideal value of the pixel. A tone curve generator for generating a first tone curve used for
A correction unit that performs color correction on the first image using the generated first tone curve;
The tone curve generation unit, for each of the RGB color elements,
A set of pixel values and ideal values of pixels is plotted on two-dimensional coordinates for a plurality of monochrome gradation patches in the color chart included in the first image, and an approximate linear line in the plot is calculated. A first processing unit,
By moving the calculated approximate linear line in parallel, a range including all the sets in the plot is set, and a plurality of colors in the color chart are set so that an approximate cubic curve falls within the set range. A second processing unit that calculates an approximate cubic curve using a set of pixel values and ideal values of pixels for a patch of the gray scale;
And a third processing unit that outputs the calculated approximate cubic curve as the first tone curve.
JP2013069332A 2013-03-28 2013-03-28 Color correction method, program, and device Pending JP2014192859A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2013069332A JP2014192859A (en) 2013-03-28 2013-03-28 Color correction method, program, and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2013069332A JP2014192859A (en) 2013-03-28 2013-03-28 Color correction method, program, and device

Publications (1)

Publication Number Publication Date
JP2014192859A true JP2014192859A (en) 2014-10-06

Family

ID=51838721

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2013069332A Pending JP2014192859A (en) 2013-03-28 2013-03-28 Color correction method, program, and device

Country Status (1)

Country Link
JP (1) JP2014192859A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020189448A1 (en) * 2019-03-15 2020-09-24 株式会社ミマキエンジニアリング Three-dimensional-body data generation device, three-dimensional-body data generation method, program, and modeling system
CN111783793A (en) * 2020-06-04 2020-10-16 武汉纺织大学 Method for rapidly extracting color card image data
CN112950510A (en) * 2021-03-22 2021-06-11 南京莱斯电子设备有限公司 Large-scene splicing image chromatic aberration correction method
CN113873210A (en) * 2021-09-29 2021-12-31 苏州市测绘院有限责任公司 Color restoration authenticity precision detection method

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020189448A1 (en) * 2019-03-15 2020-09-24 株式会社ミマキエンジニアリング Three-dimensional-body data generation device, three-dimensional-body data generation method, program, and modeling system
JPWO2020189448A1 (en) * 2019-03-15 2020-09-24
JP7447083B2 (en) 2019-03-15 2024-03-11 株式会社ミマキエンジニアリング 3D data generation device, 3D data generation method, program, and modeling system
CN111783793A (en) * 2020-06-04 2020-10-16 武汉纺织大学 Method for rapidly extracting color card image data
CN112950510A (en) * 2021-03-22 2021-06-11 南京莱斯电子设备有限公司 Large-scene splicing image chromatic aberration correction method
CN112950510B (en) * 2021-03-22 2024-04-02 南京莱斯电子设备有限公司 Large scene spliced image chromatic aberration correction method
CN113873210A (en) * 2021-09-29 2021-12-31 苏州市测绘院有限责任公司 Color restoration authenticity precision detection method
CN113873210B (en) * 2021-09-29 2024-02-23 苏州市测绘院有限责任公司 Color restoration authenticity precision detection method

Similar Documents

Publication Publication Date Title
JP4375781B2 (en) Image processing apparatus, image processing method, program, and recording medium
JP4906627B2 (en) Image processing apparatus, image processing method, computer program, and storage medium
JP5032911B2 (en) Image processing apparatus and image processing method
EP2800352B1 (en) Image pickup apparatus and image processing apparatus
JP4905552B2 (en) Image quality adjustment capability measurement method, apparatus and program, and image quality adjustment method, apparatus and program
JP5457652B2 (en) Image processing apparatus and method
US20120057785A1 (en) Method and system to modify a color lookup table
JP5870598B2 (en) Image white balance processing method and apparatus
JP2017187994A (en) Image processing apparatus, image processing method, image processing system, and program
CN1655626B (en) System and method for clipping values of pixels
KR102311367B1 (en) Image processing apparatus, image processing method, and storage medium
JP2014192859A (en) Color correction method, program, and device
JP2016201026A (en) Image processing device and program
JP4527500B2 (en) Image processing method, apparatus, and program
JP4359662B2 (en) Color image exposure compensation method
US8922580B2 (en) Method and system to modify a color lookup table
JP2014007449A (en) Illumination light color estimation device, illumination light color estimation method, and illumination light color estimation program
JP2012028973A (en) Illumination light estimation device, illumination light estimation method, and illumination light estimation program
KR102215607B1 (en) Electronic device capable of correction to improve the brightness of dark images and operating method thereof
JP2011124884A (en) Image processor, and image processing method
JP5810593B2 (en) Image processing apparatus, imaging apparatus, and program
JP5222795B2 (en) Image reading method and image reading system
JP2020088709A (en) Image processing apparatus, image processing method and program
US20240202990A1 (en) Data generation method, learning method, imaging apparatus, and program
US20200273213A1 (en) Configuration for modifying a color feature of an image