JP2018105639A - Position detection device, electronic apparatus, and position detection method - Google Patents

Position detection device, electronic apparatus, and position detection method Download PDF

Info

Publication number
JP2018105639A
JP2018105639A JP2016249389A JP2016249389A JP2018105639A JP 2018105639 A JP2018105639 A JP 2018105639A JP 2016249389 A JP2016249389 A JP 2016249389A JP 2016249389 A JP2016249389 A JP 2016249389A JP 2018105639 A JP2018105639 A JP 2018105639A
Authority
JP
Japan
Prior art keywords
detection
color
edge
medium
unit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2016249389A
Other languages
Japanese (ja)
Other versions
JP6816498B2 (en
Inventor
秀明 笠原
Hideaki Kasahara
秀明 笠原
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.)
Seiko Epson Corp
Original Assignee
Seiko Epson 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 Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2016249389A priority Critical patent/JP6816498B2/en
Publication of JP2018105639A publication Critical patent/JP2018105639A/en
Application granted granted Critical
Publication of JP6816498B2 publication Critical patent/JP6816498B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Length Measuring Devices By Optical Means (AREA)
  • Image Analysis (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a position detection device, electronic apparatus, and position detection method capable of accurately detecting a position of a detection object in an image.SOLUTION: A position detection device includes: a distance calculation section for calculating a distance of a color coordinate at an object position in an object with respect to a color coordinate of a medium in a color space on the basis of a captured image obtained by imaging the media where the object is formed; and a position detection section for detecting a position of an object in the medium on the basis of a calculation result of the distance calculation section.SELECTED DRAWING: Figure 10

Description

本発明は、位置検出装置、電子機器、及び位置検出方法に関する。   The present invention relates to a position detection device, an electronic apparatus, and a position detection method.

従来、画像のエッジ検出を行うエッジ検出装置として、画像の注目画素と、一方向に沿って当該注目画素に隣り合う2つの隣接画素と、に基づいて、一方向に沿ってエッジ位置を検出する装置が知られている(特許文献1)。   Conventionally, as an edge detection device that detects an edge of an image, an edge position is detected along one direction based on the target pixel of the image and two adjacent pixels adjacent to the target pixel along one direction. An apparatus is known (Patent Document 1).

具体的には、特許文献1に記載の装置では、低域通過フィルタを用いてノイズの除去を行った後に、2つの隣接画素(画素値)の和と、注目画素(画素値)の2倍との差を、エッジの大きさ(エッジサイズ)、すなわちエッジの急峻さを示す値として取得し、エッジサイズが閾値を超える注目画素をエッジとして検出する。これによって、ノイズの除去と、有効なエッジの鈍化を防止することが可能で、エッジ位置をより高精度に検出できる。   Specifically, in the apparatus described in Patent Document 1, after noise removal using a low-pass filter, the sum of two adjacent pixels (pixel values) and twice the target pixel (pixel value) Is obtained as a value indicating the edge size (edge size), that is, the sharpness of the edge, and a pixel of interest whose edge size exceeds a threshold value is detected as an edge. As a result, noise removal and effective edge dulling can be prevented, and the edge position can be detected with higher accuracy.

特開平8−315157号公報JP-A-8-315157

しかしながら、特許文献1に記載の従来の装置を用いて、例えばメディアに印刷されたカラーパッチ等の検出対象の外縁(エッジ)位置を検出することにより、検出対象の位置を検出する場合、位置の検出精度を向上させることは困難であった。
すなわち、各画素の画素値を明度(反射率)によって決定した場合には、明度が同程度で色が異なるエッジは検出が困難となる。具体的には、明度がメディアと同程度となる低階調値のカラーパッチのエッジ(メディア表面との境界位置)の検出が困難となるため、カラーパッチの明度や色相によっては、検出対象の位置を高精度に検出することができないという課題があった。
However, when the position of the detection target is detected by detecting the outer edge (edge) position of the detection target such as a color patch printed on a medium using the conventional apparatus described in Patent Document 1, It has been difficult to improve detection accuracy.
That is, when the pixel value of each pixel is determined by lightness (reflectance), it is difficult to detect edges having the same lightness and different colors. Specifically, it is difficult to detect the edge of a color patch with a low gradation value that has the same brightness as the media (boundary position with the media surface), so depending on the brightness and hue of the color patch, There was a problem that the position could not be detected with high accuracy.

本発明は、画像における検出対象の位置を高精度に検出できる位置検出装置、電子機器、及び位置検出方法を提供することを1つの目的とする。   An object of the present invention is to provide a position detection device, an electronic device, and a position detection method that can detect the position of a detection target in an image with high accuracy.

本発明の一適用例に係る位置検出装置は、対象物が印刷されたメディアを撮像して得られた撮像画像に基づいて、色空間における、前記メディアの色座標に対する、対象位置の色座標の距離を算出する距離算出部と、前記距離算出部により算出された前記距離に基づいて、前記メディアにおける前記対象物の位置を検出する位置検出部と、を備えることを特徴とする。   A position detection device according to an application example of the present invention is based on a captured image obtained by capturing an image of a medium on which an object is printed, and the color coordinate of the target position with respect to the color coordinate of the medium in a color space. A distance calculation unit that calculates a distance; and a position detection unit that detects a position of the object in the media based on the distance calculated by the distance calculation unit.

本適用例では、距離算出部は、色空間における、メディアの色座標に対する、対象位置の色座標の距離を算出する。位置検出部は、算出された距離に基づいて、メディアにおける対象物の位置を検出する。
このような構成では、対象物のエッジの位置(メディア表面との境界位置)を高精度に検出することができ、ひいてはメディア上における対象物の位置を高精度に検出することができる。例えば、メディアに印刷されたカラーパッチを検出対象とする場合、カラーパッチ上の対象位置における色座標と、メディアの色との色座標との色空間における距離を算出することにより、カラーパッチとメディア表面との境界位置を高精度に検出することができ、ひいては撮像画像における対象物としてのカラーパッチ位置を高精度に検出することができる。
In this application example, the distance calculation unit calculates the distance of the color coordinate of the target position with respect to the color coordinate of the medium in the color space. The position detection unit detects the position of the object on the medium based on the calculated distance.
In such a configuration, the position of the edge of the object (boundary position with the media surface) can be detected with high accuracy, and consequently the position of the object on the media can be detected with high accuracy. For example, when a color patch printed on a medium is a detection target, the color patch and the medium are calculated by calculating the distance in the color space between the color coordinate at the target position on the color patch and the color coordinate of the medium. The position of the boundary with the surface can be detected with high accuracy, and as a result, the position of the color patch as the object in the captured image can be detected with high accuracy.

本適用例の位置検出装置において、前記距離算出部は、前記対象位置の色座標を(RC1,C2,C3)とし、前記メディアの色座標を(RM1,M2,M3)とし、下記式(1)に基づいて、前記距離としてR1を算出することが好ましい。 In the position detection device according to this application example, the distance calculation unit sets the color coordinates of the target position as ( RC1, RC2, RC3 ), and the media color coordinates as ( RM1, RM2, RM3 ). It is preferable to calculate R1 as the distance based on the following formula (1).

Figure 2018105639
Figure 2018105639

本適用例では、上記式(1)によって、色空間における距離を算出する。これにより、撮像画像における任意の対象位置について、当該対象位置の画素値を用いて上記距離を算出することができる。例えば、撮像画像における各画素値を赤(R)、緑(G)、青(B)の各色の階調値として取得した際に、各画素値を用いて、任意の画素における上記距離を算出することができる。したがって、他の色座標によって定義される色空間に変換する等の処理を行う必要がなく、処理負荷を低減できる。   In this application example, the distance in the color space is calculated by the above equation (1). Accordingly, the distance can be calculated for an arbitrary target position in the captured image using the pixel value of the target position. For example, when each pixel value in the captured image is acquired as a gradation value of each color of red (R), green (G), and blue (B), the above-mentioned distance in an arbitrary pixel is calculated using each pixel value. can do. Therefore, it is not necessary to perform processing such as conversion to a color space defined by other color coordinates, and the processing load can be reduced.

本適用例の位置検出装置において、前記距離算出部は、前記メディアの色座標(RM1,M2,M3)がRM1=RM2=RM3=Rである場合、前記対象位置の色座標を(RC1,C2,C3)とし、kcompを補正係数とし、下記式(2)(3)に基づいて、前記距離としてR1を算出することが好ましい。 In the position detection apparatus of this application example, the distance calculation unit may calculate the target position when the color coordinates (R M1, R M2, R M3 ) of the medium are R M1 = R M2 = R M3 = R W. It is preferable to calculate R1 as the distance based on the following equations (2) and (3), where the color coordinates are (R C1, R C2, R C3 ), k comp is a correction coefficient.

Figure 2018105639
Figure 2018105639

本適用例では、撮像画像のホワイトバランスをメディアの色に基づいて調整する場合、上記式(2)に基づいて、対象位置の色座標にグレースケール変換を行った後、上記式(3)に基づいて、グレースケール変換後の対象位置の色座標における、上記距離を算出する。このような構成では、対象位置の色座標をグレー軸方向に圧縮することができ、メディアの凹凸による輝度むらの影響を抑制することができる。また、メディアの色座標の各値として同一の値を用いることができるため、距離を算出する場合の処理負荷の増大を抑制できる。   In this application example, when adjusting the white balance of the captured image based on the color of the media, after performing grayscale conversion on the color coordinates of the target position based on the above equation (2), the above equation (3) is obtained. Based on this, the distance in the color coordinates of the target position after gray scale conversion is calculated. In such a configuration, the color coordinates of the target position can be compressed in the gray axis direction, and the influence of luminance unevenness due to the unevenness of the media can be suppressed. Further, since the same value can be used as each value of the color coordinate of the media, an increase in processing load when calculating the distance can be suppressed.

本適用例の位置検出装置において、前記距離算出部は、前記メディアに応じた補正係数kcompを設定することが好ましい。
本適用例では、メディアに応じた補正係数kcompを設定することにより、例えば、メディア種別に応じてメディアの色が異なる場合や、表面の光沢が異なる場合でも、補正係数kcompとして適切な値を設定することができる。したがって、メディア種別による距離の算出精度の低下を抑制でき、ひいては対象物の位置を高精度に検出できる。
In the position detection device of the application example, it is preferable that the distance calculation unit sets a correction coefficient k comp corresponding to the medium.
In this application example, by setting the correction coefficient k comp according to the medium, for example, even if the color of the medium differs depending on the media type or the glossiness of the surface differs, an appropriate value as the correction coefficient k comp Can be set. Accordingly, it is possible to suppress a decrease in the distance calculation accuracy due to the media type, and consequently to detect the position of the object with high accuracy.

本適用例の位置検出装置において、前記対象物として前記メディアに印刷されたカラーパッチのエッジ位置を検出する検出範囲を設定する検出範囲設定部を備え、前記検出範囲設定部は、前記メディアの色を含む前記検出範囲を設定し、前記位置検出部は、前記検出範囲における前記エッジ位置を検出することが好ましい。
本適用例では、位置検出部は、メディアに印刷されたカラーパッチのエッジ位置を検出対象とし、検出範囲設定部は、メディアの色を含む検出範囲を設定する。このような構成では、検出対象となるカラーパッチのエッジを含むように検出範囲を設定することができる。したがって、エッジ位置をより確実に検出できるとともに、検出範囲を絞り込むことによる処理負荷の低減を図ることができる。
In the position detection device according to this application example, the detection apparatus includes a detection range setting unit that sets a detection range for detecting an edge position of a color patch printed on the medium as the object, and the detection range setting unit includes a color of the medium. It is preferable that the detection range including is set, and the position detection unit detects the edge position in the detection range.
In this application example, the position detection unit sets the edge position of the color patch printed on the medium as a detection target, and the detection range setting unit sets a detection range including the color of the medium. In such a configuration, the detection range can be set so as to include the edge of the color patch to be detected. Therefore, the edge position can be detected more reliably, and the processing load can be reduced by narrowing the detection range.

本適用例では、前記検出範囲設定部は、一方向において、前記対象位置に対して判定範囲を設定し、前記一方向に前記対象位置及び前記判定範囲を走査して、前記判定範囲における前記メディアの色の占有量が所定値を超えた際の前記対象位置を、前記検出範囲の外縁に設定することが好ましい。
本適用例では、検出範囲設定部は、対象位置に対して、当該対象位置を検出範囲に含めるか否かを判定するための判定範囲を設定する。そして、検出範囲設定部は、一方向に対象位置と判定範囲とを走査した際に、当該判定範囲におけるメディアの色の占有量が所定値を超える際の対象位置を、検出範囲の外縁に設定する。このような構成では、エッジ位置の近傍領域を含む範囲に検出範囲を絞り込むことができ、検出処理による処理負荷をより確実に低減させることができる。
In this application example, the detection range setting unit sets a determination range with respect to the target position in one direction, scans the target position and the determination range in the one direction, and the medium in the determination range Preferably, the target position when the color occupancy exceeds a predetermined value is set to the outer edge of the detection range.
In this application example, the detection range setting unit sets a determination range for determining whether to include the target position in the detection range with respect to the target position. Then, when the detection range setting unit scans the target position and the determination range in one direction, the detection position setting unit sets the target position when the amount of media color in the determination range exceeds a predetermined value as the outer edge of the detection range. To do. In such a configuration, the detection range can be narrowed down to a range including the vicinity region of the edge position, and the processing load due to the detection processing can be more reliably reduced.

本発明の一適用例に係る電子機器は、対象物が印刷されたメディアを撮像して得られた撮像画像に基づいて、色空間における、前記メディアの色座標に対する、対象位置の色座標の距離を算出する距離算出部と、前記距離算出部により算出された前記距離に基づいて、前記メディアにおける前記対象物の位置を検出する位置検出部と、前記対象物の前記位置の検出結果に基づく処理を行う処理部と、を備えることを特徴とする。   An electronic apparatus according to an application example of the invention is based on a captured image obtained by capturing an image of a medium on which an object is printed, and a color coordinate distance of the target position with respect to the color coordinate of the medium in a color space. A distance calculation unit that calculates the position, a position detection unit that detects the position of the object on the media based on the distance calculated by the distance calculation unit, and a process based on the detection result of the position of the object And a processing unit for performing the above.

本適用例では、上記適用例と同様に、撮像画像の対象位置における上記距離を算出し、算出された距離に基づいて、メディアにおける対象物の位置を検出する。これにより、対象物のエッジの位置(メディア表面との境界位置)を高精度に検出することができ、ひいてはメディア上における対象物の位置を高精度に検出することができる。   In this application example, as in the above application example, the distance at the target position of the captured image is calculated, and the position of the target object on the media is detected based on the calculated distance. Thereby, the position of the edge of the object (boundary position with the media surface) can be detected with high accuracy, and as a result, the position of the object on the medium can be detected with high accuracy.

本発明の一適用例に係る位置検出方法は、対象物が印刷されたメディアを撮像して得られた撮像画像に基づいて、前記メディアにおける前記対象物の位置を検出する位置検出装置における位置検出方法であって、色空間における、前記メディアの色座標に対する、対象位置の色座標の距離を算出するステップと、算出された前記距離に基づいて、前記メディアにおける前記対象物の位置を検出するステップと、を実施することを特徴とする。   A position detection method according to an application example of the present invention includes position detection in a position detection device that detects the position of the object on the medium based on a captured image obtained by imaging the medium on which the object is printed. A method of calculating a distance of a color coordinate of a target position with respect to a color coordinate of the medium in a color space, and detecting a position of the target object on the medium based on the calculated distance And performing the above.

本適用例では、上記適用例と同様に、撮像画像の対象位置における上記距離を算出し、算出された距離に基づいて、メディアにおける対象物の位置を検出する。これにより、対象物のエッジの位置(メディア表面との境界位置)を高精度に検出することができ、ひいてはメディア上における対象物の位置を高精度に検出することができる。   In this application example, as in the above application example, the distance at the target position of the captured image is calculated, and the position of the target object on the media is detected based on the calculated distance. Thereby, the position of the edge of the object (boundary position with the media surface) can be detected with high accuracy, and as a result, the position of the object on the medium can be detected with high accuracy.

本発明の第1実施形態に係るプリンターの外観の構成例を示す図。FIG. 2 is a diagram illustrating a configuration example of an appearance of the printer according to the first embodiment of the invention. 第1実施形態のプリンターの概略構成を示すブロック図。1 is a block diagram illustrating a schematic configuration of a printer according to a first embodiment. 第1実施形態のプリンターにおける撮像部の概略構成を示す概略図。FIG. 2 is a schematic diagram illustrating a schematic configuration of an imaging unit in the printer of the first embodiment. 第1実施形態の制御ユニットが備えるCPUの機能構成を示すブロック図。The block diagram which shows the function structure of CPU with which the control unit of 1st Embodiment is provided. 第1実施形態における画像処理方法を示すフローチャート。6 is a flowchart illustrating an image processing method according to the first embodiment. 第1実施形態の画像処理に用いられるテストパターンを模式的に示す図。The figure which shows typically the test pattern used for the image processing of 1st Embodiment. 第1実施形態のカラーパッチ位置の取得方法を示すフローチャート。5 is a flowchart illustrating a method for acquiring a color patch position according to the first embodiment. 第1実施形態のカラーパッチ位置の取得方法を模式的に示す図。FIG. 3 is a diagram schematically illustrating a method for acquiring a color patch position according to the first embodiment. 第1実施形態のカラーパッチ位置の取得方法を模式的に示す図。FIG. 3 is a diagram schematically illustrating a method for acquiring a color patch position according to the first embodiment. 第1実施形態のエッジ位置の検出方法を示すフローチャート。5 is a flowchart illustrating a method for detecting an edge position according to the first embodiment. 第1実施形態のエッジ位置の検出方法を模式的に示す図。The figure which shows typically the detection method of the edge position of 1st Embodiment. 第1実施形態のエッジ位置の検出方法を模式的に示す図。The figure which shows typically the detection method of the edge position of 1st Embodiment. 第1実施形態のエッジ位置の検出方法を模式的に示す図。The figure which shows typically the detection method of the edge position of 1st Embodiment.

[第1実施形態]
以下、本発明に係る第1実施形態について、図面に基づいて説明する。本実施形態では、本発明の画像処理方法を実施する位置検出装置及び電子機器の一例として、プリンター1(インクジェットプリンター)について説明する。
[First Embodiment]
DESCRIPTION OF EXEMPLARY EMBODIMENTS Hereinafter, a first embodiment according to the invention will be described with reference to the drawings. In the present embodiment, a printer 1 (inkjet printer) will be described as an example of a position detection apparatus and an electronic apparatus that perform the image processing method of the present invention.

[プリンターの概略構成]
図1は、プリンター1の外観の構成例を示す図である。図2は、プリンター1の概略構成を示すブロック図である。
図1に示すように、プリンター1は、供給ユニット11、搬送ユニット12と、キャリッジ13と、キャリッジ移動ユニット14と、制御ユニット15(図2参照)と、を備えている。このプリンター1は、例えばパーソナルコンピューター等の外部機器20から入力された印刷データに基づいて、各ユニット11,12,14及びキャリッジ13を制御し、メディアM上に画像を印刷する。また、本実施形態のプリンター1は、予め設定された元画像データに基づいてメディアM上の所定位置にテストパターンを形成し、当該テストパターンの撮像画像を取得して画像処理を行い、印刷された画像が適正でない場合に補正処理を行う。
以下、プリンター1の各構成について具体的に説明する。
[Schematic configuration of printer]
FIG. 1 is a diagram illustrating a configuration example of the appearance of the printer 1. FIG. 2 is a block diagram illustrating a schematic configuration of the printer 1.
As shown in FIG. 1, the printer 1 includes a supply unit 11, a transport unit 12, a carriage 13, a carriage moving unit 14, and a control unit 15 (see FIG. 2). The printer 1 controls the units 11, 12, and 14 and the carriage 13 based on print data input from an external device 20 such as a personal computer, and prints an image on the medium M. The printer 1 of the present embodiment forms a test pattern at a predetermined position on the medium M based on preset original image data, acquires a captured image of the test pattern, performs image processing, and is printed. Correction processing is performed when the captured image is not appropriate.
Hereinafter, each configuration of the printer 1 will be specifically described.

供給ユニット11は、画像形成対象となるメディアM(本実施形態では、紙面を例示)を、画像形成位置に供給するユニットである。この供給ユニット11は、例えばメディアMが巻装されたロール体111(図1参照)、ロール駆動モーター(図示略)、及びロール駆動輪列(図示略)等を備える。そして、制御ユニット15からの指令に基づいて、ロール駆動モーターが回転駆動され、ロール駆動モーターの回転力がロール駆動輪列を介してロール体111に伝達される。これにより、ロール体111が回転し、ロール体111に巻装された紙面がY方向(副走査方向)における下流側(+Y方向)に供給される。
なお、本実施形態では、ロール体111に巻装された紙面を供給する例を示すがこれに限定されない。例えば、トレイ等に積載された紙面等のメディアMをローラー等によって例えば1枚ずつ供給する等、如何なる供給方法によってメディアMが供給されてもよい。
The supply unit 11 is a unit that supplies a medium M (an example of which is a paper surface in this embodiment) that is an image formation target to an image formation position. The supply unit 11 includes, for example, a roll body 111 (see FIG. 1) around which a medium M is wound, a roll drive motor (not shown), a roll drive wheel train (not shown), and the like. Then, based on a command from the control unit 15, the roll drive motor is rotationally driven, and the rotational force of the roll drive motor is transmitted to the roll body 111 via the roll drive wheel train. As a result, the roll body 111 rotates and the paper surface wound around the roll body 111 is supplied downstream (+ Y direction) in the Y direction (sub-scanning direction).
In the present embodiment, an example in which the paper surface wound around the roll body 111 is supplied is shown, but the present invention is not limited to this. For example, the medium M may be supplied by any supply method such as supplying the medium M such as a sheet of paper loaded on a tray or the like one by one with a roller or the like.

搬送ユニット12は、本発明の搬送機構であって、供給ユニット11から供給されたメディアMを、本発明の一方向であるY方向に沿って搬送する。この搬送ユニット12は、搬送ローラー121と、搬送ローラー121とメディアMを挟んで配置され、搬送ローラー121に従動する従動ローラー(図示略)と、プラテン122と、を含んで構成されている。
搬送ローラー121は、図示略の搬送モーターからの駆動力が伝達され、制御ユニット15の制御により搬送モーターが駆動されると、その回転力により回転駆動されて、従動ローラーとの間にメディアMを挟み込んだ状態でY方向に沿って搬送する。また、搬送ローラー121のY方向の下流側(+Y側)には、キャリッジ13に対向するプラテン122が設けられている。
The transport unit 12 is the transport mechanism of the present invention, and transports the medium M supplied from the supply unit 11 along the Y direction, which is one direction of the present invention. The transport unit 12 includes a transport roller 121, a transport roller 121, a driven roller (not shown) that is driven by the transport roller 121, and a platen 122.
The conveyance roller 121 receives a driving force from a conveyance motor (not shown), and when the conveyance motor is driven by the control of the control unit 15, the conveyance roller 121 is rotationally driven by the rotation force, so that the medium M is placed between the conveyance roller 121 and the driven roller. It is transported along the Y direction while being sandwiched. A platen 122 facing the carriage 13 is provided on the downstream side (+ Y side) in the Y direction of the transport roller 121.

キャリッジ13は、メディアMに対して画像を印刷する印刷部16と、メディアM上の所定の測定位置(測定領域)の撮像処理を行う撮像部17と、を備えている。
このキャリッジ13は、キャリッジ移動ユニット14によって、Y方向と交差する主走査方向(X方向)に沿って移動可能に設けられている。
また、キャリッジ13は、フレキシブル回路131により制御ユニット15に接続され、制御ユニット15からの指令に基づいて、印刷部16による印刷処理(メディアMに対する画像形成処理)及び、撮像部17による撮像処理を実施する。
なお、キャリッジ13の詳細な構成については後述する。
The carriage 13 includes a printing unit 16 that prints an image on the medium M, and an imaging unit 17 that performs imaging processing of a predetermined measurement position (measurement region) on the medium M.
The carriage 13 is provided by a carriage moving unit 14 so as to be movable along a main scanning direction (X direction) intersecting with the Y direction.
The carriage 13 is connected to the control unit 15 by a flexible circuit 131, and performs printing processing (image forming processing for the medium M) by the printing unit 16 and imaging processing by the imaging unit 17 based on a command from the control unit 15. carry out.
The detailed configuration of the carriage 13 will be described later.

キャリッジ移動ユニット14は、キャリッジ13を移動させる移動機構を構成し、制御ユニット15からの指令に基づいて、キャリッジ13をX方向に沿って往復移動させる。
このキャリッジ移動ユニット14は、例えば、キャリッジガイド軸141と、キャリッジモーター142と、タイミングベルト143と、を含んで構成されている。
キャリッジガイド軸141は、X方向に沿って配置され、両端部がプリンター1の例えば筐体に固定されている。キャリッジモーター142は、タイミングベルト143を駆動させる。タイミングベルト143は、キャリッジガイド軸141と略平行に支持され、キャリッジ13の一部が固定されている。そして、制御ユニット15の指令に基づいてキャリッジモーター142が駆動されると、タイミングベルト143が正逆走行され、タイミングベルト143に固定されたキャリッジ13がキャリッジガイド軸141にガイドされて往復移動する。
The carriage moving unit 14 constitutes a moving mechanism that moves the carriage 13 and reciprocates the carriage 13 along the X direction based on a command from the control unit 15.
The carriage moving unit 14 includes, for example, a carriage guide shaft 141, a carriage motor 142, and a timing belt 143.
The carriage guide shaft 141 is disposed along the X direction, and both ends are fixed to, for example, a casing of the printer 1. The carriage motor 142 drives the timing belt 143. The timing belt 143 is supported substantially parallel to the carriage guide shaft 141, and a part of the carriage 13 is fixed. When the carriage motor 142 is driven based on a command from the control unit 15, the timing belt 143 travels forward and backward, and the carriage 13 fixed to the timing belt 143 is guided by the carriage guide shaft 141 and reciprocates.

次に、キャリッジ13に設けられる印刷部16、及び撮像部17の構成について説明する。
[印刷部の構成]
印刷部16は、メディアMと対向する部分に、インクを個別にメディアM上に吐出して、メディアM上に画像を形成する。
この印刷部16は、複数色のインクに対応したインクカートリッジ(図示略)が着脱自在に装着されており、各インクカートリッジからインクタンク(図示略)にチューブ(図示略)を介してインクが供給される。また、印刷部16の下面(メディアMに対向する位置)には、インク滴を吐出するノズル(図示略)が、各色に対応して設けられている。これらのノズルには、例えばピエゾ素子が配置されており、ピエゾ素子を駆動させることで、インクタンクから供給されたインク滴が吐出されてメディアMに着弾し、ドットが形成される。
Next, the configuration of the printing unit 16 and the imaging unit 17 provided on the carriage 13 will be described.
[Configuration of printing section]
The printing unit 16 forms an image on the medium M by ejecting ink onto the medium M individually at a portion facing the medium M.
The printing unit 16 is detachably mounted with ink cartridges (not shown) corresponding to a plurality of colors of ink, and ink is supplied from each ink cartridge to an ink tank (not shown) via a tube (not shown). Is done. Further, nozzles (not shown) for ejecting ink droplets are provided on the lower surface (position facing the medium M) of the printing unit 16 corresponding to each color. For example, piezo elements are arranged in these nozzles, and by driving the piezo elements, ink droplets supplied from the ink tank are ejected and land on the medium M to form dots.

[撮像部の構成]
図3は、撮像部17の概略構成を示す図である。
撮像部17は、図3に示すように、光源171と、撮像レンズ172と、撮像素子173と、を含んで構成され、例えばキャリッジ13において、印刷部16の+X側で、かつ+Y側に配置されている。
このような撮像部17は、光源171からの照明光をメディアMに照射し、メディアMで反射された光を、撮像レンズ172を介して撮像素子173に入射させる。撮像素子173から出力された画像信号は、I−V変換器(図示略)、増幅器(図示略)、及びAD変換器(図示略)を介して制御ユニット15に入力される。
[Configuration of imaging unit]
FIG. 3 is a diagram illustrating a schematic configuration of the imaging unit 17.
As illustrated in FIG. 3, the imaging unit 17 includes a light source 171, an imaging lens 172, and an imaging element 173. For example, in the carriage 13, the imaging unit 17 is disposed on the + X side and the + Y side of the printing unit 16. Has been.
Such an imaging unit 17 irradiates the medium M with illumination light from the light source 171 and causes the light reflected by the medium M to enter the imaging element 173 via the imaging lens 172. The image signal output from the image sensor 173 is input to the control unit 15 via an IV converter (not shown), an amplifier (not shown), and an AD converter (not shown).

光源171は、メディアMに対して照明光を45°±2°の入射角で入射させる。光源171は、例えば、ハロンゲンランプやLEDやLD等の発光体と、当該発光体から出射された照明光をメディアMの所定領域に照射させるレンズやアパーチャー等の光学部材と、を含み構成される。
撮像レンズ172は、単一又は複数のレンズにより構成され、メディアMの照明領域で0°±10°で法線方向に反射された撮像光を、撮像素子173に導く。
The light source 171 causes the illumination light to enter the medium M at an incident angle of 45 ° ± 2 °. The light source 171 includes, for example, a light emitter such as a halongen lamp, an LED, or an LD, and an optical member such as a lens or an aperture that irradiates a predetermined area of the medium M with illumination light emitted from the light emitter. The
The imaging lens 172 includes a single lens or a plurality of lenses, and guides imaging light reflected in the normal direction at 0 ° ± 10 ° in the illumination area of the medium M to the imaging element 173.

撮像素子173は、メディアM上の所定の撮像領域で反射され、撮像レンズ172によって当該撮像素子173に導かれた撮像光を撮像する。撮像素子173は、例えば、RGBフィルターを備え、各画素におけるR(赤),G(緑),B(青)の各色の階調値のデータを取得することにより、撮像画像を取得する。また、撮像素子173は、一方向(水平方向)及び当該一方向に直交する方向(垂直方向)に配列された複数の画素を含む撮像画像を取得する。このような撮像素子173としてCCDやCMOS等の各種イメージセンサーを用いることができる。   The imaging element 173 captures imaging light reflected by a predetermined imaging area on the medium M and guided to the imaging element 173 by the imaging lens 172. The image sensor 173 includes, for example, an RGB filter, and acquires a captured image by acquiring gradation value data of each color of R (red), G (green), and B (blue) in each pixel. In addition, the imaging element 173 acquires a captured image including a plurality of pixels arranged in one direction (horizontal direction) and a direction orthogonal to the one direction (vertical direction). As such an image sensor 173, various image sensors such as a CCD and a CMOS can be used.

[制御ユニットの構成]
次に、制御ユニット15について説明する。
制御ユニット15は、図2に示すように、I/F151と、ユニット制御回路152と、メモリー153と、CPU(Central Processing Unit)154と、を含む。
I/F151は、外部機器20から入力される印刷データをCPU154に入力する。
ユニット制御回路152は、供給ユニット11、搬送ユニット12、印刷部16、光源171、撮像部17、及びキャリッジ移動ユニット14をそれぞれ制御する制御回路を備えており、CPU154からの指令信号に基づいて、各ユニットの動作を制御する。なお、各ユニットの制御回路が、制御ユニット15とは別体に設けられ、制御ユニット15に接続されていてもよい。
[Control unit configuration]
Next, the control unit 15 will be described.
As shown in FIG. 2, the control unit 15 includes an I / F 151, a unit control circuit 152, a memory 153, and a CPU (Central Processing Unit) 154.
The I / F 151 inputs print data input from the external device 20 to the CPU 154.
The unit control circuit 152 includes control circuits that respectively control the supply unit 11, the transport unit 12, the printing unit 16, the light source 171, the imaging unit 17, and the carriage movement unit 14, and based on a command signal from the CPU 154. Control the operation of each unit. The control circuit of each unit may be provided separately from the control unit 15 and connected to the control unit 15.

メモリー153は、プリンター1の動作を制御する各種プログラムや各種データが記憶されている。
各種データとしては、例えば、テストパターンを印刷するための元画像データ、印刷データとして含まれる色データに対する各インクの吐出量等を記憶した印刷プロファイルデータ等が挙げられる。
The memory 153 stores various programs and various data for controlling the operation of the printer 1.
Examples of the various data include original image data for printing a test pattern, print profile data storing the ejection amount of each ink for color data included as print data, and the like.

図4は、プリンター1の制御ユニット15に含まれるCPU154の機能構成を示したブロック図である。
CPU154は、メモリー153に記憶された各種プログラムを読み出し実行することで、図4に示すように、走査制御部154A、印刷制御部154B、撮像制御部154C、パッチ位置取得部154D、補正部154E等として機能する。
FIG. 4 is a block diagram illustrating a functional configuration of the CPU 154 included in the control unit 15 of the printer 1.
The CPU 154 reads and executes various programs stored in the memory 153, and as shown in FIG. 4, the scanning control unit 154A, the print control unit 154B, the imaging control unit 154C, the patch position acquisition unit 154D, the correction unit 154E, and the like. Function as.

走査制御部154Aは、供給ユニット11、搬送ユニット12、及びキャリッジ移動ユニット14を駆動させる旨の指令信号をユニット制御回路152に出力する。これにより、ユニット制御回路152は、供給ユニット11のロール駆動モーターを駆動させて、メディアMを搬送ユニット12に供給させる。また、ユニット制御回路152は、搬送ユニット12の搬送モーターを駆動させて、メディアMの所定領域をプラテン122のキャリッジ13に対向する位置まで、Y方向に沿って搬送させる。また、ユニット制御回路152は、キャリッジ移動ユニット14のキャリッジモーター142を駆動させて、キャリッジ13をX方向に沿って移動させる。   The scanning control unit 154A outputs a command signal for driving the supply unit 11, the transport unit 12, and the carriage moving unit 14 to the unit control circuit 152. As a result, the unit control circuit 152 drives the roll drive motor of the supply unit 11 to supply the medium M to the transport unit 12. Further, the unit control circuit 152 drives the transport motor of the transport unit 12 to transport the predetermined area of the medium M along the Y direction to a position facing the carriage 13 of the platen 122. Further, the unit control circuit 152 drives the carriage motor 142 of the carriage moving unit 14 to move the carriage 13 along the X direction.

印刷制御部154Bは、例えば外部機器20から入力された印刷データに基づいて、印刷部16を制御する旨の指令信号をユニット制御回路152に出力する。印刷制御部154Bからユニット制御回路152に指令信号が出力されると、ユニット制御回路152は、印刷部16に印刷制御信号を出力し、ノズルに設けられたピエゾ素子を駆動させてメディアMに対してインクを吐出させる。なお、印刷を実施する際は、キャリッジ13がX方向に沿って移動されて、その移動中に印刷部16からインクを吐出させてドットを形成するドット形成動作と、メディアMをY方向に搬送する搬送動作とを交互に繰り返し、複数のドットから構成される画像をメディアMに印刷する。   The print control unit 154B outputs a command signal for controlling the printing unit 16 to the unit control circuit 152 based on, for example, print data input from the external device 20. When a command signal is output from the print control unit 154B to the unit control circuit 152, the unit control circuit 152 outputs a print control signal to the printing unit 16, and drives the piezo element provided in the nozzle to the medium M. Eject ink. When printing is performed, the carriage 13 is moved along the X direction, and during the movement, a dot forming operation for forming dots by ejecting ink from the printing unit 16 and the medium M are transported in the Y direction. The conveying operation is alternately repeated, and an image composed of a plurality of dots is printed on the medium M.

撮像制御部154Cは、撮像処理を実施する。具体的には、撮像制御部154Cは、撮像部17を制御して撮像素子173を駆動させ、撮像素子173から入力された画像信号(撮像画像)を取得する。   The imaging control unit 154C performs imaging processing. Specifically, the imaging control unit 154C controls the imaging unit 17 to drive the imaging element 173, and acquires an image signal (captured image) input from the imaging element 173.

パッチ位置取得部154Dは、後述する校正用のテストパターンが撮像された撮像画像に基づいて、当該テストパターンを構成するカラーパッチのエッジ位置を検出し、検出結果に基づいてカラーパッチの位置を取得する。ここで、本実施形態では、テストパターンは、隣接配置され複数のカラーパッチにより構成されたカラーパッチ群がメディアMに印刷され、形成される。パッチ位置取得部154Dは、当該撮像画像に基づいて、カラーパッチが印刷されていないメディアMの表面(以下、メディア領域とも称する)と、カラーパッチ群との境界位置、すなわちカラーパッチ群(カラーパッチ)のエッジを検出する。
パッチ位置取得部154Dは、検出範囲設定部154D1、距離算出部154D2、エッジ検出部154D3、及び位置算出部154D4として機能する。
The patch position acquisition unit 154D detects the edge position of the color patch constituting the test pattern based on a captured image obtained by capturing a test pattern for calibration described later, and acquires the position of the color patch based on the detection result. To do. Here, in the present embodiment, the test pattern is formed by printing on the medium M a group of color patches that are adjacently arranged and configured by a plurality of color patches. Based on the captured image, the patch position acquisition unit 154D determines the boundary position between the surface of the medium M on which the color patch is not printed (hereinafter also referred to as a media area) and the color patch group, that is, the color patch group (color patch group). ) Edge is detected.
The patch position acquisition unit 154D functions as a detection range setting unit 154D1, a distance calculation unit 154D2, an edge detection unit 154D3, and a position calculation unit 154D4.

検出範囲設定部154D1は、撮像画像におけるエッジ位置の検出を行う際の、検出範囲を設定する。
距離算出部154D2は、メディア表面の色座標に対する、検出範囲の各画素の色座標の色空間における距離を算出する。ここで、色空間における距離は、メディア表面の色座標を基準とした各画素の階調値である。なお、色空間としてRGB色空間を用いる場合は、撮像画像の画像データであるR,G,Bの各階調値を色座標として使用することができる。また、色空間としRGB色空間以外にも、例えば、XYZ色空間等の他の色座標系によって表現される色空間を用いることもできる。この場合、距離算出部154D2は、各画素におけるR,G,Bの各階調値がXYZ座標系に変換された画像データを用いて、XYZ色空間における上記距離を算出する。
The detection range setting unit 154D1 sets a detection range when detecting the edge position in the captured image.
The distance calculation unit 154D2 calculates the distance in the color space of the color coordinate of each pixel in the detection range with respect to the color coordinate of the media surface. Here, the distance in the color space is a gradation value of each pixel with reference to the color coordinates on the surface of the medium. When the RGB color space is used as the color space, the R, G, and B gradation values that are image data of the captured image can be used as color coordinates. In addition to the RGB color space, a color space represented by another color coordinate system such as an XYZ color space can also be used. In this case, the distance calculation unit 154D2 calculates the distance in the XYZ color space using image data obtained by converting the R, G, and B tone values in each pixel into the XYZ coordinate system.

エッジ検出部154D3は、位置検出部に相当し、距離算出部154D2によって算出された色空間における距離に基づいて、カラーパッチ群のエッジを検出する。
位置算出部154D4は、エッジ検出部154D3によるカラーパッチ群のエッジの検出結果に基づいて、撮像画像におけるカラーパッチ群の位置及び当該カラーパッチ群を構成するカラーパッチの位置を算出する。
The edge detection unit 154D3 corresponds to a position detection unit, and detects the edge of the color patch group based on the distance in the color space calculated by the distance calculation unit 154D2.
The position calculation unit 154D4 calculates the position of the color patch group in the captured image and the position of the color patch constituting the color patch group based on the detection result of the edge of the color patch group by the edge detection unit 154D3.

補正部154Eは、処理部に相当し、画像処理された撮像画像、つまり各画素に対して各色の階調値が算出されたデモザイクデータに基づいて、印刷プロファイルデータを補正(更新)する。   The correction unit 154E corresponds to a processing unit, and corrects (updates) the print profile data based on the captured image subjected to image processing, that is, the demosaic data in which the gradation value of each color is calculated for each pixel.

[画像処理方法]
次に、本実施形態のプリンター1における画像処理方法について、図面に基づいて説明する。
図5は、プリンター1における画像処理方法を示すフローチャートである。また、図6は、プリンター1におけるエッジ位置の検出対象となるカラーパッチの一例を模式的に示す図である。
プリンター1は、メディアMに複数のカラーパッチ31からなるカラーパッチ群30(図6参照)を印刷し、印刷された各カラーパッチ31の位置を検出する。そして、プリンター1は、カラーパッチ31の撮像画像に基づく各種処理を行う。
[Image processing method]
Next, an image processing method in the printer 1 of the present embodiment will be described based on the drawings.
FIG. 5 is a flowchart illustrating an image processing method in the printer 1. FIG. 6 is a diagram schematically illustrating an example of a color patch that is an edge position detection target in the printer 1.
The printer 1 prints a color patch group 30 (see FIG. 6) including a plurality of color patches 31 on the medium M, and detects the position of each printed color patch 31. The printer 1 performs various processes based on the captured image of the color patch 31.

図5に示すように、プリンター1は、例えばユーザー操作や外部機器20からの入力により、分光測定処理を実施する旨の指令を受け付けると、走査制御部154A及び印刷制御部154BによりメディアMに対してテストパターンを印刷させる(ステップS1)。
つまり、走査制御部154Aは、供給ユニット11、搬送ユニット12を制御して、プラテン122の所定位置にメディアMを搬送させ、印刷制御部154Bは、印刷部16を制御して、搬送されたメディアMの所定位置にテストパターン3(図6参照)を印刷する。このテストパターン3は、メモリー153に予め記憶された元画像データに基づいて印刷される。したがって、走査制御部154Aは、元画像データに従ってメディアMの搬送量、キャリッジ13の移動量を制御し、印刷制御部154Bは、元画像データに基づいて、キャリッジ13が所定位置に位置した際に所定色のインクを吐出させてテストパターン3を形成する。また、必要に応じて乾燥機構によりインクを乾燥させてもよい。
As illustrated in FIG. 5, when the printer 1 receives a command to execute the spectroscopic measurement process, for example, by a user operation or an input from the external device 20, the scanning control unit 154 </ b> A and the print control unit 154 </ b> B The test pattern is printed (step S1).
That is, the scanning control unit 154A controls the supply unit 11 and the transport unit 12 to transport the medium M to a predetermined position of the platen 122, and the print control unit 154B controls the printing unit 16 to transport the transported media. Test pattern 3 (see FIG. 6) is printed at a predetermined position of M. The test pattern 3 is printed based on original image data stored in the memory 153 in advance. Accordingly, the scanning control unit 154A controls the transport amount of the medium M and the movement amount of the carriage 13 according to the original image data, and the print control unit 154B detects when the carriage 13 is positioned at a predetermined position based on the original image data. A test pattern 3 is formed by ejecting ink of a predetermined color. Further, if necessary, the ink may be dried by a drying mechanism.

テストパターン3は、図6に示すように、主走査方向(X方向)及び副走査方向(Y方向)に沿って配置された複数のカラーパッチ群30を含み構成される。カラーパッチ群30は、主走査方向及び副走査方向に沿って、複数のカラーパッチ31が隣接配置され構成される。これら複数のカラーパッチ群30は、互いに離間して配置される。すなわち、主走査方向(X方向)及び副走査方向(Y方向)に沿って隣り合うカラーパッチ群30の間には、カラーパッチ31が印刷されておらず、メディアMの表面が露出するメディア領域が形成される。   As shown in FIG. 6, the test pattern 3 includes a plurality of color patch groups 30 arranged along the main scanning direction (X direction) and the sub scanning direction (Y direction). The color patch group 30 includes a plurality of color patches 31 arranged adjacent to each other along the main scanning direction and the sub-scanning direction. The plurality of color patch groups 30 are spaced apart from each other. That is, the color patch 31 is not printed between the adjacent color patch groups 30 along the main scanning direction (X direction) and the sub-scanning direction (Y direction), and the media area where the surface of the medium M is exposed. Is formed.

ステップS1でテストパターン3が印刷された後、撮像制御部154Cは、撮像部17を制御して、テストパターン3に対する撮像画像を取得する(ステップS2)。具体的には、走査制御部154Aは、搬送ユニット12やキャリッジ移動ユニット14を制御して、撮像部17がテストパターンに対向するように、キャリッジ13とメディアMとの位置を調整する。そして、撮像制御部154Cは、光源171を点灯させ、撮像素子173を駆動させて、撮像素子173から出力された画像信号(撮像画像)を取得する。   After the test pattern 3 is printed in step S1, the imaging control unit 154C controls the imaging unit 17 to acquire a captured image for the test pattern 3 (step S2). Specifically, the scanning control unit 154A controls the transport unit 12 and the carriage movement unit 14 to adjust the positions of the carriage 13 and the medium M so that the imaging unit 17 faces the test pattern. Then, the imaging control unit 154C turns on the light source 171 and drives the imaging element 173 to acquire an image signal (captured image) output from the imaging element 173.

この後、パッチ位置取得部154Dは、撮像画像に基づいて、カラーパッチ群30を構成するカラーパッチ31の位置を取得する(ステップS3)。ステップS3の詳細については後述する。
ステップS3の後、補正部154Eは、撮像画像におけるR,G,Bの各階調値に基づいて、画像解析処理を実施する。そして、例えば、カラーパッチ31の階調値に基づく濃淡むらや白スジ等を検出して、印刷部16のノズルの印字密度等を補正する補正処理を実施する(ステップS4)。
Thereafter, the patch position acquisition unit 154D acquires the positions of the color patches 31 constituting the color patch group 30 based on the captured image (step S3). Details of step S3 will be described later.
After step S3, the correction unit 154E performs image analysis processing based on the R, G, and B gradation values in the captured image. Then, for example, a shading unevenness or white stripe based on the gradation value of the color patch 31 is detected, and a correction process for correcting the printing density of the nozzles of the printing unit 16 is performed (step S4).

[カラーパッチ位置の取得方法]
図7は、図5のステップS3における、パッチ位置取得部154Dによるカラーパッチ位置の取得方法を示すフローチャートである。また、図8及び図9は、カラーパッチ位置の取得手順の一例を模式的に示す図である。
パッチ位置取得部154Dは、撮像画像におけるカラーパッチ群30のエッジを複数点で検出し、エッジ位置の検出結果に基づいてカラーパッチ31の位置を算出する。
ここで、以下の説明では、撮像画像における水平方向(図8における左右方向)は、プリンター1の主走査方向(X方向)に沿う方向である。また、撮像画像における垂直方向(図8における上下方向)は、プリンター1の副走査方向(Y方向)に沿う方向である。すなわち、カラーパッチ群30の左右のエッジは、上下方向に延在し、上下のエッジは、左右方向に延在するものとする。なお、撮像画像における水平方向(左右方向)と、プリンター1における主走査方向とは、搬送時におけるメディアMの位置ずれ等により、必ずしも一致しない。また、上下方向(垂直方向)及び副走査方向についても同様である。
[How to get color patch position]
FIG. 7 is a flowchart showing a method of acquiring a color patch position by the patch position acquisition unit 154D in step S3 of FIG. 8 and 9 are diagrams schematically illustrating an example of a procedure for acquiring a color patch position.
The patch position acquisition unit 154D detects the edge of the color patch group 30 in the captured image at a plurality of points, and calculates the position of the color patch 31 based on the detection result of the edge position.
Here, in the following description, the horizontal direction (left-right direction in FIG. 8) in the captured image is a direction along the main scanning direction (X direction) of the printer 1. Further, the vertical direction (up and down direction in FIG. 8) in the captured image is a direction along the sub-scanning direction (Y direction) of the printer 1. That is, the left and right edges of the color patch group 30 extend in the up-down direction, and the upper and lower edges extend in the left-right direction. Note that the horizontal direction (left-right direction) in the captured image and the main scanning direction in the printer 1 do not necessarily match due to the positional deviation of the medium M during conveyance. The same applies to the vertical direction (vertical direction) and the sub-scanning direction.

図7に示すように、パッチ位置取得部154Dは、撮像画像に基づいて、水平方向に沿ってエッジ検出を行い、カラーパッチ群30の左右のエッジ位置を検出する、左右エッジ位置のプレ検出処理を行う(ステップS11)。
エッジ検出処理では、パッチ位置取得部154Dは、検出方向に沿って検出範囲を設定し、設定した当該検出範囲におけるカラーパッチ群30とメディアMとの境界位置をエッジ位置として検出する。ステップS11では、図8の上段の図に示すように、パッチ位置取得部154Dは、カラーパッチ群30の左側の境界B3を左右方向に跨ぐように検出範囲Ar(第1プレ検出範囲Ar1)を設定し、左側のエッジ位置(第1プレ検出位置Po1)を検出する。また、パッチ位置取得部154Dは、同様に、カラーパッチ群30の右側の境界B4を含む検出範囲Ar(第2プレ検出範囲Ar2)を設定し、右側のエッジ位置(第2プレ検出位置Po2)を検出する。
なお、検出範囲Arの設定方法や、エッジ検出の方法については、後述する。
As illustrated in FIG. 7, the patch position acquisition unit 154D performs edge detection along the horizontal direction based on the captured image, and detects the left and right edge positions of the color patch group 30. Is performed (step S11).
In the edge detection process, the patch position acquisition unit 154D sets a detection range along the detection direction, and detects a boundary position between the color patch group 30 and the medium M in the set detection range as an edge position. In step S11, as shown in the upper diagram of FIG. 8, the patch position acquisition unit 154D sets the detection range Ar (first pre-detection range Ar1) so as to straddle the left boundary B3 of the color patch group 30 in the left-right direction. The left edge position (first pre-detection position Po1) is detected. Similarly, the patch position acquisition unit 154D sets a detection range Ar (second pre-detection range Ar2) including the right boundary B4 of the color patch group 30, and sets the right edge position (second pre-detection position Po2). Is detected.
Note that a detection range Ar setting method and an edge detection method will be described later.

次に、パッチ位置取得部154Dは、ステップS11のプレ検出処理による検出結果に基づいて、垂直方向に沿ってエッジ検出を行い、カラーパッチ群30の上下のエッジ位置を検出する、上下エッジ位置の検出処理を行う(ステップS12)。
図8の中段の図に示すように、パッチ位置取得部154Dは、カラーパッチ群30の上側の境界B1を上下方向に跨ぐように検出範囲Ar(第1上部検出範囲Ar11)を設定し、上側のエッジ位置として第1上部エッジ位置P11を検出する。また、パッチ位置取得部154Dは、同様に、第2上部検出範囲Ar12を設定し、第2上部エッジ位置P12を検出する。第1上部検出範囲Ar11及び第2上部検出範囲Ar12は、左右方向にて第1プレ検出位置Po1と第2プレ検出位置Po2との間に設定される。また、第2上部検出範囲Ar12は、第1上部検出範囲Ar11の右側に設定される。
パッチ位置取得部154Dは、同様に、下側の境界B2を含む第1下部検出範囲Ar21を設定し、下側のエッジ位置として第1下部エッジ位置P21を検出する。また、パッチ位置取得部154Dは、境界B2を含む第2下部検出範囲Ar22を設定し、第2下部エッジ位置P22を検出する。
Next, the patch position acquisition unit 154D performs edge detection along the vertical direction based on the detection result of the pre-detection process in step S11, and detects the upper and lower edge positions of the color patch group 30. A detection process is performed (step S12).
As shown in the middle diagram of FIG. 8, the patch position acquisition unit 154D sets the detection range Ar (first upper detection range Ar11) so as to straddle the upper boundary B1 of the color patch group 30 in the upper and lower directions. The first upper edge position P11 is detected as the edge position. Similarly, the patch position acquisition unit 154D sets the second upper detection range Ar12 and detects the second upper edge position P12. The first upper detection range Ar11 and the second upper detection range Ar12 are set between the first pre-detection position Po1 and the second pre-detection position Po2 in the left-right direction. Further, the second upper detection range Ar12 is set on the right side of the first upper detection range Ar11.
Similarly, the patch position acquisition unit 154D sets the first lower detection range Ar21 including the lower boundary B2, and detects the first lower edge position P21 as the lower edge position. Further, the patch position acquisition unit 154D sets the second lower detection range Ar22 including the boundary B2, and detects the second lower edge position P22.

次に、パッチ位置取得部154Dは、ステップS12の上下エッジ位置の検出結果に基づいて、水平方向に沿ってエッジ検出を行い、カラーパッチ群30の左右のエッジ位置を検出する、左右エッジ位置の検出処理を行う(ステップS13)。
図8の下段の図に示すように、パッチ位置取得部154Dは、カラーパッチ群30の左側の境界B3を左右方向に跨ぐように検出範囲Ar(第1左部検出範囲Ar31)を設定し、左側のエッジ位置として第1左部エッジ位置P31を検出する。また、パッチ位置取得部154Dは、同様に、第2左部検出範囲Ar32を設定し、第2左部エッジ位置P32を検出する。第1左部検出範囲Ar31及び第2左部検出範囲Ar32は、上下方向にて、第1上部エッジ位置P11及び第2上部エッジ位置P12と、第1下部エッジ位置P21及び第2下部エッジ位置P22との間に設定される。
パッチ位置取得部154Dは、同様に、右側の境界B2を含む第1右部検出範囲Ar41を設定し、第1右部エッジ位置P41を検出する。また、パッチ位置取得部154Dは、境界B2を含む第2右部検出範囲Ar42を設定し、第2右部エッジ位置P42を検出する。
Next, the patch position acquisition unit 154D performs edge detection along the horizontal direction based on the detection result of the upper and lower edge positions in step S12, and detects the left and right edge positions of the color patch group 30. A detection process is performed (step S13).
As shown in the lower diagram of FIG. 8, the patch position acquisition unit 154D sets the detection range Ar (first left detection range Ar31) so as to straddle the left boundary B3 of the color patch group 30; The first left edge position P31 is detected as the left edge position. Similarly, the patch position acquisition unit 154D sets the second left detection range Ar32 and detects the second left edge position P32. The first left detection range Ar31 and the second left detection range Ar32 are, in the vertical direction, a first upper edge position P11 and a second upper edge position P12, and a first lower edge position P21 and a second lower edge position P22. And set between.
Similarly, the patch position acquisition unit 154D sets the first right part detection range Ar41 including the right boundary B2, and detects the first right part edge position P41. Further, the patch position acquisition unit 154D sets the second right part detection range Ar42 including the boundary B2 and detects the second right part edge position P42.

次に、パッチ位置取得部154Dの位置算出部154D4は、ステップS12及びステップS13におけるエッジ位置の検出結果に基づいて、カラーパッチ群30及びカラーパッチ31の位置を算出する(ステップS14)。
位置算出部154D4は、図9に示すように、カラーパッチ群30の四隅の各点P5〜P8の座標を算出することにより、カラーパッチ群30の位置を算出する。具体的には、位置算出部154D4は、第1上部エッジ位置P11及び第2上部エッジ位置P12を通る第1直線L1と、第1下部エッジ位置P21及び第2下部エッジ位置P22を通る第2直線L2と、第1左部エッジ位置P31及び第2左部エッジ位置P32を通る第3直線L3と、第1右部エッジ位置P41及び第2右部エッジ位置P42を通る第4直線L4と、を算出する。そして、位置算出部154D4は、第1直線L1及び第3直線L3の交点として点P5の座標を算出する。同様に、位置算出部154D4は、第1直線L1及び第4直線L4から点P6、第2直線L2及び第3直線L3から点P7、並びに、第2直線L2及び第4直線L4から点P8のそれぞれの座標を算出する。
Next, the position calculation unit 154D4 of the patch position acquisition unit 154D calculates the positions of the color patch group 30 and the color patch 31 based on the detection results of the edge positions in Step S12 and Step S13 (Step S14).
The position calculation unit 154D4 calculates the position of the color patch group 30 by calculating the coordinates of the points P5 to P8 at the four corners of the color patch group 30, as shown in FIG. Specifically, the position calculation unit 154D4 includes a first straight line L1 that passes through the first upper edge position P11 and the second upper edge position P12, and a second straight line that passes through the first lower edge position P21 and the second lower edge position P22. L2, a third straight line L3 passing through the first left edge position P31 and the second left edge position P32, and a fourth straight line L4 passing through the first right edge position P41 and the second right edge position P42. calculate. And position calculation part 154D4 calculates the coordinate of point P5 as an intersection of the 1st straight line L1 and the 3rd straight line L3. Similarly, the position calculation unit 154D4 calculates the point P6 from the first straight line L1 and the fourth straight line L4, the point P7 from the second straight line L2 and the third straight line L3, and the point P8 from the second straight line L2 and the fourth straight line L4. Calculate each coordinate.

また、位置算出部154D4は、カラーパッチ群30の四隅の各点P5〜P8の座標から、当該カラーパッチ群30を構成する各カラーパッチ31の位置を算出する。例えば、カラーパッチ31が所定の幅で形成されている場合、位置算出部154D4は、カラーパッチ31の幅に基づいて、各カラーパッチ31の四隅の座標や中心位置の座標を算出することができる。   Further, the position calculation unit 154D4 calculates the position of each color patch 31 constituting the color patch group 30 from the coordinates of the points P5 to P8 at the four corners of the color patch group 30. For example, when the color patch 31 is formed with a predetermined width, the position calculation unit 154D4 can calculate the coordinates of the four corners and the coordinates of the center position of each color patch 31 based on the width of the color patch 31. .

[エッジ位置の検出方法]
次に、ステップS11乃至ステップS13におけるエッジ位置の検出方法の詳細について、図面に基づいて説明する。
図10は、プリンター1におけるエッジ位置の検出方法を示すフローチャートである。また、図11から図13は、図10に示すエッジ位置の検出方法を説明するための図である。
以下の説明では、ステップS11及びステップS13において、水平方向(左右方向)に沿ってエッジ検出を行い、左側の境界B3に対応するエッジ位置を検出する場合について主に説明する。
[Edge position detection method]
Next, details of the edge position detection method in steps S11 to S13 will be described with reference to the drawings.
FIG. 10 is a flowchart illustrating an edge position detection method in the printer 1. FIGS. 11 to 13 are diagrams for explaining the edge position detection method shown in FIG.
In the following description, the case where edge detection is performed along the horizontal direction (left-right direction) and the edge position corresponding to the left boundary B3 is detected in step S11 and step S13 will be mainly described.

図10に示すように、検出範囲設定部154D1は、エッジ位置の検出方向に沿って検出範囲Arを設定する(ステップS21)。
検出範囲設定部154D1は、例えば、図11の上段の図に示すように、カラーパッチ群30の左側の境界B3に対応するエッジ位置を検出する場合、検出方向αに沿って検出範囲Ar(第1プレ検出範囲Ar1、第1左部検出範囲Ar31、及び第2左部検出範囲Ar32)を設定する。
なお、垂直方向に沿って上下のエッジを検出する場合、検出方向αは、図11における上から下に向かう方向である。
As illustrated in FIG. 10, the detection range setting unit 154D1 sets the detection range Ar along the detection direction of the edge position (step S21).
For example, as illustrated in the upper diagram of FIG. 11, the detection range setting unit 154D1 detects the edge position corresponding to the left boundary B3 of the color patch group 30 in the detection range Ar (first 1 pre-detection range Ar1, first left detection range Ar31, and second left detection range Ar32).
When detecting upper and lower edges along the vertical direction, the detection direction α is a direction from top to bottom in FIG.

検出範囲Arは、図11に示すように、検出方向αに沿って、メディア領域を含み、かつ、カラーパッチ群30Aの境界B3を跨ぐように設定される。検出方向αに直交する直交方向βにおける検出範囲Arの寸法は、カラーパッチ31よりも小さい。これにより、複数のカラーパッチ31が含まれることがないように、検出範囲Arを設定することができる。
また、検出範囲Arの検出方向αにおける寸法は、カラーパッチ31の寸法よりも大きい。これにより、検出範囲にカラーパッチ群30の境界B3が含まれず、エッジ位置を検出することができないという不具合が生じることを抑制できる。なお、本実施形態では、検出範囲Arは、検出方向αに沿って二つのカラーパッチ群30に亘って設定されている。また、検出範囲Arは、検出対象のカラーパッチ群30Aにおいて、検出方向αに沿って隣接する二つのカラーパッチ31A,31Bに亘って設定されている。
As shown in FIG. 11, the detection range Ar is set so as to include the media area and straddle the boundary B3 of the color patch group 30A along the detection direction α. The size of the detection range Ar in the orthogonal direction β orthogonal to the detection direction α is smaller than that of the color patch 31. Thereby, the detection range Ar can be set so that the plurality of color patches 31 are not included.
In addition, the size of the detection range Ar in the detection direction α is larger than the size of the color patch 31. As a result, it is possible to suppress the occurrence of a problem that the detection range does not include the boundary B3 of the color patch group 30 and the edge position cannot be detected. In the present embodiment, the detection range Ar is set across the two color patch groups 30 along the detection direction α. The detection range Ar is set across two color patches 31A and 31B adjacent in the detection direction α in the color patch group 30A to be detected.

なお、検出範囲Arの位置は、例えば、撮像画像に2値化処理を行うことにより推定された、カラーパッチ群30の境界の位置や、カラーパッチ31の端縁の位置に基づいて設定することができる。すなわち、検出範囲設定部154D1は、2値化処理の結果に基づいて、カラーパッチ群30Aの境界の位置を推定し、当該境界を含むように、検出方向αにおける検出範囲Arの位置や寸法を設定できる。また、検出範囲設定部154D1は、例えばカラーパッチ31Aの端縁が推定可能な場合は、当該カラーパッチ31Aの上下の端縁の間に、検出範囲Arが位置するように、直交方向βにおける検出範囲Arの位置や寸法を設定する。また、カラーパッチ31Aの下側の端縁が検出できない場合は、カラーパッチ群30の左右の境界の推定結果と、カラーパッチ31の幅寸法とに基づいて、同様に直交方向βにおける第1プレ検出範囲Ar1の位置を設定する。なお、カラーパッチ31の幅寸法は、カラーパッチ群30Aの左側の境界の推定位置と、カラーパッチ群30Bの右側の境界B4の推定位置とに基づいて、推定することができる。   The position of the detection range Ar is set based on, for example, the position of the boundary of the color patch group 30 or the position of the edge of the color patch 31 estimated by performing binarization processing on the captured image. Can do. That is, the detection range setting unit 154D1 estimates the position of the boundary of the color patch group 30A based on the result of the binarization process, and determines the position and size of the detection range Ar in the detection direction α so as to include the boundary. Can be set. For example, when the edge of the color patch 31A can be estimated, the detection range setting unit 154D1 detects in the orthogonal direction β so that the detection range Ar is located between the upper and lower edges of the color patch 31A. The position and size of the range Ar are set. If the lower edge of the color patch 31A cannot be detected, the first pre-process in the orthogonal direction β is similarly determined based on the estimation result of the left and right boundaries of the color patch group 30 and the width dimension of the color patch 31. The position of the detection range Ar1 is set. The width dimension of the color patch 31 can be estimated based on the estimated position of the left boundary of the color patch group 30A and the estimated position of the right boundary B4 of the color patch group 30B.

次に、距離算出部154D2は、色空間において、メディアMの表面の色座標に対する、検出範囲Arの各画素の色座標の距離を算出する(ステップS22)。
ステップS22では、検出範囲Ar内の各画素の色座標を(RC1,C2,C3)とし、メディアMの色座標を(RM1,M2,M3)として、距離算出部154D2は、RGB色空間における、メディアMの色座標に対する各画素の色座標の距離を、下記式(4)に基づいて算出し、各画素の階調値R1とする。この階調値R1は、メディアMの色座標に基づいて、各画素の階調値をグレースケール変換した値である。なお、例えば、RC1はR階調値に、RC2はG階調値に、RC3はB階調値にそれぞれ対応する。
Next, the distance calculation unit 154D2 calculates the distance of the color coordinate of each pixel in the detection range Ar with respect to the color coordinate of the surface of the medium M in the color space (step S22).
In step S22, the color coordinates of each pixel in the detection range Ar and (R C1, R C2, R C3), the color coordinates of the media M as the (R M1, R M2, R M3), the distance calculation unit 154D2 is The distance of the color coordinate of each pixel with respect to the color coordinate of the medium M in the RGB color space is calculated based on the following formula (4), and is set as the gradation value R1 of each pixel. The gradation value R1 is a value obtained by performing gray scale conversion on the gradation value of each pixel based on the color coordinates of the medium M. For example, R C1 corresponds to the R gradation value, R C2 corresponds to the G gradation value, and R C3 corresponds to the B gradation value.

Figure 2018105639
Figure 2018105639

ここで、撮像画像に対して、メディアMの階調値を均一とするようにシェーディング補正が実施されている場合、全画素に対して、メディアMの色座標として同一の値を用いることができる。なお、シェーディング補正が行われていない場合でも、例えば、検出範囲ArにおけるメディアMの各階調値RC1,C2,C3の平均値を用いてもよい。
また、メディアMの色に基づいてホワイトバランス調整を行う場合、(RM1,M2,M3)の各値に同一の値を用いることができる。
Here, when the shading correction is performed on the captured image so that the gradation value of the medium M is uniform, the same value can be used as the color coordinate of the medium M for all the pixels. . Even when the shading correction is not performed, for example, the average value of each gradation value R C1, R C2, R C3 of the medium M in the detection range Ar may be used.
When white balance adjustment is performed based on the color of the medium M, the same value can be used for each value of ( RM1, RM2, RM3 ).

次に、エッジ検出部154D3は、検出範囲Arにおいて、直交方向βに沿って各画素の階調値R1の画素平均を行い、階調値R1を検出方向αに沿って1次元化する(ステップS23)。
すなわち、エッジ検出部154D3は、直交方向βに重なる各画素の階調値R1の平均値R2を算出する(図11の下段図参照)。これにより、検出範囲Arは、検出方向αに1次元化される。このステップS23の1次元化処理により、直交方向βに画素平均を算出することにより、カラーパッチ31の色むらの影響が抑制される。
Next, the edge detection unit 154D3 performs pixel averaging of the gradation value R1 of each pixel along the orthogonal direction β in the detection range Ar, and makes the gradation value R1 one-dimensional along the detection direction α (step) S23).
That is, the edge detection unit 154D3 calculates the average value R2 of the gradation values R1 of each pixel overlapping in the orthogonal direction β (see the lower diagram in FIG. 11). As a result, the detection range Ar is made one-dimensional in the detection direction α. By calculating the pixel average in the orthogonal direction β by the one-dimensional processing in step S23, the influence of the color unevenness of the color patch 31 is suppressed.

次に、検出範囲設定部154D1は、ステップS23で算出された平均値R2に基づいて、検出対象の境界の近傍領域を検出範囲とするように、検出範囲Arの絞り込み処理を行う(ステップS24)。
検出範囲設定部154D1は、図11に示すように、検出方向αに沿って平均値R2が増大する位置(境界B3に対応する位置)をエッジ位置として検出する、すなわち、立ち上がりエッジを検出する場合、検出範囲Arの判定位置α(α方向における画素の位置座標)の−α側に判定範囲Ardを設定する。そして、検出範囲設定部154D1は、検出方向αに沿って、判定位置α及び判定範囲Ardを走査して、判定範囲Ardにおけるメディア領域の占有量が所定閾値を超えた際の判定位置αを、検出範囲の端点(外縁に相当)に設定する。
Next, based on the average value R2 calculated in step S23, the detection range setting unit 154D1 performs a process of narrowing down the detection range Ar so that the vicinity region of the detection target boundary is set as the detection range (step S24). .
As shown in FIG. 11, the detection range setting unit 154D1 detects a position where the average value R2 increases along the detection direction α (a position corresponding to the boundary B3) as an edge position, that is, detects a rising edge. The determination range Ard is set on the −α side of the determination position α k (pixel position coordinates in the α direction) of the detection range Ar. Then, the detection range setting unit 154D1 along the detection direction alpha, scans the determined position alpha k and the determination range Ard, determining position when occupancy of the media area in the determination range Ard exceeds a predetermined threshold value alpha k Is set to the end point (corresponding to the outer edge) of the detection range.

具体的には、検出範囲設定部154D1は、検出範囲Arにおいて、下記式(5)に示すように、2値化閾値Rth(図12の上段図を参照)を用いて、平均値R2に対して反転2値化処理を行い、2値化処理値R3(α)を算出する(図12の中段図を参照)。2値化閾値Rthは、エッジの検出対象となるカラーパッチ31、すなわちカラーパッチ群30の外周縁を構成する各カラーパッチ31の階調値よりも小さい値に設定されている。 Specifically, the detection range setting unit 154D1 sets the average value R2 in the detection range Ar using the binarization threshold R th (see the upper diagram of FIG. 12) as shown in the following formula (5). Then, an inversion binarization process is performed, and a binarization process value R3 (α k ) is calculated (see the middle diagram of FIG. 12). The binarization threshold R th is set to a value smaller than the gradation value of each color patch 31 constituting the outer peripheral edge of the color patch 31 that is an edge detection target, that is, the color patch group 30.

Figure 2018105639
Figure 2018105639

次に、検出範囲設定部154D1は、検出範囲Arの各画素位置αに対して、判定範囲Ardを設定し、当該判定範囲ArdにおけるR3(α)の積算値V(α)を算出する。この積算値V(α)は、判定範囲Ardにおける、メディアMの色の占有量に相当する。
検出方向αに沿って立ち上がりエッジを検出する場合、すなわち、上部エッジや左部エッジを検出する場合、図12の中段の図に示すように、判定範囲Ardは、(α−Δα1)から(α−Δα2)の範囲(但し、Δα1>Δα2)に設定される。また、立ち上がりエッジを検出する場合、積算値V(α)は、下記式(6)に基づいて算出される。
Next, the detection range setting unit 154D1 sets a determination range Ard for each pixel position α k of the detection range Ar, and calculates an integrated value V (α k ) of R3 (α k ) in the determination range Ard. To do. The integrated value V (α k ) corresponds to the color occupation amount of the medium M in the determination range Ard.
When a rising edge is detected along the detection direction α, that is, when an upper edge or a left edge is detected, the determination range Ard is (α−Δα1) to (α -Δα2) (where Δα1> Δα2). Further, when detecting a rising edge, the integrated value V (α k ) is calculated based on the following formula (6).

Figure 2018105639
Figure 2018105639

また、検出範囲設定部154D1は、下記式(7)に基づいて、検出範囲Arの各画素位置αに対して、上記積算値V(α)が判定閾値Vthより大きくなる全ての画素位置αを含む範囲を、検出範囲Arとするための絞り込み関数F(α)を算出する。
図12の中段の図に示す例では、画素位置αから画素位置αの範囲において、積算値V(α)の値が判定閾値Vthを超えている。すなわち、絞り込み関数F(α)の値は、図12の下段の図に示すように、画素位置αから画素位置αの範囲で1となり、それ以外の範囲で0となる。なお、図12の中段の図における射線によって示される範囲が、メディアMが検出された検出領域に相当する。
In addition, the detection range setting unit 154D1 determines, based on the following equation (7), all pixels in which the integrated value V (α k ) is greater than the determination threshold V th for each pixel position α k in the detection range Ar. A narrow-down function F (α k ) for calculating the range including the position α k as the detection range Ar is calculated.
In the example shown in the middle view of FIG. 12, in a range from the pixel position alpha 1 pixel position alpha 2, the value of the integrated value V (alpha k) is greater than the determination threshold V th. That is, the value of the narrowing-down function F (α k ) is 1 in the range from the pixel position α 1 to the pixel position α 2 as shown in the lower diagram of FIG. 12, and is 0 in the other ranges. Note that a range indicated by a ray in the middle diagram of FIG. 12 corresponds to a detection region where the medium M is detected.

Figure 2018105639
Figure 2018105639

上述のように、本実施形態では、立ち上がりエッジを検出する場合に、判定範囲Ardを、画素位置αの−α側に設定している。これにより、2値化処理値R3(α)の立ち上がりエッジに対応する位置を含み、立ち下がり位置(立ち下がりエッジに相当)に対応する位置を含まないように、検出範囲Arを絞り込むことができる。したがって、検出対象のカラーパッチ群30に隣接する、他のカラーパッチ群30のエッジ(図12の上段図の境界B4に相当)に対応する立ち下がりエッジの誤検出を抑制できる。 As described above, in the present embodiment, when detecting the rising edge, the determination range Ard, is set to -α side pixel position alpha k. As a result, the detection range Ar is narrowed down so as to include the position corresponding to the rising edge of the binarization processing value R3 (α k ) and not include the position corresponding to the falling position (corresponding to the falling edge). it can. Accordingly, it is possible to suppress erroneous detection of the falling edge corresponding to the edge of the other color patch group 30 adjacent to the detection target color patch group 30 (corresponding to the boundary B4 in the upper diagram of FIG. 12).

一方、検出方向αに沿って立ち下がりエッジを検出する場合、すなわち、下部エッジや右部エッジを検出する場合、判定範囲Ardは、(α+Δα2)から(α+Δα1)の範囲に設定される。つまり、判定範囲Ardは、画素位置αの+α側に設定される。これにより、検出対象のカラーパッチ群30に隣接する他のカラーパッチ群30における、立ち上下がりエッジ(図12の上段図の境界B3に相当)の誤検出を抑制できる。
また、立ち下がりエッジを検出する場合の積算値V(α)は、下記式(8)に基づいて算出される。
On the other hand, when detecting the falling edge along the detection direction alpha, that is, when detecting the lower edge and the right edge, the determination range Ard is set in the range of (α k + Δα2) of (α k + Δα1) The That is, the determination range Ard is set on the + α side of the pixel position α k . Accordingly, it is possible to suppress erroneous detection of a rising edge (corresponding to the boundary B3 in the upper diagram of FIG. 12) in another color patch group 30 adjacent to the color patch group 30 to be detected.
Further, the integrated value V (α) when detecting the falling edge is calculated based on the following equation (8).

Figure 2018105639
Figure 2018105639

ここで、Δα1、Δα2、及びVthは、検出範囲を、検出対象のエッジのみを含む範囲に絞り込みが可能なように設定されている。具体的には、各カラーパッチ31及びメディアMの階調値や、撮像部17の特性(例えば光源171の光量や、撮像素子173の感度等)に応じて、予め実験やシミュレーション等により、Δα1、Δα2、及びVhを算出することができる。 Here, Δα1, Δα2, and Vth are set so that the detection range can be narrowed down to a range including only the detection target edge. Specifically, Δα1 is obtained through experiments, simulations, or the like in advance according to the tone values of the color patches 31 and the media M and the characteristics of the imaging unit 17 (for example, the light amount of the light source 171 and the sensitivity of the imaging element 173). , it can be calculated Derutaarufa2, and V t h.

例えば、Δα1は、少なくともカラーパッチ31のα方向の幅寸法よりも小さく設定されていることが好ましい。これにより、範囲が絞り込まれた検出範囲に、2以上のカラーパッチ31が含まれることを抑制でき、カラーパッチ群30のエッジ以外の、カラーパッチ31のエッジが検出されることを抑制できる。   For example, Δα1 is preferably set to be smaller than at least the width dimension of the color patch 31 in the α direction. Thereby, it is possible to suppress the detection range in which the range is narrowed down from including two or more color patches 31, and it is possible to suppress the detection of the edge of the color patch 31 other than the edge of the color patch group 30.

また、Δα2を設けることにより、判定範囲Ardの外側に画素位置αが位置するように当該判定範囲Ardを設定することができる。したがって、検出対象のエッジ(図12の上段図における境界B3に相当)が、絞り込み後の検出範囲に、より確実に含まれるように、検出範囲の絞り込みを行うことができる。なお、Δα2を小さくすることにより、絞り込み範囲の端点を検出対象のエッジ(図12の上段図における境界B3に相当)に近づけることができるが、撮像画像が低画質である場合等、絞り込み後の検出範囲に検出対象のエッジが含まれないという不具合が発生するおそれもある。すなわち、上記不具合が発生しない範囲で、Δα2を小さくすることにより、後述するエッジ位置の特定を行う際の対象範囲を小さくすることができ、処理負荷を低減させることができる。 Further, it is possible by providing the Derutaarufa2, pixel position alpha k outside the determination range Ard sets the determination range Ard so as to be located. Therefore, the detection range can be narrowed down so that the detection target edge (corresponding to the boundary B3 in the upper diagram of FIG. 12) is included in the detection range after narrowing down more reliably. Note that, by reducing Δα2, the end point of the narrowing range can be brought close to the detection target edge (corresponding to the boundary B3 in the upper diagram of FIG. 12). However, when the captured image has a low image quality, There is also a possibility that a problem that the detection target edge is not included in the detection range may occur. That is, by reducing Δα2 within a range in which the above-described problem does not occur, the target range for specifying the edge position described later can be reduced, and the processing load can be reduced.

また、Vthを大きくすることにより、絞り込み量を大きくすることができるものの、Vthを大きくしすぎると、同様に、絞り込み後の検出範囲に検出対象のエッジが含まれないという不具合が発生するおそれがある。したがって、上記不具合が発生しない範囲で、Vthを大きくすることにより、後述するエッジ位置の特定を行う際の対象範囲を小さくすることができ、処理負荷を低減させることができる。 Further, by increasing the V th, although it is possible to increase the narrowing amount is too large V th, likewise, a problem that does not include the detection target of edge detection range after narrowing occurs There is a fear. Therefore, by increasing Vth within a range where the above-described problem does not occur, the target range when specifying the edge position described later can be reduced, and the processing load can be reduced.

図10に戻り、エッジ検出部154D3は、検出範囲Arにおいて、平均値R2に対して、フィルター係数が−α側から[−1,0,1]である微分フィルターを用いて空間微分を行い、微分値ΔR2(α)を取得する(ステップS25)。
図13の上段の図に示すように、微分値ΔR2(α)は、検出方向αに沿って、平均値R2が立ち上がりエッジに対応する位置では正の値となり、立ち下がりエッジに対応する位置では負の値となり、それ以外の位置では0付近の値となる。
なお、ステップS24の絞り込み処理が施された検出範囲では上記微分値が出力され、それ以外の領域では0が出力されるフィルターを用いてもよい。これにより、空間微分処理における処理負荷の増大を抑制することができる。
Returning to FIG. 10, the edge detection unit 154D3 performs spatial differentiation on the average value R2 in the detection range Ar by using a differential filter whose filter coefficient is [-1, 0, 1] from the -α side. A differential value ΔR2 (α k ) is acquired (step S25).
As shown in the upper diagram of FIG. 13, the differential value ΔR2 (α k ) is a positive value along the detection direction α at a position where the average value R2 corresponds to the rising edge, and a position corresponding to the falling edge. In, the value is negative, and in other positions, the value is near zero.
Note that a filter that outputs the differential value in the detection range subjected to the narrowing process in step S24 and outputs 0 in other areas may be used. Thereby, an increase in processing load in the spatial differentiation process can be suppressed.

次に、エッジ検出部154D3は、ステップS24の検出範囲(検出範囲)の絞り込み結果と、ステップS25で取得された空間微分の結果と、に基づいて、エッジ位置を特定する(ステップS26)。
具体的には、エッジ検出部154D3は、図13の下段の図に示すように、微分値ΔR2(α)に絞り込み関数F(α)を適用した、すなわち、絞り込み関数F(α)と微分値ΔR2(α)との積の値に基づいて、エッジ位置を特定する。図13では、左側のエッジを検出する場合について図示しており、検出対象のカラーパッチ群30の境界B3に対応する立ち上がりエッジが検出される。
Next, the edge detection unit 154D3 specifies the edge position based on the result of narrowing down the detection range (detection range) in step S24 and the result of the spatial differentiation acquired in step S25 (step S26).
Specifically, the edge detection unit 154D3 applies the narrowing function F (α k ) to the differential value ΔR2 (α k ) as shown in the lower diagram of FIG. 13, that is, the narrowing function F (α k ). The edge position is specified based on the value of the product of the differential value ΔR2 (α k ). FIG. 13 illustrates the case where the left edge is detected, and the rising edge corresponding to the boundary B3 of the color patch group 30 to be detected is detected.

本実施形態では、ステップS24において、検出範囲に検出対象となるエッジのみを含むように検出範囲の絞り込みを行っている。したがって、エッジ検出部154D3は、図13に示すように、立ち上がりエッジを検出する場合は、F(α)・ΔR2(α)が最大値となる位置をエッジ位置とする。また、立ち下がりエッジを検出する場合は、F(α)・ΔR2(α)が最小値となる位置をエッジ位置とする。 In this embodiment, in step S24, the detection range is narrowed down so that the detection range includes only the edge to be detected. Therefore, as illustrated in FIG. 13, when detecting the rising edge, the edge detection unit 154D3 sets the position where F (α k ) · ΔR2 (α k ) is the maximum value as the edge position. Further, when detecting a falling edge, a position where F (α k ) · ΔR 2 (α k ) is the minimum value is set as the edge position.

なお、エッジ検出部154D3は、立ち上がりエッジを検出する場合であり、かつ、F(α)・ΔR2(α)が最大値となるエッジ候補位置が複数存在する場合では、最も−α側の位置をエッジ位置とする。
また、エッジ検出部154D3は、立ち下がりエッジを検出する場合であり、かつ、F(α)・ΔR2(α)が最小値となるエッジ候補位置が複数存在する場合では、最も+α側の位置をエッジ位置とする。
Note that the edge detection unit 154D3 detects a rising edge, and when there are a plurality of edge candidate positions where F (α k ) · ΔR2 (α k ) is the maximum value, the edge detection unit 154D3 is the closest to the -α side. Let the position be the edge position.
Further, the edge detection unit 154D3 detects a falling edge, and when there are a plurality of edge candidate positions where F (α k ) · ΔR2 (α k ) is the minimum value, Let the position be the edge position.

次に、エッジ検出部154D3は、カラーパッチ群30A(図11参照)の検出対象のエッジに対して、全てのエッジ位置を検出したか否かを判定する(ステップS27)。
例えば、ステップS11の左右エッジ位置のプレ検出処理では、エッジ検出部154D3は、左側の立ち上がりエッジと、右側の立ち下がりエッジと、の各1点ずつのエッジ位置を検出している場合、YESと判定し、図10に示すフローチャートによる処理を終了させる。一方、エッジ検出部154D3は、全てのエッジ位置を検出していない場合は、ステップS21に戻り、検出していないエッジ位置の検出を行う。
Next, the edge detection unit 154D3 determines whether or not all edge positions have been detected for the detection target edge of the color patch group 30A (see FIG. 11) (step S27).
For example, in the pre-detection process of the left and right edge positions in step S11, when the edge detection unit 154D3 detects the edge position of each of the left rising edge and the right falling edge, YES is determined. Determination is made, and the process according to the flowchart shown in FIG. 10 is terminated. On the other hand, when all edge positions are not detected, the edge detection unit 154D3 returns to step S21 and detects an undetected edge position.

なお、ステップS12の上下エッジ位置の検出処理では、エッジ検出部154D3は、上側の立ち上がりエッジ及び下側の立ち下がりエッジとそれぞれについて2点ずつのエッジ位置を検出している場合、ステップS27でYESと判定する。
また、ステップS13の左右エッジ位置の検出処理では、エッジ検出部154D3は、左側の立ち上がりエッジ及び右側の立ち下がりエッジ、のそれぞれについて2点ずつのエッジ位置を検出している場合、ステップS27でYESと判定する。
In the detection process of the upper and lower edge positions in step S12, when the edge detection unit 154D3 detects two edge positions for each of the upper rising edge and the lower falling edge, YES in step S27. Is determined.
In the detection processing of the left and right edge positions in step S13, if the edge detection unit 154D3 has detected two edge positions for each of the left rising edge and the right falling edge, YES in step S27. Is determined.

[第1実施形態の作用効果]
本実施形態では、距離算出部154D2は、RGB色空間における、メディアMの色座標に対する、対象物としてのカラーパッチ群30の対象位置の色座標の距離を算出する。エッジ検出部154D3は、算出された距離に基づいて、メディアMにおけるカラーパッチ群30のエッジ位置を検出する。このような構成では、エッジ位置を高精度に検出することができ、ひいてはメディアM上におけるカラーパッチ群30及びカラーパッチ31の位置を、高精度に検出することができる。すなわち、本実施形態では、メディアMに印刷されたカラーパッチ群30及びカラーパッチ31を検出対象とする場合、上述の色空間における対象位置の色座標の距離を算出することにより、カラーパッチ31とメディアM表面との境界位置を高精度に検出することができる。したがって、撮像画像におけるカラーパッチ31の位置を高精度に検出することができる。
[Effects of First Embodiment]
In the present embodiment, the distance calculation unit 154D2 calculates the distance between the color coordinates of the target position of the color patch group 30 as the target with respect to the color coordinates of the medium M in the RGB color space. The edge detection unit 154D3 detects the edge position of the color patch group 30 on the medium M based on the calculated distance. With such a configuration, the edge position can be detected with high accuracy, and consequently the positions of the color patch group 30 and the color patch 31 on the medium M can be detected with high accuracy. That is, in the present embodiment, when the color patch group 30 and the color patch 31 printed on the medium M are to be detected, the color patch 31 and the color patch 31 are calculated by calculating the distance between the color coordinates of the target position in the color space described above. The boundary position with the surface of the medium M can be detected with high accuracy. Therefore, the position of the color patch 31 in the captured image can be detected with high accuracy.

本実施形態では、距離算出部154D2は、上記式(4)によって、色空間における距離を算出する。これにより、撮像画像における任意の対象位置について、当該対象位置の画素値を用いて上記距離を算出することができる。すなわち、本適用例のように、撮像画像における各画素値を赤(R)、緑(G)、青(B)の各色の階調値として取得した際に、各画素値を用いて、任意の画素における上記距離を算出することができる。したがって、他の色座標によって定義される色空間に変換する等の処理を行う必要がなく、処理負荷を低減できる。   In the present embodiment, the distance calculation unit 154D2 calculates the distance in the color space by the above equation (4). Accordingly, the distance can be calculated for an arbitrary target position in the captured image using the pixel value of the target position. That is, when each pixel value in the captured image is acquired as a gradation value of each color of red (R), green (G), and blue (B) as in this application example, each pixel value is arbitrarily used. It is possible to calculate the distance in the pixel. Therefore, it is not necessary to perform processing such as conversion to a color space defined by other color coordinates, and the processing load can be reduced.

本実施形態では、検出範囲設定部154D1は、メディアMの色を含む検出範囲を設定する。このような構成では、検出対象となるカラーパッチ群30(カラーパッチ31)のエッジを含むように検出範囲を設定することができる。したがって、エッジ位置をより確実に検出できるとともに、検出範囲を絞り込むことによる処理負荷の低減を図ることができる。   In the present embodiment, the detection range setting unit 154D1 sets a detection range including the color of the medium M. In such a configuration, the detection range can be set so as to include the edge of the color patch group 30 (color patch 31) to be detected. Therefore, the edge position can be detected more reliably, and the processing load can be reduced by narrowing the detection range.

また、本実施形態では、検出範囲設定部154D1は、検出方向αに沿って、検出範囲Arの各画素位置に対して判定範囲を設定し、メディアMの占有量が所定値(判定閾値Vth)を超える判定範囲が設定された画素位置を検出範囲の端点とする。これにより、少なくともエッジ位置の近傍領域を含むように検出範囲Arを絞り込むことができ、検出処理による処理負荷を低減させることができる。   In the present embodiment, the detection range setting unit 154D1 sets a determination range for each pixel position in the detection range Ar along the detection direction α, and the occupation amount of the medium M is a predetermined value (determination threshold Vth). A pixel position in which a determination range that exceeds is set as an end point of the detection range. As a result, the detection range Ar can be narrowed to include at least the region near the edge position, and the processing load due to the detection process can be reduced.

また、本実施形態では、立ち上がりエッジを検出する場合、判定対象の画素位置に対して、検出方向αにおける−α側に判定範囲を設定する。また、立ち下がりエッジを検出する場合、判定対象の画素位置に対して、検出方向αにおける+α側に判定範囲を設定する。これにより、検出対象のエッジのみを含むように判定範囲を設定することができ、エッジの誤検出をより確実に抑制できる。   In this embodiment, when a rising edge is detected, a determination range is set on the −α side in the detection direction α with respect to the pixel position to be determined. When detecting a falling edge, a determination range is set on the + α side in the detection direction α with respect to the pixel position to be determined. Thereby, the determination range can be set so as to include only the detection target edge, and the erroneous detection of the edge can be more reliably suppressed.

[第2実施形態]
以下、第2実施形態について説明する。
第1実施形態では、パッチ位置取得部154Dは、上記式(4)を用いて、色空間における各画素の距離を算出していた。これに対して、第2実施形態では、各画素の階調値に対してグレースケール変換を行った後に、色空間における距離を算出する点で、第1実施形態と相違する。
なお、以降の説明にあたり、第1実施形態と同様の構成については、同符号を付し、その説明を省略又は簡略化する。
[Second Embodiment]
Hereinafter, a second embodiment will be described.
In the first embodiment, the patch position acquisition unit 154D calculates the distance of each pixel in the color space using the above equation (4). On the other hand, the second embodiment is different from the first embodiment in that the distance in the color space is calculated after performing grayscale conversion on the gradation value of each pixel.
In the following description, the same components as those in the first embodiment are denoted by the same reference numerals, and the description thereof is omitted or simplified.

第2実施形態では、距離算出部154D2は、ステップS12にて、色空間における距離を算出する際に、例えば下記式(9)を用いてグレースケール変換を行う。
ここで、下記式(9)を用いたグレースケール変換は、メディアMの色に基づいてホワイトバランス調整を実施した場合に実施することができる。なお、下記式(9)では、メディアMの各色の階調値RM1,M2,M3をRとしている。また、グレースケール変換を行う際の変換行列における各値(係数)は、下記式(9)に示す値に限定されず、変換方式に各種の値を適宜用いることができる。
In the second embodiment, the distance calculation unit 154D2 performs grayscale conversion using, for example, the following equation (9) when calculating the distance in the color space in step S12.
Here, the gray scale conversion using the following formula (9) can be performed when white balance adjustment is performed based on the color of the medium M. Note that the following equation (9), the tone value R M1 of each color of the medium M, the R M2, R M3 and the R w. In addition, each value (coefficient) in the conversion matrix when performing grayscale conversion is not limited to the value shown in the following formula (9), and various values can be appropriately used for the conversion method.

Figure 2018105639
Figure 2018105639

変換後の色座標(Rgray,RU,RV)によって定義される色空間では、各画素の色座標の値は、メディアMの色座標を基準とする値である。したがって、距離算出部154D2は、下記式(10)により、変換後の色空間において、メディアMの色座標に対する、各画素の色座標(Rgray,RU,RV)の距離を算出することができる。
なお、下記式(10)におけるkcompは、グレー軸における補正係数であり、メディアMの色に応じた値であり、例えば予め実験等により取得され、メモリー153に記憶されている。距離算出部154D2は、メディアMの種別に応じて、kcompを取得する。なお、メディアMの種別は、ユーザーによって指定されてもよいし、撮像画像におけるメディア領域の階調値に基づいて判定されてもよい。
In the color space defined by the converted color coordinates (R gray , R U , R V ), the color coordinate value of each pixel is a value based on the color coordinate of the medium M. Therefore, the distance calculation unit 154D2 calculates the distance of the color coordinates (R gray , R U , R V ) of each pixel with respect to the color coordinates of the medium M in the converted color space by the following equation (10). Can do.
In the following equation (10), k comp is a correction coefficient on the gray axis, and is a value corresponding to the color of the medium M. For example, k comp is acquired in advance through experiments or the like and stored in the memory 153. The distance calculation unit 154D2 acquires k comp according to the type of the medium M. Note that the type of the medium M may be specified by the user, or may be determined based on the gradation value of the media area in the captured image.

Figure 2018105639
Figure 2018105639

[第2実施形態の作用効果]
本実施形態では、撮像画像のホワイトバランスをメディアMの色に基づいて調整する場合、上記式(9)に基づいて、対象位置の色座標にグレースケール変換を行う。さらに、上記式(10)に基づいて、グレースケール変換後の対象位置の色座標における、距離を算出する。このような構成では、対象位置の色座標をグレー軸方向に圧縮することができ、メディアMの凹凸による輝度むらの影響を抑制することができる。また、メディアMの色座標の各値として同一の値を用いることができるため、距離を算出する場合の処理負荷の増大を抑制できる。
[Effects of Second Embodiment]
In the present embodiment, when the white balance of the captured image is adjusted based on the color of the medium M, gray scale conversion is performed on the color coordinates of the target position based on the above equation (9). Further, the distance in the color coordinates of the target position after gray scale conversion is calculated based on the above equation (10). In such a configuration, the color coordinates of the target position can be compressed in the gray axis direction, and the influence of uneven brightness due to the unevenness of the medium M can be suppressed. Moreover, since the same value can be used as each value of the color coordinates of the medium M, an increase in processing load when calculating the distance can be suppressed.

また、メディアに応じた補正係数kcompを設定することにより、例えば、メディア種別に応じてメディアの色が異なる場合や、表面の光沢が異なる場合でも、補正係数kcompとして適切な値を設定することができる。したがって、メディア種別による距離の算出精度の低下を抑制でき、ひいては対象物の位置を高精度に検出できる。 Further, by setting the correction coefficient k comp according to the media, for example, even when the color of the media differs depending on the media type or the gloss of the surface is different, an appropriate value is set as the correction coefficient k comp. be able to. Accordingly, it is possible to suppress a decrease in the distance calculation accuracy due to the media type, and consequently to detect the position of the object with high accuracy.

[変形例]
なお、本発明は上述の各実施形態に限定されるものではなく、本発明の目的を達成できる範囲での変形、改良、及び各実施形態を適宜組み合わせる等によって得られる構成は本発明に含まれるものである。
[Modification]
Note that the present invention is not limited to the above-described embodiments, and the present invention includes configurations obtained by modifying, improving, and appropriately combining the embodiments as long as the object of the present invention can be achieved. Is.

上記各実施形態では、カラーパッチ群30の四隅の位置を算出して、カラーパッチ群30及びカラーパッチ31の位置を算出していたが、これに限定されず、少なくとも1つの隅部の位置を算出して、カラーパッチ群30及びカラーパッチ31の位置を算出してもよい。例えば、カラーパッチ群30の上下のエッジのいずれかと、左右のエッジのいずれかと、を検出し、これらエッジの交点の座標を算出する。また、検出方向と、検出されたエッジが立ち上がりエッジか否かと、に応じて、検出されたエッジの種類を特定する。例えば、水平方向に沿ってエッジ検出を行い、立ち上がりエッジを検出した場合は、検出されたエッジが左部エッジであることを特定できる。したがって、エッジの種類と、交点の座標位置と、カラーパッチのサイズと、に基づいて、各カラーパッチの位置を算出することができる。
また、上下左右のエッジのうちの一つのみが検出された場合は、検出されたエッジに沿ってエッジ検出を行い、カラーパッチ群30の角部に相当する座標を検出してもよい。
In the above embodiments, the positions of the four corners of the color patch group 30 are calculated and the positions of the color patch group 30 and the color patch 31 are calculated. However, the present invention is not limited to this, and the position of at least one corner is determined. The positions of the color patch group 30 and the color patch 31 may be calculated. For example, one of the upper and lower edges and the left and right edges of the color patch group 30 are detected, and the coordinates of the intersection of these edges are calculated. Further, the type of the detected edge is specified according to the detection direction and whether or not the detected edge is a rising edge. For example, when edge detection is performed along the horizontal direction and a rising edge is detected, it can be specified that the detected edge is the left edge. Therefore, the position of each color patch can be calculated based on the type of edge, the coordinate position of the intersection, and the size of the color patch.
If only one of the top, bottom, left, and right edges is detected, edge detection may be performed along the detected edges to detect coordinates corresponding to the corners of the color patch group 30.

上記各実施形態では、左右エッジ位置のプレ検出を行い、プレ検出結果に基づいて、上下エッジ位置を検出していたが、これに限定されない。例えば、上下エッジ位置のプレ検出を行って、プレ検出結果に基づいて、左右エッジ位置を検出してもよい。また、エッジ位置のプレ検出を行わずに、左右エッジ位置の検出及び上下エッジ位置の検出を行ってもよい。   In each of the above embodiments, the left and right edge positions are pre-detected and the top and bottom edge positions are detected based on the pre-detection result, but the present invention is not limited to this. For example, the pre-detection of the upper and lower edge positions may be performed, and the left and right edge positions may be detected based on the pre-detection result. Further, the left and right edge positions and the upper and lower edge positions may be detected without performing the pre-detection of the edge positions.

上記各実施形態では、左右エッジ位置の検出及び上下エッジ位置の検出は、それぞれのエッジについて2点のエッジ位置を検出していたが、これに限定されない。例えば、エッジ位置を1点のみ検出してもよいし、3点以上検出してもよい。3点以上の複数のエッジ位置を検出する場合、複数のエッジ位置に基づいて平均二乗法等によりエッジに相当する直線を算出してもよい。   In each of the embodiments described above, the detection of the left and right edge positions and the detection of the upper and lower edge positions are performed by detecting two edge positions for each edge, but the present invention is not limited to this. For example, only one edge position may be detected, or three or more points may be detected. When detecting a plurality of edge positions of three or more points, straight lines corresponding to the edges may be calculated based on the plurality of edge positions by the mean square method or the like.

上記各実施形態では、1次元化処理として、直交方向βに沿って各画素値の画素平均を算出していたが、これに限定されない。例えば、撮像画像に対して2値化処理等を施してエッジの延在方向を推定し、推定された延在方向に沿って、画素平均を算出してもよい。また、延在方向に直交する方向を検出方向αとしてもよい。これにより、メディアMの位置ずれや波打ち等により、撮像画像の水平方向と、プリンター1の主走査方向とのずれが大きい場合でも、カラーパッチの内外に跨って画素平均が算出される不具合を抑制でき、エッジ位置の検出精度を向上できる。   In each of the above-described embodiments, the pixel average of each pixel value is calculated along the orthogonal direction β as the one-dimensional processing, but is not limited to this. For example, a binarization process or the like may be performed on the captured image to estimate the edge extension direction, and the pixel average may be calculated along the estimated extension direction. Further, the direction orthogonal to the extending direction may be set as the detection direction α. As a result, even when there is a large shift between the horizontal direction of the captured image and the main scanning direction of the printer 1 due to misalignment or undulation of the medium M, a problem that the pixel average is calculated across the inside and outside of the color patch is suppressed. And the edge position detection accuracy can be improved.

上記各実施形態では、検出範囲Arの絞り込みを行う際の判定範囲Ardとして、判定位置を含まない判定範囲Ardを設定していたが、これに限定されず、判定位置を含む判定範囲Ardを設定してもよい。例えば、上記各実施形態では、検出方向αに対して、立ち上がりエッジを検出する場合、判定位置の−α側に判定範囲Ardを設定していた。これに対して、例えば、Δα2を設定せずに、+α側の端点として判定位置を含む判定範囲Ardを設定してもよい。なお、立ち下がりエッジを検出する場合は、−α側の端点として判定位置を含む判定範囲Ardを設定する。
すなわち、メディア領域からカラーパッチに向かってエッジ検出を行う場合は、判定位置と、判定位置よりも検出方向の下流側の領域と、を含む領域に判定範囲を設定すればよい。また、カラーパッチの領域からメディア領域に向かってエッジ検出を行う場合は、判定位置と、判定位置よりも検出方向の上流側の領域と、を含む領域に判定範囲Ardを設定すればよい。これにより、上記各実施形態と同様に、検出対象ではないエッジを検出範囲から除外でき、エッジの誤検出を抑制できる。
In each of the above embodiments, the determination range Ard that does not include the determination position is set as the determination range Ard when the detection range Ar is narrowed down. However, the present invention is not limited to this, and the determination range Ard that includes the determination position is set. May be. For example, in the above embodiments, when a rising edge is detected in the detection direction α, the determination range Ard is set on the −α side of the determination position. On the other hand, for example, the determination range Ard including the determination position may be set as an end point on the + α side without setting Δα2. When a falling edge is detected, a determination range Ard including a determination position is set as an end point on the −α side.
That is, when edge detection is performed from the media area toward the color patch, a determination range may be set in an area including the determination position and an area downstream of the determination position in the detection direction. When edge detection is performed from the color patch area toward the media area, the determination range Ard may be set in an area including the determination position and an area upstream in the detection direction from the determination position. As a result, as in the above embodiments, edges that are not detection targets can be excluded from the detection range, and erroneous detection of edges can be suppressed.

上記各実施形態では、上述のように検出対象のエッジを一つ限定するように検出範囲の絞り込みを行ったが、これに限定されない。例えば、検出方向に沿って複数のエッジを検出してもよい。この場合、判定位置を含む判定範囲Ardを設定してもよい。例えば、判定範囲Ardの中心に判定位置が位置してもよい。これにより、検出方向に沿って複数のエッジの近傍領域を検出範囲に含めることができる。   In each of the above embodiments, the detection range is narrowed down to limit one detection target edge as described above, but the present invention is not limited to this. For example, a plurality of edges may be detected along the detection direction. In this case, a determination range Ard including the determination position may be set. For example, the determination position may be located at the center of the determination range Ard. Thereby, the vicinity area | region of a some edge along a detection direction can be included in a detection range.

また、検出方向に沿って複数のエッジを検出する場合、検出されたエッジの種類と、検出されたエッジの位置と、に応じてカラーパッチ群30及びカラーパッチ31の位置を算出してもよい。例えば、検出方向に沿って、順に、立ち上がりエッジと、立ち下がりエッジが検出された場合、これら二つのエッジに挟まれる範囲が、カラーパッチ群30の形成範囲である。   Further, when a plurality of edges are detected along the detection direction, the positions of the color patch group 30 and the color patch 31 may be calculated according to the type of detected edge and the position of the detected edge. . For example, when a rising edge and a falling edge are detected in order along the detection direction, the range between these two edges is the formation range of the color patch group 30.

上記各実施形態では、検出方向α及び直交方向βに沿って検出範囲を設定したが、これに限定されず、検出方向αのみに沿って検出範囲を設定してもよい。これにより、各検出範囲におけるエッジ検出処理の処理負荷の増大を抑制できる。
なお、この場合、各エッジについて複数のエッジ位置を検出して、上述のように、複数のエッジ位置に基づいて平均二乗法等によりエッジに相当する直線を算出することにより、エッジの検出精度を向上させることができる。
In each of the above embodiments, the detection range is set along the detection direction α and the orthogonal direction β. However, the present invention is not limited to this, and the detection range may be set only along the detection direction α. Thereby, the increase in the processing load of the edge detection process in each detection range can be suppressed.
In this case, by detecting a plurality of edge positions for each edge and calculating a straight line corresponding to the edge by the mean square method or the like based on the plurality of edge positions as described above, the edge detection accuracy is improved. Can be improved.

上記各実施形態では、複数のカラーパッチが、主走査方向及び副走査方向に沿って隣接配置されたカラーパッチ群のエッジを検出する場合について例示したが、これに限定されない。例えば、主走査方向及び副走査方向のいずれか一方に沿って、カラーパッチが隣接配置されたカラーパッチ群を、検出対象としてもよい。また、メディア領域によって囲まれた単一のカラーパッチを検出対象としてもよい。また、メディアに形成されたカラーパッチ以外の対象物を検出対象としてもよい。   In each of the embodiments described above, the case where a plurality of color patches detect the edge of a color patch group arranged adjacent to each other along the main scanning direction and the sub-scanning direction is exemplified, but the present invention is not limited to this. For example, a color patch group in which color patches are adjacently arranged along either the main scanning direction or the sub-scanning direction may be a detection target. A single color patch surrounded by the media area may be a detection target. Further, an object other than the color patch formed on the medium may be set as the detection target.

上記各実施形態では、撮像部17がキャリッジ13に搭載され、メディアMに対して一方向に移動可能に構成されていたが、本発明はこれに限定されない。例えば、撮像部17がキャリッジに搭載されない構成とし、所定の撮像範囲を撮像するものであってもよく、キャリッジ13とは別体として他の移動機構により移動可能な構成であってもよい。   In each of the above embodiments, the imaging unit 17 is mounted on the carriage 13 and configured to be movable in one direction with respect to the medium M. However, the present invention is not limited to this. For example, the imaging unit 17 may be configured not to be mounted on the carriage and may capture a predetermined imaging range, or may be configured to be movable by another moving mechanism separately from the carriage 13.

上記各実施形態では、撮像素子173を含む撮像部17を用いて撮像画像を取得し、各画素の画素値(R,G,Bのそれぞれの階調値)を取得する場合について例示したが、これに限定されない。例えば、干渉フィルター等の分光フィルターを用いて、複数波長について取得された分光画像に基づいて、各画素の画素値を取得してもよい。   In each of the above embodiments, the case where a captured image is acquired using the imaging unit 17 including the imaging element 173 and the pixel value of each pixel (respective gradation values of R, G, and B) is illustrated is exemplified. It is not limited to this. For example, the pixel value of each pixel may be acquired based on a spectral image acquired for a plurality of wavelengths using a spectral filter such as an interference filter.

上記各実施形態では、本発明の位置検出装置を備える電子機器としてプリンター1を例示したが、これに限定されない。例えば、位置検出装置は、当該位置検出装置とは別体のプリンターによってメディアMに印刷された対象物を、位置検出対象としてもよい。   In each of the above embodiments, the printer 1 is exemplified as an electronic apparatus including the position detection device of the present invention, but the present invention is not limited to this. For example, the position detection device may use an object printed on the medium M by a printer separate from the position detection device as the position detection target.

また、プリンターによってメディアに印刷された対象物を検出対象とする構成を例示したが、これに限定されない。本発明における位置検出方法では、撮像画像に基づいて、被撮像物の位置を検出する場合に特に好適に用いることができ、例えば工場等の製造ラインにおいて、製造された製品を検査する際に、製品を撮像装置により撮像し、その撮像画像を本発明の位置検出方法を適用してもよい。さらに、上記のような検査等の用途に限定されず、例えば、一般家庭においてデジタルカメラ等により撮像された撮像画像についても、本発明を適用することができる。   Moreover, although the structure which made the detection object the target object printed on the medium with the printer was illustrated, it is not limited to this. The position detection method according to the present invention can be particularly preferably used when detecting the position of an object to be imaged based on a captured image. For example, when inspecting a manufactured product in a production line such as a factory, The product may be imaged by an imaging device, and the position detection method of the present invention may be applied to the captured image. Furthermore, the present invention is not limited to the use such as the inspection as described above. For example, the present invention can be applied to a captured image captured by a digital camera or the like in a general household.

その他、本発明の実施の際の具体的な構造は、本発明の目的を達成できる範囲で上記各実施形態及び変形例を適宜組み合わせることで構成してもよく、また他の構造などに適宜変更してもよい。   In addition, the specific structure for carrying out the present invention may be configured by appropriately combining the above-described embodiments and modifications within the scope that can achieve the object of the present invention, and may be appropriately changed to other structures and the like. May be.

1…プリンター、30,30A,30B…カラーパッチ群、31,31A,31B…カラーパッチ、154D…パッチ位置取得部、154D1…検出範囲設定部、154D2…距離算出部、154D3…エッジ検出部、154D4…位置算出部、154E…補正部、Ar…検出範囲、Ar1…第1プレ検出範囲、Ar11…第1上部検出範囲、Ar12…第2上部検出範囲、Ar2…第2プレ検出範囲、Ar21…第1下部検出範囲、Ar22…第2下部検出範囲、Ar31…第1左部検出範囲、Ar32…第2左部検出範囲、Ar41…第1右部検出範囲、Ar42…第2右部検出範囲、Ard…判定範囲、M…メディア、P11…第1上部エッジ位置、P12…第2上部エッジ位置、P21…第1下部エッジ位置、P22…第2下部エッジ位置、P31…第1左部エッジ位置、P32…第2左部エッジ位置、P41…第1右部エッジ位置、P42…第2右部エッジ位置、Po1…第1プレ検出位置、Po2…第2プレ検出位置。   DESCRIPTION OF SYMBOLS 1 ... Printer, 30, 30A, 30B ... Color patch group, 31, 31A, 31B ... Color patch, 154D ... Patch position acquisition part, 154D1 ... Detection range setting part, 154D2 ... Distance calculation part, 154D3 ... Edge detection part, 154D4 ... position calculation unit, 154E ... correction unit, Ar ... detection range, Ar1 ... first pre-detection range, Ar11 ... first upper detection range, Ar12 ... second upper detection range, Ar2 ... second pre-detection range, Ar21 ... first 1 lower detection range, Ar22 2nd lower detection range, Ar31 1st left detection range, Ar32 2nd left detection range, Ar41 1st right detection range, Ar42 2nd right detection range, Ard ... judgment range, M ... media, P11 ... first upper edge position, P12 ... second upper edge position, P21 ... first lower edge position, P22 ... second lower edge Position, P31 ... first left edge position, P32 ... second left edge position, P41 ... first right edge position, P42 ... second right edge position, Po1 ... first pre-detection position, Po2 ... second Pre-detection position.

Claims (8)

対象物が印刷されたメディアを撮像して得られた撮像画像に基づいて、色空間における、前記メディアの色座標に対する、対象位置の色座標の距離を算出する距離算出部と、
前記距離算出部により算出された前記距離に基づいて、前記メディアにおける前記対象物の位置を検出する位置検出部と、を備える
ことを特徴とする位置検出装置。
A distance calculation unit that calculates a distance of a color coordinate of the target position with respect to a color coordinate of the medium in a color space, based on a captured image obtained by imaging the medium on which the object is printed;
A position detection unit configured to detect a position of the object on the medium based on the distance calculated by the distance calculation unit.
請求項1に記載の位置検出装置において、
前記距離算出部は、前記対象位置の色座標を(RC1,C2,C3)とし、前記メディアの色座標を(RM1,M2,M3)とし、下記式(1)に基づいて、前記距離としてR1を算出する
Figure 2018105639
ことを特徴とする位置検出装置。
The position detection device according to claim 1,
The distance calculation unit sets the color coordinates of the target position as ( RC1, RC2, RC3 ) and the media color coordinates as ( RM1, RM2, RM3 ), and is based on the following formula (1). R1 is calculated as the distance
Figure 2018105639
A position detecting device characterized by that.
請求項1に記載の位置検出装置において、
前記距離算出部は、前記メディアの色座標(RM1,M2,M3)がRM1=RM2=RM3=Rである場合、前記対象位置の色座標を(RC1,C2,C3)とし、kcompを補正係数とし、下記式(2)(3)に基づいて、前記距離としてR1を算出する
Figure 2018105639
ことを特徴とする位置検出装置。
The position detection device according to claim 1,
When the color coordinates (R M1, R M2, R M3 ) of the media are R M1 = R M2 = R M3 = R W , the distance calculation unit calculates the color coordinates of the target position (R C1, R C2 , R C3 ), k comp as a correction coefficient, and R1 is calculated as the distance based on the following equations (2) and (3).
Figure 2018105639
A position detecting device characterized by that.
請求項3に記載の位置検出装置において、
前記距離算出部は、前記メディアに応じた補正係数kcompを設定する
ことを特徴とする位置検出装置。
In the position detection device according to claim 3,
The distance calculation unit sets a correction coefficient k comp corresponding to the medium.
請求項1から請求項4のいずれか1項に記載の位置検出装置において、
前記対象物として前記メディアに印刷されたカラーパッチのエッジ位置を検出する検出範囲を設定する検出範囲設定部を備え、
前記検出範囲設定部は、前記メディアの色を含む前記検出範囲を設定し、
前記位置検出部は、前記検出範囲における前記エッジ位置を検出する
ことを特徴とする位置検出装置。
In the position detection device according to any one of claims 1 to 4,
A detection range setting unit for setting a detection range for detecting an edge position of a color patch printed on the medium as the object;
The detection range setting unit sets the detection range including the color of the media,
The position detection device detects the edge position in the detection range.
請求項5に記載の位置検出装置において、
前記検出範囲設定部は、
一方向において、前記対象位置に対して判定範囲を設定し、
前記一方向に前記対象位置及び前記判定範囲を走査して、前記判定範囲における前記メディアの色の占有量が所定値を超えた際の前記対象位置を、前記検出範囲の外縁に設定する
ことを特徴とする位置検出装置。
The position detection device according to claim 5,
The detection range setting unit
In one direction, set a determination range for the target position,
Scanning the target position and the determination range in the one direction, and setting the target position when the occupation amount of the color of the medium in the determination range exceeds a predetermined value as an outer edge of the detection range; A position detection device.
対象物が印刷されたメディアを撮像して得られた撮像画像に基づいて、色空間における、前記メディアの色座標に対する、対象位置の色座標の距離を算出する距離算出部と、
前記距離算出部により算出された前記距離に基づいて、前記メディアにおける前記対象物の位置を検出する位置検出部と、
前記対象物の前記位置の検出結果に基づく処理を行う処理部と、を備える
ことを特徴とする電子機器。
A distance calculation unit that calculates a distance of a color coordinate of the target position with respect to a color coordinate of the medium in a color space, based on a captured image obtained by imaging the medium on which the object is printed;
A position detection unit that detects a position of the object in the media based on the distance calculated by the distance calculation unit;
An electronic device comprising: a processing unit that performs processing based on a detection result of the position of the object.
対象物が印刷されたメディアを撮像して得られた撮像画像に基づいて、前記メディアにおける前記対象物の位置を検出する位置検出装置における位置検出方法であって、
色空間における、前記メディアの色座標に対する、対象位置の色座標の距離を算出するステップと、
算出された前記距離に基づいて、前記メディアにおける前記対象物の位置を検出するステップと、を実施する
ことを特徴とする位置検出方法。
A position detection method in a position detection device for detecting the position of the object on the medium based on a captured image obtained by imaging the medium on which the object is printed,
Calculating a distance of a color coordinate of a target position with respect to a color coordinate of the medium in a color space;
Detecting the position of the object on the medium based on the calculated distance. A position detection method comprising:
JP2016249389A 2016-12-22 2016-12-22 Position detectors, electronic devices, and position detection methods Active JP6816498B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2016249389A JP6816498B2 (en) 2016-12-22 2016-12-22 Position detectors, electronic devices, and position detection methods

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2016249389A JP6816498B2 (en) 2016-12-22 2016-12-22 Position detectors, electronic devices, and position detection methods

Publications (2)

Publication Number Publication Date
JP2018105639A true JP2018105639A (en) 2018-07-05
JP6816498B2 JP6816498B2 (en) 2021-01-20

Family

ID=62786973

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2016249389A Active JP6816498B2 (en) 2016-12-22 2016-12-22 Position detectors, electronic devices, and position detection methods

Country Status (1)

Country Link
JP (1) JP6816498B2 (en)

Also Published As

Publication number Publication date
JP6816498B2 (en) 2021-01-20

Similar Documents

Publication Publication Date Title
US10105948B2 (en) Image inspection device, image inspection method, program, and ink jet printing system
JP6569302B2 (en) Image forming apparatus, method for adjusting image forming apparatus, and program
US10311561B2 (en) Image inspection method, image inspection device, program, and image recording system
JP6111730B2 (en) Color measuring device, image forming apparatus, color measuring system and color measuring method
JP5619041B2 (en) Discharge failure detection method and apparatus, image processing apparatus, program, and printing system
US8922831B2 (en) Image capturing device, color measuring device, color measuring system, and image forming apparatus
WO2020022024A1 (en) Machine learning model generation device, method, program, inspection device, inspection method, and print device
US10486422B2 (en) Printer and control method
US20230103391A1 (en) Defect inspection device, defect inspection method, and program, and printing device and method of manufacturing printed matter
JP5303503B2 (en) Image inspection apparatus, printing apparatus, and image inspection method
US20160352956A1 (en) Image processing apparatus, method, and storage medium storing program
JP6543906B2 (en) Image forming apparatus and control method of image forming apparatus
US20090262373A1 (en) Method of calculating correction value and liquid ejecting apparatus
JP7259265B2 (en) Image forming apparatus and white correction method
JP6816498B2 (en) Position detectors, electronic devices, and position detection methods
CN108124079B (en) Shadow correction device, electronic apparatus, and shadow correction method
JP6888420B2 (en) Printing device and control method of printing device
JP6398783B2 (en) Color unevenness detection method, head adjustment method using this color unevenness detection method, and color unevenness inspection apparatus
JP6665698B2 (en) Image processing method
JP6379908B2 (en) Nozzle inspection apparatus, image forming apparatus, and nozzle inspection method
JP2021187110A (en) Image processing device, image processing method and program, reader and printer
JP2022049509A (en) Color measuring device, recording device, method for measuring color, and program
JP2009234020A (en) Correction value acquiring method
JP2020025188A (en) Reading device and reading method
JP2017154417A (en) Printing apparatus and printing method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20191003

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20200722

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20200804

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20200925

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20201207

R150 Certificate of patent or registration of utility model

Ref document number: 6816498

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150