JP4748041B2 - Image processing method, program, and image processing apparatus - Google Patents

Image processing method, program, and image processing apparatus Download PDF

Info

Publication number
JP4748041B2
JP4748041B2 JP2006324083A JP2006324083A JP4748041B2 JP 4748041 B2 JP4748041 B2 JP 4748041B2 JP 2006324083 A JP2006324083 A JP 2006324083A JP 2006324083 A JP2006324083 A JP 2006324083A JP 4748041 B2 JP4748041 B2 JP 4748041B2
Authority
JP
Japan
Prior art keywords
color
conversion
image processing
point
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2006324083A
Other languages
Japanese (ja)
Other versions
JP2008139997A (en
Inventor
豊 木内
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Omron Corp
Original Assignee
Omron Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Omron Corp filed Critical Omron Corp
Priority to JP2006324083A priority Critical patent/JP4748041B2/en
Publication of JP2008139997A publication Critical patent/JP2008139997A/en
Application granted granted Critical
Publication of JP4748041B2 publication Critical patent/JP4748041B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Processing (AREA)
  • Color Image Communication Systems (AREA)
  • Image Analysis (AREA)

Description

この発明はカラー画像を処理するための画像処理方法、プログラムおよび画像処理装置に関し、特にカラー画像を構成する画素間の色差を軽減するための画像処理技術に関するものである。   The present invention relates to an image processing method, a program, and an image processing apparatus for processing a color image, and more particularly to an image processing technique for reducing a color difference between pixels constituting a color image.

製造現場においては、省力化および高効率化の観点から、オートメーション化が進められている。オートメーション化を実現するためには、光、電気、電波、音波などを用いる数多くのセンサ類が使用される。このようなセンサ類の中でも、製品や半製品などを撮影し、その撮影した画像を処理することで、当該製品の良否判別や当該製品の生産管理を行なうことのできる画像処理技術がよく用いられている。画像処理技術によれば、人間の視覚による検出と同様の検出機能を実現できるため、その応用範囲は広い。   In the manufacturing field, automation is being promoted from the viewpoint of labor saving and high efficiency. In order to realize automation, many sensors using light, electricity, radio waves, sound waves and the like are used. Among such sensors, an image processing technique that can photograph a product, a semi-finished product, and the like and process the photographed image to determine whether the product is good or not and to manage production of the product is often used. ing. According to the image processing technology, since the detection function similar to the detection by human vision can be realized, the application range is wide.

このような画像処理技術の中で、検出対象の汚れやキズなどを検出するための欠陥検出処理は、頻繁に行なわれる処理である。このような欠陥検出処理は、撮影した画像を構成する画素間の色差などに基づいて実現される。たとえば、隣接または近接する画素間における色差が予め定められたしきい値を超過するか否かに基づいて、欠陥部の有無が判断される。   In such an image processing technique, defect detection processing for detecting dirt or scratches to be detected is frequently performed. Such a defect detection process is realized based on a color difference between pixels constituting a captured image. For example, the presence / absence of a defective portion is determined based on whether or not the color difference between adjacent or adjacent pixels exceeds a predetermined threshold value.

ところで、検出対象が単色である場合には、当該単色と欠陥部の色との間の色差が比較的容易に算出されるので、誤検出の問題は生じにくい。一方、検出対象にロゴマークなどがプリントされている場合には、検出対象の下地の色、ロゴマークの色、および欠陥部の色の3色を含む画像となるので、検出対象の下地の色とロゴマークの色との間の色差を欠陥部であると誤って判断してしまう場合がある。また、同様の現象は、撮影時における照明のバラツキなどによっても生じ得る。   By the way, when the detection target is a single color, the color difference between the single color and the color of the defective portion is relatively easily calculated, so that the problem of erroneous detection hardly occurs. On the other hand, when a logo mark or the like is printed on the detection target, an image including three colors of the background color of the detection target, the color of the logo mark, and the color of the defective portion is obtained. And the color of the logo mark may be erroneously determined to be a defective part. A similar phenomenon can also occur due to variations in illumination during shooting.

このように、検出対象を撮影した際に生じる「色ムラ」によって、欠陥部の検出精度が低下する。そのため、このような画像中の色ムラを減衰させて、なるべく平滑化するような前処理が必要となる。   As described above, the “color unevenness” generated when the detection target is photographed reduces the detection accuracy of the defective portion. For this reason, it is necessary to perform preprocessing that attenuates the color unevenness in the image and smoothes it as much as possible.

従来の色補正技術として、たとえば、特開平5−28236号公報(特許文献1)には、地色の薄い部分のみを白く再現し、画像部分の淡い有彩色については原稿画像のとおり再現できるように構成したカラー画像処理装置が開示されている。このカラー画像処理装置によれば、複数の色成分のすべてが所定範囲内の値を有するとき、当該カラー画像信号を特定色信号に変換する手段を具備する。また、特開平7−147629号公報(特許文献2)には、入力画像中の特定の色の部分を高精度に指定した所望の色に置換することの可能なカラー画像処理装置が開示されている。このカラー画像処理装置によれば、補正手段による補正前のカラー画像信号が特定色を含むか否かを判断する判別手段と、判別手段により判別された特定色を他の特定色に変換する変換手段とを有する。
特開平5−28236号公報 特開平7−147629号公報
As a conventional color correction technique, for example, in Japanese Patent Laid-Open No. 5-28236 (Patent Document 1), only a thin portion of a ground color is reproduced in white, and a light chromatic color of an image portion can be reproduced as a document image. A color image processing apparatus configured as described above is disclosed. According to this color image processing apparatus, there is provided means for converting the color image signal into a specific color signal when all of the plurality of color components have values within a predetermined range. Japanese Laid-Open Patent Publication No. 7-147629 (Patent Document 2) discloses a color image processing apparatus capable of replacing a specific color portion in an input image with a desired color designated with high accuracy. Yes. According to this color image processing apparatus, a determination unit that determines whether or not a color image signal before correction by the correction unit includes a specific color, and a conversion that converts the specific color determined by the determination unit into another specific color. Means.
Japanese Patent Laid-Open No. 5-28236 JP-A-7-147629

しかしながら、上述の特開平5−28236号公報(特許文献1)や特開平7−147629号公報(特許文献2)に開示されるカラー画像処理装置では、元のカラー画像の色の再現性を向上させることを目的とするものであった。そのため、カラー画像中に色ムラが存在すれば、その色ムラをより忠実に再現しようとするものであり、色ムラを減衰させて、平滑化するような処理を想定したものではなかった。したがって、従来の色補正技術を用いて、上述のような欠陥検出処理の前処理を実現することはできなかった。   However, the color image processing apparatus disclosed in the above-mentioned Japanese Patent Application Laid-Open No. 5-28236 (Patent Document 1) and Japanese Patent Application Laid-Open No. 7-147629 (Patent Document 2) improves the color reproducibility of the original color image. It was intended to be made. For this reason, if color unevenness exists in a color image, the color unevenness is to be reproduced more faithfully, and a process for attenuating and smoothing the color unevenness has not been assumed. Therefore, it has not been possible to realize the pre-processing of the defect detection process as described above using a conventional color correction technique.

そこで、この発明は、かかる問題を解決するためになされたものであり、その目的は、カラー画像中の色ムラを平滑化することのできる画像処理方法、プログラムおよび画像処理装置を提供することである。   Accordingly, the present invention has been made to solve such a problem, and an object of the present invention is to provide an image processing method, a program, and an image processing apparatus capable of smoothing color unevenness in a color image. is there.

この発明のある局面に従えば、複数の画素からなるカラー画像に対して画素間の色差を軽減するための画像処理方法である。この局面に従う画像処理方法は、選択される第1および第2色に対応する色座標上の2つの基準点を含む基準線を色座標上に規定するステップと、カラー画像の予め定められた処理領域内に含まれる各画素を順次抽出する抽出ステップと、抽出ステップにおいて抽出された画素の色に対応する色座標上の変換元点を含み、かつ基準線に沿う変換線を色座標上に規定する規定ステップと、規定ステップにおいて規定された変換線に従って、変換元点を所定の移動量だけ移動させて得られる変換後点を算出する変換ステップと、抽出された画素の色を変換ステップにおいて算出された変換後点に対応する色に置換する置換ステップと、抽出ステップにおいて処理領域内に含まれるすべての画素が抽出されるまで、規定ステップ、変換ステップおよび置換ステップを繰返し実行させるステップとを含む。   According to an aspect of the present invention, there is provided an image processing method for reducing a color difference between pixels with respect to a color image composed of a plurality of pixels. The image processing method according to this aspect includes a step of defining a reference line including two reference points on the color coordinates corresponding to the first and second colors to be selected on the color coordinates, and a predetermined processing of the color image An extraction step for sequentially extracting each pixel included in the region, and a conversion line on the color coordinate including the conversion source point on the color coordinate corresponding to the color of the pixel extracted in the extraction step is defined on the color coordinate A conversion step for calculating a post-conversion point obtained by moving the conversion source point by a predetermined movement amount according to the conversion line specified in the specification step, and calculating a color of the extracted pixel in the conversion step A replacement step for replacing the converted color with a color corresponding to the converted point, and a extracting step, a conversion step, and a conversion step until all pixels included in the processing region are extracted. And a step of repeatedly executing the substitution step.

この局面に従う発明によれば、選択される第1および第2色に対応する色座標上の2つの基準点を含む基準線に沿うように規定された変換線に従って、変換対象の画素の色に対応する変換元点を所定の移動量だけ移動させた変換後点が算出される。そして、当該変換対象となる画素の色がこの変換後点に対応する色に置換される。このように、カラー画像の予め定められた処理領域内に含まれる各画素は、基準線に沿って規定される変換線に従って算出される色に置換されるので、全体として統一的な色補正が行なわれる。これにより、カラー画像中の色ムラを平滑化できる。   According to the invention according to this aspect, the color of the pixel to be converted is changed in accordance with the conversion line defined along the reference line including the two reference points on the color coordinates corresponding to the selected first and second colors. A post-conversion point is calculated by moving the corresponding conversion source point by a predetermined amount of movement. Then, the color of the pixel to be converted is replaced with a color corresponding to the post-conversion point. In this way, each pixel included in the predetermined processing region of the color image is replaced with a color calculated according to the conversion line defined along the reference line, so that unified color correction as a whole is performed. Done. Thereby, the color nonuniformity in a color image can be smoothed.

好ましくは、基準線は、色座標上において一次式として規定される。
さらに好ましくは、変換線は、色座標上において、基準線と平行になるように規定される。
Preferably, the reference line is defined as a linear expression on the color coordinates.
More preferably, the conversion line is defined to be parallel to the reference line on the color coordinates.

好ましくは、この局面に従う画像処理方法は、変換元点から基準線までの距離に基づいて、変換元点に対する移動量を決定するステップをさらに含む。   Preferably, the image processing method according to this aspect further includes a step of determining a movement amount with respect to the conversion source point based on a distance from the conversion source point to the reference line.

好ましくは、変換ステップにおいて、変換後点は、変換元点を基準線の線上に存在する予め定められた収束点に近付く方向に移動させることで得られる。   Preferably, in the conversion step, the post-conversion point is obtained by moving the conversion source point in a direction approaching a predetermined convergence point existing on the reference line.

さらに好ましくは、収束点は、2つの基準点の中点である。
また、好ましくは、収束点は、前記2つの基準点のいずれかに一致する。
More preferably, the convergence point is the midpoint between the two reference points.
Preferably, the convergence point coincides with one of the two reference points.

この発明の別の局面に従えば、複数の画素からなるカラー画像に対して画素間の色差を軽減するための画像処理方法である。この局面に従う画像処理方法は、選択される第1および第2色に対応する色座標上の2つの基準点を含む基準線を色座標上に規定するステップと、カラー画像の予め定められた処理領域内に含まれる各画素を順次抽出する抽出ステップと、抽出ステップにおいて抽出された画素の色に対応する色座標上の変換元点を含む変換線を色座標上に規定する規定ステップと、変換元点から規定ステップにおいて規定された基準線までの距離に基づいて、変換元点に対する移動量を決定する決定ステップと、規定ステップにおいて規定された変換線に従って、変換元点を決定ステップにおいて決定された移動量だけ移動させて得られる変換後点を算出する変換ステップと、抽出された画素の色を変換ステップにおいて算出された変換後点に対応する色に置換する置換ステップと、抽出ステップにおいて処理領域内に含まれるすべての画素が抽出されるまで、規定ステップ、決定ステップ、変換ステップおよび置換ステップを繰返し実行させるステップとを含む。   According to another aspect of the present invention, an image processing method for reducing a color difference between pixels in a color image composed of a plurality of pixels. The image processing method according to this aspect includes a step of defining a reference line including two reference points on the color coordinates corresponding to the first and second colors to be selected on the color coordinates, and a predetermined processing of the color image An extraction step for sequentially extracting each pixel included in the region, a defining step for defining on the color coordinate a conversion line including a conversion source point on the color coordinate corresponding to the color of the pixel extracted in the extraction step, and conversion Based on the distance from the original point to the reference line defined in the defining step, a determining step for determining the amount of movement with respect to the converting source point and the converting source point determined in the determining step according to the conversion line defined in the defining step A conversion step for calculating a post-conversion point obtained by moving the amount of movement, and a color corresponding to the post-conversion point calculated in the conversion step. Comprising a substitution step of conversion, it extracted until all the pixels contained in the processing region is extracted in step, defining step, determination step, and a step of repeatedly executing the conversion step and replacing step.

この局面に従う発明によれば、変換対象の画素の色に対応する変換元点から選択される第1および第2色に対応する色座標上の2つの基準点を含む基準線までの距離に基づいて、変換後点を得るための移動量を決定する。そして、変換線に従って、変換元点を当該移動量だけ移動させることで変換後点を算出する。色座標上において、変換元点から基準線までの距離は、変換対象の画素の色と第1色または第2色との近似性を示すものであるから、第1色または第2色に近似した色をより大きく色補正する一方で、それ以外の色(たとえば、上述の欠陥部の色)の色補正を抑制することができる。これにより、カラー画像のうち検出すべき欠陥部の色を維持したまま、背景領域の色ムラを平滑化できる。   According to the invention according to this aspect, based on the distance to the reference line including two reference points on the color coordinates corresponding to the first and second colors selected from the conversion source point corresponding to the color of the pixel to be converted. To determine the amount of movement for obtaining the converted point. Then, the converted point is calculated by moving the conversion source point by the movement amount according to the conversion line. On the color coordinates, the distance from the conversion source point to the reference line indicates the closeness between the color of the pixel to be converted and the first color or the second color, and thus approximates the first color or the second color. While correcting the larger color, the color correction of the other colors (for example, the color of the defective portion described above) can be suppressed. As a result, the color unevenness in the background region can be smoothed while maintaining the color of the defective portion to be detected in the color image.

好ましくは、決定ステップにおいて、移動量は、変換元点から基準線までの距離が小さくなるに従って大きな値に決定される。   Preferably, in the determination step, the movement amount is determined to be a larger value as the distance from the conversion source point to the reference line becomes smaller.

好ましくは、上述の画像処理方法は、カラー画像の少なくとも一部を含む色抽出領域の指定を受付けるステップと、色抽出領域に含まれる各画素の有する色に基づいて、当該色抽出領域を代表する2つの色を第1および第2色として選択するステップとをさらに含む。   Preferably, the above-described image processing method represents the color extraction region based on the step of accepting the designation of the color extraction region including at least a part of the color image and the color of each pixel included in the color extraction region. Selecting two colors as the first and second colors.

好ましくは、上述の画像処理方法は、第1および第2色に加えて、第3色が選択されると、第1および第2色に基づいて、一連のステップを実行した後に、当該一連のステップの実行により生じる収束点に対応する色および第3色に基づいて、一連のステップを再度実行するステップをさらに含む
好ましくは、移動量は、変換元点から基準線までの距離を変数とする関数に基づいて決定され、関数は、外部から設定されるパラメータに応じて、距離と移動量との関係を可変に構成される。
Preferably, in the image processing method described above, when the third color is selected in addition to the first and second colors, the series of steps is performed after the series of steps is performed based on the first and second colors. The method further includes a step of executing the series of steps again based on the color corresponding to the convergence point generated by the execution of the step and the third color. Preferably, the movement amount is a variable from the distance from the conversion source point to the reference line. The function is determined based on the function, and the function is configured such that the relationship between the distance and the movement amount is variable according to a parameter set from the outside.

好ましくは、画像処理方法は、カラー画像と、第1および第2色の視覚的表示および色情報の少なくとも一方とを、同一画面上に同時に表示するステップをさらに含む。   Preferably, the image processing method further includes a step of simultaneously displaying a color image and at least one of the visual display and the color information of the first and second colors on the same screen.

好ましくは、色座標は、色の3原色に対応する3つの座標軸を含んで構成される。
この発明のさらに別の局面に従えば、複数の画素からなるカラー画像に対して画素間の色差を軽減するための画像処理方法をコンピュータに実行させるためのプログラムである。この局面に従うプログラムは、選択される第1および第2色に対応する色座標上の2つの基準点を含む基準線を色座標上に規定するステップと、カラー画像の予め定められた処理領域内に含まれる各画素を順次抽出する抽出ステップと、抽出ステップにおいて抽出された画素の色に対応する色座標上の変換元点を含み、かつ基準線に沿う変換線を色座標上に規定する規定ステップと、規定ステップにおいて規定された変換線に従って、変換元点を所定の移動量だけ移動させて得られる変換後点を算出する変換ステップと、抽出された画素の色を変換ステップにおいて算出された変換後点に対応する色に置換する置換ステップと、抽出ステップにおいて処理領域内に含まれるすべての画素が抽出されるまで、規定ステップ、変換ステップおよび置換ステップを繰返し実行させるステップとを含む。
Preferably, the color coordinates include three coordinate axes corresponding to the three primary colors.
According to still another aspect of the present invention, there is provided a program for causing a computer to execute an image processing method for reducing a color difference between pixels for a color image composed of a plurality of pixels. The program according to this aspect includes a step of defining a reference line including two reference points on the color coordinates corresponding to the first and second colors to be selected on the color coordinates, and a predetermined processing area of the color image. An extraction step for sequentially extracting each pixel included in the image, and a rule that includes a conversion source point on the color coordinate corresponding to the color of the pixel extracted in the extraction step and defines a conversion line on the color coordinate along the reference line A conversion step for calculating a post-conversion point obtained by moving the conversion source point by a predetermined movement amount in accordance with the conversion line defined in the defining step, and a color of the extracted pixel calculated in the converting step A replacement step for replacing with a color corresponding to the post-conversion point, and until all the pixels included in the processing region are extracted in the extraction step, the defining step, the conversion step, and And a step of repeatedly executing the conversion step.

この発明のさらに別の局面に従えば、複数の画素からなるカラー画像に対して画素間の色差を軽減するための画像処理方法をコンピュータに実行させるためのプログラムである。この局面に従うプログラムは、選択される第1および第2色に対応する色座標上の2つの基準点を含む基準線を色座標上に規定するステップと、カラー画像の予め定められた処理領域内に含まれる各画素を順次抽出する抽出ステップと、抽出ステップにおいて抽出された画素の色に対応する色座標上の変換元点を含む変換線を色座標上に規定する規定ステップと、変換元点から規定ステップにおいて規定された基準線までの距離に基づいて、変換元点に対する移動量を決定する決定ステップと、規定ステップにおいて規定された変換線に従って、変換元点を決定ステップにおいて決定された移動量だけ移動させて得られる変換後点を算出する変換ステップと、抽出された画素の色を変換ステップにおいて算出された変換後点に対応する色に置換する置換ステップと、抽出ステップにおいて処理領域内に含まれるすべての画素が抽出されるまで、規定ステップ、決定ステップ、変換ステップおよび置換ステップを繰返し実行させるステップとを含む。   According to still another aspect of the present invention, there is provided a program for causing a computer to execute an image processing method for reducing a color difference between pixels for a color image composed of a plurality of pixels. The program according to this aspect includes a step of defining a reference line including two reference points on the color coordinates corresponding to the first and second colors to be selected on the color coordinates, and a predetermined processing area of the color image. An extraction step for sequentially extracting each pixel included in the image, a defining step for defining a conversion line on the color coordinate on the color coordinate corresponding to the color of the pixel extracted in the extraction step, and a conversion source point A determination step for determining a movement amount with respect to the conversion source point based on a distance from the reference line specified in the specification step to the reference line, and a movement determined in the determination step for the conversion source point according to the conversion line specified in the specification step A conversion step for calculating a post-conversion point obtained by moving the image by an amount, and setting the color of the extracted pixel to a color corresponding to the post-conversion point calculated in the conversion step. Comprising a substitution step of the extraction until all the pixels contained in the processing region is extracted in step, defining step determination step, and a step of repeatedly executing the conversion step and replacing step.

この発明のさらに別の局面に従えば、複数の画素からなるカラー画像に対して画素間の色差を軽減するための画像処理装置である。この局面に従う画像処理装置は、選択される第1および第2色に対応する色座標上の2つの基準点を含む基準線を色座標上に規定する第1規定手段と、カラー画像の予め定められた処理領域内に含まれる各画素を順次抽出する抽出手段と、抽出手段によって抽出された画素の色に対応する色座標上の変換元点を含み、かつ基準線に沿う変換線を色座標上に規定する第2規定手段と、第2規定手段によって規定された変換線に従って、変換元点を所定の移動量だけ移動させて得られる変換後点を算出する変換手段と、抽出された画素の色を変換手段によって算出された変換後点に対応する色に置換する置換手段とを備える。   According to still another aspect of the present invention, an image processing apparatus for reducing a color difference between pixels in a color image composed of a plurality of pixels. An image processing apparatus according to this aspect includes a first defining unit that defines, on a color coordinate, a reference line that includes two reference points on the color coordinate corresponding to the first and second colors to be selected, and a predetermined color image. Extraction means for sequentially extracting each pixel included in the processed area, and a conversion line that includes a conversion source point on the color coordinate corresponding to the color of the pixel extracted by the extraction means, and that is along the reference line Second defining means defined above, conversion means for calculating a converted point obtained by moving the conversion source point by a predetermined movement amount according to the conversion line defined by the second defining means, and the extracted pixels Replacement means for substituting the color corresponding to the post-conversion point calculated by the conversion means.

この発明のさらに別の局面に従えば、複数の画素からなるカラー画像に対して画素間の色差を軽減するための画像処理装置である。この局面に従う画像処理装置は、選択される第1および第2色に対応する色座標上の2つの基準点を含む基準線を色座標上に規定する第1規定手段と、カラー画像の予め定められた処理領域内に含まれる各画素を順次抽出する抽出手段と、抽出手段によって抽出された画素の色に対応する色座標上の変換元点を含む変換線を色座標上に規定する第2規定手段と、変換元点から第2規定手段によって規定された基準線までの距離に基づいて、変換元点に対する移動量を決定する決定手段と、規定手段によって規定された変換線に従って、変換元点を決定手段によって決定された移動量だけ移動させて得られる変換後点を算出する変換手段と、抽出された画素の色を変換手段によって算出された変換後点に対応する色に置換する置換手段とを備える。   According to still another aspect of the present invention, an image processing apparatus for reducing a color difference between pixels in a color image composed of a plurality of pixels. An image processing apparatus according to this aspect includes a first defining unit that defines, on a color coordinate, a reference line that includes two reference points on the color coordinate corresponding to the first and second colors to be selected, and a predetermined color image. Extraction means for sequentially extracting each pixel included in the processed area, and a conversion line including a conversion source point on the color coordinate corresponding to the color of the pixel extracted by the extraction means is defined on the color coordinate. Based on the defining means, the determining means for determining the movement amount with respect to the conversion source point based on the distance from the conversion source point to the reference line defined by the second defining means, and the conversion source according to the conversion line defined by the defining means A conversion unit that calculates a post-conversion point obtained by moving the point by the amount of movement determined by the determination unit, and a replacement that replaces the color of the extracted pixel with a color corresponding to the post-conversion point calculated by the conversion unit With means .

この発明によれば、カラー画像中の色ムラを平滑化することのできる画像処理方法、プログラムおよび画像処理装置を実現できる。   According to the present invention, it is possible to realize an image processing method, a program, and an image processing apparatus that can smooth color unevenness in a color image.

この発明の実施の形態について、図面を参照しながら詳細に説明する。なお、図中の同一または相当部分については、同一符号を付してその説明は繰返さない。   Embodiments of the present invention will be described in detail with reference to the drawings. Note that the same or corresponding parts in the drawings are denoted by the same reference numerals and description thereof will not be repeated.

図1は、この発明の実施の形態に従う画像処理装置1を備える画像処理システム100の概略構成図である。   FIG. 1 is a schematic configuration diagram of an image processing system 100 including an image processing apparatus 1 according to an embodiment of the present invention.

図1を参照して、画像処理システム100は、画像処理装置1と、撮像部2と、表示部3とからなり、一例として、製造ライン上などを連続的に搬送される検出対象を撮像部2が撮影し、撮影されたカラー画像に対して、画像処理装置1が本実施の形態に従う色ムラ平滑処理(以下、「平滑化処理」とも称す)を行なう。そして、画像処理装置1は、前処理である平滑化処理を行なった後のカラー画像に対して、欠陥検出処理を行ない、検出対象に汚れやキズなどの欠陥部が存在するか否かを判断する。さらに、画像処理装置1は、その検出結果を表示部3に表示するとともに、図示しない他の装置へ当該検出結果を出力する。なお、検出対象は、一例として、紙やフィルムなどのシート状のものや、金属製品などである。   Referring to FIG. 1, an image processing system 100 includes an image processing device 1, an imaging unit 2, and a display unit 3. As an example, an imaging unit detects a detection target that is continuously conveyed on a production line or the like. The image processing apparatus 1 performs color unevenness smoothing processing (hereinafter, also referred to as “smoothing processing”) according to the present embodiment on the captured color image. Then, the image processing apparatus 1 performs defect detection processing on the color image that has been subjected to smoothing processing, which is preprocessing, and determines whether or not a defective portion such as a stain or a scratch exists in the detection target. To do. Further, the image processing device 1 displays the detection result on the display unit 3 and outputs the detection result to another device (not shown). The detection target is, for example, a sheet-like object such as paper or film, or a metal product.

撮像部2は、一例として、CCD(Coupled Charged Device)やCMOS(Complementary Metal Oxide Semiconductor)センサなどの撮像素子およびレンズを備え、検出対象を撮影し、その撮影したカラー画像を画像処理装置1へ出力する。なお、撮像部2が撮影するカラー画像は、静止画像および動画像のいずれでもよい。また、撮像部2で撮影されるカラー画像は、行列状に配置された複数の画素からなり、各画素は色情報を有する。色情報の一例として、本実施の形態では、色の三原色に基づく「赤色」「緑色」「青色」の濃淡値からなるRGB情報を用いる。なお、RGB情報に代えて、色の三原色の補色である「シアン」「マゼンダ」「黄色」の濃淡値からなるCMY情報や、「色相(Hue)」「明度(Value)」「彩度(Chroma)」の各パラメータからなる色属性を色情報として用いてもよい。   As an example, the imaging unit 2 includes an imaging element and a lens such as a CCD (Coupled Charged Device) or a CMOS (Complementary Metal Oxide Semiconductor) sensor, captures a detection target, and outputs the captured color image to the image processing apparatus 1. To do. Note that the color image captured by the imaging unit 2 may be either a still image or a moving image. The color image captured by the imaging unit 2 includes a plurality of pixels arranged in a matrix, and each pixel has color information. As an example of color information, in the present embodiment, RGB information including gray values of “red”, “green”, and “blue” based on the three primary colors is used. Instead of RGB information, CMY information consisting of shades of “cyan”, “magenta”, and “yellow”, which are complementary colors of the three primary colors, “Hue”, “Value”, and “Chroma” ) "May be used as the color information.

表示部3は、画像処理装置1における処理結果、撮像部2で撮影された画像、および画像処理装置1を操作するためのユーザインターフェイス画面などを表示する。一例として、表示部3は、液晶ディスプレイ(LCD:Liquid Crystal Display)、プラズマディスプレイ(Plasma Display)、ELディスプレイ(Electro Luminescence display)などからなる。   The display unit 3 displays a processing result in the image processing device 1, an image taken by the imaging unit 2, a user interface screen for operating the image processing device 1, and the like. As an example, the display unit 3 includes a liquid crystal display (LCD), a plasma display, an EL display (Electro Luminescence display), and the like.

画像処理装置1は、CPU部4と、補助記憶部5と、入力部6と、撮像部インターフェイス(撮像部I/F)7と、主記憶部8と、表示処理部9と、外部インターフェイス(外部I/F)10と、読取部11と、バス13とからなり、一例としてパーソナルコンピュータなどで実現される。   The image processing apparatus 1 includes a CPU unit 4, an auxiliary storage unit 5, an input unit 6, an imaging unit interface (imaging unit I / F) 7, a main storage unit 8, a display processing unit 9, and an external interface ( The external I / F 10, the reading unit 11, and the bus 13 are realized by a personal computer as an example.

撮像部インターフェイス7は、撮像部2と電気的に接続され、撮像部2で撮影された映像信号を受け、所定の信号変換処理を行ない各画素の色情報を取得した後、その色情報をバス13を介してCPU部4へ伝達する。具体的には、撮像部インターフェイス7は、撮像部2から受信する映像信号に対してフレーム同期を行ない、時間軸上に展開されて伝送される各画素の色情報を復調して、各画素についての赤色、青色および緑色の濃淡値(以下、単に「RGB情報」とも称す)を取得する。   The imaging unit interface 7 is electrically connected to the imaging unit 2, receives a video signal captured by the imaging unit 2, performs predetermined signal conversion processing, acquires color information of each pixel, and then transmits the color information to the bus. 13 to the CPU unit 4 via Specifically, the imaging unit interface 7 performs frame synchronization with the video signal received from the imaging unit 2, demodulates the color information of each pixel that is expanded and transmitted on the time axis, and The red, blue, and green shade values (hereinafter also simply referred to as “RGB information”) are acquired.

主記憶部8は、CPU部4で実行されるプログラム、撮像部2で撮影されたカラー画像、およびCPU部4における画像処理中のカラー画像などを格納する。そして、主記憶部8は、一例として、DRAM(Dynamic Random Access Memory)やSRAM(Static Random Access Memory)などの半導体記憶素子からなる。   The main storage unit 8 stores a program executed by the CPU unit 4, a color image taken by the imaging unit 2, a color image during image processing in the CPU unit 4, and the like. For example, the main storage unit 8 includes a semiconductor storage element such as a DRAM (Dynamic Random Access Memory) or an SRAM (Static Random Access Memory).

表示処理部9は、CPU部4における処理後の画像、撮像部2で撮影された画像、ユーザインターフェイス画面、CPU部4における処理状態などを表示するための表示データを受け、所定の信号処理を行なった後、映像信号として表示部3へ出力する。   The display processing unit 9 receives display data for displaying an image after processing in the CPU unit 4, an image taken by the imaging unit 2, a user interface screen, a processing state in the CPU unit 4, and performs predetermined signal processing. After performing, it outputs to the display part 3 as a video signal.

外部インターフェイス10は、CPU部4により実行された処理結果などを外部へ出力する。一例として、外部インターフェイス10は、フォトダイオード、トランジスタまたはリレーなどから構成される接点出力(DO)や、USB(Universal Serial Bus)、RS−232C(Recommended Standard 232 version C)、IEEE(Institute of Electrical and Electronic Engineers)1394、SCSI(Small Computer System Interface)およびイーサネット(登録商標)などに従う通信手段などからなる。   The external interface 10 outputs a processing result executed by the CPU unit 4 to the outside. As an example, the external interface 10 includes a contact output (DO) composed of a photodiode, a transistor, or a relay, USB (Universal Serial Bus), RS-232C (Recommended Standard 232 version C), IEEE (Institute of Electrical and It consists of communication means in accordance with Electronic Engineers (1394), Small Computer System Interface (SCSI), Ethernet (registered trademark), and the like.

補助記憶部5は、不揮発性の記憶領域を備え、撮像部2で撮影された画像、CPU部4における処理後の画像や処理結果などを格納する。一例として、補助記憶部5は、ハードディスクドライブ(HDD)やフラッシュメモリカード、SDメモリカード、ICメモリカードなどの半導体メモリなどからなる。   The auxiliary storage unit 5 includes a non-volatile storage area, and stores images captured by the imaging unit 2, images processed by the CPU unit 4, processing results, and the like. As an example, the auxiliary storage unit 5 includes a semiconductor memory such as a hard disk drive (HDD), a flash memory card, an SD memory card, and an IC memory card.

入力部6は、ユーザからの設定および指令などを受け、バス13を介してCPU部4へ与える。一例として、入力部6は、キーボード、マウスおよび表示部3の表示面に設けられるタッチパネルやタッチペンなどからなる。   The input unit 6 receives settings and instructions from the user and supplies them to the CPU unit 4 via the bus 13. As an example, the input unit 6 includes a keyboard, a mouse, and a touch panel or a touch pen provided on the display surface of the display unit 3.

読取部11は、CPU部4で実行されるプログラムが記録された記録媒体12を受入れてプログラムを読取り、補助記憶部5または主記憶部8へ与える。なお、記録媒体12は、不揮発的にデータを担持するものであればよく、一例として、光ディスク(CD(Compact Disk)、DVD(Digital Versatile Disc)−ROM/RAM/R/RW、MO(Magnetic Optical Disc)、MD(Mini Disc))、フレキシブルディスク、磁気テープなどの着脱可能な記録媒体からなる。   The reading unit 11 receives the recording medium 12 on which the program executed by the CPU unit 4 is recorded, reads the program, and supplies the program to the auxiliary storage unit 5 or the main storage unit 8. The recording medium 12 may be any medium that holds data in a nonvolatile manner. As an example, the recording medium 12 is an optical disc (CD (Compact Disk), DVD (Digital Versatile Disc) -ROM / RAM / R / RW, MO (Magnetic Optical). Disc), MD (Mini Disc)), a flexible disk, and a removable recording medium such as a magnetic tape.

CPU部4は、撮像部インターフェイス7を介して、撮像部2により撮影されたカラー画像から生成されたRGB情報を受け、各画素の座標と対応付けて主記憶部8に格納する。そして、CPU部4は、入力部6を介して予め与えられる処理領域内の設定に応じて、当該処理領域内に含まれる各画素に対して、後述する平滑化処理を順次実行し、置換後のカラー画像を主記憶部8に格納する。また、CPU部4は、この平滑化処理後のカラー画像を表示処理部9などへ出力するとともに、当該平滑化処理後のカラー画像に対して、欠陥検出処理などを実行する。   The CPU unit 4 receives the RGB information generated from the color image photographed by the imaging unit 2 via the imaging unit interface 7 and stores it in the main storage unit 8 in association with the coordinates of each pixel. Then, the CPU unit 4 sequentially executes a smoothing process, which will be described later, on each pixel included in the processing region in accordance with the setting in the processing region given in advance via the input unit 6, and after the replacement Are stored in the main storage unit 8. In addition, the CPU unit 4 outputs the color image after the smoothing process to the display processing unit 9 and the like, and executes a defect detection process and the like on the color image after the smoothing process.

(平滑化処理の概略)
図2は、この発明の実施の形態に従う平滑化処理の概略を説明するための模式図である。
(Outline of smoothing process)
FIG. 2 is a schematic diagram for illustrating an outline of the smoothing process according to the embodiment of the present invention.

図2(a)は、平滑化処理前のカラー画像の一例である。
図2(b)は、平滑化処理後のカラー画像の一例である。
FIG. 2A is an example of a color image before the smoothing process.
FIG. 2B is an example of a color image after the smoothing process.

図2(a)を参照して、検出対象OBJがその地色(たとえば、白色)上に「PATENT」の文字からなるロゴマーク30を有する場合を示す。ロゴマーク30は、地色とは異なる所定の色を有している。本実施の形態に従う平滑化処理は、このような検出対象OBJに発生する欠陥部40を検出する場合を対象とする。   With reference to FIG. 2A, a case where the detection target OBJ has a logo mark 30 composed of characters “PATENT” on the ground color (for example, white) is shown. The logo mark 30 has a predetermined color different from the ground color. The smoothing process according to the present embodiment is intended for the case of detecting a defective portion 40 that occurs in such a detection target OBJ.

上述したように、このようなカラー画像内の隣接する画素間の色差を算出すると、地色とロゴマーク30との境界、および地色と欠陥部40との境界で大きな値となる。そのため、地色とロゴマーク30との境界を欠陥部であると誤検出してしまう。   As described above, when the color difference between adjacent pixels in such a color image is calculated, a large value is obtained at the boundary between the ground color and the logo mark 30 and the boundary between the ground color and the defective portion 40. For this reason, the boundary between the ground color and the logo mark 30 is erroneously detected as a defective portion.

そこで、図2(b)に示すように、検出対象OBJの地色およびロゴマーク30からなる色ムラ(色差)を平滑化して、欠陥部40だけを「浮き彫り」にする必要がある。このような平滑化の一例として、図2(b)では、検出対象OBJの地色およびロゴマーク30をその中間色、すなわち地色とロゴマーク30の色との間に存在する特定の色に近付けるように、色補正を行なう。   Therefore, as shown in FIG. 2B, it is necessary to smooth the color unevenness (color difference) including the ground color of the detection target OBJ and the logo mark 30 so that only the defective portion 40 is “relieved”. As an example of such smoothing, in FIG. 2B, the ground color of the detection target OBJ and the logo mark 30 are brought close to an intermediate color, that is, a specific color existing between the ground color and the logo mark 30 color. As described above, color correction is performed.

このように、平滑化処理とは、検出対象OBJが本来有する色、すなわちカラー画像内における欠陥部40を除く領域(以下、「背景領域」とも称す)の色を、欠陥部40との間に比較的大きな色差を確保することのできる特定の色に近付けるような補正を意味する。   As described above, the smoothing process refers to the color originally included in the detection target OBJ, that is, the color of the area excluding the defective part 40 in the color image (hereinafter also referred to as “background area”) between the defective part 40. It means correction that approaches a specific color that can ensure a relatively large color difference.

実際に撮影される検出対象OBJのカラー画像の背景領域は、図2に概念的に示すように、単純な2色で構成されるとは限らない。すなわち、撮像部2(図1)は、その色分解能が高いほど、微妙な色の違いを判別し、互いに異なる色をもつ画素として出力する。また、撮影時における照明光の照射具合の差異によっても同様の現象を生じ得る。その結果、撮影されるカラー画像には、近似しているが同一ではない色情報を有する複数の画素が含まれる。そのため、特定の2色(第1色および第2色)だけを特定の中間色に置換しても十分な平滑化処理を実現できない。そこで、本実施の形態では、以下に説明するように、色座標上での変換処理を行なう。   The background area of the color image of the detection target OBJ that is actually captured is not necessarily composed of simple two colors as conceptually shown in FIG. That is, the imaging unit 2 (FIG. 1) discriminates a subtle difference in color as the color resolution is higher, and outputs it as pixels having different colors. A similar phenomenon can also occur due to a difference in illumination light irradiation during photographing. As a result, the captured color image includes a plurality of pixels having color information that is similar but not identical. Therefore, even if only two specific colors (first color and second color) are replaced with a specific intermediate color, sufficient smoothing processing cannot be realized. Therefore, in the present embodiment, conversion processing on color coordinates is performed as described below.

図3は、この発明の実施の形態に従う平滑化処理の内容を説明するための図である。
図3を参照して、本実施の形態では、平滑化処理を実現するために、色座標SYS上において変換処理を行なう。色座標とは、各画素の色情報に含まれるパラメータを座標軸に対応付けて規定した座標系である。本実施の形態では、一例として、RGB情報を用いるので、R軸、G軸、B軸で規定される3次元の色座標(色座標空間)を規定できる。そして、カラー画像を構成する各画素の色情報は、このような色座標SYS上の座標点と一意に対応付けられる。なお、色情報のパラメータの種類に応じて、色座標は、2次元もしくは4次元以上に拡張できるが、以下に説明する処理は、いずれの次元数の色座標にも適用可能である。
FIG. 3 is a diagram for illustrating the contents of the smoothing process according to the embodiment of the present invention.
Referring to FIG. 3, in the present embodiment, conversion processing is performed on color coordinates SYS in order to realize smoothing processing. The color coordinate is a coordinate system in which parameters included in the color information of each pixel are defined in association with coordinate axes. In the present embodiment, RGB information is used as an example, so that three-dimensional color coordinates (color coordinate space) defined by the R axis, the G axis, and the B axis can be defined. The color information of each pixel constituting the color image is uniquely associated with such coordinate points on the color coordinate SYS. Although the color coordinates can be expanded to two dimensions or four dimensions or more according to the type of color information parameter, the processing described below can be applied to any number of color coordinates.

そして、本実施の形態では、色座標SYS上において、選択される第1色および第2色に対応する基準点COL1,COL2を含む基準線CDVを規定するとともに、基準線CDVに基づいて、各画素の色が補正される。   In the present embodiment, the reference line CDV including the reference points COL1 and COL2 corresponding to the selected first color and second color is defined on the color coordinate SYS, and each reference line CDV is used to determine each reference line CDV. Pixel color is corrected.

ここで、ユーザは、第1色および第2色を任意に選択することが可能であるが、多くの場合において、ユーザは、図2に示すような検出対象OBJの地色に対応する一色、およびロゴマーク30の色に対応する一色をそれぞれ選択する。以下の説明では、ユーザの選択した第1色が色情報の値としてそれぞれR1,G1,B1を有し、第2色が色情報の値としてそれぞれR2,G2,B2を有するとする。   Here, the user can arbitrarily select the first color and the second color, but in many cases, the user can select one color corresponding to the ground color of the detection target OBJ as shown in FIG. One color corresponding to the color of the logo mark 30 is selected. In the following description, it is assumed that the first color selected by the user has R1, G1, and B1 as color information values, and the second color has R2, G2, and B2 as color information values, respectively.

このように第1色および第2色が選択されると、これらに対応する色座標SYS上の基準点COL1,COL2を含む基準線CDVが規定される。本実施の形態では、基準線CDVは、色座標SYS上において一次式として規定される、すなわち基準点COL1,COL2を通る直線として規定される。さらに、基準線CDV上の基準点COL1と基準点COL2との中点に位置する収束点CNTで直交する基準平面CPLが規定される。   When the first color and the second color are selected in this way, the reference line CDV including the reference points COL1 and COL2 on the color coordinates SYS corresponding to these is defined. In the present embodiment, the reference line CDV is defined as a linear expression on the color coordinates SYS, that is, defined as a straight line passing through the reference points COL1 and COL2. Further, a reference plane CPL orthogonal to the convergence point CNT located at the midpoint between the reference point COL1 and the reference point COL2 on the reference line CDV is defined.

続いて、カラー画像の処理領域内に含まれる画素が順次抽出される。そして、この画素抽出に応答して、当該画素の色に対応する色座標SYS上の変換元点PELを含み、かつ基準線CDVに沿う変換線#CDVが規定される。本実施の形態では、基準線CDVが直線として規定されるので、変換線#CDVについても、基準線CDVと平行で、変換元点PELを含む直線として規定される。   Subsequently, pixels included in the color image processing region are sequentially extracted. In response to this pixel extraction, a conversion line #CDV including the conversion source point PEL on the color coordinate SYS corresponding to the color of the pixel and along the reference line CDV is defined. In the present embodiment, since the reference line CDV is defined as a straight line, the conversion line #CDV is also defined as a straight line that is parallel to the reference line CDV and includes the conversion source point PEL.

続いて、この変換線#CDVに従って、収束点CNTに近付く方向に、変換元点PELを所定の移動量だけ移動させて得られる変換後点#PELが算出される。そして、抽出された画素の色は、この算出された変換後点#PELに対応する色に置換される。   Subsequently, a post-conversion point #PEL obtained by moving the conversion source point PEL by a predetermined amount of movement in a direction approaching the convergence point CNT according to the conversion line #CDV is calculated. Then, the color of the extracted pixel is replaced with a color corresponding to the calculated post-conversion point #PEL.

以上の処理が、カラー画像の処理領域内に含まれるすべての画素に対して逐次的に実行される。   The above processing is sequentially executed for all the pixels included in the color image processing region.

概念的に言えば、処理対象のカラー画像に含まれる各画素の色は、変換線#CDV上を基準平面CPLに向かうように補正される。したがって、各画素は、基準平面CPLと変換線#CDVとの交点に対応する色に近付くように補正されることになる。   Conceptually speaking, the color of each pixel included in the color image to be processed is corrected so as to be directed to the reference plane CPL on the conversion line #CDV. Therefore, each pixel is corrected so as to approach the color corresponding to the intersection of the reference plane CPL and the conversion line #CDV.

ここで、各画素の色をどの程度まで基準平面CPLに近付けるかも重要である。すなわち、色差に基づいて欠陥検出処理などを実行するためには、欠陥部40(図2)に対応する色を基準平面CPLに可能な限り近付けないようにする必要がある。言い換えれば、図2に示すような検出対象OBJの地色およびロゴマーク30の色に近接した色をもつ画素は、可能な限り基準平面CPLに近付ける必要があるが、欠陥部40に相当する画素は、基準平面CPLから可能な限り離す必要がある。   Here, it is also important how close the color of each pixel is to the reference plane CPL. That is, in order to execute a defect detection process or the like based on the color difference, it is necessary to keep the color corresponding to the defect portion 40 (FIG. 2) as close as possible to the reference plane CPL. In other words, a pixel having a color close to the background color of the detection target OBJ and the logo mark 30 as shown in FIG. 2 needs to be as close to the reference plane CPL as possible. Needs to be as far as possible from the reference plane CPL.

そこで、本実施の形態では、変換元点PELから基準線CDVまでの距離wに基づいて、変換元点PELに対する移動量が決定される。より具体的には、移動量は、距離wが小さくなるに従って大きくなるように決定される。すなわち、基準点COL1およびCOL2を含む基準線CDVに対応する色範囲との間の色差が小さいほど、より基準平面CPLに近付くように補正される。   Therefore, in the present embodiment, the movement amount with respect to the conversion source point PEL is determined based on the distance w from the conversion source point PEL to the reference line CDV. More specifically, the movement amount is determined so as to increase as the distance w decreases. In other words, the smaller the color difference between the color range corresponding to the reference line CDV including the reference points COL1 and COL2, the more the correction is made so that it is closer to the reference plane CPL.

このように移動量が決定されることで、選択される第1色および第2色に近接した画素は、より大きく補正(平滑化)される一方で、第1色および第2色から離れた欠陥部40などに対応する画素は、ほとんど補正されない。この結果、カラー画像の背景領域が重点的に平滑化され、欠陥部をより正確に検出することができるようになる。   By determining the amount of movement in this way, the pixels close to the selected first color and second color are corrected (smoothed) more greatly, but separated from the first color and the second color. Pixels corresponding to the defective portion 40 and the like are hardly corrected. As a result, the background region of the color image is focused and smoothed, and the defective portion can be detected more accurately.

(平滑化処理の処理過程)
図4は、この発明の実施の形態に従う平滑化処理の処理過程を説明するための図である。図4では、図3に示す基準平面CPLを中心にして、基準点COL1,COL2および基準線CDVなどが示される。
(Smoothing process)
FIG. 4 is a diagram for describing the process of the smoothing process according to the embodiment of the present invention. 4, reference points COL1, COL2, a reference line CDV, and the like are shown with reference to the reference plane CPL shown in FIG.

図5は、この発明の実施の形態に従う平滑化処理の処理手順の概略を示すフローチャートである。なお、以下の処理手順は、画像処理装置1のCPU部4(図1)がプログラムを実行することで実現される。   FIG. 5 is a flowchart showing an outline of the processing procedure of the smoothing processing according to the embodiment of the present invention. The following processing procedure is realized when the CPU unit 4 (FIG. 1) of the image processing apparatus 1 executes a program.

図4および図5を参照して、CPU部4は、ユーザが入力部6を操作して選択する第1色および第2色を受付ける(ステップS2)。なお、ユーザは、後述する色抽出処理などに従って、第1色および第2色を容易に選択することが可能である。そして、CPU部4は、色座標SYS上の第1色および第2色に対応する基準点COL1,COL2を含む基準線CDVを規定する(ステップS4)。さらに、CPU部4は、基準線CDV上の基準点COL1と基準点COL2との中点(収束点CNT)で直交する基準平面CPLを規定する(ステップS6)。   Referring to FIGS. 4 and 5, CPU unit 4 accepts the first color and the second color selected by the user by operating input unit 6 (step S2). Note that the user can easily select the first color and the second color according to a color extraction process described later. Then, the CPU unit 4 defines a reference line CDV including reference points COL1 and COL2 corresponding to the first color and the second color on the color coordinate SYS (step S4). Furthermore, the CPU unit 4 defines a reference plane CPL that is orthogonal to the midpoint (convergence point CNT) between the reference point COL1 and the reference point COL2 on the reference line CDV (step S6).

CPU部4は、カラー画像の処理領域内に含まれる画素を抽出する(ステップS8)。なお、処理領域は、ユーザによって任意に設定可能に構成され、撮像部2(図1)で撮影されたカラー画像の全体またはその一部が平滑化処理の対象領域として設定される。そして、CPU部4は、抽出した画素に対応する色座標SYS上の変換元点PELを含む変換線#CDVを規定するとともに、変換元点PELから基準平面CPLまでの高さhを算出する(ステップS10)。   The CPU unit 4 extracts pixels included in the color image processing area (step S8). The processing area can be arbitrarily set by the user, and the whole or a part of the color image photographed by the imaging unit 2 (FIG. 1) is set as the target area for the smoothing process. Then, the CPU unit 4 defines the conversion line #CDV including the conversion source point PEL on the color coordinate SYS corresponding to the extracted pixel, and calculates the height h from the conversion source point PEL to the reference plane CPL ( Step S10).

また、CPU部4は、変換元点PELから変換線CDVまでの距離wを算出する(ステップS12)。そして、CPU部4は、ステップS12で算出された距離wに基づいて、変換線#CDVに沿って所定の移動量だけ移動させて得られる変換後点#PELを算出する(ステップS14)。より具体的には、CPU部4は、変換後点#PELから基準平面CPLまでの高さ#hを算出する。したがって、(高さh−高さ#h)が移動量となる。   Further, the CPU unit 4 calculates the distance w from the conversion source point PEL to the conversion line CDV (step S12). Then, the CPU unit 4 calculates a post-conversion point #PEL obtained by moving the predetermined amount of movement along the conversion line #CDV based on the distance w calculated in step S12 (step S14). More specifically, the CPU unit 4 calculates the height #h from the post-conversion point #PEL to the reference plane CPL. Therefore, (height h−height #h) is the amount of movement.

さらに、CPU部4は、ステップS8において抽出された画素の色を、変換後点#PELに対応する色に置換する(ステップS16)。   Further, the CPU unit 4 replaces the color of the pixel extracted in step S8 with a color corresponding to the post-conversion point #PEL (step S16).

その後、CPU部4は、カラー画像の処理領域内に含まれるすべての画素を抽出したか否かを判断する(ステップS18)。すべての画素を抽出していない場合(ステップS18においてNOの場合)には、CPU部4は、上述のステップS8からS18までの処理を繰り返し実行する。   Thereafter, the CPU unit 4 determines whether or not all the pixels included in the color image processing area have been extracted (step S18). If all the pixels have not been extracted (NO in step S18), the CPU unit 4 repeatedly executes the processes from step S8 to S18 described above.

すべての画素を抽出している場合(ステップS18においてYESの場合)には、CPU部4は、色置換された後の画素からなるカラー画像、ならびに第1色および第2色の色表示およびRGB情報を表示部3に表示し(ステップS20)、平滑化処理を終了する。   When all the pixels have been extracted (YES in step S18), the CPU unit 4 displays the color image including the pixels after color replacement, the color display of the first color and the second color, and RGB Information is displayed on the display unit 3 (step S20), and the smoothing process is terminated.

以下、図4を参照しながら、図5に示す主要なステップにおける演算処理内容について説明する。   Hereinafter, the contents of the arithmetic processing in the main steps shown in FIG. 5 will be described with reference to FIG.

(1)基準線CDVの規定(ステップS4)
基準線CDVを規定するために、色座標SYS上における基準点COL1から基準点COL2までのベクトルCDV(なお、図4においては文字の上部に矢印を付けてベクトルを示す)が算出される。ここで、ベクトルCDVの各成分は、
ベクトルCDV=(VR,VG,VB)=(R2−R1,G2−G1,B2−B1)
である。さらに、ベクトルCDVを正規化、すなわちそのノルム(大きさ)を「1」とした場合の成分VRn,VGn,VBnを、
(VRn,VGn,VBn)=(VR/NRM,VG/NRM,VB/NRM)
但し、NRM=VR+VG+VB
とする。
(1) Definition of reference line CDV (step S4)
In order to define the reference line CDV, a vector CDV from the reference point COL1 to the reference point COL2 on the color coordinate SYS (in FIG. 4, an arrow is added to the upper part of the character to indicate the vector) is calculated. Here, each component of the vector CDV is
Vector CDV = (VR, VG, VB) = (R2-R1, G2-G1, B2-B1)
It is. Further, the components VRn, VGn, VBn when the vector CDV is normalized, that is, the norm (magnitude) thereof is set to “1”,
(VRn, VGn, VBn) = (VR / NRM, VG / NRM, VB / NRM)
However, NRM 2 = VR 2 + VG 2 + VB 2
And

(2)基準平面CPLの規定(ステップS6)
本実施の形態では、収束点CNTは基準点COL1と基準点COL2との中点に規定されるので、収束点CNTを通り、ベクトルCDVと直交する基準平面CPLが規定される。なお、収束点CNTの座標は、
収束点CNT=(Rc,Gc,Bc)=((R2+R1)/2,(G2+G1)/2,(B2+B1)/2)
となる。
(2) Definition of reference plane CPL (step S6)
In the present embodiment, since the convergence point CNT is defined at the midpoint between the reference point COL1 and the reference point COL2, a reference plane CPL passing through the convergence point CNT and orthogonal to the vector CDV is defined. The coordinates of the convergence point CNT are
Convergence point CNT = (Rc, Gc, Bc) = ((R2 + R1) / 2, (G2 + G1) / 2, (B2 + B1) / 2)
It becomes.

(3)変換線#CDVの規定および変換元点PELから基準平面CPLまでの高さhの算出(ステップS10)
変換線#CDVは、変換線CDVと平行であるから、ベクトル#CDVの各成分は、ベクトルCDVの各成分と同一となる。すなわち、変換線#CDVは、変換元点PELを通り、ベクトルCDVと同一のベクトル成分を有する。
(3) Definition of conversion line #CDV and calculation of height h from conversion source point PEL to reference plane CPL (step S10)
Since conversion line #CDV is parallel to conversion line CDV, each component of vector #CDV is the same as each component of vector CDV. That is, the conversion line #CDV passes through the conversion source point PEL and has the same vector component as the vector CDV.

変換元点PELから基準平面CPLまでの高さhは、変換元点PELの座標位置(Rs,Gs,Bs)、収束点CNTの座標位置(Rc,Gc,Bc)およびベクトルCDVの成分値(VR,VG,VB)を用いて、
高さh=VR×Rs+VG×Gs+VB×Bs−VR×Rc−VG×Gc−VB×Bc
に従って算出される。
The height h from the conversion source point PEL to the reference plane CPL includes the coordinate position (Rs, Gs, Bs) of the conversion source point PEL, the coordinate position (Rc, Gc, Bc) of the convergence point CNT, and the component value of the vector CDV ( VR, VG, VB)
Height h = VR × Rs + VG × Gs + VB × Bs−VR × Rc−VG × Gc−VB × Bc
Is calculated according to

(4)変換元点PELから変換線CDVまでの距離wの算出(ステップS12)
変換元点PELから変換線CDVまでの距離wは、変換線#CDVと基準平面CPLとの交点である写像点PRJと、収束点CNTとの間の距離に等しい。
(4) Calculation of distance w from conversion source point PEL to conversion line CDV (step S12)
The distance w from the conversion source point PEL to the conversion line CDV is equal to the distance between the mapping point PRJ, which is the intersection of the conversion line #CDV and the reference plane CPL, and the convergence point CNT.

そこで、写像点PRJの座標は、ベクトルCDVを正規化した成分値を用いて、
写像点PRJ=(Rs−h×VRn,Gs−h×VGn,Bs−h×VBn)
となる。
Therefore, the coordinates of the mapping point PRJ are obtained by using a component value obtained by normalizing the vector CDV.
Mapping point PRJ = (Rs−h × VRn, Gs−h × VGn, Bs−h × VBn)
It becomes.

そして、基準平面CPL上における収束点CNTと写像点PRJとの間の距離(距離wに相当)は、
距離w=√{(Rs−h×VRn−Rc)+(Gs−h×VGn−Gc)+(Bs−h×VBn−Bc)
に従って算出される。
The distance (corresponding to the distance w) between the convergence point CNT and the mapping point PRJ on the reference plane CPL is:
Distance w = √ {(Rs−h × VRn−Rc) 2 + (Gs−h × VGn−Gc) 2 + (Bs−h × VBn−Bc) 2 }
Is calculated according to

(5)変換後点#PELの算出(ステップS14)
上述の(4)で算出された距離wに基づいて、変換後点#PELから基準平面CPLまでの高さ#hが算出される。より詳細には、距離wを変数とする関数f(w)(但し、0≦f(w)≦1)を用いて、#h=h×f(w)に従って算出される。
(5) Calculation of post-conversion point #PEL (step S14)
Based on the distance w calculated in the above (4), the height #h from the post-conversion point #PEL to the reference plane CPL is calculated. More specifically, it is calculated according to # h = h × f (w) using a function f (w) (where 0 ≦ f (w) ≦ 1) with the distance w as a variable.

ここで、関数f(w)は、距離wが小さくなるに従って変換元点PELの移動量が大きくなるように、すなわち距離wが小さくなるに従って高さ#hが低くなるような特性を有する。   Here, the function f (w) has a characteristic that the movement amount of the conversion source point PEL increases as the distance w decreases, that is, the height #h decreases as the distance w decreases.

図6は、関数f(w)の特性の一例を示す図である。
図6を参照して、上述のような特性を有する関数f(w)であれば、どのような関数を用いてもよいが、本実施の形態では、
f(w)=w/(w+Lv
なる関数を用いる。なお、パラメータLvは、ユーザが設定可能に構成され、このパラメータLvに応じて、関数f(w)の特性は変化する。
FIG. 6 is a diagram illustrating an example of the characteristics of the function f (w).
With reference to FIG. 6, any function may be used as long as it is a function f (w) having the above-described characteristics. In the present embodiment,
f (w) = w 2 / (w 2 + Lv 2 )
Is used. The parameter Lv is configured to be settable by the user, and the characteristic of the function f (w) changes according to the parameter Lv.

図6に示す関数f(w)は、距離wについての単調増加関数であり、距離wがパラメータLvと一致するときに、f(w)=0.5となる。すなわち、高さhを50%まで低減させる距離wがパラメータLvに応じて変化することになるため、このパラメータLvは、どの程度の色範囲を基準平面CPLに近付けるかを示す「射程範囲」を定義することになる。   The function f (w) shown in FIG. 6 is a monotonically increasing function with respect to the distance w, and f (w) = 0.5 when the distance w matches the parameter Lv. That is, since the distance w for reducing the height h to 50% changes according to the parameter Lv, the parameter Lv indicates a “range” indicating how much the color range approaches the reference plane CPL. Will be defined.

再度、図4を参照して、上述の過程において算出された高さ#hを用いて、変換後点#PELの座標は、写像点PRJの座標(Rs−h×VRn,Gs−h×VGn,Bs−h×VBn)を用いて、
変換後点#PEL=(Rs+(#h−h)×VRn,Gs+(#h−h)×VGn,Bs+(#h−h)×VBn)
となる。
Referring to FIG. 4 again, using the height #h calculated in the above-described process, the coordinates of the converted point #PEL are the coordinates of the mapping point PRJ (Rs−h × VRn, Gs−h × VGn). , Bs−h × VBn)
Post-conversion point # PEL = (Rs + (# h−h) × VRn, Gs + (# h−h) × VGn, Bs + (# h−h) × VBn)
It becomes.

変換後点#PELの座標の各成分は、それぞれ「赤色」「緑色」「青色」の濃淡値に対応するから、この各成分値が抽出された画素の色情報として置換される。   Since each component of the coordinates of the post-conversion point #PEL corresponds to the shade value of “red”, “green”, and “blue”, each component value is replaced as color information of the extracted pixel.

なお、変換線#CDV上において、収束点CNTに最も近付く点(収束点CNTに対する距離が最も短くなる点)は、写像点PRJであるので、本実施の形態において「収束点CNTに近付く方向」とは、「変換線#CDV上を写像点PRJに向かう方向」を意味する。   On the conversion line #CDV, the point closest to the convergence point CNT (the point at which the distance to the convergence point CNT is the shortest) is the mapping point PRJ. Therefore, in the present embodiment, the “direction toward the convergence point CNT” Means “direction on conversion line #CDV toward mapping point PRJ”.

(平滑化処理における画面表示の一例)
本実施の形態に従う表示部3における画面表示の一例を参照して、本実施の形態に従う平滑化処理の実行動作についてさらに説明する。
(Example of screen display in smoothing process)
With reference to an example of the screen display in display unit 3 according to the present embodiment, the smoothing processing execution operation according to the present embodiment will be further described.

図7は、検出対象OBJのカラー画像を撮影した直後の画面表示例を示す図である。
図8は、第1色および第2色を選択する時の画面表示例を示す図である。
FIG. 7 is a diagram illustrating a screen display example immediately after a color image of the detection target OBJ is captured.
FIG. 8 is a diagram showing a screen display example when selecting the first color and the second color.

図9は、平滑化処理を実行した後の画面表示例を示す図である。
図10は、図9に比較してパラメータLvの値を大きく設定して、平滑化処理を実行した後の画面表示例を示す図である。
FIG. 9 is a diagram illustrating a screen display example after the smoothing process is executed.
FIG. 10 is a diagram illustrating a screen display example after executing the smoothing process by setting the value of the parameter Lv to be larger than that in FIG. 9.

図7を参照して、表示部3では、撮影された検出対象OBJのカラー画像が右側に表示されるとともに、第1色および第2色の視覚的表示ならびに色情報の表示/設定のための領域が左側に表示される。   Referring to FIG. 7, in display unit 3, the captured color image of detection object OBJ is displayed on the right side, and for the visual display of the first color and the second color and the display / setting of color information. The area is displayed on the left.

ユーザは、入力部6を操作して画面上のポインタ50を移動させて、選択および設定が可能である。まず、ユーザは、撮像部2によってリアルタイムで撮影されるカラー画像、もしくは、予め撮影されたカラー画像のうち、所望のカラー画像を選択して、表示部3上に表示させる。   The user can select and set by operating the input unit 6 and moving the pointer 50 on the screen. First, the user selects a desired color image from among color images photographed in real time by the imaging unit 2 or color images photographed in advance, and displays the selected color image on the display unit 3.

一例として、図7では、市松模様の検出対象OBJに対して欠陥部40が発生している場合を示す。さらに、検出対象OBJの輝度に放射状の濃淡差を生じているとする。   As an example, FIG. 7 shows a case where a defective portion 40 is generated with respect to a checkered pattern detection target OBJ. Furthermore, it is assumed that there is a radial shading difference in the luminance of the detection target OBJ.

カラー画像が表示されると、ユーザは、ポインタ50を操作して、処理領域AREAを設定する。この処理領域AREAは、左上の開始点STARTと右下の終了点ENDとによって設定される。なお、図7では、製造ラインに相当する領域をカットするため、検出対象OBJに対応して処理領域AREAが設定されている。また、開始点STARTの画像内の座標を(Xs,Ys)とし、終了点ENDの座標を(Xe,Ye)とする。   When the color image is displayed, the user operates the pointer 50 to set the processing area AREA. This processing area AREA is set by the upper left start point START and the lower right end point END. In FIG. 7, in order to cut an area corresponding to the production line, a processing area AREA is set corresponding to the detection target OBJ. Also, the coordinates of the start point START in the image are (Xs, Ys), and the coordinates of the end point END are (Xe, Ye).

また、表示部3の左側の領域には、第1色表示枠54および第2色表示枠64が設けられるとともに、それぞれの色情報(一例として、RGB情報)を表示するRGB表示枠56および66が設けられる。さらに、第1色および第2色の色情報をユーザが任意に設定可能なように、それぞれRGB表示枠56および66に対応付けてパラメータ設定ダイヤル58および68が設けられる。   In addition, a first color display frame 54 and a second color display frame 64 are provided in the left area of the display unit 3, and RGB display frames 56 and 66 for displaying the respective color information (RGB information as an example). Is provided. Further, parameter setting dials 58 and 68 are provided in association with the RGB display frames 56 and 66, respectively, so that the user can arbitrarily set the color information of the first color and the second color.

そして、ユーザは、処理領域AREAの設定が完了すると、第1色および第2色を選択するために、「画像指定」のボタン52を押圧する。すると、図8に示す画面に切り替わる。   When the setting of the processing area AREA is completed, the user presses the “image designation” button 52 in order to select the first color and the second color. Then, the screen is switched to the screen shown in FIG.

ユーザは、ポインタ50を操作して、カラー画像内の色ムラ(市松模様)を含むように色抽出領域42を指定する。色抽出領域42の指定が完了すると、ユーザは、「OK」ボタン70を押圧する。すると、後述する色抽出処理に従って、色抽出領域42に含まれる各画素の有する色から、色抽出領域42を代表する2つの色が第1色および第2色として選択される。そして、当該選択された第1色および第2色に応じて、上述した平滑化処理が実行される。平滑化処理が実行された後のカラー画像は、図9に示すように表示される。   The user operates the pointer 50 to specify the color extraction region 42 so as to include color unevenness (checkered pattern) in the color image. When the specification of the color extraction area 42 is completed, the user presses the “OK” button 70. Then, according to the color extraction process described later, two colors representing the color extraction area 42 are selected as the first color and the second color from the colors of the respective pixels included in the color extraction area 42. Then, the above-described smoothing process is executed according to the selected first color and second color. The color image after the smoothing process is executed is displayed as shown in FIG.

図9に示すように、本実施の形態に従う平滑化処理によって、欠陥部40を除く背景領域がほぼ平滑化されている。なお、図9では、図7においてユーザによって設定された処理領域AREA以外の領域がマスクされ、処理領域AREA内のカラー画像のみが表示される例を示す。   As shown in FIG. 9, the background area excluding the defective portion 40 is substantially smoothed by the smoothing process according to the present embodiment. FIG. 9 shows an example in which the area other than the processing area AREA set by the user in FIG. 7 is masked and only the color image in the processing area AREA is displayed.

また、図9では、第1色表示枠54および第2色表示枠64において、選択された第1色および第2色の色が視覚的に表示されるとともに、RGB表示枠56および66において、当該第1色および第2色のRGB情報が数値値として表示される。なお、ユーザは、パラメータ設定ダイヤル58および68を操作して、選択された第1色および第2色をさらに変更することも可能である。   In FIG. 9, the selected first color and second color are visually displayed in the first color display frame 54 and the second color display frame 64, and in the RGB display frames 56 and 66, The RGB information of the first color and the second color is displayed as numerical values. Note that the user can further change the selected first color and second color by operating the parameter setting dials 58 and 68.

そして、ユーザのパラメータ設定ダイヤル58および68の操作に応答して、平滑化処理が再実行される。なお、平滑化処理の再実行が可能となるように、画像処理装置1には、元のカラー画像および変換後のカラー画像がそれぞれ独立に格納される。   In response to the user's operation of the parameter setting dials 58 and 68, the smoothing process is executed again. Note that the original color image and the converted color image are independently stored in the image processing apparatus 1 so that the smoothing process can be re-executed.

ここで、図9では、検出対象OBJに生じている放射状の濃淡差によって、処理領域AREAの右側の領域に色ムラが残っている。すなわち、例示する検出対象OBJのカラー画像に対しては、平滑化処理が不十分となっている。   Here, in FIG. 9, color unevenness remains in the area on the right side of the processing area AREA due to the radial density difference occurring in the detection target OBJ. That is, the smoothing process is insufficient for the color image of the detection target OBJ illustrated.

そこで、図10を参照して、表示部3の左下に設けられる「色ムラカットレベル」設定枠72に設定されるパラメータLvの値を、ユーザがパラメータ設定ダイヤル74を操作して変更すると、変更されたパラメータLvに基づいて、平滑化処理が再実行される。そして、その再実行によって得られたカラー画像が表示部3上に表示される。このように、ユーザは、表示部3上に表示される平滑化処理後のカラー画像を目視しながら、最適なパラメータLvを設定することもできる。   Therefore, referring to FIG. 10, when the user changes the value of parameter Lv set in “color unevenness cut level” setting frame 72 provided at the lower left of display unit 3 by operating parameter setting dial 74, the change is made. The smoothing process is re-executed based on the parameter Lv. Then, the color image obtained by the re-execution is displayed on the display unit 3. In this way, the user can also set the optimum parameter Lv while viewing the smoothed color image displayed on the display unit 3.

(色抽出処理)
図8を参照して説明したように、指定された色抽出領域42に含まれる各画素が有する色に基づいて、当該色抽出領域42を代表する2つの色が選択される。具体的には、色抽出領域42に含まれる各画素を、その色情報に基づいて、クラスタリング手法により2つのクラスタに分類するととともに、当該分類された各クラスタを代表する色を決定する。
(Color extraction processing)
As described with reference to FIG. 8, two colors representing the color extraction region 42 are selected based on the color of each pixel included in the designated color extraction region 42. Specifically, each pixel included in the color extraction region 42 is classified into two clusters by a clustering method based on the color information, and a color representing each classified cluster is determined.

図11は、色抽出処理の概略を説明するための図である。
図11(a)は、クラスタリング処理の初期状態を示す。
FIG. 11 is a diagram for explaining the outline of the color extraction processing.
FIG. 11A shows an initial state of the clustering process.

図11(b)は、クラスタリング処理の完了状態を示す。
図11(a)を参照して、一例として、色抽出領域42に8個の画素PEL1〜PEL8が含まれている場合について説明する。
FIG. 11B shows a completed state of the clustering process.
With reference to FIG. 11A, the case where eight pixels PEL1 to PEL8 are included in the color extraction region 42 will be described as an example.

まず、色抽出領域42に含まれる各画素が抽出され、当該画素の色情報、すなわちRGB情報に基づいて、2つのクラスタの重心V1およびV2が決定される。本実施の形態においては、重心V1およびV2は、各画素のR値、G値、B値の各最大値および各最小値として決定される。すなわち、画素PELi(1≦i≦8)の色情報を(Ri,Gi,Bi,)とすると、
V1=(Rmax,Gmax,Bmax)
V2=(Rmin,Gmin,Bmin)
但し、
Rmax=max(Ri),Gmax=max(Gi),Bmax=max(Bi)
Rmin=min(Ri),Gmin=min(Gi),Bmin=min(Bi)
となる。このようにして決定された重心V1は、抽出される画素のもつRGB情報の中から、それぞれ独立に最大値を抽出したものであり、重心V2は、同様にそれぞれ独立に最小値を抽出したものである。
First, each pixel included in the color extraction region 42 is extracted, and the centroids V1 and V2 of the two clusters are determined based on the color information of the pixel, that is, RGB information. In the present embodiment, the centroids V1 and V2 are determined as the maximum value and the minimum value of the R value, G value, and B value of each pixel. That is, if the color information of the pixel PELi (1 ≦ i ≦ 8) is (Ri, Gi, Bi,),
V1 = (Rmax, Gmax, Bmax)
V2 = (Rmin, Gmin, Bmin)
However,
Rmax = max (Ri), Gmax = max (Gi), Bmax = max (Bi)
Rmin = min (Ri), Gmin = min (Gi), Bmin = min (Bi)
It becomes. The center of gravity V1 determined in this way is obtained by independently extracting the maximum value from the RGB information of the extracted pixels, and the center of gravity V2 is obtained by independently extracting the minimum value from each other. It is.

続いて、画素PEL1〜PEL8の各々と重心V1およびV2との距離が順次算出される。そして、画素PEL1〜PEL8のうち、重心V1により近いものがクラスタ1に分類されるとともに、重心V2により近いものがクラスタ2に分類される。   Subsequently, the distance between each of the pixels PEL1 to PEL8 and the centroids V1 and V2 is sequentially calculated. Among the pixels PEL1 to PEL8, those closer to the center of gravity V1 are classified as cluster 1, and those closer to the center of gravity V2 are classified into cluster 2.

このように各画素が初期的に分類された後に、各クラスタに属する複数の画素のRGB情報の平均値からそれぞれのクラスタの新たな重心#V1および#V2が算出される。さらに、画素PEL1〜PEL8の各々と算出された新たな重心#V1および#V2との距離が順次算出され、上記と同様の手順に従って、再度のクラスタ分類が行なわれる。   Thus, after each pixel is initially classified, new centroids # V1 and # V2 of each cluster are calculated from the average value of the RGB information of a plurality of pixels belonging to each cluster. Further, the distance between each of the pixels PEL1 to PEL8 and the calculated new centroids # V1 and # V2 is sequentially calculated, and the cluster classification is performed again according to the same procedure as described above.

以下、同様の処理が、再度のクラスタ分類によっても属する画素が変化しなくなるまで、もしくは所定の回数に達するまで繰返される。すると、図11(b)に示されるように、画素PEL1〜PEL4がクラスタ1に属し、画素PEL5〜PEL8がクラスタ2に属するように分類される。そして、この時の重心#V1および#V2に対応する2つの色が第1色および第2色として選択される。   Thereafter, the same processing is repeated until the pixel to which the pixel belongs is not changed by the cluster classification again or until a predetermined number of times is reached. Then, as shown in FIG. 11B, the pixels PEL1 to PEL4 are classified so as to belong to the cluster 1, and the pixels PEL5 to PEL8 belong to the cluster 2. Then, two colors corresponding to the centroids # V1 and # V2 at this time are selected as the first color and the second color.

なお、撮像部2を構成する撮像素子の欠損やノイズなどにより、指定された色抽出領域42には、他の画素との間に大きな色差を生じる色(たとえば、黒色:(R,G,B)=(0,0,0))を有するノイズ画素が含まれる場合もある。このようなノイズ画素を用いて重心#V1もしくは#V2などが算出されると、色抽出領域42に含まれる画素を代表する本来の2色とは異なる色が選択される可能性がある。そこで、第1色および第2色を選択する前段階において、各クラスタに含まれる画素の数に基づいて、クラスタリング処理が正常に完了したか否かを判断する。   Note that a color (for example, black: (R, G, B) that causes a large color difference with other pixels in the designated color extraction region 42 due to defects or noise of the image sensor that constitutes the imaging unit 2. ) = (0,0,0)) may be included. When the center of gravity # V1 or # V2 is calculated using such a noise pixel, a color different from the original two colors representing the pixels included in the color extraction region 42 may be selected. Therefore, before the first color and the second color are selected, it is determined whether or not the clustering process has been normally completed based on the number of pixels included in each cluster.

具体的には、上述の一連のクラスタリングが終了すると、各クラスタに属する画素の数を算出し、全体の画素数に対する割合が正常範囲(たとえば、全体数の10%以上の画素が各クラスタに含まれている)であるか否かを判断する。そして、いずれかのクラスタに割当てられた画素数の割合が正常範囲外であれば、クラスタリング処理は失敗であると判断する。さらに、正常範囲を外れたクラスタに割当てられた画素を除いて、再度クラスタリング処理が実行される。このようにして、ノイズ画素による影響を回避する。   Specifically, when the above-described series of clustering is completed, the number of pixels belonging to each cluster is calculated, and the ratio of the total number of pixels to the normal range (for example, 10% or more of the total number of pixels is included in each cluster). Is determined). If the ratio of the number of pixels assigned to any cluster is outside the normal range, it is determined that the clustering process has failed. Further, the clustering process is executed again except for the pixels assigned to the cluster outside the normal range. In this way, the influence of noise pixels is avoided.

図12は、色抽出処理の処理手順を示すフローチャートである。なお、以下の処理手順は、画像処理装置1のCPU部4(図1)がプログラムを実行することで実現される。   FIG. 12 is a flowchart illustrating the processing procedure of the color extraction processing. The following processing procedure is realized when the CPU unit 4 (FIG. 1) of the image processing apparatus 1 executes a program.

図12を参照して、CPU部4は、カラー画像に対する色抽出領域42の指定を受付ける(ステップS100)。そして、CPU部4は、指定された色抽出領域42に含まれる画素のRGB情報を抽出する(ステップS102)。   Referring to FIG. 12, CPU unit 4 accepts designation of color extraction region 42 for a color image (step S100). Then, the CPU unit 4 extracts RGB information of pixels included in the designated color extraction area 42 (step S102).

CPU部4は、抽出したRGB情報に基づいて初期の重心V1およびV2を算出する(ステップS104)。そして、CPU部4は、画素の各々と重心V1およびV2との距離を順次算出し(ステップS106)、当該算出した距離に基づいて、それぞれ重心V1またはV2に近いものをクラスタ1または2に分類する(ステップS108)。   The CPU unit 4 calculates initial centroids V1 and V2 based on the extracted RGB information (step S104). Then, the CPU unit 4 sequentially calculates the distance between each pixel and the centroids V1 and V2 (step S106), and classifies the ones close to the centroid V1 or V2 as clusters 1 or 2 based on the calculated distances, respectively. (Step S108).

続いて、CPU部4は、分類した各クラスタに属する画素のRGB情報の平均値から、各クラスタの新たな重心#V1および#V2を算出する(ステップS110)。そして、CPU部4は、画素の各々と新たな重心#V1および#V2との距離を順次算出する(ステップS112)。さらに、CPU部4は、算出した距離に基づいて、それぞれ新たな重心#V1または#V2に近いものをクラスタ1または2に再分類する(ステップS114)。   Subsequently, the CPU unit 4 calculates new centroids # V1 and # V2 of each cluster from the average value of the RGB information of the pixels belonging to each classified cluster (step S110). Then, the CPU 4 sequentially calculates the distance between each of the pixels and the new centroids # V1 and # V2 (step S112). Further, based on the calculated distance, the CPU unit 4 reclassifies the one close to the new center of gravity # V1 or # V2 into the cluster 1 or 2 (step S114).

そして、再分類されたクラスタ1および2に属する画素が前回の分類時から変化しているか否かを判断する(ステップS116)。前回の分類時から変化している場合(ステップS116においてYESの場合)には、CPU部4は、クラスタの再分類を所定回数だけ実行したか否かを判断する(ステップS118)。   Then, it is determined whether or not the pixels belonging to the reclassified clusters 1 and 2 have changed since the previous classification (step S116). If there has been a change since the previous classification (YES in step S116), the CPU unit 4 determines whether or not the cluster reclassification has been executed a predetermined number of times (step S118).

クラスタの再分類を所定回数だけ実行していない場合(ステップS118においてNOの場合)には、CPU部4は、上述のステップS108〜S116の処理を再度実行する。   When the cluster reclassification has not been executed a predetermined number of times (NO in step S118), the CPU unit 4 executes the processes of steps S108 to S116 described above again.

前回の分類時から変化していない場合(ステップS116においてNOの場合)、もしくはクラスタの再分類を所定回数だけ実行している場合(ステップS118においてYESの場合)には、CPU部4は、クラスタ1および2に属する画素の数を算出する(ステップS120)。そして、CPU部4は、全体の画素数に対する各クラスタに属する画素数の割合が正常範囲であるか否かを判断する(ステップS122)。   If no change has occurred since the previous classification (NO in step S116), or if cluster reclassification has been executed a predetermined number of times (YES in step S118), the CPU unit 4 The number of pixels belonging to 1 and 2 is calculated (step S120). Then, the CPU unit 4 determines whether or not the ratio of the number of pixels belonging to each cluster to the total number of pixels is within a normal range (step S122).

全体の画素数に対するいずれかのクラスタに属する画素数の割合が正常範囲でない場合(ステップS122においてNOの場合)には、CPU部4は、当該正常範囲ではないクラスタに属する画素を除外し(ステップS124)、上述のステップS104以降の処理を再度実行する。   If the ratio of the number of pixels belonging to any cluster to the total number of pixels is not in the normal range (NO in step S122), the CPU unit 4 excludes pixels belonging to the cluster that is not in the normal range (step S122). S124), the process after step S104 described above is executed again.

全体の画素数に対する各クラスタに属する画素数の割合が正常範囲である場合(ステップS122においてYESの場合)には、CPU部4は、現在の重心#V1および#V2に対応する2つの色を第1色および第2色として選択する(ステップS126)。そして、CPU部4は、色抽出処理を終了する。   When the ratio of the number of pixels belonging to each cluster with respect to the total number of pixels is within the normal range (YES in step S122), the CPU unit 4 selects two colors corresponding to the current centroids # V1 and # V2. The first color and the second color are selected (step S126). Then, the CPU unit 4 ends the color extraction process.

(第1変形例)
上述した本実施の形態では、基準平面CPLが基準線CDV上の基準点COL1と基準点COL2との中点で直交する場合について例示した。これは、第1色および第2色の中間色に向かって各画素の色を補正することを意味するが、必ずしも基準平面は基準点COL1と基準点COL2との中点で直交する必要はなく、いずれの位置で直交してもよい。
(First modification)
In the present embodiment described above, the case where the reference plane CPL is orthogonal at the midpoint between the reference point COL1 and the reference point COL2 on the reference line CDV is exemplified. This means that the color of each pixel is corrected toward the intermediate color between the first color and the second color, but the reference plane does not necessarily have to be orthogonal at the midpoint between the reference point COL1 and the reference point COL2, It may be orthogonal at any position.

図13は、この発明の実施の形態の第1変形例に従う基準平面#CPLの位置を説明するための図である。   FIG. 13 is a diagram for describing the position of reference plane #CPL according to the first modification of the embodiment of the present invention.

図13を参照して、一例として、第2色に対応する基準点COL2を含むような基準平面#CPLを用いると、各画素は、基準平面#CPLに近付くように補正されるので、基準点COL2に対応する色に近付くように色補正される。このように基準平面#CPLの位置を変更することで、たとえば、第2色が白色などであった場合には、背景領域を全体的に薄い色に平滑化できるので、中間色に向かって補正する場合に比較して、欠陥部40をより高精度に検出できる場合がある。   Referring to FIG. 13, as an example, when a reference plane #CPL that includes a reference point COL2 corresponding to the second color is used, each pixel is corrected to approach the reference plane #CPL. Color correction is performed so as to approach the color corresponding to COL2. By changing the position of the reference plane #CPL in this way, for example, when the second color is white or the like, the background area can be smoothed to a light color as a whole, so that correction is made toward the intermediate color. In some cases, the defective portion 40 can be detected with higher accuracy.

なお、どのような位置に基準平面を設定するについては、ユーザが任意に設定可能に構成される。また、基準平面#CPLと画素PELとの間の高さhが大きくなる点を除いて、画素PELの移動方向などは、上述した本実施の形態と同様であるので、詳細な説明は繰返さない。   Note that the user can arbitrarily set the reference plane at any position. Further, except for the point that the height h between the reference plane #CPL and the pixel PEL is increased, the moving direction of the pixel PEL is the same as that of the present embodiment described above, and therefore the detailed description will not be repeated. .

(第2変形例)
上述した本実施の形態では、一次式として規定される、すなわち直線の基準線CDVを用いる場合について例示したが、これに限られることはない。
(Second modification)
In the present embodiment described above, the case where a linear reference line CDV is used, which is defined as a linear expression, is exemplified, but the present invention is not limited to this.

図14は、この発明の実施の形態の第2変形例に従う基準線#CDVを説明するための図である。   FIG. 14 is a diagram for illustrating a reference line #CDV according to the second modification of the embodiment of the present invention.

図14を参照して、たとえば、基準点COL1およびCOL2を含む多次式として規定される曲線状の基準線CDVを用いてもよい。基準線CDVは、各画素の色補正を行なう方向の基準となるものであるから、欠陥部40の色に対応する色座標SYS上の座標点を迂回するように基準線CDVを既定することで、欠陥部40の色との間で比較的大きな色差を保ったまま、背景領域を平滑化できる。また、色相、明度および彩度からなる色属性を色情報として用いた場合には、各要素間の重みが同一ではないので、重視する項目などに応じて、重み係数を反映した基準線CDVを用いることが望ましい。さらに、L表色系や、Lh表色系などの直交座標系ではない座標系などでは、必然的に曲線状の基準線CDVが用いられる。 Referring to FIG. 14, for example, a curved reference line CDV defined as a multi-order expression including reference points COL1 and COL2 may be used. Since the reference line CDV serves as a reference in the direction in which the color correction of each pixel is performed, by defining the reference line CDV so as to bypass the coordinate point on the color coordinate SYS corresponding to the color of the defective portion 40. The background region can be smoothed while maintaining a relatively large color difference with the color of the defect portion 40. In addition, when color attributes composed of hue, brightness, and saturation are used as color information, the weights between the elements are not the same, so that the reference line CDV reflecting the weighting coefficient is set according to the items to be emphasized. It is desirable to use it. Further, in a coordinate system that is not an orthogonal coordinate system such as the L * a * b * color system or the L * C * h color system, a curved reference line CDV is inevitably used.

なお、このような曲線状の基準線CDVを用いる場合には、変換線#CDVは、基準線CDVから所定距離だけ離れた位置を通過する同形状の曲線となる。   When such a curved reference line CDV is used, the conversion line #CDV is a curve having the same shape passing through a position away from the reference line CDV by a predetermined distance.

(第3変形例)
上述した本実施の形態では、二色(第1色および第2色)を基準として平滑化処理を行なう場合について例示したが、実際に撮影される検出対象OBJのカラー画像の背景領域に三色以上が含まれていることもある。このように三色以上が含まれている場合であっても、上述した本実施の形態に従う平滑化処理を繰返して実行することで対処可能である。
(Third Modification)
In the present embodiment described above, the case where the smoothing process is performed using two colors (first color and second color) as a reference is exemplified. However, three colors are used in the background region of the color image of the detection target OBJ actually captured. The above may be included. Thus, even when three or more colors are included, it can be dealt with by repeatedly executing the smoothing process according to the present embodiment described above.

図15は、この発明の実施の形態の第3変形例に従う平滑化処理の内容を説明するための図である。   FIG. 15 is a diagram for illustrating the contents of the smoothing process according to the third modification of the embodiment of the present invention.

図15を参照して、一例として、第1色および第2色に加えて、第3色が選択された場合について説明する。図3と同様に、基準点COL1,COL2は、それぞれ第1色および第2色に対応する一方、基準点COL3は、第3色に対応する。   With reference to FIG. 15, as an example, a case where the third color is selected in addition to the first color and the second color will be described. As in FIG. 3, the reference points COL1 and COL2 correspond to the first color and the second color, respectively, while the reference point COL3 corresponds to the third color.

まず、上述した本実施の形態に従う平滑化処理と同様に、第1色および第2色に基づいて、カラー画像の対象範囲内に含まれる各画素に対して1回目の平滑化処理が行なわれる。一例として、画素PELは、変換線#CDV(1)に従って変換後点#PEL(1)まで移動する。 First, similarly to the smoothing process according to the present embodiment described above, the first smoothing process is performed on each pixel included in the target range of the color image based on the first color and the second color. . As an example, the pixel PEL moves to the post-conversion point #PEL (1) according to the conversion line #CDV (1) .

この1回目の平滑化処理に際して使用された、基準平面CPL(1)上の収束点CNTに対応する色を当該平滑化処理後のカラー画像の代表色とみなす。そして、収束点CNTに対応する色および第3色に基づいて、1回目の平滑化処理後のカラー画像の対象範囲内に含まれる各画素に対して2回目の平滑化処理が行なわれる。 The color corresponding to the convergence point CNT on the reference plane CPL (1) used in the first smoothing process is regarded as the representative color of the color image after the smoothing process. Then, based on the color corresponding to the convergence point CNT and the third color, the second smoothing process is performed on each pixel included in the target range of the color image after the first smoothing process.

すなわち、収束点CNTと第3色に対応する基準点COL3とを含む基準線CDV(2)が規定されるとともに、基準線CDV(2)に沿う変換線#CDV(2)が規定される。そのため、変換後点#PEL(1)に移動した画素PELは、変換線#CDV(2)に従って変換後点#PEL(2)までさらに移動する。 That is, the reference line CDV (2) is defined comprising a reference point COL3 corresponding to the convergence point CNT and the third color, conversion lines #CDV along the reference line CDV (2) (2) is defined. Therefore, the pixel PEL moved to the post-conversion point #PEL (1) further moves to the post-conversion point #PEL (2) according to the conversion line #CDV (2) .

このような手順に従って、3色が選択された場合の平滑化処理が実行される。なお、4色以上が選択された場合も同様の手順を繰り返し実行すればよいので、詳細な説明は繰返さない。   According to such a procedure, the smoothing process when three colors are selected is executed. Note that the same procedure may be repeated when four or more colors are selected, and thus detailed description will not be repeated.

この発明の実施の形態によれば、ユーザによって選択される第1色および第2色に対応する色座標上の2つの基準点を含む基準線CDVに沿うように規定された変換線#CDVに従って、変換対象の画素の色に対応する変換元点PELを所定の移動量だけ移動させた変換後点#PELが算出される。そして、当該変換対象となる画素の色がこの変換後点#PELに対応する色に置換される。このように、カラー画像の予め定められた処理領域AREA内に含まれる各画素は、基準線CDVに沿って規定される変換線#CDVに従って算出される色に置換されるので、全体として統一的な色補正を実現できる。よって、カラー画像中の色ムラを平滑化できる。   According to the embodiment of the present invention, according to the conversion line #CDV defined along the reference line CDV including the two reference points on the color coordinates corresponding to the first color and the second color selected by the user. Then, a post-conversion point #PEL obtained by moving the conversion source point PEL corresponding to the color of the pixel to be converted by a predetermined movement amount is calculated. Then, the color of the pixel to be converted is replaced with a color corresponding to the post-conversion point #PEL. As described above, each pixel included in the predetermined processing area AREA of the color image is replaced with a color calculated according to the conversion line #CDV defined along the reference line CDV. Color correction can be realized. Therefore, the color unevenness in the color image can be smoothed.

この発明の実施の形態によれば、変換対象の画素の色に対応する変換元点PELから、選択される第1色および第2色に対応する色座標上の2つの基準点を含む基準線CDVまでの距離wに基づいて、変換後点#PELを得るための移動量が決定される。そして、変換線#CDVに従って、変換元点PELを当該移動量だけ移動させることで変換後点#PELを算出する。色座標SYS上において、変換元点PELから基準線CDVまでの距離は、変換対象の画素の色と第1色または第2色との近似性を示すものであるから、第1色または第2色に近似した色をより大きく色補正する一方で、それ以外の色(たとえば、欠陥部40の色)の色補正を抑制することができる。これにより、カラー画像のうち検出すべき欠陥部40の色を維持したまま、背景領域の色ムラを平滑化できる。   According to the embodiment of the present invention, the reference line including two reference points on the color coordinates corresponding to the first color and the second color selected from the conversion source point PEL corresponding to the color of the pixel to be converted. Based on the distance w to the CDV, the movement amount for obtaining the post-conversion point #PEL is determined. Then, the converted point #PEL is calculated by moving the conversion source point PEL by the movement amount according to the conversion line #CDV. On the color coordinate SYS, the distance from the conversion source point PEL to the reference line CDV indicates the closeness between the color of the pixel to be converted and the first color or the second color. While correcting the color approximate to the color more greatly, color correction of other colors (for example, the color of the defective portion 40) can be suppressed. As a result, the color unevenness in the background region can be smoothed while maintaining the color of the defective portion 40 to be detected in the color image.

今回開示された実施の形態はすべての点で例示であって制限的なものではないと考えられるべきである。本発明の範囲は、上記した説明ではなく、特許請求の範囲によって示され、特許請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。   The embodiment disclosed this time should be considered as illustrative in all points and not restrictive. The scope of the present invention is defined by the terms of the claims, rather than the description above, and is intended to include any modifications within the scope and meaning equivalent to the terms of the claims.

この発明の実施の形態に従う画像処理装置1を備える画像処理システム100の概略構成図である。1 is a schematic configuration diagram of an image processing system 100 including an image processing device 1 according to an embodiment of the present invention. この発明の実施の形態に従う平滑化処理の概略を説明するための模式図である。It is a schematic diagram for demonstrating the outline of the smoothing process according to embodiment of this invention. この発明の実施の形態に従う平滑化処理の内容を説明するための図である。It is a figure for demonstrating the content of the smoothing process according to embodiment of this invention. この発明の実施の形態に従う平滑化処理の処理過程を説明するための図である。It is a figure for demonstrating the process of the smoothing process according to embodiment of this invention. この発明の実施の形態に従う平滑化処理の処理手順の概略を示すフローチャートである。It is a flowchart which shows the outline of the process sequence of the smoothing process according to embodiment of this invention. 関数f(w)の特性の一例を示す図である。It is a figure which shows an example of the characteristic of a function f (w). 検出対象OBJのカラー画像を撮影した直後の画面表示例を示す図である。It is a figure which shows the example of a screen display immediately after image | photographing the color image of the detection target OBJ. 第1色および第2色を選択する時の画面表示例を示す図である。It is a figure which shows the example of a screen display when selecting a 1st color and a 2nd color. 平滑化処理を実行した後の画面表示例を示す図である。It is a figure which shows the example of a screen display after performing a smoothing process. 図9に比較してパラメータLvの値を大きく設定して、平滑化処理を実行した後の画面表示例を示す図である。It is a figure which shows the example of a screen display after setting the value of parameter Lv large compared with FIG. 9, and performing the smoothing process. 色抽出処理の概略を説明するための図である。It is a figure for demonstrating the outline of a color extraction process. 色抽出処理の処理手順を示すフローチャートである。It is a flowchart which shows the process sequence of a color extraction process. この発明の実施の形態の第1変形例に従う基準平面#CPLの位置を説明するための図である。It is a figure for demonstrating the position of reference plane #CPL according to the 1st modification of embodiment of this invention. この発明の実施の形態の第2変形例に従う基準線#CDVを説明するための図である。It is a figure for demonstrating the reference line #CDV according to the 2nd modification of embodiment of this invention. この発明の実施の形態の第3変形例に従う平滑化処理の内容を説明するための図である。It is a figure for demonstrating the content of the smoothing process according to the 3rd modification of embodiment of this invention.

符号の説明Explanation of symbols

1 画像処理装置、2 撮像部、3 表示部、4 CPU部、5 補助記憶部、6 入力部、7 撮像部インターフェイス(撮像部I/F)、8 主記憶部、9 表示処理部、10 外部インターフェイス(外部I/F)、11 読取部、12 記録媒体、13 バス、30 ロゴマーク、40 欠陥部、42 色抽出領域、50 ポインタ、52 ボタン、54,64 色表示枠、56,66 RGB表示枠、58 パラメータ設定ダイヤル、70 ボタン、72 設定枠、74 パラメータ設定ダイヤル、100 画像処理システム、AREA 処理領域、OBJ 検出対象、SYS 色座標。   DESCRIPTION OF SYMBOLS 1 Image processing apparatus, 2 Imaging part, 3 Display part, 4 CPU part, 5 Auxiliary storage part, 6 Input part, 7 Imaging part interface (imaging part I / F), 8 Main memory part, 9 Display processing part, 10 External Interface (external I / F), 11 reading unit, 12 recording medium, 13 bus, 30 logo mark, 40 defective part, 42 color extraction area, 50 pointer, 52 button, 54, 64 color display frame, 56, 66 RGB display Frame, 58 parameter setting dial, 70 buttons, 72 setting frame, 74 parameter setting dial, 100 image processing system, AREA processing area, OBJ detection target, SYS color coordinates.

Claims (12)

複数の画素からなるカラー画像に対して画素間の色差を軽減するための画像処理方法であって、
選択される第1および第2色に対応する色座標上の2つの基準点を含む基準線を前記色座標上に規定するステップと、
前記カラー画像の予め定められた処理領域内に含まれる各画素を順次抽出する抽出ステップと、
前記抽出ステップにおいて抽出された画素の色に対応する前記色座標上の変換元点を含み、かつ前記基準線に沿う変換線を前記色座標上に規定する規定ステップと、
前記規定ステップにおいて規定された前記変換線に従って、前記変換元点を所定の移動量だけ移動させて得られる変換後点を算出する変換ステップと、
前記抽出された画素の色を前記変換ステップにおいて算出された前記変換後点に対応する色に置換する置換ステップと、
前記抽出ステップにおいて前記処理領域内に含まれるすべての画素が抽出されるまで、前記規定ステップ、前記変換ステップおよび前記置換ステップを繰返し実行させるステップとを含み、
前記基準線は、前記色座標上において一次式として規定され、
前記変換線は、前記色座標上において、前記基準線と平行になるように規定される、画像処理方法。
An image processing method for reducing a color difference between pixels with respect to a color image composed of a plurality of pixels,
Defining a reference line on the color coordinates including two reference points on the color coordinates corresponding to the selected first and second colors;
An extraction step of sequentially extracting each pixel included in a predetermined processing region of the color image;
A defining step including a conversion source point on the color coordinate corresponding to the color of the pixel extracted in the extraction step and defining a conversion line along the reference line on the color coordinate;
A conversion step of calculating a post-conversion point obtained by moving the conversion source point by a predetermined movement amount according to the conversion line defined in the defining step;
A replacement step of replacing the color of the extracted pixel with a color corresponding to the post-conversion point calculated in the conversion step;
Until all the pixels contained in the processing region in the extraction step is extracted, the defining step, seen including a step of repeatedly executing said conversion step and said replacing step,
The reference line is defined as a linear expression on the color coordinates,
The image processing method, wherein the conversion line is defined to be parallel to the reference line on the color coordinate .
前記画像処理方法は、前記変換元点から前記基準線までの距離に基づいて、前記変換元点に対する前記移動量を決定するステップをさらに含む、請求項1に記載の画像処理方法。 The image processing method, based on the distance from the conversion source point to the reference line, further comprising determining the amount of movement with respect to the conversion source point, the image processing method according to claim 1. 前記変換ステップにおいて、前記変換後点は、前記変換元点を前記基準線の線上に存在する予め定められた収束点に近付く方向に移動させることで得られる、請求項1に記載の画像処理方法。 The image processing method according to claim 1, wherein in the conversion step, the post-conversion point is obtained by moving the conversion source point in a direction approaching a predetermined convergence point existing on the reference line. . 前記収束点は、前記2つの基準点の中点である、請求項に記載の画像処理方法。 The image processing method according to claim 3 , wherein the convergence point is a midpoint between the two reference points. 前記収束点は、前記2つの基準点のいずれかに一致する、請求項に記載の画像処理方法。 The image processing method according to claim 3 , wherein the convergence point matches one of the two reference points. 前記画像処理方法は、
前記カラー画像の少なくとも一部を含む色抽出領域の指定を受付けるステップと、
前記色抽出領域に含まれる各画素の有する色に基づいて、当該色抽出領域を代表する2つの色を前記第1および第2色として選択するステップとをさらに含む、請求項1〜のいずれか1項に記載の画像処理方法。
The image processing method includes:
Receiving a designation of a color extraction region that includes at least a portion of the color image;
Based on the color included in each pixel included in the color extraction area, two color representative of the color extraction area further comprises the step of selecting as said first and second color, one of the claims 1-5 The image processing method according to claim 1.
前記画像処理方法は、前記第1および第2色に加えて、第3色が選択されると、前記第1および第2色に基づいて、一連のステップを実行した後に、当該一連のステップの実行により生じる収束点に対応する色および前記第3色に基づいて、一連のステップを再度実行するステップをさらに含む、請求項に記載の画像処理方法。 In the image processing method, when a third color is selected in addition to the first and second colors, a series of steps is executed based on the first and second colors, and then the series of steps is performed. The image processing method according to claim 3 , further comprising a step of executing a series of steps again based on a color corresponding to a convergence point generated by the execution and the third color. 前記移動量は、前記変換元点から前記基準線までの距離を変数とする関数に基づいて決定され、
前記関数は、外部から設定されるパラメータに応じて、前記距離と前記移動量との関係を可変に構成される、請求項に記載の画像処理方法。
The amount of movement is determined based on a function having a variable from the conversion source point to the reference line,
The image processing method according to claim 2 , wherein the function is configured such that a relationship between the distance and the movement amount is variably set according to a parameter set from the outside.
前記画像処理方法は、前記カラー画像と、前記第1および第2色の視覚的表示および色情報の少なくとも一方とを、同一画面上に同時に表示するステップをさらに含む、請求項1〜のいずれか1項に記載の画像処理方法。 The image processing method includes the color image, and at least one of the first and second color visual displays and color information, further comprising the step of simultaneously displaying on the same screen, either Claim 1-8 The image processing method according to claim 1. 前記色座標は、色の3原色に対応する3つの座標軸を含んで構成される、請求項1〜のいずれか1項に記載の画像処理方法。 The color coordinate is configured to include three coordinate axes corresponding to the three primary colors, the image processing method according to any one of claims 1-9. 複数の画素からなるカラー画像に対して画素間の色差を軽減するための画像処理方法をコンピュータに実行させるためのプログラムであって、
選択される第1および第2色に対応する色座標上の2つの基準点を含む基準線を前記色座標上に規定するステップと、
前記カラー画像の予め定められた処理領域内に含まれる各画素を順次抽出する抽出ステップと、
前記抽出ステップにおいて抽出された画素の色に対応する前記色座標上の変換元点を含み、かつ前記基準線に沿う変換線を前記色座標上に規定する規定ステップと、
前記規定ステップにおいて規定された前記変換線に従って、前記変換元点を所定の移動量だけ移動させて得られる変換後点を算出する変換ステップと、
前記抽出された画素の色を前記変換ステップにおいて算出された前記変換後点に対応する色に置換する置換ステップと、
前記抽出ステップにおいて前記処理領域内に含まれるすべての画素が抽出されるまで、前記規定ステップ、前記変換ステップおよび前記置換ステップを繰返し実行させるステップとを含含み、
前記基準線は、前記色座標上において一次式として規定され、
前記変換線は、前記色座標上において、前記基準線と平行になるように規定される、プログラム。
A program for causing a computer to execute an image processing method for reducing a color difference between pixels with respect to a color image composed of a plurality of pixels,
Defining a reference line on the color coordinates including two reference points on the color coordinates corresponding to the selected first and second colors;
An extraction step of sequentially extracting each pixel included in a predetermined processing region of the color image;
A defining step including a conversion source point on the color coordinate corresponding to the color of the pixel extracted in the extraction step and defining a conversion line along the reference line on the color coordinate;
A conversion step of calculating a post-conversion point obtained by moving the conversion source point by a predetermined movement amount according to the conversion line defined in the defining step;
A replacement step of replacing the color of the extracted pixel with a color corresponding to the post-conversion point calculated in the conversion step;
Including repeatedly executing the defining step, the converting step, and the replacing step until all pixels included in the processing region are extracted in the extracting step ,
The reference line is defined as a linear expression on the color coordinates,
The program in which the conversion line is defined to be parallel to the reference line on the color coordinate .
複数の画素からなるカラー画像に対して画素間の色差を軽減するための画像処理装置であって、
選択される第1および第2色に対応する色座標上の2つの基準点を含む基準線を前記色座標上に規定する第1規定手段と、
前記カラー画像の予め定められた処理領域内に含まれる各画素を順次抽出する抽出手段と、
前記抽出手段によって抽出された画素の色に対応する前記色座標上の変換元点を含み、かつ前記基準線に沿う変換線を前記色座標上に規定する第2規定手段と、
前記第2規定手段によって規定された前記変換線に従って、前記変換元点を所定の移動量だけ移動させて得られる変換後点を算出する変換手段と、
前記抽出された画素の色を前記変換手段によって算出された前記変換後点に対応する色に置換する置換手段とを備え、
前記基準線は、前記色座標上において一次式として規定され、
前記変換線は、前記色座標上において、前記基準線と平行になるように規定される、画像処理装置。
An image processing apparatus for reducing a color difference between pixels with respect to a color image composed of a plurality of pixels,
First defining means for defining, on the color coordinates, a reference line including two reference points on the color coordinates corresponding to the selected first and second colors;
Extraction means for sequentially extracting each pixel included in a predetermined processing region of the color image;
Second defining means for defining on the color coordinates a conversion line that includes a conversion source point on the color coordinates corresponding to the color of the pixel extracted by the extracting means, and that is along the reference line;
Conversion means for calculating a post-conversion point obtained by moving the conversion source point by a predetermined amount of movement according to the conversion line defined by the second defining means;
E Bei and replacement means for replacing the color of pixels the extracted color corresponding to the converted point calculated by said converting means,
The reference line is defined as a linear expression on the color coordinates,
The image processing apparatus, wherein the conversion line is defined to be parallel to the reference line on the color coordinates .
JP2006324083A 2006-11-30 2006-11-30 Image processing method, program, and image processing apparatus Active JP4748041B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006324083A JP4748041B2 (en) 2006-11-30 2006-11-30 Image processing method, program, and image processing apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006324083A JP4748041B2 (en) 2006-11-30 2006-11-30 Image processing method, program, and image processing apparatus

Publications (2)

Publication Number Publication Date
JP2008139997A JP2008139997A (en) 2008-06-19
JP4748041B2 true JP4748041B2 (en) 2011-08-17

Family

ID=39601412

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006324083A Active JP4748041B2 (en) 2006-11-30 2006-11-30 Image processing method, program, and image processing apparatus

Country Status (1)

Country Link
JP (1) JP4748041B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2712935B1 (en) 2008-05-28 2016-07-13 Kao Corporation Method of detecting heat-resistant fungus of the genus Hamigera

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004135313A (en) * 2002-09-18 2004-04-30 Canon Inc Device and method for image processing
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
JP4513961B2 (en) * 2004-11-05 2010-07-28 富士ゼロックス株式会社 Color adjustment method and color adjustment apparatus

Also Published As

Publication number Publication date
JP2008139997A (en) 2008-06-19

Similar Documents

Publication Publication Date Title
TWI389553B (en) Methods and devices for image signal processing
JP4747970B2 (en) Image processing device
US7684617B2 (en) Apparatus and methods for processing images
JP4529888B2 (en) Image processing apparatus, image processing method, and image processing program
US8031941B2 (en) Image display apparatus, image display method, and image display program
JP5918915B2 (en) Method and device for creating an improved color image using a sensor having a color filter
US10477128B2 (en) Neighborhood haze density estimation for single-image dehaze
US20040240749A1 (en) Image processing device, image processing method, and program
CN104683634A (en) Determining Apparatus, Mobile Terminal Apparatus, And Recording Medium
US9888154B2 (en) Information processing apparatus, method for processing information, and computer program
US10438376B2 (en) Image processing apparatus replacing color of portion in image into single color, image processing method, and storage medium
JP2015011585A (en) Image processing apparatus, image forming apparatus, image forming system, image processing method, and program
US20190268580A1 (en) Image processing apparatus, image forming apparatus, image processing method, and non-transitory computer-readable storage medium
JP5640622B2 (en) Method for classifying red-eye object candidates, computer-readable medium, and image processing apparatus
JP4764903B2 (en) Method and image processing apparatus for detecting line structure from text map
JP4065517B2 (en) Color difference determination apparatus and method
US11368607B2 (en) Information processing apparatus and non-transitory computer readable medium storing program for image color conversion
CN107864365B (en) Method for eliminating purple border of image
US20220366588A1 (en) Electronic device for generating depth information of region of interest and operation method thereof
JP2018196096A (en) Image processing system, image processing method and program
JP2006268820A (en) Method, apparatus and program for image identification, image processing method and integrated circuit
US20140301638A1 (en) Color extraction-based image processing method, computer-readable storage medium storing the same, and digital image apparatus
US9998631B2 (en) Information processing apparatus, method for processing information, and computer program
EP3096294B1 (en) Computer program, image processing apparatus, and method for improving quality of image data
JP4748041B2 (en) Image processing method, program, and image processing apparatus

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20090114

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110215

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110329

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20110502

R150 Certificate of patent or registration of utility model

Ref document number: 4748041

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

Year of fee payment: 3

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250