JP2010154008A - Image processing unit and image processing program - Google Patents

Image processing unit and image processing program Download PDF

Info

Publication number
JP2010154008A
JP2010154008A JP2008327426A JP2008327426A JP2010154008A JP 2010154008 A JP2010154008 A JP 2010154008A JP 2008327426 A JP2008327426 A JP 2008327426A JP 2008327426 A JP2008327426 A JP 2008327426A JP 2010154008 A JP2010154008 A JP 2010154008A
Authority
JP
Japan
Prior art keywords
value
coordinate value
image data
color space
orthogonal coordinate
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.)
Granted
Application number
JP2008327426A
Other languages
Japanese (ja)
Other versions
JP4784642B2 (en
Inventor
Maki Kondo
真樹 近藤
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.)
Brother Industries Ltd
Original Assignee
Brother Industries Ltd
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 Brother Industries Ltd filed Critical Brother Industries Ltd
Priority to JP2008327426A priority Critical patent/JP4784642B2/en
Priority to US12/647,182 priority patent/US8428351B2/en
Publication of JP2010154008A publication Critical patent/JP2010154008A/en
Application granted granted Critical
Publication of JP4784642B2 publication Critical patent/JP4784642B2/en
Priority to US13/846,099 priority patent/US8705858B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

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

Abstract

<P>PROBLEM TO BE SOLVED: To appropriately correct HSV target image data by HSV reference image data. <P>SOLUTION: A multifunctional machine executes processing below. More specifically, the multifunction machine calculates target representative values (OH, OS, OV) representing a group of pixels including hue in a specific range in HSV target image data (1) (S44). The multifunctional machine converts the target representative values (OH, OS, OV) to target coordinates values (Ov, Oa, Ob), namely values in a vab color space (2) (S48). The multifunctional machine calculates reference representative values (SH, SS, SV) representing a group of pixels having hue in a specific range in HSV reference image data (3) (S46). The multifunctional machine converts the reference representative values (SH, SS, SV) to reference coordinates values (Sv, Sa, Sb), namely values in the vab color space (4) (S50). The multifunctional machine corrects coordinates values (Pv, Pa, Pb) of each pixel included in a peripheral region of the target coordinates values (Ov, Oa, Ob) so that the coordinates values (Pv, Pa, Pb) approach the reference coordinates values (Sv, Sa, Sb) (5). <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、基準画像データを用いて対象画像データを補正する画像処理技術に関する。   The present invention relates to an image processing technique for correcting target image data using reference image data.

下記の特許文献1には、教師画像データを用いて入力画像データを補正する技術が開示されている。この技術では、教師画像データが示す画像再現の傾向(例えば肌色、青色、緑色等の色相)に従って画像処理パラメータを決定し、この画像処理パラメータに基づいて入力画像データを補正する。   Patent Document 1 below discloses a technique for correcting input image data using teacher image data. In this technique, image processing parameters are determined in accordance with the tendency of image reproduction indicated by the teacher image data (for example, hues of skin color, blue, green, etc.), and the input image data is corrected based on the image processing parameters.

特開2006−80746号公報JP 2006-80746 A 特開平8−321957号公報JP-A-8-321957 特開2002−223366号公報JP 2002-223366 A 特開2005−197996号公報JP 2005-197996 A 特開平10−173947号公報Japanese Patent Laid-Open No. 10-173947

本発明者は、基準画像データの特定範囲の色相内の色(例えば青色)に近づくように、対象画像データの上記の特定範囲の色相内の色を補正するための技術の開発に携わっている。本発明者は、対象画像データの上記の特定範囲の色相内の色を補正する場合に、対象画像データを適切に補正することができないことがあることを見出した。例えば、対象画像データ内に無彩色付近の色(非常に小さい彩度)を有する複数の画素が存在する可能性がある。無彩色付近の色を有する画素群は、見た目の色の差がほとんどない。これらの画素群の中に、補正対象の色相(上記の特定範囲の色相)を有する画素と、補正対象の色相を有さない画素と、が存在する可能性がある。この場合、前者の画素の値のみが補正され、後者の画素の値は補正されない。この結果、補正前には見た目の色の差がほとんどない両者の画素が、補正後には大きく異なる色になってしまう。   The present inventor is engaged in the development of a technique for correcting the color in the hue in the specific range of the target image data so as to approach the color in the hue in the specific range of the reference image data (for example, blue). . The present inventor has found that the target image data may not be corrected properly when correcting the color within the hue in the specific range of the target image data. For example, there may be a plurality of pixels having a near-achromatic color (very small saturation) in the target image data. A pixel group having a color near an achromatic color has almost no difference in apparent color. In these pixel groups, there may be pixels having a hue to be corrected (the hue in the specific range) and pixels having no hue to be corrected. In this case, only the value of the former pixel is corrected, and the value of the latter pixel is not corrected. As a result, both pixels having almost no apparent color difference before correction become greatly different colors after correction.

本明細書では、基準画像データを用いて対象画像データの特定範囲の色相を適切に補正することができる技術を提供する。   The present specification provides a technique capable of appropriately correcting the hue of a specific range of target image data using reference image data.

本明細書では、基準画像データを用いて対象画像データを補正して補正済み画像データを生成する画像処理装置を開示する。この画像処理装置は、第1決定部と第1算出部と第2決定部と第2算出部と補正部とを備える。第1決定部は、対象画像データ内の特定範囲の色相を有する第1画素群を代表する値であって、極座標系の色空間内の値である第1極座標値を決定する。第1算出部は、第1極座標値を直交変換することによって、第1直交座標系の色空間内の値である第1直交座標値を算出する。第2決定部は、基準画像データ内の上記の特定範囲の色相を有する第2画素群を代表する値であって、極座標系の色空間内の値である第2極座標値を決定する。第2算出部は、第2極座標値を直交変換することによって、第1直交座標系の色空間内の値である第2直交座標値を算出する。補正部は、対象画像データ内の全ての画素のうち、第1直交座標系の色空間内における第1直交座標値の周囲の領域に含まれる各画素の座標値を、第2直交座標値に近づくように補正することによって、対象画像データから補正済み画像データを生成する。   The present specification discloses an image processing apparatus that corrects target image data using reference image data to generate corrected image data. The image processing apparatus includes a first determination unit, a first calculation unit, a second determination unit, a second calculation unit, and a correction unit. The first determining unit determines a first polar coordinate value that is a value representing the first pixel group having a hue in a specific range in the target image data and is a value in the color space of the polar coordinate system. The first calculation unit calculates a first orthogonal coordinate value that is a value in the color space of the first orthogonal coordinate system by orthogonally transforming the first polar coordinate value. The second determining unit determines a second polar coordinate value that is a value representative of the second pixel group having the hue in the specific range in the reference image data and is a value in the color space of the polar coordinate system. The second calculation unit calculates a second orthogonal coordinate value that is a value in the color space of the first orthogonal coordinate system by orthogonally transforming the second polar coordinate value. The correction unit converts the coordinate value of each pixel included in the area around the first orthogonal coordinate value in the color space of the first orthogonal coordinate system among all the pixels in the target image data to the second orthogonal coordinate value. By correcting so as to approach, corrected image data is generated from the target image data.

上記の画像処理装置では、極座標系の色空間において、対象画像データと基準画像データのそれぞれについて、上記の特定範囲の色相を有する画素群を代表する代表値(第1極座標値と第2極座標値)が決定される。極座標系の色空間において代表値が決定されるために、この極座標系の色空間において第1極座標値が第2極座標値に近づくような補正ベクトルを利用して、対象画像データ内の上記の特定範囲の色相を有する各画素の値を補正する手法を採用することも考えられる。しかしながら、この手法では、見た目の色の差がほとんどない無彩色付近の色を有する画素群が存在する場合に、それらの画素群のうちの上記の特定範囲の色相を有する画素のみが補正される事象が発生してしまう。この事象が発生するのを抑制するために、上記の画像処理装置では、直交座標系(第1直交座標系)の色空間において対象画像データの各画素の値が補正される。即ち、第1極座標値が第1直交座標値に変換され、その第1直交座標値の周囲の領域に含まれる画素の値が補正される。無彩色付近の色を有しており、見た目の色の差がほとんどない画素群は、直交座標系(第1直交座標系)の色空間において、互いに近接する座標値を有する可能性が高い。このために、無彩色付近の色を有する画素群の中に上記の特定範囲の色相を有さない画素が存在する場合でも、その画素の値が補正され得る。上記の事象が発生するのを抑制することができる。   In the image processing device, in the color space of the polar coordinate system, for each of the target image data and the reference image data, representative values (first polar coordinate value and second polar coordinate value) representing the pixel group having the hue in the specific range described above. ) Is determined. Since the representative value is determined in the color space of the polar coordinate system, the above-described identification in the target image data is performed using a correction vector that causes the first polar coordinate value to approach the second polar coordinate value in the color space of the polar coordinate system. It is also conceivable to employ a method of correcting the value of each pixel having a hue in a range. However, in this method, when there is a pixel group having an achromatic color with almost no apparent color difference, only the pixel having the hue in the specific range is corrected from the pixel group. An event occurs. In order to suppress the occurrence of this phenomenon, in the image processing apparatus described above, the value of each pixel of the target image data is corrected in the color space of the orthogonal coordinate system (first orthogonal coordinate system). That is, the first polar coordinate value is converted into the first orthogonal coordinate value, and the values of the pixels included in the area around the first orthogonal coordinate value are corrected. A pixel group having an achromatic color and having almost no apparent color difference is likely to have coordinate values close to each other in the color space of the orthogonal coordinate system (first orthogonal coordinate system). For this reason, even when there is a pixel having no hue in the specific range in the pixel group having a color near the achromatic color, the value of the pixel can be corrected. The occurrence of the above event can be suppressed.

なお、上記の対象画像データは、直交座標系(例えば上記の第1直交座標系や後述の第2直交座標系)の色空間内の値によって各画素の値が表わされるものであってもよいし、極座標系の色空間内の値によって各画素の値が表わされるものであってもよい。前者の場合、上記の第1決定部と第2決定部は、対象画像データ内の各画素の値を極座標系の色空間内の値に変換した後に、第1極座標値と第2極座標値を決定してもよい。また、後者の場合、補正部は、対象画像データ内の各画素を第1直交座標系の色空間内の値に変換した後に、補正を行なってもよい。   The target image data may be one in which the value of each pixel is represented by a value in the color space of an orthogonal coordinate system (for example, the first orthogonal coordinate system or the second orthogonal coordinate system described later). However, the value of each pixel may be represented by a value in the color space of the polar coordinate system. In the former case, the first determination unit and the second determination unit convert the value of each pixel in the target image data into a value in the color space of the polar coordinate system, and then convert the first polar coordinate value and the second polar coordinate value. You may decide. In the latter case, the correction unit may perform correction after converting each pixel in the target image data into a value in the color space of the first orthogonal coordinate system.

上記の周囲の領域の形状については、特に限定されない。上記の周囲の領域は、例えば、第1直交座標値と第2直交座標値との双方を含む特定領域であってもよい。なお、この場合、上記の特定領域は、第1直交座標値と第2直交座標値とを2つの焦点とする楕円体内の領域であってもよい。一方において、上記の周囲の領域は、例えば、第1直交座標値のみを含む領域であってもよい。   The shape of the surrounding area is not particularly limited. The surrounding area may be a specific area including both the first orthogonal coordinate value and the second orthogonal coordinate value, for example. In this case, the specific area may be an area within an ellipsoid having the first orthogonal coordinate value and the second orthogonal coordinate value as two focal points. On the other hand, the surrounding area may be an area including only the first orthogonal coordinate value, for example.

ヒトの視覚特性では、例えば、緑色は、色の変化が認識しくい。従って、例えば、緑色の色相を補正する場合には、補正後に緑色が変化したことが認識できるように、補正されるべき画素の値の範囲(即ち上記の周囲の領域)を比較的に大きくすることが好ましい。これに対し、例えば、肌色は、色の変化が認識しやすい。従って、例えば、肌色の色相を補正する場合には、補正後に肌色が大きく変化して違和感を与えることがないように、補正されるべき画素の値の範囲(即ち上記の周囲の領域)を比較的に小さくすることが好ましい。この技術思想は、以下のように表現することができる。即ち、上記の特定範囲が第1範囲の場合に設定される上記の周囲の領域のサイズは、上記の特定範囲が第1範囲と異なる第2範囲の場合に設定される上記の周囲の領域のサイズと異なってもよい。この構成によると、補正されるべき色相に応じて、上記の周囲の領域の大きさを変えることができる。例えば、上記の特定範囲が緑色の色相を示す第1範囲の場合には、上記の特定範囲が肌色の色相を示す第2範囲の場合と比べて、上記の周囲の領域を大きくすることができる。   In human visual characteristics, for example, the color change of green is difficult to recognize. Therefore, for example, when correcting the hue of green, the range of the value of the pixel to be corrected (that is, the surrounding area) is relatively large so that it can be recognized that the green color has changed after the correction. It is preferable. On the other hand, for example, the skin color is easy to recognize the color change. Therefore, for example, when correcting the hue of the flesh color, the range of pixel values to be corrected (that is, the above surrounding area) is compared so that the flesh color does not change greatly after the correction and does not give a sense of incongruity. It is preferable to make it small. This technical idea can be expressed as follows. That is, the size of the surrounding area set when the specific range is the first range is the size of the surrounding area set when the specific range is a second range different from the first range. It may be different from the size. According to this configuration, the size of the surrounding area can be changed according to the hue to be corrected. For example, in the case where the specific range is a first range showing a green hue, the surrounding area can be made larger than in the case where the specific range is a second range showing a flesh-colored hue. .

対象画像データにおいて見た目の色が似ている2つの画素が隣り合っている場合でも、一方の画素の値のみが補正され、他方の画素の値が補正されないおそれがある。この場合、補正された画素と補正されなかった画素との間において色が大きく異なり得る。この現象が発生するのを抑制するために、以下の構成を採用してもよい。即ち、補正部は、第1直交座標値と補正対象の画素の第1直交座標系の色空間内の座標値との間の第1距離と、第2直交座標値と補正対象の画素の第1直交座標系の色空間内の座標値との間の第2距離と、の和が小さい程、補正量が大きくなるように、補正対象の画素の第1直交座標系の色空間内の座標値を補正してもよい。   Even when two pixels having similar appearance colors in the target image data are adjacent to each other, only the value of one pixel may be corrected and the value of the other pixel may not be corrected. In this case, the color may be greatly different between the corrected pixel and the uncorrected pixel. In order to suppress the occurrence of this phenomenon, the following configuration may be employed. That is, the correction unit includes a first distance between the first orthogonal coordinate value and the coordinate value of the correction target pixel in the color space of the first orthogonal coordinate system, and the second orthogonal coordinate value and the correction target pixel. Coordinates in the color space of the first orthogonal coordinate system of the pixel to be corrected so that the correction amount increases as the sum of the second distance between the coordinate values in the color space of the one orthogonal coordinate system decreases. The value may be corrected.

上記の構成によると、第1直交座標値と第2直交座標値の双方に対する補正対象の画素の座標値が近いほど、補正量が大きくなる。逆に言うと、第1直交座標値と第2直交座標値の双方に対する補正対象の画素の座標値が遠いほど、補正量が小さくなる。これは、上記の周囲の領域の境界付近に存在する画素の座標値は、補正量が小さくなることを意味する。対象画像データにおいて2つの画素の見た目の色が似ているということは、それらの2つの画素は、直交座標系(第1直交座標系)の色空間において、互いに近接する座標値を有する可能性が高い。それにもかかわらず、一方の画素のみが補正されるということは、その一方の画素が上記の周囲の領域の境界付近において内側に存在する座標値を有しており、他方の画素が上記の周囲の領域の境界付近において外側に存在する座標値を有している可能性が高い。上記の構成によると、上記の周囲の領域の境界付近において内側に存在する座標値を有する画素の補正量が小さくなる。このために、見た目の色が似ていて隣り合っている2つの画素のうちの一方の画素のみが補正されても、その補正量は小さいために、それらの2つの画素の間で大きく色が異なることを抑制することができる。   According to the above configuration, the closer the coordinate value of the correction target pixel with respect to both the first orthogonal coordinate value and the second orthogonal coordinate value is, the larger the correction amount is. Conversely, the correction amount decreases as the coordinate value of the pixel to be corrected with respect to both the first orthogonal coordinate value and the second orthogonal coordinate value increases. This means that the correction amount of the coordinate value of the pixel existing near the boundary of the surrounding area is small. The fact that the apparent colors of the two pixels in the target image data are similar means that the two pixels may have coordinate values that are close to each other in the color space of the orthogonal coordinate system (first orthogonal coordinate system). Is expensive. Nevertheless, only one pixel is corrected when one of the pixels has a coordinate value that exists inside near the boundary of the surrounding area, and the other pixel has the surrounding value. There is a high possibility of having a coordinate value existing outside in the vicinity of the boundary of the region. According to the above configuration, the correction amount of the pixel having the coordinate value existing inside near the boundary of the surrounding region is small. For this reason, even if only one of the two adjacent pixels that are similar in appearance color is corrected, the correction amount is small, so that a large color is generated between the two pixels. Different things can be suppressed.

補正部は、補正対象の画素の第1直交座標系の色空間内の座標値が第1直交座標値と同じ場合に、その補正対象の画素の第1直交座標系の色空間内の座標値を、第1直交座標値と第2直交座標値との間の第3直交座標値に補正してもよい。また、補正部は、補正対象の画素の第1直交座標系の色空間内の座標値が第1直交座標値と第2直交座標値との間の第4直交座標値である場合に、その補正対象の画素の第1直交座標系の色空間内の座標値を、第3直交座標値と第2直交座標値との間の第5直交座標値に補正してもよい。   When the coordinate value in the color space of the first orthogonal coordinate system of the pixel to be corrected is the same as the first orthogonal coordinate value, the correction unit coordinates values in the color space of the first orthogonal coordinate system of the pixel to be corrected May be corrected to a third orthogonal coordinate value between the first orthogonal coordinate value and the second orthogonal coordinate value. In addition, when the coordinate value in the color space of the first orthogonal coordinate system of the correction target pixel is a fourth orthogonal coordinate value between the first orthogonal coordinate value and the second orthogonal coordinate value, The coordinate value in the color space of the first orthogonal coordinate system of the pixel to be corrected may be corrected to a fifth orthogonal coordinate value between the third orthogonal coordinate value and the second orthogonal coordinate value.

なお、第1決定部と第2決定部が第1極座標値と第2極座標値を決定するための手法は、特に限定されない。例えば、第1決定部は、上記の第1画素群に含まれる各画素の極座標系の色空間内の座標値の平均値を算出することによって、第1極座標値を決定してもよい。また、第2決定部は、上記の第2画素群に含まれる各画素の極座標系の色空間内の座標値の平均値を算出することによって、第2極座標値を決定してもよい。なお、第1極座標値及び第2極座標値は、他の手法で得られる値(例えば中央値)であってもよい。   In addition, the method for the 1st determination part and the 2nd determination part to determine a 1st polar coordinate value and a 2nd polar coordinate value is not specifically limited. For example, the first determination unit may determine the first polar coordinate value by calculating an average value of coordinate values in the color space of the polar coordinate system of each pixel included in the first pixel group. Further, the second determination unit may determine the second polar coordinate value by calculating an average value of coordinate values in the color space of the polar coordinate system of each pixel included in the second pixel group. The first polar coordinate value and the second polar coordinate value may be values obtained by other methods (for example, median value).

上記の画像処理装置は、第1直交座標系と異なる第2直交座標系の色空間内の座標値で各画素の値が表わされる特定画像データを、極座標系の色空間内の座標値で各画素の値が表わされる対象画像データに変換する変換部をさらに備えていてもよい。この場合、補正部は、以下の各処理を実行することによって、第2直交座標系の色空間内の座標値で各画素の値が表わされる補正済み画像データを生成してもよい。
(1)対象画像データ内の各画素の座標値を、第1直交座標系の色空間内の座標値である特定直交座標値に変換する。
(2)上記の周囲の領域に含まれる各特定直交座標値を、第2直交座標値に近づくように補正する。
(3)補正後の各特定直交座標値を、極座標系の色空間内の座標値である特定極座標値に変換する。
(4)各特定極座標値を、第2直交座標系の色空間内の座標値である直交座標値に変換する。
The above image processing apparatus is configured to convert specific image data in which the value of each pixel is represented by coordinate values in a color space of a second orthogonal coordinate system different from the first orthogonal coordinate system, using coordinate values in the color space of a polar coordinate system. You may further provide the conversion part which converts into the target image data in which the value of a pixel is represented. In this case, the correction unit may generate corrected image data in which the value of each pixel is represented by the coordinate value in the color space of the second orthogonal coordinate system by executing the following processes.
(1) The coordinate value of each pixel in the target image data is converted into a specific orthogonal coordinate value that is a coordinate value in the color space of the first orthogonal coordinate system.
(2) Each specific orthogonal coordinate value included in the surrounding area is corrected so as to approach the second orthogonal coordinate value.
(3) Each corrected specific orthogonal coordinate value is converted into a specific polar coordinate value that is a coordinate value in the color space of the polar coordinate system.
(4) Each specific polar coordinate value is converted into an orthogonal coordinate value that is a coordinate value in the color space of the second orthogonal coordinate system.

なお、上記の画像処理装置を実現するためのコンピュータプログラムも有用である。このコンピュータプログラムを利用すると、基準画像データを用いて対象画像データの特定範囲の色相を適切に補正することができる画像処理装置を実現することができる。   A computer program for realizing the image processing apparatus is also useful. By using this computer program, it is possible to realize an image processing apparatus that can appropriately correct the hue of a specific range of target image data using reference image data.

ここでは、以下の実施例に記載の技術の一部を列挙しておく。
(形態1)上記の極座標系は、円柱座標系であってもよい。上記の円柱座標系は、輝度を示す軸を有していてもよい。上記の円柱座標系では、動径によって彩度が表現されてもよい。上記の円柱座標系では、偏角によって色相が表現されてもよい。
Here, some of the techniques described in the following examples are listed.
(Mode 1) The polar coordinate system may be a cylindrical coordinate system. The cylindrical coordinate system may have an axis indicating luminance. In the above cylindrical coordinate system, the saturation may be expressed by the radius. In the above cylindrical coordinate system, the hue may be expressed by a declination angle.

(形態2)上記の補正部は、第1直交座標値と第2直交座標値とに基づいて、上限値(例えば実施例のUv)と下限値(例えば実施例のLv)とを決定してもよい。また、補正部は、補正対象の画素の値が上限値と下限値との間の場合に、第1直交座標値と第2直交座標値とに基づいて補正基準値(例えば実施例のCurvv)を決定してもよい。 (Mode 2) The correction unit determines an upper limit value (for example, Uv in the embodiment) and a lower limit value (for example, Lv in the embodiment) based on the first orthogonal coordinate value and the second orthogonal coordinate value. Also good. In addition, when the value of the pixel to be corrected is between the upper limit value and the lower limit value, the correction unit corrects the correction reference value (for example, Curvv in the embodiment) based on the first orthogonal coordinate value and the second orthogonal coordinate value. May be determined.

(形態3)上記の補正部は、第1直交座標値と第2直交座標値との間の距離(例えば実施例のrange)を算出してもよい。補正部は、第1直交座標値と第2直交座標値との間の距離と、上記の第1距離と第2距離との和とに基づいて、補正量を決定してもよい。 (Mode 3) The correction unit may calculate a distance between the first orthogonal coordinate value and the second orthogonal coordinate value (for example, the range of the embodiment). The correction unit may determine the correction amount based on the distance between the first orthogonal coordinate value and the second orthogonal coordinate value and the sum of the first distance and the second distance.

(第1実施例)
図面を参照して実施例を説明する。図1は、本実施例の多機能機10の概略図を示す。多機能機10は、操作部12と表示部14とスロット部16とスキャナ部20と印刷部22とネットワークインターフェイス24と制御部28等を有する。操作部12は、複数のキーによって構成される。ユーザは、操作部12を操作することによって、様々な指示や命令を多機能機10に入力することができる。表示部14は、様々な情報を表示することができる。スロット部16は、メモリカード18を収容するためのスペースを有する。ユーザは、画像データを記憶しているメモリカード18をスロット部16に挿入することができる。本実施例では、メモリカード18に記憶されている画像データは、RGB形式の画像データである。
(First embodiment)
Embodiments will be described with reference to the drawings. FIG. 1 shows a schematic diagram of a multi-function device 10 of this embodiment. The multi-function device 10 includes an operation unit 12, a display unit 14, a slot unit 16, a scanner unit 20, a printing unit 22, a network interface 24, a control unit 28, and the like. The operation unit 12 includes a plurality of keys. The user can input various instructions and commands to the multi-function device 10 by operating the operation unit 12. The display unit 14 can display various information. The slot portion 16 has a space for accommodating the memory card 18. The user can insert the memory card 18 storing the image data into the slot unit 16. In this embodiment, the image data stored in the memory card 18 is RGB format image data.

スキャナ部20は、CCD、CIS等の読取機構を有する。スキャナ部20は、原稿、写真等をカラースキャンすることによって画像データを生成することができる。本実施例では、スキャナ部20によって生成される画像データは、RGB形式の画像データである。印刷部22は、インクジェットタイプ、レーザタイプ等の印刷機構を有する。印刷部22は、メモリカード18に記憶されている画像データ、又は、スキャナ部20によって生成された画像データに基づいて印刷することができる。また、印刷部22は、ネットワークインターフェイス24に入力されたデータに基づいて印刷することができる。ネットワークインターフェイス24は、LAN26に接続されている。   The scanner unit 20 has a reading mechanism such as a CCD or CIS. The scanner unit 20 can generate image data by color scanning a document, a photograph, or the like. In this embodiment, the image data generated by the scanner unit 20 is RGB format image data. The printing unit 22 has a printing mechanism such as an ink jet type or a laser type. The printing unit 22 can print based on image data stored in the memory card 18 or image data generated by the scanner unit 20. The printing unit 22 can print based on data input to the network interface 24. The network interface 24 is connected to the LAN 26.

制御部28は、CPU30とROM32とRAM40等を有する。CPU30は、ROM32に記憶されているプログラム34〜38に従って様々な処理を実行する。ROM32は、様々なプログラム34〜38を記憶している。基本プログラム34は、多機能機10の基本的な動作を制御するためのプログラムである。基本プログラム34は、例えば、表示部14に表示されるデータを生成するためのプログラムを含んでいる。また、基本プログラム34は、例えば、スキャナ部20、印刷部22等を制御するためのプログラムを含んでいる。補正プログラム36は、画像データを補正するためのプログラムである。CPU30が補正プログラム36に従って実行する処理の内容については、後で詳しく説明する。プログラム38は、上記のプログラム34,36以外のプログラムである。RAM40は、CPU30が処理を実行する過程で生成されるデータを一時的に記憶することができる。   The control unit 28 includes a CPU 30, a ROM 32, a RAM 40, and the like. The CPU 30 executes various processes according to the programs 34 to 38 stored in the ROM 32. The ROM 32 stores various programs 34 to 38. The basic program 34 is a program for controlling basic operations of the multi-function device 10. The basic program 34 includes, for example, a program for generating data displayed on the display unit 14. The basic program 34 includes, for example, a program for controlling the scanner unit 20, the printing unit 22, and the like. The correction program 36 is a program for correcting image data. The contents of the processing executed by the CPU 30 according to the correction program 36 will be described in detail later. The program 38 is a program other than the programs 34 and 36 described above. The RAM 40 can temporarily store data generated while the CPU 30 executes processing.

本実施例の多機能機10は、スキャナ部20によって生成された画像データを用いて、メモリカード18に記憶されている画像データ(ユーザによって選択された画像データ)を補正することができる。より具体的に言うと、多機能機10は、スキャナ部20によって生成された画像データの色相(ユーザによって選択された色相)内の色に近づくように、メモリカード18に記憶されている画像データの色相内の色を補正することができる。   The multi-function device 10 of the present embodiment can correct the image data (image data selected by the user) stored in the memory card 18 using the image data generated by the scanner unit 20. More specifically, the multi-function device 10 stores the image data stored in the memory card 18 so as to approach the colors in the hue (the hue selected by the user) of the image data generated by the scanner unit 20. Colors within the hue of can be corrected.

以下では、補正の対象となる画像データ(メモリカード18に記憶されている画像データ)のことをRGB対象画像データと呼ぶ。また、補正の基準となる画像データ(スキャナ部20によって生成された画像データ)のことをRGB基準画像データと呼ぶ。図2は、RGB基準画像データ60を用いてRGB対象画像データ50が補正される様子を簡単に示す。処理の詳細については後で詳しく説明するが、ここでは、RGB対象画像データ50を補正する手順について簡単に説明する。   Hereinafter, the image data to be corrected (image data stored in the memory card 18) is referred to as RGB target image data. Further, image data serving as a correction reference (image data generated by the scanner unit 20) is referred to as RGB reference image data. FIG. 2 simply shows how the RGB target image data 50 is corrected using the RGB reference image data 60. Details of the processing will be described later in detail, but here, a procedure for correcting the RGB target image data 50 will be briefly described.

RGB対象画像データ50は、複数の画素を有する。各画素の値は、三軸の直交座標系の色空間内(以下ではRGB色空間内と呼ぶことがある)の値によって表現される。具体的に言うと、各画素の値は、R(赤)を示す値(0〜255)と、G(緑)を示す値(0〜255)と、B(青)を示す値(0〜255)とによって表わされる。多機能機10は、RGB対象画像データ50をHSV形式の画像データ52に変換する。以下では、この画像データ52のことをHSV対象画像データ52と呼ぶ。多機能機10は、RGB対象画像データ50を構成する各画素の値(直交座標値)を極座標値に変換することによって、HSV対象画像データ52を生成する。従って、HSV対象画像データ52が有する画素の数は、RGB対象画像データ50が有する画素の数に等しくなる。HSV対象画像データ52が有する各画素の値は、円柱極座標系の色空間内(以下ではHSV色空間内と呼ぶことがある)の値によって表現される。具体的に言うと、各画素の値は、色相(H)を示す値(0〜360°)と、彩度(S)を示す値(0〜1.0)と、輝度(V)を示す値(0〜1.0)とによって表わされる。   The RGB target image data 50 has a plurality of pixels. The value of each pixel is represented by a value in a color space of a three-axis orthogonal coordinate system (hereinafter sometimes referred to as an RGB color space). Specifically, the value of each pixel includes a value (0 to 255) indicating R (red), a value (0 to 255) indicating G (green), and a value (0 to 0) indicating B (blue). 255). The multi-function device 10 converts the RGB target image data 50 into image data 52 in the HSV format. Hereinafter, this image data 52 is referred to as HSV target image data 52. The multi-function device 10 generates the HSV target image data 52 by converting the value (orthogonal coordinate value) of each pixel constituting the RGB target image data 50 into a polar coordinate value. Therefore, the number of pixels included in the HSV target image data 52 is equal to the number of pixels included in the RGB target image data 50. The value of each pixel included in the HSV target image data 52 is represented by a value in a color space of a cylindrical polar coordinate system (hereinafter sometimes referred to as an HSV color space). Specifically, the value of each pixel indicates a value (0 to 360 °) indicating hue (H), a value (0 to 1.0) indicating saturation (S), and luminance (V). It is represented by a value (0 to 1.0).

多機能機10は、RGB対象画像データ50をHSV対象画像データ52に変換する上記の手法と同様にして、RGB基準画像データ60をHSV形式の画像データ62に変換する。以下では、この画像データ62のことをHSV基準画像データ62と呼ぶ。RGB基準画像データ60が有する各画素の値は、RGB色空間内の値によって表現される。また、HSV基準画像データ62が有する各画素の値は、HSV色空間内の値によって表現される。   The multi-function device 10 converts the RGB reference image data 60 into the image data 62 in the HSV format in the same manner as described above for converting the RGB target image data 50 into the HSV target image data 52. Hereinafter, the image data 62 is referred to as HSV reference image data 62. The value of each pixel included in the RGB reference image data 60 is represented by a value in the RGB color space. Further, the value of each pixel included in the HSV reference image data 62 is represented by a value in the HSV color space.

多機能機10は、後述する様々な処理を実行することによって、HSV基準画像データ62を用いてHSV対象画像データ52を補正する。これにより、補正後の画像データ56が生成される。以下では、この画像データ56のことを補正済みRGB画像データ56と呼ぶ。補正済みRGB画像データ56が有する各画素の値は、RGB色空間内の値によって表現される。   The multi-function device 10 corrects the HSV target image data 52 using the HSV reference image data 62 by executing various processes described later. Thereby, the corrected image data 56 is generated. Hereinafter, this image data 56 is referred to as corrected RGB image data 56. The value of each pixel included in the corrected RGB image data 56 is represented by a value in the RGB color space.

続いて、多機能機10が実行する補正印刷処理の内容について詳しく説明する。ユーザは、操作部12を操作することによって、補正印刷モードを選択することができる。この操作が実行された場合に、補正印刷処理が実行される。図3は、補正印刷処理のフローチャートを示す。補正印刷処理は、基本プログラム34と補正プログラム36に従ってCPU30によって実行される。なお、図3のフローチャートに示される各処理のうち、S18の処理は補正プログラム36に従って実行され、それ以外の処理は基本プログラム34に従って実行される。   Next, the content of the correction printing process executed by the multi-function device 10 will be described in detail. The user can select the corrected printing mode by operating the operation unit 12. When this operation is executed, the correction printing process is executed. FIG. 3 shows a flowchart of the correction printing process. The correction printing process is executed by the CPU 30 according to the basic program 34 and the correction program 36. Of the processes shown in the flowchart of FIG. 3, the process of S <b> 18 is executed according to the correction program 36, and the other processes are executed according to the basic program 34.

ユーザは、操作部12を操作することによって、メモリカード18に記憶されている複数の画像データの中から1つの画像データを選択することができる。ここで選択された画像データが補正対象の画像データ(即ちRGB対象画像データ50)になる。CPU30は、RGB対象画像データ50が選択されるまで待機する(S10)。   The user can select one image data from among a plurality of image data stored in the memory card 18 by operating the operation unit 12. The image data selected here becomes image data to be corrected (that is, RGB target image data 50). The CPU 30 waits until the RGB target image data 50 is selected (S10).

ユーザは、操作部12を操作することによって、RGB対象画像データ50を補正するために用いられる基準の画像(例えば写真)をスキャナ部20によってスキャンさせることができる。CPU30は、この操作が実行されるまで待機する(S12)。ユーザによって操作が実行されると、CPU30は、スキャナ部20にスキャンすることを指示する(S14)。これにより、スキャナ部20は、ユーザによって選択された基準の画像をカラースキャンすることによって、画像データ(即ちRGB基準画像データ60)を生成する。   The user can cause the scanner unit 20 to scan a reference image (for example, a photograph) used to correct the RGB target image data 50 by operating the operation unit 12. The CPU 30 waits until this operation is executed (S12). When an operation is executed by the user, the CPU 30 instructs the scanner unit 20 to scan (S14). Accordingly, the scanner unit 20 generates image data (that is, RGB reference image data 60) by performing color scanning on the reference image selected by the user.

次いで、CPU30は、複数の補正モードを示す文字列を表示部14に表示させる。具体的に言うと、CPU30は、「空モード」、「緑モード」、及び「肌モード」という文字列を表示部14に表示させる。各補正モードについて簡単に説明する。空モードは、RGB基準画像データ60が有する青色の色相内の色に近づくように、RGB対象画像データ50が有する青色の色相内の色を補正するためのモードである。緑モードは、RGB基準画像データ60が有する緑色の色相内の色に近づくように、RGB対象画像データ50が有する緑色の色相内の色を補正するためのモードである。肌モードは、RGB基準画像データ60が有する肌色の色相内の色に近づくように、RGB対象画像データ50が有する肌色の色相内の色を補正するためのモードである。ユーザは、操作部12を操作することによって、表示部14に表示された3つの補正モードの中から1つの補正モードを選択することができる。CPU30は、この操作が実行されるまで待機する(S16)。ユーザによって選択された補正モードを示す情報は、RAM40に記憶される。   Next, the CPU 30 displays a character string indicating a plurality of correction modes on the display unit 14. Specifically, the CPU 30 causes the display unit 14 to display character strings “empty mode”, “green mode”, and “skin mode”. Each correction mode will be briefly described. The sky mode is a mode for correcting the color in the blue hue of the RGB target image data 50 so as to approach the color in the blue hue of the RGB reference image data 60. The green mode is a mode for correcting the color in the green hue of the RGB target image data 50 so as to approach the color in the green hue of the RGB reference image data 60. The skin mode is a mode for correcting the color in the skin color hue of the RGB target image data 50 so as to approach the color in the skin color hue of the RGB reference image data 60. The user can select one correction mode from the three correction modes displayed on the display unit 14 by operating the operation unit 12. The CPU 30 waits until this operation is executed (S16). Information indicating the correction mode selected by the user is stored in the RAM 40.

次いで、CPU30は、補正処理を実行する(S18)。補正処理の内容については、後で詳しく説明する。補正処理によって補正済みRGB画像データ56が得られる。CPU30は、補正済みRGB画像データ56を印刷データ(CMYK形式のビットマップデータ)に変換する(S20)。続いて、CPU30は、S20で生成された印刷データに基づいて印刷することを印刷部22に指示する(S22)。この結果、印刷部22は、印刷データに基づいて印刷媒体に印刷する。ユーザは、補正済みRGB画像データ56が印刷された印刷媒体を得ることができる。   Next, the CPU 30 executes a correction process (S18). The contents of the correction process will be described in detail later. The corrected RGB image data 56 is obtained by the correction process. The CPU 30 converts the corrected RGB image data 56 into print data (CMYK format bitmap data) (S20). Subsequently, the CPU 30 instructs the printing unit 22 to perform printing based on the print data generated in S20 (S22). As a result, the printing unit 22 prints on the print medium based on the print data. The user can obtain a print medium on which the corrected RGB image data 56 is printed.

続いて、S18で実行される補正処理の内容について詳しく説明する。図4及び図5は、補正処理のフローチャートを示す。CPU30は、RGB対象画像データ50をHSV対象画像データ52に変換する(S40)。図6は、RGB色空間内の座標値をHSV色空間内の座標値に変換するための数式を示す。CPU30は、RGB対象画像データ50を構成する1つの画素(変換対象の画素)を選択する。図6(a)に示されるように、変換対象の画素の座標値を(R,G,B)と表現し、その座標値から変換されたHSV色空間内の座標値を(H,S,V)と表現する。図6(b)に示されるように、CPU30は、R/255とG/255とB/255をそれぞれ算出し、その中の最も大きい値をVとして特定する。また、CPU30は、図6(c)に示される数式に従って、Sを算出する。次いで、CPU30は、図6(d)に示される数式に従って、媒介変数r,g,bを算出する。CPU30は、図6(e)に示される数式に従って、Hを算出する。ここで算出されたHがマイナスの値である場合、CPU30は、図6(f)に示されるように、Hに360を加算することによって、新たなHを算出する。これにより、変換対象の画素の座標値(R,G,B)からHSV色空間内の座標値(H,S,V)を得ることができる。   Next, the details of the correction process executed in S18 will be described in detail. 4 and 5 show a flowchart of the correction process. The CPU 30 converts the RGB target image data 50 into HSV target image data 52 (S40). FIG. 6 shows mathematical formulas for converting coordinate values in the RGB color space into coordinate values in the HSV color space. The CPU 30 selects one pixel (conversion target pixel) constituting the RGB target image data 50. As shown in FIG. 6A, the coordinate value of the pixel to be converted is expressed as (R, G, B), and the coordinate value in the HSV color space converted from the coordinate value is expressed as (H, S, V). As shown in FIG. 6B, the CPU 30 calculates R / 255, G / 255, and B / 255, respectively, and specifies the largest value among them as V. Further, the CPU 30 calculates S according to the mathematical formula shown in FIG. Next, the CPU 30 calculates parameters r, g, and b according to the mathematical formula shown in FIG. The CPU 30 calculates H according to the mathematical formula shown in FIG. When the calculated H is a negative value, the CPU 30 calculates new H by adding 360 to H as shown in FIG. Thereby, the coordinate value (H, S, V) in the HSV color space can be obtained from the coordinate value (R, G, B) of the pixel to be converted.

図7は、HSV色空間を模式的に示す。図7を見ると、HSV色空間が円柱座標系の色空間であることがよくわかる。色相を示すHは、0〜360°のいずれかの値である。彩度を示すSは、0〜1.0のいずれかの値である。輝度を示すVは、0〜1.0のいずれかの値である。   FIG. 7 schematically shows the HSV color space. It can be seen from FIG. 7 that the HSV color space is a cylindrical coordinate system color space. H indicating the hue is any value from 0 to 360 °. S indicating saturation is any value from 0 to 1.0. V which shows a brightness | luminance is any value of 0-1.0.

CPU30は、RGB対象画像データ50の他の全ての画素のそれぞれについて、図6(a)〜図6(f)の数式に従って、HSV色空間内の座標値(H,S,V)を算出する。これにより、HSV対象画像データ52が得られる。CPU30は、HSV対象画像データ52をRAM40に記憶させる。   The CPU 30 calculates the coordinate values (H, S, V) in the HSV color space for each of all other pixels of the RGB target image data 50 according to the mathematical expressions of FIGS. 6 (a) to 6 (f). . Thereby, the HSV target image data 52 is obtained. The CPU 30 stores the HSV target image data 52 in the RAM 40.

続いて、CPU30は、RGB基準画像データ60をHSV基準画像データ62に変換する(S42)。S42の処理は、上記のS40の処理と同様の手法によって行なわれる。即ち、CPU30は、RGB基準画像データ60の全ての画素のそれぞれについて、図6(a)〜図6(f)に従って、HSV色空間内の座標値(H,S,V)を算出する。これにより、HSV基準画像データ62が得られる。CPU30は、HSV基準画像データ62をRAM40に記憶させる。   Subsequently, the CPU 30 converts the RGB reference image data 60 into HSV reference image data 62 (S42). The process of S42 is performed by the same method as the process of S40 described above. That is, the CPU 30 calculates the coordinate values (H, S, V) in the HSV color space for each of all the pixels of the RGB reference image data 60 according to FIGS. 6 (a) to 6 (f). Thereby, the HSV reference image data 62 is obtained. The CPU 30 stores the HSV reference image data 62 in the RAM 40.

次いで、CPU30は、HSV対象画像データ52から代表値を算出する(S44)。以下では、この代表値のことを対象代表値(OH,OS,OV)と呼ぶ。S44の処理は、図3のS16で選択された補正モードに従って実行される。図8は、補正モードと、HとSとVのそれぞれの範囲との対応関係の一例を示す。例えば、補正モードが空モードの場合、Hが180〜240°であり、Sが0〜1.0であり、Vが0〜1.0である。これは、補正モードが空モードの場合には、CPU30は、Hが180〜240°であり、Sが0〜1.0であり、かつ、Vが0〜1.0である画素群に基づいて、代表値を算出することを意味している。   Next, the CPU 30 calculates a representative value from the HSV target image data 52 (S44). Hereinafter, this representative value is referred to as a target representative value (OH, OS, OV). The process of S44 is executed according to the correction mode selected in S16 of FIG. FIG. 8 shows an example of the correspondence relationship between the correction mode and the ranges of H, S, and V. For example, when the correction mode is the empty mode, H is 180 to 240 °, S is 0 to 1.0, and V is 0 to 1.0. This is based on the pixel group in which H is 180 to 240 °, S is 0 to 1.0, and V is 0 to 1.0 when the correction mode is the empty mode. This means that a representative value is calculated.

より具体的に言うと、補正モードが空モードの場合、CPU30は、HSV対象画像データ52を構成する全ての画素のうち、Hが180〜240°(図8(a)参照)である画素群を特定する。なお、ここでは、SとVを考慮しない。空モードの場合のSとVのそれぞれの範囲は0〜1.0であり(図8(a)参照)、いずれの画素であってもSとVが0〜1.0の範囲に含まれるからである。次いで、CPU30は、特定された画素群のHの平均値を算出することによってOHを特定し、特定された画素群のSの平均値を算出することによってOSを特定し、特定された画素群のVの平均値を算出することによってOVを特定する。これにより、対象代表値(OH,OS,OV)が得られる。なお、図3のS16で選択された補正モードが緑モードの場合、CPU30は、Hが50〜170°(図8(b)参照)である画素群から対象代表値(OH,OS,OV)を特定する。また、図3のS16で選択された補正モードが肌モードの場合、CPU30は、Hが10〜40°であり、Sが0.1〜0.6であり、かつ、Vが0.2〜1.0(図8(c)参照)である画素群から対象代表値(OH,OS,OV)を特定する。   More specifically, when the correction mode is the empty mode, the CPU 30 is a pixel group in which H is 180 to 240 ° (see FIG. 8A) among all the pixels constituting the HSV target image data 52. Is identified. Here, S and V are not considered. Each range of S and V in the sky mode is 0 to 1.0 (see FIG. 8A), and S and V are included in the range of 0 to 1.0 in any pixel. Because. Next, the CPU 30 specifies OH by calculating an average value of H of the specified pixel group, specifies an OS by calculating an average value of S of the specified pixel group, and specifies the specified pixel group OV is specified by calculating the average value of V. Thereby, the target representative values (OH, OS, OV) are obtained. When the correction mode selected in S16 in FIG. 3 is the green mode, the CPU 30 determines the target representative value (OH, OS, OV) from the pixel group in which H is 50 to 170 ° (see FIG. 8B). Is identified. Further, when the correction mode selected in S16 of FIG. 3 is the skin mode, the CPU 30 determines that H is 10 to 40 °, S is 0.1 to 0.6, and V is 0.2 to The target representative value (OH, OS, OV) is specified from the pixel group that is 1.0 (see FIG. 8C).

続いて、CPU30は、HSV基準画像データ62から代表値を算出する(S46)。以下では、この代表値のことを基準代表値(SH,SS,SV)と呼ぶ。S46の処理は、S44の処理と同様に実行される。例えば、図3のS16で選択された補正モードが空モードの場合、CPU30は、HSV基準画像データ62を構成する全ての画素のうち、Hが180〜240°(図8(a)参照)である画素群を特定する。次いで、CPU30は、特定された画素群のHの平均値を算出することによってSHを特定し、特定された画素群のSの平均値を算出することによってSSを特定し、特定された画素群のVの平均値を算出することによってSVを特定する。これにより、基準代表値(SH,SS,SV)が得られる。   Subsequently, the CPU 30 calculates a representative value from the HSV reference image data 62 (S46). Hereinafter, this representative value is referred to as a reference representative value (SH, SS, SV). The process of S46 is executed similarly to the process of S44. For example, when the correction mode selected in S16 of FIG. 3 is the empty mode, the CPU 30 has H of 180 to 240 ° (see FIG. 8A) among all the pixels constituting the HSV reference image data 62. A certain pixel group is specified. Next, the CPU 30 specifies SH by calculating an average value of H of the specified pixel group, specifies SS by calculating an average value of S of the specified pixel group, and specifies the specified pixel group SV is specified by calculating the average value of V. Thereby, the reference representative values (SH, SS, SV) are obtained.

次いで、CPU30は、S44で特定された対象代表値(OH,OS,OV)をvab色空間内の座標値に変換する(S48)。以下では、この座標値のことを対象座標値(Ov,Oa,Ob)と呼ぶ。なお、vab色空間は、RGB色空間と異なる三軸の直交座標系の色空間である。vab色空間は、本実施例特有の色空間であり、周知の色空間ではない。図9を参照しながら、S48の処理の内容について説明する。図9は、HSV色空間内の座標値をvab色空間内の座標値に変換するための数式を示す。図9では、変換対象の座標値を(H,S,V)と表現し、その座標値から変換されたvab色空間内の座標値を(v,a,b)と表現している。図9に示される数式において、(H,S,V)を(OH,OS,OV)に置き換えるとともに、(v,a,b)を(Ov,Oa,Ob)に置き換えると、対象座標値(Ov,Oa,Ob)を得るための数式が得られる。CPU30は、この数式に従って、対象座標値(Ov,Oa,Ob)を算出する。   Next, the CPU 30 converts the target representative value (OH, OS, OV) specified in S44 into a coordinate value in the vab color space (S48). Hereinafter, these coordinate values are referred to as target coordinate values (Ov, Oa, Ob). The vab color space is a three-axis orthogonal coordinate color space different from the RGB color space. The vab color space is a color space unique to the present embodiment, and is not a well-known color space. The contents of the processing of S48 will be described with reference to FIG. FIG. 9 shows mathematical formulas for converting coordinate values in the HSV color space into coordinate values in the vab color space. In FIG. 9, the coordinate value to be converted is expressed as (H, S, V), and the coordinate value in the vab color space converted from the coordinate value is expressed as (v, a, b). In the equation shown in FIG. 9, when (H, S, V) is replaced with (OH, OS, OV) and (v, a, b) is replaced with (Ov, Oa, Ob), the target coordinate value ( Equations for obtaining Ov, Oa, Ob) are obtained. The CPU 30 calculates target coordinate values (Ov, Oa, Ob) according to this mathematical formula.

次いで、CPU30は、S46で特定された基準代表値(SH,SS,SV)をvab色空間内の座標値に変換する(S50)。以下では、この座標値のことを基準座標値(Sv,Sa,Sb)と呼ぶ。S50の処理は、S48の処理と同様に実行される。図9に示される数式において、(H,S,V)を(SH,SS,SV)に置き換えるとともに、(v,a,b)を(Sv,Sa,Sb)に置き換えると、基準座標値(Sv,Sa,Sb)を得るための数式が得られる。CPU30は、この数式に従って、基準座標値(Sv,Sa,Sb)を算出する。   Next, the CPU 30 converts the reference representative values (SH, SS, SV) specified in S46 into coordinate values in the vab color space (S50). Hereinafter, this coordinate value is referred to as a reference coordinate value (Sv, Sa, Sb). The process of S50 is executed similarly to the process of S48. In the equation shown in FIG. 9, when (H, S, V) is replaced with (SH, SS, SV) and (v, a, b) is replaced with (Sv, Sa, Sb), the reference coordinate value ( Equations for obtaining Sv, Sa, Sb) are obtained. The CPU 30 calculates reference coordinate values (Sv, Sa, Sb) according to this mathematical formula.

続いて、CPU30は、HSV対象画像データ52を構成する1つの画素を選択する(S52)。S52で選択された画素の座標値(以下では画素値と言い換えることもある)を(PH,PS,PV)と表現する。CPU30は、S52で選択された画素の座標値(PH,PS,PV)をvab色空間内の座標値(Pv,Pa,Pb)に変換する(S54)。S54の処理は、S48の処理と同様に実行される。図9に示される数式において、(H,S,V)を(PH,PS,PV)に置き換えるとともに、(v,a,b)を(Pv,Pa,Pb)に置き換えると、座標値(Pv,Pa,Pb)を得るための数式が得られる。CPU30は、この数式に従って、座標値(Pv,Pa,Pb)を算出する。   Subsequently, the CPU 30 selects one pixel constituting the HSV target image data 52 (S52). The coordinate value of the pixel selected in S52 (hereinafter sometimes referred to as a pixel value) is expressed as (PH, PS, PV). The CPU 30 converts the coordinate values (PH, PS, PV) of the pixel selected in S52 into coordinate values (Pv, Pa, Pb) in the vab color space (S54). The process of S54 is performed similarly to the process of S48. In the equation shown in FIG. 9, when (H, S, V) is replaced with (PH, PS, PV) and (v, a, b) is replaced with (Pv, Pa, Pb), the coordinate value (Pv , Pa, Pb) is obtained. The CPU 30 calculates coordinate values (Pv, Pa, Pb) according to this mathematical formula.

次いで、CPU30は、座標値(Pv,Pa,Pb)の補正量(Cv,Ca,Cb)を算出する(S56)。図10は、補正量を算出するための数式を示す。CPU30は、S54で算出されたPvと、S48で算出されたOvと、S50で算出されたSvとに基づいて、Cvを算出する。まず、CPU30は、図10(a)に示される数式に従って、下限値Lvと上限値Uvを算出する。次いで、CPU30は、図10(b)に示される数式に従って、Curvvを算出する。なお、図10(b)に示される数式に含まれるAdjSとAdjOは、PvとOvとSvに依存する数値ではなく、予め設定されている定数である。続いて、CPU30は、図10(c)に示される数式に従って、Cvを算出する。   Next, the CPU 30 calculates the correction amount (Cv, Ca, Cb) of the coordinate values (Pv, Pa, Pb) (S56). FIG. 10 shows mathematical formulas for calculating the correction amount. The CPU 30 calculates Cv based on Pv calculated in S54, Ov calculated in S48, and Sv calculated in S50. First, the CPU 30 calculates the lower limit value Lv and the upper limit value Uv according to the mathematical formula shown in FIG. Next, the CPU 30 calculates Curvv according to the mathematical formula shown in FIG. It should be noted that AdjS and AdjO included in the formula shown in FIG. 10B are not constant values depending on Pv, Ov, and Sv, but are preset constants. Subsequently, the CPU 30 calculates Cv according to the mathematical formula shown in FIG.

図11は、Pvが横軸であり、PvとCvの和(ここではMvと呼ぶ)が縦軸であるグラフを示す。図11のグラフは、Ovが0.25であるとともにSvが0.38である場合を例にしている。なお、Mvは、PvをCvで補正した場合の補正後の値である。後で詳しく説明するが、本実施例では、PvにCvを加算することのみによってMvを求めない。ただし、Cvについての理解を容易にするために、図11では、PvとCvの和をMvとしている。   FIG. 11 shows a graph in which Pv is the horizontal axis and the sum of Pv and Cv (referred to herein as Mv) is the vertical axis. The graph of FIG. 11 exemplifies a case where Ov is 0.25 and Sv is 0.38. Mv is a value after correction when Pv is corrected by Cv. As will be described in detail later, in this embodiment, Mv is not obtained only by adding Cv to Pv. However, in order to facilitate understanding of Cv, in FIG. 11, the sum of Pv and Cv is Mv.

図11のグラフから明らかなように、Pvが下限値Lvと上限値Uvの間の値である場合、PvはSvに近づくような補正カーブになっている。この補正カーブは、Svを境界として、上に凸である領域と下に凸である領域とに分けられる。例えば、PvがOvに等しい場合、CvはC1になる。この場合のMvは、OvとC1の和であるV1になる。V1は、OvとSvの間の値である。また、例えば、PvがOvとSvの間の値V2である場合、CvはC2になる。この場合のMvは、V2とC2の和であるV3になる。V3は、V2とSvの間の値である。より具体的には、V3は、V1とSvの間の値である。即ち、補正前の値PvがSvに近い程、補正後の値Mvは、Svに近い値になる。なお、PvがOvである場合にV1に補正される様子と、PvがV2の場合にV3に補正される様子は、図12(a)にも示されている。   As is apparent from the graph of FIG. 11, when Pv is a value between the lower limit value Lv and the upper limit value Uv, Pv is a correction curve that approaches Sv. This correction curve is divided into a region convex upward and a region convex downward with Sv as a boundary. For example, if Pv is equal to Ov, Cv is C1. In this case, Mv is V1, which is the sum of Ov and C1. V1 is a value between Ov and Sv. For example, when Pv is a value V2 between Ov and Sv, Cv is C2. In this case, Mv is V3 which is the sum of V2 and C2. V3 is a value between V2 and Sv. More specifically, V3 is a value between V1 and Sv. That is, the closer the value Pv before correction is to Sv, the closer the value Mv after correction is to Sv. It should be noted that FIG. 12A also shows how the correction is made to V1 when Pv is Ov, and how the correction is made to V3 when Pv is V2.

CPU30は、補正量Cvを算出する場合と同様の手法を用いて、補正量Caを算出する。CPU30は、PaとOaとSaとに基づいて、Caを算出する。Caは、図10に示される数式と同様の数式に従って算出される。具体的に言うと、図10(a)と図10(b)において、LvをLaに変更し、UvをUaに変更し、OvをOaに変更し、SvをSaに変更し、CurvvをCurvaに変更すると、Curvaを算出することができる。CPU30は、図10(c)に示される数式に従って、Caを算出する。   The CPU 30 calculates the correction amount Ca using the same method as that for calculating the correction amount Cv. The CPU 30 calculates Ca based on Pa, Oa, and Sa. Ca is calculated according to a mathematical formula similar to the mathematical formula shown in FIG. Specifically, in FIGS. 10A and 10B, Lv is changed to La, Uv is changed to Ua, Ov is changed to Oa, Sv is changed to Sa, and Curvv is changed to Curva. By changing to, Curva can be calculated. The CPU 30 calculates Ca according to the mathematical formula shown in FIG.

Paが横軸であり、PaとCaの和(ここではMaと呼ぶ)が縦軸であるグラフを描くと、図11のグラフと同様のグラフが得られる。即ち、Paが下限値Laと上限値Uaの間の値である場合、PaはSaに近づくように補正される。図12(b)は、Paが補正される様子の一例を示す。PaがOaに等しい場合、Paは、OaとSaの間の値A1に補正される。また、PaがOaとSaの間の値A2である場合、Paは、A1とSaの間の値A3に補正される。即ち、補正前の値PaがSaに近い程、補正後の値は、Saに近くなる。   When a graph is drawn in which Pa is the horizontal axis and the sum of Pa and Ca (herein referred to as Ma) is the vertical axis, a graph similar to the graph of FIG. 11 is obtained. That is, when Pa is a value between the lower limit value La and the upper limit value Ua, Pa is corrected so as to approach Sa. FIG. 12B shows an example of how Pa is corrected. When Pa is equal to Oa, Pa is corrected to a value A1 between Oa and Sa. When Pa is a value A2 between Oa and Sa, Pa is corrected to a value A3 between A1 and Sa. That is, the closer the value Pa before correction is to Sa, the closer the value after correction is to Sa.

さらに、CPU30は、補正量Cvを算出する場合と同様の手法を用いて、補正量Cbを算出する。CPU30は、PbとObとSbとに基づいて、Cbを算出する。図10(a)と図10(b)において、LvをLbに変更し、UvをUbに変更し、OvをObに変更し、SvをSbに変更し、CurvvをCurvbに変更すると、Curvbを算出することができる。CPU30は、図10(c)に示される数式に従って、Cbを算出する。   Further, the CPU 30 calculates the correction amount Cb by using the same method as that for calculating the correction amount Cv. The CPU 30 calculates Cb based on Pb, Ob, and Sb. 10 (a) and 10 (b), when Lv is changed to Lb, Uv is changed to Ub, Ov is changed to Ob, Sv is changed to Sb, and Curvv is changed to Curvb, Curvb is changed to Curvb. Can be calculated. The CPU 30 calculates Cb according to the mathematical formula shown in FIG.

Pbが横軸であり、PbとCbの和(ここではMbと呼ぶ)が縦軸であるグラフを描くと、図11のグラフと同様のグラフが得られる。即ち、Pbが下限値Lbと上限値Ubの間の値である場合、PbはSbに近づくように補正される。図12(c)は、Pbが補正される様子の一例を示す。PbがObに等しい場合、Pbは、ObとSbの間の値B1に補正される。また、PbがObとSbの間の値B2である場合、Pbは、B1とSbの間の値B3に補正される。即ち、補正前の値PbがSbに近い程、補正後の値は、Sbに近くなる。   When a graph is drawn in which Pb is the horizontal axis and the sum of Pb and Cb (referred to herein as Mb) is the vertical axis, a graph similar to the graph of FIG. 11 is obtained. That is, when Pb is a value between the lower limit value Lb and the upper limit value Ub, Pb is corrected so as to approach Sb. FIG. 12C shows an example of how Pb is corrected. When Pb is equal to Ob, Pb is corrected to a value B1 between Ob and Sb. When Pb is a value B2 between Ob and Sb, Pb is corrected to a value B3 between B1 and Sb. That is, the closer the value Pb before correction is to Sb, the closer the value after correction is to Sb.

図12から明らかなように、補正対象の画素(図4のS52で選択された画素)の座標値(Pv,Pa,Pb)が対象座標値(Ov,Oa,Ob)に等しい場合、座標値(Pv,Pa,Pb)は、対象座標値(Ov,Oa,Ob)と基準座標値(Sv,Sa,Sb)の間の座標値(V1,A1,B1)に補正される。また、補正対象の画素の座標値(Pv,Pa,Pb)が対象座標値(Ov,Oa,Ob)と基準座標値(Sv,Sa,Sb)の間の座標値(V2,A2,B2)である場合、座標値(V2,A2,B2)は、座標値(V1,A1,B1)と基準座標値(Sv,Sa,Sb)の間の座標値(V3,A3,B3)に補正される。   As is clear from FIG. 12, when the coordinate values (Pv, Pa, Pb) of the correction target pixel (the pixel selected in S52 of FIG. 4) are equal to the target coordinate value (Ov, Oa, Ob), the coordinate value (Pv, Pa, Pb) is corrected to coordinate values (V1, A1, B1) between the target coordinate values (Ov, Oa, Ob) and the reference coordinate values (Sv, Sa, Sb). Further, the coordinate values (Pv, Pa, Pb) of the correction target pixel are coordinate values (V2, A2, B2) between the target coordinate values (Ov, Oa, Ob) and the reference coordinate values (Sv, Sa, Sb). The coordinate values (V2, A2, B2) are corrected to coordinate values (V3, A3, B3) between the coordinate values (V1, A1, B1) and the reference coordinate values (Sv, Sa, Sb). The

CPU30は、補正量(Cv,Ca,Cb)を算出すると、図5のS58に進む。S58では、CPU30は、パラメータdとパラメータrangeを算出する。図13(a)は、パラメータdとパラメータrangeを算出するための数式を示す。CPU30は、図13(a)に示される数式に従って、パラメータdとパラメータrangeを算出する。パラメータdは、補正対象の画素の座標値(Pv,Pa,Pb)と対象座標値(Ov,Oa,Ob)との間の距離と、補正対象の画素の座標値(Pv,Pa,Pb)と基準座標値(Sv,Sa,Sb)との間の距離との和である。また、パラメータrangeは、対象座標値(Ov,Oa,Ob)と基準座標値(Sv,Sa,Sb)との間の距離である。   After calculating the correction amount (Cv, Ca, Cb), the CPU 30 proceeds to S58 in FIG. In S58, the CPU 30 calculates a parameter d and a parameter range. FIG. 13A shows mathematical formulas for calculating the parameter d and the parameter range. The CPU 30 calculates the parameter d and the parameter range according to the mathematical formula shown in FIG. The parameter d includes the distance between the coordinate value (Pv, Pa, Pb) of the correction target pixel and the target coordinate value (Ov, Oa, Ob), and the coordinate value (Pv, Pa, Pb) of the correction target pixel. And the distance between the reference coordinate value (Sv, Sa, Sb). The parameter range is a distance between the target coordinate value (Ov, Oa, Ob) and the reference coordinate value (Sv, Sa, Sb).

次いで、CPU30は、パラメータdとパラメータrangeに基づいて、パラメータwを算出する(S60)。図13(b)は、wを算出するための数式を示す。なお、図13(b)の数式において、suiの値は、図3のS16で選択された補正モードに応じて設定される。図13(c)は、補正モードとsuiの値の対応関係を示す。緑モードの場合のsuiの値が最も大きく、肌モードの場合のsuiの値が最も小さい。空モードの場合のsuiの値は、緑モードの場合のsuiの値と肌モードの場合のsuiの値との間の値である。図13(b)から分かるように、dがrangeに等しい場合、wは、最も大きい値(1.0)になる。また、dがrangeより大きい場合、dが大きくなるにつれて、wが小さくなる。dがrangeとsuiを乗算することによって得られる値より大きい場合、wは、最も小さい値(0)になる。図13(b)の数式によると、wは、dが大きくなる程、小さくなる値であると言える。逆に言うと、wは、dが小さくなる程、大きくなる値であると言える。   Next, the CPU 30 calculates the parameter w based on the parameter d and the parameter range (S60). FIG. 13B shows mathematical formulas for calculating w. In the equation of FIG. 13B, the value of sui is set according to the correction mode selected in S16 of FIG. FIG. 13C shows the correspondence between the correction mode and the value of sui. The value of sui in the green mode is the largest, and the value of sui in the skin mode is the smallest. The value of sui in the case of the sky mode is a value between the value of sui in the case of the green mode and the value of sui in the case of the skin mode. As can be seen from FIG. 13B, when d is equal to range, w is the largest value (1.0). Further, when d is larger than range, w decreases as d increases. If d is greater than the value obtained by multiplying range and sui, then w is the smallest value (0). According to the equation in FIG. 13B, it can be said that w is a value that decreases as d increases. Conversely, it can be said that w is a value that increases as d decreases.

図14は、Pvが横軸であり、wが縦軸であるグラフを示す。図14のグラフは、Ovが0.2であるとともにSvが0.31である場合を例にしている。なお、図14のグラフから明らかなように、PvがOvとSvの間の値である場合(即ちd=rangeである場合)、wは1.0である。PvがOvより小さくなるにつれて、wが滑らかに小さくなっている。また、PvがSvより大きくなるにつれて、wが滑らかに小さくなっている。OvとSvの両者からPvが遠くなる程、wが小さくなる。逆に言うと、OvとSvの両者にPvが近い程、wが大きくなる。なお、Paが横軸であってwが縦軸であるグラフと、Pbが横軸であってwが縦軸であるグラフも、図14のグラフと同様の形状を示す。   FIG. 14 shows a graph where Pv is the horizontal axis and w is the vertical axis. The graph of FIG. 14 exemplifies a case where Ov is 0.2 and Sv is 0.31. As is clear from the graph of FIG. 14, when Pv is a value between Ov and Sv (that is, when d = range), w is 1.0. As Pv becomes smaller than Ov, w decreases smoothly. Also, as Pv becomes larger than Sv, w becomes smaller smoothly. As Pv becomes farther from both Ov and Sv, w becomes smaller. In other words, w is larger as Pv is closer to both Ov and Sv. A graph in which Pa is the horizontal axis and w is the vertical axis, and a graph in which Pb is the horizontal axis and w is the vertical axis also show the same shape as the graph of FIG.

CPU30は、補正対象の画素の座標値(Pv,Pa,Pb)を、パラメータwと補正量(Cv,Ca,Cb)に基づいて補正する(S62)。これにより、補正後の座標値(Mv,Ma,Mb)が得られる。図15は、補正後の座標値(Mv,Ma,Mb)を算出するための数式を示す。CPU30は、パラメータwを補正量(Cv,Ca,Cb)に乗算することによって得られる座標値を、補正対象の画素の座標値(Pv,Pa,Pb)に加算することによって、補正後の座標値(Mv,Ma,Mb)を算出する。   The CPU 30 corrects the coordinate value (Pv, Pa, Pb) of the pixel to be corrected based on the parameter w and the correction amount (Cv, Ca, Cb) (S62). As a result, corrected coordinate values (Mv, Ma, Mb) are obtained. FIG. 15 shows mathematical formulas for calculating the corrected coordinate values (Mv, Ma, Mb). The CPU 30 adds the coordinate value obtained by multiplying the correction amount (Cv, Ca, Cb) by the parameter w to the coordinate value (Pv, Pa, Pb) of the correction target pixel, thereby correcting the corrected coordinate. Values (Mv, Ma, Mb) are calculated.

上述したように、wを補正量(Cv,Ca,Cb)に乗算することによって、実際の補正量が算出される。wは、図13(b)に示される数式に従って算出されるものであり、dが小さくなる程、大きくなる値である。dが小さくなる程、実際の補正量(w×(Cv,Ca,Cb))が大きくなる。即ち、dが小さくなる程、補正対象の画素の座標値(Pv,Pa,Pb)が大きく補正されることになる。図16は、va平面上の対象座標値Oと基準座標値Sを示す。図16は、色が白に近づく程、大きく補正されることを意味している。逆に言うと、図16は、色が黒に近づく程、小さく補正されることを意味している。完全に黒色の領域は、補正されないことを意味している。この図16からも、上記のパラメータdが小さい程、補正対象の画素の座標値(Pv,Pa,Pb)が大きく補正されることが理解できる。   As described above, the actual correction amount is calculated by multiplying w by the correction amount (Cv, Ca, Cb). w is calculated according to the mathematical formula shown in FIG. 13B, and is a value that increases as d decreases. As d decreases, the actual correction amount (w × (Cv, Ca, Cb)) increases. That is, the smaller the d is, the larger the coordinate values (Pv, Pa, Pb) of the pixel to be corrected are corrected. FIG. 16 shows the target coordinate value O and the reference coordinate value S on the va plane. FIG. 16 means that the closer the color is to white, the greater the correction is made. Conversely, FIG. 16 means that the color is corrected to be smaller as it approaches black. A completely black area means no correction. FIG. 16 also shows that the smaller the parameter d is, the larger the coordinate values (Pv, Pa, Pb) of the pixel to be corrected are corrected.

なお、図16において完全に黒色の領域は、対象座標値Oと基準座標値Sを2つの焦点とする楕円の外側の領域である。即ち、対象座標値Oと基準座標値Sを2つの焦点とする楕円の外側の領域に、補正対象の画素の座標値(Pv,Pa,Pb)が存在する場合、その座標値は補正されない。逆に言うと、対象座標値Oと基準座標値Sを2つの焦点とする楕円の内側の領域に、補正対象の画素の座標値(Pv,Pa,Pb)が存在する場合、その座標値が補正される。図16はva平面で表現されているが、vb平面及びab平面でも同様の図になる。即ち、vab空間において、対象座標値Oと基準座標値Sを2つの焦点とする楕円体の外側の領域に、補正対象の画素の座標値(Pv,Pa,Pb)が存在する場合、その座標値は補正されない。逆に言うと、vab空間において、対象座標値Oと基準座標値Sを2つの焦点とする楕円体の内側の領域に、補正対象の画素の座標値(Pv,Pa,Pb)が存在する場合、その座標値が補正される。   In FIG. 16, a completely black region is a region outside the ellipse having the target coordinate value O and the reference coordinate value S as two focal points. That is, when the coordinate value (Pv, Pa, Pb) of the pixel to be corrected exists in a region outside the ellipse having the target coordinate value O and the reference coordinate value S as two focal points, the coordinate value is not corrected. In other words, if the coordinate value (Pv, Pa, Pb) of the pixel to be corrected exists in the area inside the ellipse having the target coordinate value O and the reference coordinate value S as two focal points, the coordinate value is It is corrected. Although FIG. 16 is represented by the va plane, the same applies to the vb plane and the ab plane. That is, in the vab space, when the coordinate value (Pv, Pa, Pb) of the correction target pixel exists in an area outside the ellipsoid having the target coordinate value O and the reference coordinate value S as two focal points, The value is not corrected. In other words, in the vab space, the coordinate value (Pv, Pa, Pb) of the pixel to be corrected exists in the area inside the ellipsoid having the target coordinate value O and the reference coordinate value S as two focal points. The coordinate value is corrected.

CPU30は、S62において補正後座標値(Mv,Ma,Mb)を算出すると、S64に進む。S64では、CPU30は、補正後座標値(Mv,Ma,Mb)をHSV色空間内の座標値(MH,MS,MV)に変換する。図17は、vab色空間内の座標値をHSV色空間内の座標値に変換する数式を示す。図17では、変換対象の座標値を(v,a,b)と表現し、その座標値から変換されたHSV色空間内の座標値を(H,S,V)と表現している。図17に示される数式において、(v,a,b)を(Mv,Ma,Mb)に置き換えるとともに、(H,S,V)を(MH,MS,MV)に置き換えると、座標値(MH,MS,MV)を得るための数式が得られる。CPU30は、この数式に従って、座標値(MH,MS,MV)を算出する。   After calculating the corrected coordinate values (Mv, Ma, Mb) in S62, the CPU 30 proceeds to S64. In S64, the CPU 30 converts the corrected coordinate values (Mv, Ma, Mb) into coordinate values (MH, MS, MV) in the HSV color space. FIG. 17 shows mathematical formulas for converting coordinate values in the vab color space into coordinate values in the HSV color space. In FIG. 17, the coordinate value to be converted is expressed as (v, a, b), and the coordinate value in the HSV color space converted from the coordinate value is expressed as (H, S, V). In the equation shown in FIG. 17, when (v, a, b) is replaced with (Mv, Ma, Mb) and (H, S, V) is replaced with (MH, MS, MV), the coordinate value (MH , MS, MV). The CPU 30 calculates coordinate values (MH, MS, MV) according to this mathematical formula.

次いで、CPU30は、S64で特定された座標値(MH,MS,MV)を、RGB色空間内の座標値(MR,MG,MB)に変換する(S66)。図18は、HSV色空間内の座標値をRGB色空間内の座標値に変換する数式を示す。図18では、変換対象の座標値を(H,S,V)と表現し、その座標値から変換されたRGB色空間内の座標値を(R,G,B)と表現している。図18に示される数式において、(H,S,V)を(MH,MS,MV)に置き換えるとともに、(R,G,B)を(MR,MG,MB)に置き換えると、座標値(MR,MG,MB)を得るための数式が得られる。図18(a)に示されるように、CPU30は、MHから媒介変数in及びflを算出する。なお、図18(b)に示されるように、CPU30は、媒介変数inが偶数の場合、1からflを減算し、新たなflを算出する。次いで、CPU30は、図18(c)に示される数式に従って、MSとMVから媒介変数m及びnを算出する。CPU30は、図18(d)に示される数式に従って、MVとmとnからMRとMGとMBを算出する。これにより、RGB色空間内の座標値(MR,MG,MB)が得られる。   Next, the CPU 30 converts the coordinate values (MH, MS, MV) specified in S64 into coordinate values (MR, MG, MB) in the RGB color space (S66). FIG. 18 shows mathematical formulas for converting coordinate values in the HSV color space into coordinate values in the RGB color space. In FIG. 18, the coordinate value to be converted is expressed as (H, S, V), and the coordinate value in the RGB color space converted from the coordinate value is expressed as (R, G, B). In the mathematical formula shown in FIG. 18, when (H, S, V) is replaced with (MH, MS, MV) and (R, G, B) is replaced with (MR, MG, MB), the coordinate value (MR , MG, MB) is obtained. As shown in FIG. 18A, the CPU 30 calculates parameter variables in and fl from MH. As shown in FIG. 18B, when the parameter variable in is an even number, the CPU 30 subtracts fl from 1 to calculate a new fl. Next, the CPU 30 calculates parameter variables m and n from the MS and the MV according to the mathematical formula shown in FIG. CPU30 calculates MR, MG, and MB from MV, m, and n according to the numerical formula shown by FIG.18 (d). Thereby, coordinate values (MR, MG, MB) in the RGB color space are obtained.

上記のS54〜S66の処理が実行されることによって、HSV対象画像データ52内の1つの画素の座標値(PH,PS,PV)が補正され、補正後の座標値としてRGB色空間内の座標値(MR,MG,MB)が得られる。CPU30は、HSV対象画像データ52内の全ての画素についてS54〜S66の処理が実行されたのか否かを判断する(S68)。ここでNOの場合、CPU30は、HSV対象画像データ52内の次の画素を選択する(S70)。CPU30は、S70で選択された画素について、S54〜S66の処理を実行する。一方において、S68でYESの場合、補正処理が終了する。この場合、S54〜S66の処理で得られたRGB色空間内の座標値で各画素の値が表現される補正済みRGB画像データ56(図2参照)が得られることになる。   By executing the processing of S54 to S66, the coordinate value (PH, PS, PV) of one pixel in the HSV target image data 52 is corrected, and the coordinate value in the RGB color space is corrected as the coordinate value. Values (MR, MG, MB) are obtained. The CPU 30 determines whether or not the processing of S54 to S66 has been executed for all the pixels in the HSV target image data 52 (S68). In the case of NO here, the CPU 30 selects the next pixel in the HSV target image data 52 (S70). CPU30 performs the process of S54-S66 about the pixel selected by S70. On the other hand, if YES in S68, the correction process ends. In this case, corrected RGB image data 56 (see FIG. 2) in which the value of each pixel is expressed by the coordinate value in the RGB color space obtained by the processing of S54 to S66 is obtained.

本実施例の多機能機10について詳しく説明した。多機能機10は、図4のS44及びS46において、HSV色空間(図7参照)内で処理を実行する。例えば、図4のS44では、多機能機10は、ユーザが望む補正モードに応じた色相H(例えば空モードの場合は180〜240°)を有する画素群をHSV対象画像データ52から特定し、その画素群から対象代表値を算出する。   The multi-function device 10 of the present embodiment has been described in detail. The multi-function device 10 executes processing in the HSV color space (see FIG. 7) in S44 and S46 of FIG. For example, in S44 of FIG. 4, the multi-function device 10 identifies a pixel group having a hue H (for example, 180 to 240 ° in the sky mode) according to the correction mode desired by the user from the HSV target image data 52, A target representative value is calculated from the pixel group.

HSV色空間において対象代表値と基準代表値が求められるために、HSV対象画像データ52内の各画素をHSV色空間内で補正する手法を採用することも考えられる。しかしながら、この場合、次の問題が発生する。図19は、HSV色空間内のHS平面を示す。図19に示すαは、補正モードに応じた色相H(例えば空モードの場合は180〜240°)を示す。HSV色空間内で補正する手法を採用すると、彩度Sの小さい2つの画素120,124が図19に示される位置に存在する場合に、画素120が補正され、画素124が補正されないことになる。この結果、補正前には見た目の色の差がほとんどない両者の画素120,124が、補正後には大きく異なる色になってしまう。HSV色空間内で補正する手法で上記の問題に対処するためには、図20のハッチングで示される領域に含まれる画素群を補正するようにしなければならない。しかしながら、このようなV軸を包含する領域をHSV色空間内で定義するためには、様々なHの値のそれぞれについてS及びVを定義する必要があり、膨大な計算量を必要とする。   Since the target representative value and the reference representative value are obtained in the HSV color space, it may be possible to adopt a method of correcting each pixel in the HSV target image data 52 in the HSV color space. However, in this case, the following problem occurs. FIG. 19 shows the HS plane in the HSV color space. Α shown in FIG. 19 indicates a hue H (for example, 180 to 240 ° in the sky mode) according to the correction mode. When the correction method in the HSV color space is employed, when two pixels 120 and 124 having a low saturation S are present at the positions shown in FIG. 19, the pixel 120 is corrected and the pixel 124 is not corrected. . As a result, the two pixels 120 and 124 that have almost no difference in the apparent color before correction become greatly different colors after correction. In order to cope with the above problem by the method of correcting in the HSV color space, it is necessary to correct the pixel group included in the area indicated by hatching in FIG. However, in order to define such a region including the V axis in the HSV color space, it is necessary to define S and V for each of various values of H, which requires a huge amount of calculation.

これに対し、本実施例の多機能機10は、直交座標系のvab色空間において補正を実行する。即ち、多機能機10は、対象代表値(OH,OS,OV)をvab色空間内の対象座標値(Ov,Oa,Ob)に変換し(図4のS48)、その対象座標値(Ov,Oa,Ob)の周囲の領域(対象座標値(Ov,Oa,Ob)と基準座標値(Sv,Sa,Sb)とを2つの焦点とする楕円体内の領域)に含まれる画素の値を補正する。このために、補正モードに応じた色相を有さない画素124が存在する場合でも、その画素124の値が補正され得る。補正前には見た目の色の差がほとんどない2つの画素120,124が、補正後には大きく異なる色になってしまうことを抑制することができる。本実施例の多機能機10は、HSV基準画像データ62を用いてHSV対象画像データ52を適切に補正することができる。   On the other hand, the multi-function device 10 of the present embodiment executes correction in the vab color space of the orthogonal coordinate system. That is, the multi-function device 10 converts the target representative value (OH, OS, OV) into the target coordinate value (Ov, Oa, Ob) in the vab color space (S48 in FIG. 4), and the target coordinate value (Ov , Oa, Ob) are the values of the pixels included in the area around the object (the area within the ellipsoid having the target coordinate values (Ov, Oa, Ob) and the reference coordinate values (Sv, Sa, Sb) as two focal points). to correct. For this reason, even when there is a pixel 124 that does not have a hue corresponding to the correction mode, the value of the pixel 124 can be corrected. It is possible to prevent the two pixels 120 and 124 that have almost no difference in apparent color before correction from becoming significantly different colors after correction. The multi-function device 10 according to this embodiment can appropriately correct the HSV target image data 52 using the HSV reference image data 62.

また、図13の数式に示されるように、多機能機10では、補正モードに応じて設定されているsuiの値が大きい程、補正されるべき画素の値の範囲(range×sui)が大きくなるように設定されている。suiは、緑モードの場合に最も大きく、肌モードの場合に最も小さい。従って、色の変化が認識しにくい緑色を補正する場合には、補正されるべき画素の値の範囲が大きくなり、色の変化を認識しやすい肌色を補正する場合には、補正されるべき画素の値の範囲が小さくなる。補正されるべき画素の値の範囲が、ヒトの視覚特性に鑑みて適切に設定されている。   Further, as shown in the mathematical formula of FIG. 13, in the multi-function device 10, the range of the pixel value to be corrected (range × sui) increases as the value of sui set according to the correction mode increases. It is set to be. sui is the largest in the green mode and the smallest in the skin mode. Therefore, when correcting green, which is difficult to recognize color changes, the range of pixel values to be corrected becomes large, and when correcting skin colors that are easy to recognize color changes, pixels to be corrected The range of values becomes smaller. The range of pixel values to be corrected is appropriately set in view of human visual characteristics.

なお、図11に示される補正カーブは、wが1.0の場合を例にしている。図11の例では、V4は補正されず、V5がV6に補正される。V4とV5は、値が近いために、見た目の色が似ている。V4に対応する画素とV5に対応する画素が隣り合っている場合、補正されない前者の画素(即ちV=V4)と補正される後者の画素(即ちV=V6)の間において、大きく色が異なる可能性がある。このような事象が発生するのを抑制するために、本実施例では、以下の構成が採用されている。即ち、対象座標値(Ov,Oa,Ob)と補正対象の画素の座標値(Pv,Pa,Pb)との間の距離と、基準座標値(Sv,Sa,Sb)と補正対象の画素の座標値(Pv,Pa,Pb)との間の距離との和dが小さい程、補正量が大きくなるように、パラメータwが採用されている。パラメータwは、dが大きくなるにつれて、小さくなる値である(図13(b)参照)。図11に示されるV5に対応する画素は、対象座標値(図11のOv)と基準座標値(図11のSv)の双方に対して遠い位置に存在するために、補正量が小さくなる。この結果、V4に対応する画素とV5に対応する画素が隣り合っている場合であっても、それらの画素の間で大きく色が異なることを抑制することができる。   Note that the correction curve shown in FIG. 11 is an example when w is 1.0. In the example of FIG. 11, V4 is not corrected, and V5 is corrected to V6. Since the values of V4 and V5 are close, the appearance colors are similar. When the pixel corresponding to V4 and the pixel corresponding to V5 are adjacent to each other, the color is greatly different between the former pixel that is not corrected (ie, V = V4) and the latter pixel that is corrected (ie, V = V6). there is a possibility. In order to suppress the occurrence of such an event, the following configuration is adopted in this embodiment. That is, the distance between the target coordinate value (Ov, Oa, Ob) and the coordinate value (Pv, Pa, Pb) of the correction target pixel, the reference coordinate value (Sv, Sa, Sb) and the correction target pixel. The parameter w is employed so that the correction amount increases as the sum d with the distance between the coordinate values (Pv, Pa, Pb) decreases. The parameter w is a value that decreases as d increases (see FIG. 13B). Since the pixel corresponding to V5 shown in FIG. 11 is located far from both the target coordinate value (Ov in FIG. 11) and the reference coordinate value (Sv in FIG. 11), the correction amount is small. As a result, even when the pixel corresponding to V4 and the pixel corresponding to V5 are adjacent to each other, it is possible to suppress a large difference in color between the pixels.

請求項に記載されている各要素と第1実施例との関係について記載しておく。請求項の画像処理装置は、多機能機10に対応する。請求項の対象画像データは、HSV対象画像データ52に対応する。請求項の基準画像データは、HSV基準画像データ62に対応する。請求項の補正済み画像データは、補正済みRGB画像データ56に対応する。請求項の特定範囲は、各補正モードに応じて決められている色相Hの範囲(図8参照)に対応する。請求項の極座標系の色空間は、HSV色空間に対応する。請求項の第1極座標値は、対象代表値(OH,OS,OV)に対応する。請求項の第1決定部は、補正プログラム36に従って図4のS44の処理を実行するCPU30に対応する。請求項の第1直交座標値は、対象座標値(Ov,Oa,Ob)に対応する。請求項の第1直交座標系の色空間は、vab色空間に対応する。請求項の第1算出部は、補正プログラム36に従って図4のS48の処理を実行するCPU30に対応する。請求項の第2極座標値は、基準代表値(SH,SS,SV)に対応する。請求項の第2決定部は、補正プログラム36に従って図4のS46の処理を実行するCPU30に対応する。請求項の第2直交座標値は、基準座標値(Sv,Sa,Sb)に対応する。請求項の第2算出部は、補正プログラム36に従って図4のS50の処理を実行するCPU30に対応する。請求項の第1直交座標値の周囲の領域(特定領域、及び、楕円体内の領域)は、図13の数式に従って求められるw>0の領域(図16の黒色以外の領域)に対応する。請求項の補正部は、補正プログラム36に従って図4のS52〜S56、及び、図5のS58〜S70の処理を実行するCPU30に対応する。   The relationship between each element described in the claims and the first embodiment will be described. The image processing apparatus according to the claims corresponds to the multi-function device 10. The target image data in the claims corresponds to the HSV target image data 52. The reference image data in the claims corresponds to the HSV reference image data 62. The corrected image data in the claims corresponds to the corrected RGB image data 56. The specific range of the claims corresponds to the range of hue H (see FIG. 8) determined according to each correction mode. The polar coordinate system color space in the claims corresponds to the HSV color space. The first polar coordinate value in the claims corresponds to the target representative value (OH, OS, OV). The first determination unit in the claims corresponds to the CPU 30 that executes the process of S44 of FIG. The first orthogonal coordinate value in the claims corresponds to the target coordinate value (Ov, Oa, Ob). The color space of the first orthogonal coordinate system in the claims corresponds to the vab color space. The first calculation unit in the claims corresponds to the CPU 30 that executes the process of S48 of FIG. The second polar coordinate value in the claims corresponds to the reference representative value (SH, SS, SV). The second determination unit in the claims corresponds to the CPU 30 that executes the process of S46 of FIG. The second orthogonal coordinate value in the claims corresponds to the reference coordinate value (Sv, Sa, Sb). The second calculation unit in the claims corresponds to the CPU 30 that executes the process of S50 of FIG. The area around the first orthogonal coordinate value (the specific area and the area within the ellipsoid) in the claims corresponds to an area of w> 0 (an area other than black in FIG. 16) obtained according to the mathematical formula of FIG. The correction unit in the claims corresponds to the CPU 30 that executes the processes of S52 to S56 in FIG. 4 and S58 to S70 in FIG.

請求項の第1距離と第2距離との和は、パラメータdに対応する。請求項の第3直交座標値は、図12の(V1,A1,B1)に対応する。請求項の第4直交座標値は、図12の(V2,A2,B2)に対応する。請求項の第5直交座標値は、図12の(V3,A3,B3)に対応する。請求項の第2直交座標系の色空間は、RGB色空間に対応する。請求項の特定画像データは、RGB対象画像データ50に対応する。請求項の変換部は、補正プログラム36に従って図4のS40の処理を実行するCPU30に対応する。請求項の特定直交座標値は、座標値(Pv,Pa,Pb)に対応する。請求項の特定極座標値は、座標値(MH,MS,MV)に対応する。   The sum of the first distance and the second distance in the claims corresponds to the parameter d. The third orthogonal coordinate value in the claims corresponds to (V1, A1, B1) in FIG. The fourth orthogonal coordinate value in the claims corresponds to (V2, A2, B2) in FIG. The fifth orthogonal coordinate value in the claims corresponds to (V3, A3, B3) in FIG. The color space of the second orthogonal coordinate system in the claims corresponds to the RGB color space. The specific image data in the claims corresponds to the RGB target image data 50. The conversion unit in the claims corresponds to the CPU 30 that executes the process of S40 of FIG. The specific orthogonal coordinate value in the claims corresponds to the coordinate value (Pv, Pa, Pb). The specific polar coordinate value in the claims corresponds to the coordinate value (MH, MS, MV).

(第2実施例)
続いて、第2実施例について説明する。本実施例では、図3のS18の補正処理の内容が第1実施例と異なる。第1実施例では、vab色空間内において補正対象の画素の座標値が補正される。これに対し、本実施例では、RGB色空間内において補正対象の画素の座標値が補正される。
(Second embodiment)
Subsequently, a second embodiment will be described. In the present embodiment, the content of the correction process in S18 of FIG. 3 is different from that of the first embodiment. In the first embodiment, the coordinate value of the correction target pixel is corrected in the vab color space. In contrast, in this embodiment, the coordinate value of the correction target pixel is corrected in the RGB color space.

図21は、本実施例の補正処理のフローチャートを示す。CPU30は、図4のS40〜S46の処理を実行することによって、対象代表値(OH,OS,OV)を算出するとともに、基準代表値(SH,SS,SV)を算出する。次いで、CPU30は、対象代表値(OH,OS,OV)をRGB色空間内の対象座標値(OR,OG,OB)に変換する(S148)。さらに、CPU30は、基準代表値(SH,SS,SV)をRGB色空間内の対象座標値(SR,SG,SB)に変換する(S150)。S148とS150の処理は、図18に示される数式に従って実行される。   FIG. 21 shows a flowchart of the correction process of this embodiment. The CPU 30 calculates the target representative value (OH, OS, OV) and the reference representative value (SH, SS, SV) by executing the processes of S40 to S46 in FIG. Next, the CPU 30 converts the target representative values (OH, OS, OV) into target coordinate values (OR, OG, OB) in the RGB color space (S148). Further, the CPU 30 converts the reference representative values (SH, SS, SV) into target coordinate values (SR, SG, SB) in the RGB color space (S150). The processing of S148 and S150 is executed according to the mathematical formula shown in FIG.

次いで、CPU30は、RGB対象画像データ50を構成する1つの画素を選択する(S152)。なお、以下では、S152で選択された画素の座標値を(PR,PG,PB)と表現する。CPU30は、S152で選択された画素の座標値(PR,PG,PB)の補正量(CR,CG,CB)を算出する。この補正量は、図10に示される数式によって算出される。具体的に言うと、図10において、LvをLRに変更し、UvをURに変更し、OvをORに変更し、SvをSRに変更し、PvをPRに変更し、CurvvをCurvRに変更し、CvをCRに変更すると、CRを算出することができる。なお、本実施例では、図10(a)の「Lv>1.0の場合 Lv=1.0」という記載は、「LR>255の場合 LR=255」に変更される。また、図10(a)の「Uv>1.0の場合 Uv=1.0」という記載は、「UR>255の場合 UR=255」に変更される。CGとCBを算出する手法は、CRを算出する手法と同様である。   Next, the CPU 30 selects one pixel constituting the RGB target image data 50 (S152). Hereinafter, the coordinate value of the pixel selected in S152 is expressed as (PR, PG, PB). The CPU 30 calculates the correction amount (CR, CG, CB) of the coordinate values (PR, PG, PB) of the pixel selected in S152. This correction amount is calculated by the mathematical formula shown in FIG. Specifically, in FIG. 10, Lv is changed to LR, Uv is changed to UR, Ov is changed to OR, Sv is changed to SR, Pv is changed to PR, and Curvv is changed to CurvR. If Cv is changed to CR, CR can be calculated. In this embodiment, the description “Lv = 1.0 when Lv> 1.0” in FIG. 10A is changed to “LR = 255 when LR> 255”. Further, the description “Uv = 1.0 when Uv> 1.0” in FIG. 10A is changed to “UR = 255 when UR> 255”. The method for calculating CG and CB is the same as the method for calculating CR.

続いて、CPU30は、パラメータdとパラメータrangeを算出する(S158)。パラメータdとパラメータrangeは、図13(a)に示される数式に従って算出される。パラメータdは、補正対象の画素の座標値(PR,PG,PB)と対象座標値(OR,OG,OG)との間の距離と、補正対象の画素の座標値(PR,PG,PB)と基準座標値(SR,SG,SB)との間の距離との和である。また、パラメータrangeは、対象座標値(OR,OG,OB)と基準座標値(SR,SG,SB)との間の距離である。   Subsequently, the CPU 30 calculates a parameter d and a parameter range (S158). The parameter d and the parameter range are calculated according to the mathematical formula shown in FIG. The parameter d includes the distance between the coordinate value (PR, PG, PB) of the pixel to be corrected and the target coordinate value (OR, OG, OG), and the coordinate value (PR, PG, PB) of the pixel to be corrected. And the distance between the reference coordinate values (SR, SG, SB). The parameter range is a distance between the target coordinate value (OR, OG, OB) and the reference coordinate value (SR, SG, SB).

次いで、CPU30は、パラメータdとパラメータrangeに基づいて、パラメータwを算出する(S160)。パラメータwは、図13(b)に示される数式に従って算出される。続いて、CPU30は、補正対象の画素の座標値(PR,PG,PB)を、パラメータwと補正量(CR,CG,CB)に基づいて補正する(S162)。これにより、補正後の座標値(MR,MG,MB)が得られる。S162の処理は、図15に示される数式に従って算出される。即ち、CPU30は、パラメータwを補正量(CR,CG,CB)に乗算することによって得られる座標値を、補正対象の画素の座標値(PR,PG,PB)に加算することによって、補正後の座標値(MR,MG,MB)を算出する。   Next, the CPU 30 calculates the parameter w based on the parameter d and the parameter range (S160). The parameter w is calculated according to the mathematical formula shown in FIG. Subsequently, the CPU 30 corrects the coordinate values (PR, PG, PB) of the pixel to be corrected based on the parameter w and the correction amount (CR, CG, CB) (S162). As a result, corrected coordinate values (MR, MG, MB) are obtained. The process of S162 is calculated according to the mathematical formula shown in FIG. That is, the CPU 30 adds the coordinate value obtained by multiplying the parameter w by the correction amount (CR, CG, CB) to the coordinate value (PR, PG, PB) of the pixel to be corrected, thereby correcting the corrected value. Are calculated (MR, MG, MB).

CPU30は、S162において補正後座標値(MR,MG,MB)を算出すると、S168に進む。S168では、CPU30は、RGB対象画像データ50内の全ての画素についてS156〜S162の処理が実行されたのか否かを判断する。ここでNOの場合、CPU30は、RGB対象画像データ50内の次の画素を選択し(S170)、S156〜S162の処理を実行する。一方において、S168でYESの場合、補正処理が終了する。この場合、補正済みRGB画像データ56(図2参照)が得られることになる。   After calculating the corrected coordinate values (MR, MG, MB) in S162, the CPU 30 proceeds to S168. In S168, the CPU 30 determines whether or not the processing in S156 to S162 has been executed for all the pixels in the RGB target image data 50. In the case of NO here, the CPU 30 selects the next pixel in the RGB target image data 50 (S170), and executes the processing of S156 to S162. On the other hand, if YES in S168, the correction process ends. In this case, corrected RGB image data 56 (see FIG. 2) is obtained.

第1実施例では、図5のS62において補正後の座標値(Mv,Ma,Mb)が算出された後に、座標値(Mv,Ma,Mb)をHSV色空間内の座標値(MH,MS,MV)に変換する処理(S64)と、座標値(MH,MS,MV)をRGB色空間内の座標値(MR,MG,MB)に変換する処理(S66)とが必要とされる。これに対し、本実施例では、図21のS162の処理で得られる座標値(MR,MG,MB)がRGB色空間内の座標値であるために、変換処理が不要である。   In the first embodiment, after the corrected coordinate values (Mv, Ma, Mb) are calculated in S62 of FIG. 5, the coordinate values (Mv, Ma, Mb) are converted into the coordinate values (MH, MS) in the HSV color space. , MV), and a process (S66) for converting the coordinate values (MH, MS, MV) to the coordinate values (MR, MG, MB) in the RGB color space. On the other hand, in this embodiment, since the coordinate values (MR, MG, MB) obtained by the process of S162 in FIG. 21 are coordinate values in the RGB color space, no conversion process is required.

以上、本発明の具体例を詳細に説明したが、これらは例示にすぎず、特許請求の範囲を限定するものではない。特許請求の範囲に記載の技術には、以上に例示した具体例を様々に変形、変更したものが含まれる。上記の実施例の変形例を以下に列挙する。   Specific examples of the present invention have been described in detail above, but these are merely examples and do not limit the scope of the claims. The technology described in the claims includes various modifications and changes of the specific examples illustrated above. The modifications of the above embodiment are listed below.

(1)上記の第1実施例では、図5のS60で算出されるパラメータwが0である場合には、図4のS52で選択された画素に対して補正が行なわれない。従って、パラメータwが0の場合には、図5のS62とS64をスキップしてもよい。この場合、CPU30は、図4のS52で選択された画素の座標値(PH,PS,PV)を座標値(MH,MS,MV)として、図5のS66の処理を実行してもよい。なお、座標値(PH,PS,PV)に対応するRGB対象画像データ50内の座標値がわかっている場合には、S66をスキップすることもできる。 (1) In the first embodiment, when the parameter w calculated in S60 of FIG. 5 is 0, no correction is performed on the pixel selected in S52 of FIG. Therefore, when the parameter w is 0, S62 and S64 in FIG. 5 may be skipped. In this case, the CPU 30 may execute the process of S66 in FIG. 5 with the coordinate values (PH, PS, PV) of the pixel selected in S52 of FIG. 4 as the coordinate values (MH, MS, MV). Note that if the coordinate values in the RGB target image data 50 corresponding to the coordinate values (PH, PS, PV) are known, S66 can be skipped.

(2)上記の各実施例では、メモリカード18に記憶されている画像データを、補正の対象となるRGB対象画像データ50としている。しかしながら、他の画像データをRGB対象画像データ50としてもよい。例えば、スキャナ部20によって生成される画像データをRGB対象画像データ50としてもよい。また、上記の各実施例では、スキャナ部20によって生成される画像データをRGB基準画像データ60としている。しかしながら、他の画像データをRGB基準画像データ60としてもよい。例えば、メモリカード18に記憶されている画像データをRGB基準画像データ60としてもよい。 (2) In each of the above embodiments, the image data stored in the memory card 18 is the RGB target image data 50 to be corrected. However, other image data may be used as the RGB target image data 50. For example, the image data generated by the scanner unit 20 may be RGB target image data 50. In each of the above embodiments, the image data generated by the scanner unit 20 is the RGB reference image data 60. However, other image data may be used as the RGB reference image data 60. For example, the image data stored in the memory card 18 may be the RGB reference image data 60.

(3)上記の各実施例では、極座標系の色空間として円柱座標系の色空間(HSV色空間)を採用している。しかしながら、極座標系の色空間として球座標系の色空間を採用してもよい。 (3) In each of the above-described embodiments, a cylindrical coordinate system color space (HSV color space) is adopted as the polar coordinate system color space. However, a spherical coordinate system color space may be adopted as the polar coordinate system color space.

(4)上記の各実施例では、ユーザによって選択された補正モードに応じて、補正対象の色相の範囲が決定される。しかしながら、補正印刷処理では、1つの補正モードのみが存在していてもよい(即ち補正対象の色相の範囲が固定されていてもよい)。また、補正印刷処理では、複数の補正モード(上記の実施例では3つの補正モード)のそれぞれについて補正処理を順次実行してもよい。この場合、多機能機10は、補正後の複数の画像データを表示し、その中から1つの画像データを選択することをユーザに許容し、ユーザによって選択された画像データに基づいて印刷を実行してもよい。 (4) In each of the above embodiments, the hue range to be corrected is determined according to the correction mode selected by the user. However, in the correction printing process, only one correction mode may exist (that is, the hue range to be corrected may be fixed). In the correction printing process, the correction process may be sequentially executed for each of a plurality of correction modes (three correction modes in the above embodiment). In this case, the multi-function device 10 displays a plurality of corrected image data, allows the user to select one of the image data, and executes printing based on the image data selected by the user. May be.

(5)上記の各実施例において、wを利用して補正しなくてもよい。即ち、図15に示される数式において、wを常に1としてもよい。この場合、図11に示される下限値Lvと上限値Uvの間の値のみが補正され、それ以外の値が補正されないことになる(a軸とb軸の場合も同様に補正される)。この変形例では、請求項の周囲の領域は、下限値Lvと上限値Uvの間の領域に対応する。 (5) In each of the embodiments described above, it is not necessary to correct using w. That is, in the mathematical formula shown in FIG. In this case, only the value between the lower limit value Lv and the upper limit value Uv shown in FIG. 11 is corrected, and other values are not corrected (the same is corrected in the case of the a-axis and b-axis). In this modification, the area around the claims corresponds to the area between the lower limit value Lv and the upper limit value Uv.

また、本明細書または図面に説明した技術要素は、単独であるいは各種の組合せによって技術的有用性を発揮するものであり、出願時請求項記載の組合せに限定されるものではない。また、本明細書または図面に例示した技術は複数目的を同時に達成するものであり、そのうちの一つの目的を達成すること自体で技術的有用性を持つものである。   The technical elements described in this specification or the drawings exhibit technical usefulness alone or in various combinations, and are not limited to the combinations described in the claims at the time of filing. In addition, the technology illustrated in the present specification or the drawings achieves a plurality of objects at the same time, and has technical utility by achieving one of the objects.

多機能機の構成を示す。The configuration of the multi-function device is shown. 画像データが補正される様子を簡単に示す。A brief description of how the image data is corrected is shown. 補正印刷処理のフローチャートを示す。5 shows a flowchart of correction printing processing. 補正処理のフローチャートを示す。The flowchart of a correction process is shown. 図4の続きのフローチャートを示す。FIG. 5 is a flowchart continued from FIG. 4. FIG. RGBからHSVに変換するための数式を示す。An equation for converting from RGB to HSV is shown. HSV色空間を示す。The HSV color space is shown. 補正モードとHSVの範囲との対応関係の一例を示す。An example of the correspondence between the correction mode and the HSV range is shown. HSVからvabに変換するための数式を示す。An expression for converting from HSV to vab is shown. 補正量を算出するための数式を示す。An equation for calculating the correction amount is shown. Pvが横軸であり、PvとCvの和が縦軸であるグラフの一例を示す。An example of a graph in which Pv is the horizontal axis and the sum of Pv and Cv is the vertical axis is shown. 座標値が補正される様子を示す。The manner in which coordinate values are corrected is shown. パラメータwを算出するための数式を示す。An equation for calculating the parameter w is shown. Pvが横軸であり、パラメータwが縦軸であるグラフの一例を示す。An example of a graph in which Pv is the horizontal axis and the parameter w is the vertical axis is shown. 補正後の座標値(Mv,Ma,Mb)を算出するための数式を示す。Formulas for calculating the corrected coordinate values (Mv, Ma, Mb) are shown. va平面において補正量が大きいほど白色に近づく様子を示す。In the va plane, the larger the correction amount, the closer to white. vabからHSVに変換するための数式を示す。An expression for converting vab to HSV is shown. HSVからRGBに変換するための数式を示す。An equation for converting from HSV to RGB is shown. SH平面を示す。The SH plane is shown. HSV色空間を示す。The HSV color space is shown. 第2実施例の補正処理のフローチャートを示す。The flowchart of the correction process of 2nd Example is shown.

符号の説明Explanation of symbols

10:多機能機、12:操作部、14:表示部、16:スロット部、18:メモリカード、20:スキャナ部、22:印刷部、24:ネットワークインターフェイス、28:制御部、30:CPU、32:ROM、34:基本プログラム、36:補正プログラム、50 :RGB対象画像データ、52:HSV対象画像データ、56:補正済みRGB画像データ、60:RGB基準画像データ、62:HSV基準画像データ 10: Multi-function device, 12: Operation unit, 14: Display unit, 16: Slot unit, 18: Memory card, 20: Scanner unit, 22: Printing unit, 24: Network interface, 28: Control unit, 30: CPU, 32: ROM, 34: Basic program, 36: Correction program, 50: RGB target image data, 52: HSV target image data, 56: Corrected RGB image data, 60: RGB reference image data, 62: HSV reference image data

Claims (9)

基準画像データを用いて対象画像データを補正して補正済み画像データを生成する画像処理装置であって、
前記対象画像データ内の特定範囲の色相を有する第1画素群を代表する値であって、極座標系の色空間内の値である第1極座標値を決定する第1決定部と、
前記第1極座標値を直交変換することによって、第1直交座標系の色空間内の値である第1直交座標値を算出する第1算出部と、
前記基準画像データ内の前記特定範囲の色相を有する第2画素群を代表する値であって、前記極座標系の色空間内の値である第2極座標値を決定する第2決定部と、
前記第2極座標値を直交変換することによって、前記第1直交座標系の色空間内の値である第2直交座標値を算出する第2算出部と、
前記対象画像データ内の全ての画素のうち、前記第1直交座標系の色空間内における前記第1直交座標値の周囲の領域に含まれる各画素の座標値を、前記第2直交座標値に近づくように補正することによって、前記対象画像データから前記補正済み画像データを生成する補正部と
を備える画像処理装置。
An image processing apparatus that corrects target image data using reference image data to generate corrected image data,
A first determination unit for determining a first polar coordinate value representing a first pixel group having a specific range of hues in the target image data, which is a value in a color space of a polar coordinate system;
A first calculation unit that calculates a first orthogonal coordinate value that is a value in a color space of a first orthogonal coordinate system by orthogonally transforming the first polar coordinate value;
A second determination unit that determines a second polar coordinate value that is a value representing the second pixel group having the hue in the specific range in the reference image data and that is a value in the color space of the polar coordinate system;
A second calculation unit that calculates a second orthogonal coordinate value that is a value in a color space of the first orthogonal coordinate system by orthogonally transforming the second polar coordinate value;
Among all the pixels in the target image data, the coordinate value of each pixel included in the area around the first orthogonal coordinate value in the color space of the first orthogonal coordinate system is set as the second orthogonal coordinate value. An image processing apparatus comprising: a correction unit that generates the corrected image data from the target image data by correcting the image data so as to approach each other.
前記周囲の領域は、前記第1直交座標値と前記第2直交座標値との双方を含む特定領域である
ことを特徴とする請求項1に記載の画像処理装置。
The image processing apparatus according to claim 1, wherein the surrounding area is a specific area including both the first orthogonal coordinate value and the second orthogonal coordinate value.
前記特定領域は、前記第1直交座標値と前記第2直交座標値とを2つの焦点とする楕円体内の領域である
ことを特徴とする請求項2に記載の画像処理装置。
The image processing apparatus according to claim 2, wherein the specific region is a region in an ellipsoid having the first orthogonal coordinate value and the second orthogonal coordinate value as two focal points.
前記特定範囲が第1範囲の場合に設定される前記周囲の領域のサイズは、前記特定範囲が前記第1範囲と異なる第2範囲の場合に設定される前記周囲の領域のサイズと異なる
ことを特徴とする請求項1から3のいずれかに記載の画像処理装置。
The size of the surrounding area set when the specific range is the first range is different from the size of the surrounding area set when the specific range is a second range different from the first range. The image processing apparatus according to claim 1, wherein the image processing apparatus is an image processing apparatus.
前記補正部は、前記第1直交座標値と補正対象の画素の前記第1直交座標系の色空間内の座標値との間の第1距離と、前記第2直交座標値と前記補正対象の画素の前記第1直交座標系の色空間内の座標値との間の第2距離と、の和が小さい程、補正量が大きくなるように、前記補正対象の画素の前記第1直交座標系の色空間内の座標値を補正する
ことを特徴とする請求項1から4のいずれかに記載の画像処理装置。
The correction unit includes a first distance between the first orthogonal coordinate value and a coordinate value of the pixel to be corrected in the color space of the first orthogonal coordinate system, the second orthogonal coordinate value, and the correction target. The first orthogonal coordinate system of the pixel to be corrected is such that the smaller the sum of the second distance between the pixel and the coordinate value in the color space of the first orthogonal coordinate system of the pixel, the larger the correction amount. The image processing apparatus according to claim 1, wherein the coordinate value in the color space is corrected.
前記補正部は、
補正対象の画素の前記第1直交座標系の色空間内の座標値が前記第1直交座標値と同じ場合に、前記補正対象の画素の前記第1直交座標系の色空間内の座標値を、前記第1直交座標値と前記第2直交座標値との間の第3直交座標値に補正し、
補正対象の画素の前記第1直交座標系の色空間内の座標値が前記第1直交座標値と前記第2直交座標値との間の第4直交座標値である場合に、前記補正対象の画素の前記第1直交座標系の色空間内の座標値を、前記第3直交座標値と前記第2直交座標値との間の第5直交座標値に補正する
ことを特徴とする請求項1から5のいずれかに記載の画像処理装置。
The correction unit is
When the coordinate value in the color space of the first orthogonal coordinate system of the pixel to be corrected is the same as the first orthogonal coordinate value, the coordinate value in the color space of the first orthogonal coordinate system of the pixel to be corrected is , Correcting to a third orthogonal coordinate value between the first orthogonal coordinate value and the second orthogonal coordinate value;
When the coordinate value in the color space of the first orthogonal coordinate system of the pixel to be corrected is a fourth orthogonal coordinate value between the first orthogonal coordinate value and the second orthogonal coordinate value, the correction target pixel The coordinate value of the pixel in the color space of the first orthogonal coordinate system is corrected to a fifth orthogonal coordinate value between the third orthogonal coordinate value and the second orthogonal coordinate value. 6. The image processing apparatus according to any one of items 1 to 5.
前記第1決定部は、前記第1画素群に含まれる各画素の前記極座標系の色空間内の座標値の平均値を算出することによって、前記第1極座標値を決定し、
前記第2決定部は、前記第2画素群に含まれる各画素の前記極座標系の色空間内の座標値の平均値を算出することによって、前記第2極座標値を決定する
ことを特徴とする請求項1から6のいずれかに記載の画像処理装置。
The first determination unit determines the first polar coordinate value by calculating an average value of coordinate values in the color space of the polar coordinate system of each pixel included in the first pixel group,
The second determination unit determines the second polar coordinate value by calculating an average value of coordinate values in a color space of the polar coordinate system of each pixel included in the second pixel group. The image processing apparatus according to claim 1.
前記第1直交座標系と異なる第2直交座標系の色空間内の座標値で各画素の値が表わされる特定画像データを、前記極座標系の色空間内の座標値で各画素の値が表わされる前記対象画像データに変換する変換部をさらに備え、
前記補正部は、
(1)前記対象画像データ内の各画素の座標値を、前記第1直交座標系の色空間内の座標値である特定直交座標値に変換し、
(2)前記周囲の領域に含まれる各特定直交座標値を、前記第2直交座標値に近づくように補正し、
(3)補正後の各特定直交座標値を、前記極座標系の色空間内の座標値である特定極座標値に変換し、
(4)各特定極座標値を、前記第2直交座標系の色空間内の座標値である直交座標値に変換する
ことによって、前記第2直交座標系の色空間内の座標値で各画素の値が表わされる前記補正済み画像データを生成する
ことを特徴とする請求項1から7のいずれかに記載の画像処理装置。
The specific image data in which the value of each pixel is represented by the coordinate value in the color space of the second orthogonal coordinate system different from the first orthogonal coordinate system, and the value of each pixel is represented by the coordinate value in the color space of the polar coordinate system. Further comprising a conversion unit for converting into the target image data.
The correction unit is
(1) The coordinate value of each pixel in the target image data is converted into a specific orthogonal coordinate value that is a coordinate value in the color space of the first orthogonal coordinate system,
(2) correcting each specific orthogonal coordinate value included in the surrounding area so as to approach the second orthogonal coordinate value;
(3) Convert each specific orthogonal coordinate value after correction into a specific polar coordinate value that is a coordinate value in the color space of the polar coordinate system,
(4) By converting each specific polar coordinate value into an orthogonal coordinate value that is a coordinate value in the color space of the second orthogonal coordinate system, the coordinate value in the color space of the second orthogonal coordinate system The image processing apparatus according to claim 1, wherein the corrected image data representing a value is generated.
基準画像データを用いて対象画像データを補正して補正済み画像データを生成する画像処理プログラムであって、
前記対象画像データ内の特定範囲の色相を有する第1画素群を代表する値であって、極座標系の色空間内の値である第1極座標値を決定する第1決定処理と、
前記第1極座標値を直交変換することによって、第1直交座標系の色空間内の値である第1直交座標値を算出する第1算出処理と、
前記基準画像データ内の前記特定範囲の色相を有する第2画素群を代表する値であって、前記極座標系の色空間内の値である第2極座標値を決定する第2決定処理と、
前記第2極座標値を直交変換することによって、前記第1直交座標系の色空間内の値である第2直交座標値を算出する第2算出処理と、
前記対象画像データ内の全ての画素のうち、前記第1直交座標系の色空間内における前記第1直交座標値の周囲の領域に含まれる各画素の座標値を、前記第2直交座標値に近づくように補正することによって、前記対象画像データから前記補正済み画像データを生成する補正処理と
をコンピュータに実行させる画像処理プログラム。
An image processing program for generating corrected image data by correcting target image data using reference image data,
A first determination process for determining a first polar coordinate value representing a first pixel group having a specific range of hues in the target image data, which is a value in a color space of a polar coordinate system;
A first calculation process for calculating a first orthogonal coordinate value that is a value in a color space of a first orthogonal coordinate system by orthogonally transforming the first polar coordinate value;
A second determination process for determining a second polar coordinate value representing a second pixel group having the hue in the specific range in the reference image data, which is a value in the color space of the polar coordinate system;
A second calculation process for calculating a second orthogonal coordinate value that is a value in a color space of the first orthogonal coordinate system by orthogonally transforming the second polar coordinate value;
Among all the pixels in the target image data, the coordinate value of each pixel included in the area around the first orthogonal coordinate value in the color space of the first orthogonal coordinate system is set as the second orthogonal coordinate value. An image processing program for causing a computer to execute a correction process for generating the corrected image data from the target image data by correcting the data so as to approach each other.
JP2008327426A 2008-12-24 2008-12-24 Image processing apparatus and image processing program Active JP4784642B2 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
JP2008327426A JP4784642B2 (en) 2008-12-24 2008-12-24 Image processing apparatus and image processing program
US12/647,182 US8428351B2 (en) 2008-12-24 2009-12-24 Image processing device
US13/846,099 US8705858B2 (en) 2008-12-24 2013-03-18 Image processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008327426A JP4784642B2 (en) 2008-12-24 2008-12-24 Image processing apparatus and image processing program

Publications (2)

Publication Number Publication Date
JP2010154008A true JP2010154008A (en) 2010-07-08
JP4784642B2 JP4784642B2 (en) 2011-10-05

Family

ID=42572618

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008327426A Active JP4784642B2 (en) 2008-12-24 2008-12-24 Image processing apparatus and image processing program

Country Status (1)

Country Link
JP (1) JP4784642B2 (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05300531A (en) * 1992-04-14 1993-11-12 Nippon Hoso Kyokai <Nhk> Method and device for correction of color
JPH09326941A (en) * 1996-06-05 1997-12-16 Fuji Xerox Co Ltd Image processing unit
JP2004112694A (en) * 2002-09-20 2004-04-08 Fuji Xerox Co Ltd Color control method, color control apparatus, color conversion definition editing apparatus, image processing apparatus, program, and storage medium
JP2004254303A (en) * 2003-01-31 2004-09-09 Fuji Xerox Co Ltd Color processing method, color processing apparatus, color processing program, and storage medium
JP2004320723A (en) * 2003-03-31 2004-11-11 Seiko Epson Corp Image processor, image processing method, and program
JP2005354314A (en) * 2004-06-09 2005-12-22 Canon Inc Information processing method, information processing apparatus, and imaging apparatus
JP2006303708A (en) * 2005-04-18 2006-11-02 Canon Inc Unit and method of processing image
JP2008171062A (en) * 2007-01-09 2008-07-24 Noritsu Koki Co Ltd Receiving device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05300531A (en) * 1992-04-14 1993-11-12 Nippon Hoso Kyokai <Nhk> Method and device for correction of color
JPH09326941A (en) * 1996-06-05 1997-12-16 Fuji Xerox Co Ltd Image processing unit
JP2004112694A (en) * 2002-09-20 2004-04-08 Fuji Xerox Co Ltd Color control method, color control apparatus, color conversion definition editing apparatus, image processing apparatus, program, and storage medium
JP2004254303A (en) * 2003-01-31 2004-09-09 Fuji Xerox Co Ltd Color processing method, color processing apparatus, color processing program, and storage medium
JP2004320723A (en) * 2003-03-31 2004-11-11 Seiko Epson Corp Image processor, image processing method, and program
JP2005354314A (en) * 2004-06-09 2005-12-22 Canon Inc Information processing method, information processing apparatus, and imaging apparatus
JP2006303708A (en) * 2005-04-18 2006-11-02 Canon Inc Unit and method of processing image
JP2008171062A (en) * 2007-01-09 2008-07-24 Noritsu Koki Co Ltd Receiving device

Also Published As

Publication number Publication date
JP4784642B2 (en) 2011-10-05

Similar Documents

Publication Publication Date Title
JP5067276B2 (en) Color conversion method, color conversion table generated by the color conversion method, image processing apparatus, and color conversion program
US9055263B2 (en) Apparatus, method and computer program for correcting an image using lookup tables generated by inputted image analysis
JP6417851B2 (en) Image processing apparatus and computer program
JP2012121265A (en) Image forming apparatus and control method thereof
JP4715639B2 (en) Image formation control device and program
JP2008299365A (en) Image processor, image processing method and computer program
US8705858B2 (en) Image processing device
JPWO2009093294A1 (en) Image signal processing apparatus and image signal processing program
JP4375580B2 (en) Image processing apparatus, image processing method, and image processing program
JP4784642B2 (en) Image processing apparatus and image processing program
JP4743271B2 (en) Image processing apparatus and image processing program
JP2010050832A (en) Device and method for processing image, program, and recording medium
JP4930503B2 (en) Image processing apparatus and image processing program
JP2010154009A (en) Image processing unit and image processing program
JP5689090B2 (en) Image forming method and image forming apparatus
JP6794821B2 (en) Image processing equipment and computer programs
JP2008072550A (en) Color processing method, color processing apparatus, image forming apparatus, program and recording medium
JP4334498B2 (en) Image processing apparatus, image forming apparatus, image processing method, and computer program
JP2008160298A (en) Color gamut generator, color gamut generation method, color gamut generation program and color converter
JP5205364B2 (en) Image forming apparatus and image forming method
JP2017017374A (en) Image processing device and computer program
JP6311409B2 (en) Image processing apparatus and computer program
JP2006114994A (en) Image processing method, image processing apparatus, and image forming system
JP5577279B2 (en) Image forming apparatus and color gamut correction method
JP4775409B2 (en) Color gamut generation device and color gamut generation program

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20101208

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20101214

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110214

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

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

R150 Certificate of patent or registration of utility model

Ref document number: 4784642

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20140722

Year of fee payment: 3