JP6149782B2 - Image processing apparatus and computer program - Google Patents

Image processing apparatus and computer program Download PDF

Info

Publication number
JP6149782B2
JP6149782B2 JP2014073901A JP2014073901A JP6149782B2 JP 6149782 B2 JP6149782 B2 JP 6149782B2 JP 2014073901 A JP2014073901 A JP 2014073901A JP 2014073901 A JP2014073901 A JP 2014073901A JP 6149782 B2 JP6149782 B2 JP 6149782B2
Authority
JP
Japan
Prior art keywords
image
region
area
pixels
partial
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2014073901A
Other languages
Japanese (ja)
Other versions
JP2015198274A (en
Inventor
長谷川 智彦
智彦 長谷川
卓也 嶋橋
卓也 嶋橋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Brother Industries Ltd
Original Assignee
Brother Industries Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Brother Industries Ltd filed Critical Brother Industries Ltd
Priority to JP2014073901A priority Critical patent/JP6149782B2/en
Publication of JP2015198274A publication Critical patent/JP2015198274A/en
Application granted granted Critical
Publication of JP6149782B2 publication Critical patent/JP6149782B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、第1の画像と第2の画像とが合成された画像を表す合成画像データを生成する技術に関する。   The present invention relates to a technique for generating composite image data representing an image obtained by combining a first image and a second image.

第1の画像と第2の画像とが合成された画像を表す合成画像データを生成する技術が知られている。例えば、特許文献1に開示された技術では、一度には読み取れない大きさの原稿を、スキャナを用いて2回に分けて読み取ることによって、第1の画像を表すスキャンデータと、第2の画像を表すスキャンデータと、が取得される。そして、2個のスキャンデータを用いて、第1の画像と第2の画像とが合成された画像を表す出力画像データが生成される。第1の画像と第2の画像とを合成する位置は、パターンマッチングを用いて決定される。   A technique for generating composite image data representing an image obtained by combining a first image and a second image is known. For example, in the technique disclosed in Patent Document 1, an original having a size that cannot be read at one time is read in two using a scanner, and scan data representing the first image and the second image are read. Is obtained. Then, output image data representing an image obtained by combining the first image and the second image is generated using the two scan data. The position where the first image and the second image are combined is determined using pattern matching.

特開平4−290066号公報JP-A-4-290066 特開平4−195689号公報JP-A-4-19589 特開平11−196261号公報JP 11-196261 A 特開2003−23530号公報JP 2003-23530 A 特開平1−39153号公報JP-A-1-39153

しかしながら、上記技術では、第1の画像がどのような画像であっても、同じ画像処理によって、第1の画像と第2の画像とが合成される。この結果、画像処理が十分に適正化されているとはいえず、第1の画像と第2の画像との合成位置を決定する精度が低下する可能性があった。   However, in the above technique, the first image and the second image are synthesized by the same image processing regardless of what the first image is. As a result, it cannot be said that the image processing is sufficiently optimized, and there is a possibility that the accuracy of determining the combination position of the first image and the second image is lowered.

本発明は、第1の画像と第2の画像とが合成された合成画像を表す合成画像データを生成する際に、第1の画像と第2の画像との合成位置を決定する精度の低下を抑制することを目的とする。   According to the present invention, when generating composite image data representing a composite image obtained by combining the first image and the second image, the accuracy of determining the composite position of the first image and the second image is reduced. It aims at suppressing.

本発明は、上述の課題の少なくとも一部を解決するためになされたものであり、以下の適用例として実現することが可能である。   SUMMARY An advantage of some aspects of the invention is to solve at least a part of the problems described above, and the invention can be implemented as the following application examples.

[適用例1]画像処理装置であって、第1の画像を表す第1の画像データと、第2の画像を表す第2の画像データと、を取得する取得部と、前記第1の画像内の一部の領域である基準領域を決定する基準領域決定部と、前記第1の画像内の前記基準領域と、前記第2の画像内の複数個の候補領域と、の間の複数個の類似度を算出する算出部と、前記複数個の類似度に基づいて、前記複数の候補領域のうちの1つの候補領域を前記基準領域に対応する対応領域として決定する対応領域決定部と、前記第1の画像データと前記第2の画像データとを用いて、前記基準領域と前記対応領域とが重なるように、前記第1の画像と前記第2の画像とが合成された合成画像を表す合成画像データを生成する生成部と、を備え、前記算出部は、前記基準領域内の複数個の画素の値のばらつきに基づいて、前記基準領域内の前記N個(Nは3以上の整数)の画素の中から、前記類似度の算出に用いられるM個(Mは1以上N未満の整数)の画素を決定し、前記基準領域内のM個の画素と、前記基準領域内のM個の画素に対応する前記各候補領域内のM個の画素と、を用いて、前記類似度を算出する、画像処理装置。 Application Example 1 An image processing apparatus, an acquisition unit that acquires first image data representing a first image and second image data representing a second image, and the first image A plurality of regions between a reference region determining unit that determines a reference region, which is a partial region, a reference region in the first image, and a plurality of candidate regions in the second image. A calculation unit that calculates the similarity of the corresponding region, a corresponding region determination unit that determines one candidate region of the plurality of candidate regions as a corresponding region corresponding to the reference region based on the plurality of similarities, Using the first image data and the second image data, a synthesized image obtained by synthesizing the first image and the second image so that the reference area and the corresponding area overlap each other is obtained. A generating unit that generates composite image data to be expressed, and the calculating unit includes the reference region Based on the variation of the values of the plurality of pixels, M (M is 1 or more) used for calculating the similarity among the N (N is an integer of 3 or more) pixels in the reference region. N integers less than N) and using M pixels in the reference region and M pixels in each candidate region corresponding to the M pixels in the reference region, An image processing apparatus that calculates the similarity.

上記構成によれば、基準領域内の複数個の画素の値のばらつきに基づいて、類似度の算出に用いられるM個が決定される。そして、基準領域内のM個の画素と、各候補領域内のM個の画素と、を用いて、類似度が算出される。この結果、適切な個数の画素を用いて類似度が算出されるので、対応領域を適切に決定することができる。したがって、合成画像における第1の画像と第2の画像との合成位置を決定する精度の低下を抑制することができる。   According to the above configuration, M to be used for calculating the degree of similarity is determined based on variations in values of a plurality of pixels in the reference region. Then, the similarity is calculated using the M pixels in the reference area and the M pixels in each candidate area. As a result, the similarity is calculated using an appropriate number of pixels, so that the corresponding region can be determined appropriately. Therefore, it is possible to suppress a decrease in accuracy in determining the synthesis position of the first image and the second image in the synthesized image.

[適用例2]画像処理装置であって、第1の画像を表す第1の画像データと、第2の画像を表す第2の画像データと、を取得する取得部と、前記第1の画像内の一部の領域である基準領域を決定する基準領域決定部と、前記第1の画像内の前記基準領域と、前記第1の画像内の前記基準領域に対応する前記第2の画像内の複数個の候補領域と、の間の複数個の類似度を算出する算出部と、前記複数個の類似度に基づいて、前記複数の候補領域のうちの1つの候補領域を前記基準領域に対応する対応領域として決定する対応領域決定部と、前記第1の画像データと前記第2の画像データとを用いて、前記基準領域と前記対応領域とが重なるように、前記第1の画像と前記第2の画像とが合成された合成画像を表す合成画像データを生成する生成部と、を備え、前記第1の画像内の前記基準領域は、第1の部分基準領域と、内部に含まれる複数個の画素の値のばらつきが前記第1の部分基準領域とは異なる第2の部分基準領域と、を含み、前記第2の画像内の前記各候補領域は、前記第1の画像内の前記第1の部分基準領域と前記第2の部分基準領域とにそれぞれ対応する第1の部分候補領域と第2の部分候補領域とを含み、前記算出部は、前記基準領域内の複数個の画素のばらつきに基づいて、前記第1の部分基準領域と、前記第2の部分基準領域と、を特定し、第1の重み値を用いて、前記第1の部分基準領域と前記第1の部分基準領域に対応する前記第1の部分候補領域との間の第1の部分類似度を算出し、かつ、第2の重み値を用いて、前記第2の部分基準領域と前記第2の部分基準領域に対応する前記第2の部分候補領域との間の第2の部分類似度を算出することによって、前記第1の画像内の前記基準領域と、前記第1の画像内の前記基準領域に対応する前記第2の画像内の前記各候補領域と、の間の前記類似度を算出する、画像処理装置。 Application Example 2 An image processing apparatus, an acquisition unit that acquires first image data representing a first image and second image data representing a second image, and the first image A reference area determining unit that determines a reference area that is a partial area of the first image; the reference area in the first image; and the second image in the second image corresponding to the reference area in the first image. A plurality of candidate regions, a calculation unit that calculates a plurality of similarities between the plurality of candidate regions, and one candidate region of the plurality of candidate regions as the reference region based on the plurality of similarities Using the corresponding area determining unit that determines the corresponding corresponding area, the first image data, and the second image data, the first image and the corresponding area are overlapped with each other. Generation for generating composite image data representing a composite image synthesized with the second image The reference area in the first image is different from the first partial reference area, and the second partial reference area is different from the first partial reference area. Each of the candidate regions in the second image corresponding to the first partial reference region and the second partial reference region in the first image, respectively. One partial candidate area and a second partial candidate area, wherein the calculation unit is configured to determine whether the first partial reference area and the second partial area are based on variations of a plurality of pixels in the reference area. A first portion between the first partial reference region and the first partial candidate region corresponding to the first partial reference region using a first weight value The second partial reference area and the second part are calculated using the second weight value by calculating the similarity. The reference region in the first image and the reference region in the first image are calculated by calculating a second partial similarity between the second partial candidate region corresponding to the reference region. An image processing device that calculates the degree of similarity between each of the candidate regions in the second image corresponding to.

上記構成によれば、第1の重み値を用いて、第1の部分基準領域と第1の部分候補領域との間の第1の部分類似度が算出され、第2の重み値を用いて、第2の部分基準領域と第2の部分候補領域との間の第2の部分類似度が算出される。これによって、基準領域と、基準領域に対応する各候補領域と、の間の類似度が算出される。この結果、ばらつきが異なる2個の部分基準領域についての2個の部分類似度を適切に用いて類似度が算出されるので、対応領域を適切に決定することができる。したがって、合成画像における第1の画像と第2の画像との合成位置を決定する精度を向上することができる。   According to the above configuration, the first partial similarity between the first partial reference region and the first partial candidate region is calculated using the first weight value, and the second weight value is used. The second partial similarity between the second partial reference region and the second partial candidate region is calculated. Thereby, the similarity between the reference region and each candidate region corresponding to the reference region is calculated. As a result, the similarity is calculated by appropriately using the two partial similarities for the two partial reference regions having different variations, so that the corresponding region can be appropriately determined. Therefore, it is possible to improve the accuracy of determining the synthesis position of the first image and the second image in the synthesized image.

[適用例3]画像処理装置であって、第1の画像を表す第1の画像データと、第2の画像を表す第2の画像データと、を取得する取得部と、前記第1の画像内の一部の領域である基準領域を決定する基準領域決定部と、前記基準領域内の複数個の画素の値のばらつきに基づいて、縮小率を決定する縮小率決定部と、前記第1の画像内の前記基準領域内の画像を前記縮小率で縮小した縮小基準画像と、前記第2の画像内の複数個の候補領域内の画像を前記縮小率で縮小した複数個の縮小候補画像と、の間の複数個の類似度を算出する算出部と、前記複数個の類似度に基づいて、前記複数の候補領域のうちの1つの候補領域を前記基準領域に対応する対応領域として決定する対応領域決定部と、前記第1の画像データと前記第2の画像データとを用いて、前記基準領域と前記対応領域とが重なるように、前記第1の画像と前記第2の画像とが合成された合成画像を表す合成画像データを生成する生成部と、を備える、画像処理装置。 Application Example 3 An image processing apparatus, an acquisition unit that acquires first image data representing a first image and second image data representing a second image, and the first image A reference region determining unit that determines a reference region that is a partial region of the reference region; a reduction rate determining unit that determines a reduction rate based on variations in values of a plurality of pixels in the reference region; A reduced reference image obtained by reducing the image in the reference area in the image at the reduction ratio, and a plurality of reduced candidate images obtained by reducing the images in the plurality of candidate areas in the second image at the reduction ratio. And a calculation unit for calculating a plurality of similarities between the plurality of candidate regions, and determining one candidate region of the plurality of candidate regions as a corresponding region corresponding to the reference region A corresponding area determination unit, the first image data, and the second image data. And a generation unit that generates combined image data representing a combined image in which the first image and the second image are combined so that the reference region and the corresponding region overlap. apparatus.

上記構成によれば、基準領域内の複数個の画素の値のばらつきに基づいて決定された縮小率で縮小した縮小基準画像と縮小候補画像との間の類似度が算出される。この結果、適切なサイズの画像を用いて、類似度が算出されるので、対応領域を適切に決定することができる。したがって、合成画像における第1の画像と第2の画像との合成位置を決定する精度の低下を抑制することができる。   According to the above configuration, the similarity between the reduced reference image and the reduced candidate image reduced at the reduction rate determined based on the variation in the values of the plurality of pixels in the reference region is calculated. As a result, the similarity is calculated using an image of an appropriate size, so that the corresponding area can be determined appropriately. Therefore, it is possible to suppress a decrease in accuracy in determining the synthesis position of the first image and the second image in the synthesized image.

なお、本発明は、種々の形態で実現することが可能であり、例えば、画像処理装置の制御方法、これらの装置または方法を実現するためのコンピュータプ口グラム、そのコンピュータプログラムを記録した記録媒体、等の形態で実現することができる。   The present invention can be realized in various forms. For example, a method for controlling an image processing apparatus, a computer program for realizing these apparatuses or methods, a recording medium on which the computer program is recorded, Or the like.

第1実施例における画像処理システムの構成を示すブロック図である。It is a block diagram which shows the structure of the image processing system in 1st Example. 画像処理システム1000の動作を示すフローチャートである。5 is a flowchart showing the operation of the image processing system 1000. 本実施例で用いられる原稿10の一例を示す図である。It is a figure which shows an example of the original document 10 used in a present Example. UI画面の一例を示す図である。It is a figure which shows an example of UI screen. スキャン画像の一例を示す図である。It is a figure which shows an example of a scanned image. 参照画素決定処理のフローチャートである。It is a flowchart of a reference pixel determination process. 参照画素決定処理の説明図である。It is explanatory drawing of a reference pixel determination process. ばらつき画素と非ばらつき画素とを説明する図である。It is a figure explaining a variation pixel and a non-variation pixel. マスクデータ生成処理のフローチャートである。It is a flowchart of a mask data generation process. マスクデータ生成処理の説明図である。It is explanatory drawing of a mask data generation process. 対応領域決定処理のフローチャートである。It is a flowchart of a corresponding area determination process. 探索領域SA内に配置可能な複数個の候補領域について説明する図である。It is a figure explaining the some candidate area | region which can be arrange | positioned in search area | region SA. 合成画像30の一例を示す図である。3 is a diagram illustrating an example of a composite image 30. FIG. 第2実施例の参照画素決定処理のフローチャートである。It is a flowchart of the reference pixel determination process of 2nd Example. 第2実施例の参照画素決定処理の説明図である。It is explanatory drawing of the reference pixel determination process of 2nd Example. 第3実施例の対応領域決定処理のフローチャートである。It is a flowchart of the corresponding | compatible area | region determination process of 3rd Example. 第4実施例の参照画素決定処理のフローチャートである。It is a flowchart of the reference pixel determination process of 4th Example. 第4実施例の対応領域決定処理のフローチャートである。It is a flowchart of the corresponding | compatible area | region determination process of 4th Example.

A.第1実施例:
A−1:画像処理システム1000の構成
図1は、第1実施例における画像処理システムの構成を示すブロック図である。画像処理システム1000は、画像処理装置としてのサーバ400と、複合機200と、を備えている。サーバ400は、インターネット70に接続されており、複合機200は、LAN(Local Area Network)80を介して、インターネット70に接続されている。この結果、サーバ400と複合機200は、LAN80とインターネット70とを介して、通信可能である。また、LAN80には、複合機200のユーザのパーソナルコンピュータ500が接続されていても良い。
A. First embodiment:
A-1: Configuration of Image Processing System 1000 FIG. 1 is a block diagram showing the configuration of the image processing system in the first embodiment. The image processing system 1000 includes a server 400 as an image processing apparatus and a multifunction device 200. The server 400 is connected to the Internet 70, and the multi-function device 200 is connected to the Internet 70 via a LAN (Local Area Network) 80. As a result, the server 400 and the multifunction device 200 can communicate with each other via the LAN 80 and the Internet 70. Further, the personal computer 500 of the user of the multifunction device 200 may be connected to the LAN 80.

サーバ400は、CPU410と、DRAMなどの揮発性記憶装置420と、ハードディスクドライブやフラッシュメモリなどの不揮発性記憶装置430と、インターネット70などのネットワークに接続するためのインタフェースを含む通信部480と、を備えている。揮発性記憶装置420には、CPU410が処理を行う際に生成される種々の中間データを一時的に格納するバッファ領域421が設けられている。不揮発性記憶装置430には、コンピュータプログラム431と、UIデータ群433と、が格納されている。   The server 400 includes a CPU 410, a volatile storage device 420 such as a DRAM, a nonvolatile storage device 430 such as a hard disk drive or a flash memory, and a communication unit 480 including an interface for connecting to a network such as the Internet 70. I have. The volatile storage device 420 is provided with a buffer area 421 for temporarily storing various intermediate data generated when the CPU 410 performs processing. The nonvolatile storage device 430 stores a computer program 431 and a UI data group 433.

コンピュータプログラム431、および、UIデータ群433は、例えば、サーバ400の管理者によって、インターネット70を介してサーバ400にアップロードされることによって、サーバ400にインストールされる。または、コンピュータプログラム431、および、UIデータ群433は、例えば、DVD−ROMなどに格納された形態で提供され、サーバ400の管理者によって、サーバ400にインストールされても良い。CPU410は、コンピュータプログラム431を実行することにより、後述する画像処理を実現する。   The computer program 431 and the UI data group 433 are installed in the server 400 by being uploaded to the server 400 via the Internet 70 by an administrator of the server 400, for example. Alternatively, the computer program 431 and the UI data group 433 may be provided in a form stored in, for example, a DVD-ROM, and may be installed in the server 400 by the administrator of the server 400. The CPU 410 implements image processing to be described later by executing the computer program 431.

複合機200は、CPU210と、DRAMなどの揮発性記憶装置220と、フラッシュメモリやハードディスクドライブなどの不揮発性記憶装置230と、プリンタ部240と、スキャナ部250と、タッチパネルやボタンなどの操作部260と、液晶ディスプレイなどの表示部270と、外部機器と通信を行う通信部280と、を備えている。例えば、通信部280は、LAN80などのネットワークに接続するためのインタフェースや、外部記憶装置(例えば、USBメモリ)と接続するためのインタフェースを含んでいる。   The MFP 200 includes a CPU 210, a volatile storage device 220 such as a DRAM, a nonvolatile storage device 230 such as a flash memory and a hard disk drive, a printer unit 240, a scanner unit 250, and an operation unit 260 such as a touch panel and buttons. A display unit 270 such as a liquid crystal display, and a communication unit 280 that communicates with an external device. For example, the communication unit 280 includes an interface for connecting to a network such as the LAN 80 and an interface for connecting to an external storage device (for example, a USB memory).

揮発性記憶装置220には、CPU210が処理を行う際に生成される種々のデータを一時的に格納するバッファ領域221が設けられている。不揮発性記憶装置230には、制御プログラム231が格納されている。   The volatile storage device 220 is provided with a buffer area 221 for temporarily storing various data generated when the CPU 210 performs processing. A control program 231 is stored in the non-volatile storage device 230.

プリンタ部240は、インクジェット方式やレーザー方式などの印刷方式を用いて印刷を実行する。スキャナ部250は、光電変換素子(例えば、CCD、CMOS)を用いて光学的に原稿を読み取ることによってスキャンデータを生成する。スキャナ部250は、いわゆるフラットベッド式の原稿台を備えており、本実施例では、1回で読み取ることができる原稿の最大サイズは、A4より大きくA3より小さいサイズである。具体的には、スキャナ部250は、長手方向の長さがA4と同じであり、かつ、短手方向の長さがA4より少しだけ(例えば、数センチ)長いサイズの原稿を読み取ることができる。このために、後述するように、A3サイズの原稿の長手方向の中央付近が重複するように、A3サイズの原稿を2回に分けて読み取ることができる。   The printer unit 240 executes printing using a printing method such as an inkjet method or a laser method. The scanner unit 250 generates scan data by optically reading a document using a photoelectric conversion element (for example, CCD, CMOS). The scanner unit 250 includes a so-called flat bed type document table. In this embodiment, the maximum size of a document that can be read at one time is larger than A4 and smaller than A3. Specifically, the scanner unit 250 can read a document having a length in the longitudinal direction that is the same as that of A4 and a length in the short direction that is slightly longer (for example, several centimeters) than A4. . Therefore, as will be described later, the A3 size document can be read in two steps so that the vicinity of the center in the longitudinal direction of the A3 size document overlaps.

CPU210は、制御プログラム231を実行することにより、複合機200の制御を実行する。例えば、CPU210は、プリンタ部240やスキャナ部250を制御して、コピー処理、印刷処理、スキャン処理などを実行する。さらに、CPU210は、サーバ400にアクセスして、サーバ400が提供するサービスを利用するサービス利用処理を、実行することができる。   The CPU 210 executes control of the multifunction device 200 by executing the control program 231. For example, the CPU 210 controls the printer unit 240 and the scanner unit 250 to execute a copy process, a print process, a scan process, and the like. Furthermore, the CPU 210 can access the server 400 and execute a service use process that uses a service provided by the server 400.

A−2:画像処理システム1000の動作
図2は、画像処理システム1000の動作を示すフローチャートである。このフローチャートの処理は、複合機200が、サーバ400が提供する画像生成サービスの利用指示を、ユーザから受け付けた場合に開始される。この画像生成サービスは、詳細は後述するが、複数個のスキャンデータによって表される複数個のスキャン画像を合成するサービスである。複数個のスキャンデータは、詳細は後述するが、例えば、1回で読み取り可能なサイズより大きなサイズの原稿を、複数回に分けて読み取ることによって生成される。
A-2: Operation of Image Processing System 1000 FIG. 2 is a flowchart showing the operation of the image processing system 1000. The processing of this flowchart is started when the multifunction device 200 receives an instruction to use an image generation service provided by the server 400 from a user. As will be described in detail later, this image generation service is a service that combines a plurality of scan images represented by a plurality of scan data. The details of the plurality of scan data are described later. For example, the plurality of scan data are generated by reading a document having a size larger than the size that can be read at one time in a plurality of times.

処理が開始されると、S5では、複合機200のCPU210は、サービス開始要求を、サーバ400に対して送信する。サーバ400のCPU410は、サービス開始要求を受信すると、UIデータ群433(図1)から画像生成サービスの提供に必要なUIデータを選択し、該UIデータを複合機200に対して送信する(S10)。UIデータは、具体的には、ユーザインタフェース画面(以下、UI画面)を表す画面データと、制御データと、を含む。この制御データは、例えば、UI画面を利用して複合機200が所定の処理(具体的には、後述するS15のスキャン処理)を行うために必要な各種のデータを含む。例えば、制御データは、UI画面(例えば、図4)を介して受け付けたユーザの指示に基づいて、複合機200が実行すべき処理(例えば、サーバ400へのスキャンデータの送信)を行うために必要な情報(例えば、スキャンデータの送信先アドレス)を含む。   When the process is started, in S5, the CPU 210 of the multifunction device 200 transmits a service start request to the server 400. When receiving the service start request, the CPU 410 of the server 400 selects UI data necessary for providing the image generation service from the UI data group 433 (FIG. 1), and transmits the UI data to the multifunction device 200 (S10). ). Specifically, the UI data includes screen data representing a user interface screen (hereinafter referred to as UI screen) and control data. This control data includes, for example, various data necessary for the MFP 200 to perform predetermined processing (specifically, scan processing in S15 described later) using the UI screen. For example, the control data is used to perform processing (for example, transmission of scan data to the server 400) to be executed by the multifunction device 200 based on a user instruction received via a UI screen (for example, FIG. 4). Necessary information (for example, transmission address of scan data) is included.

S15では、CPU210は、受信したUIデータに基づいて、複数個のスキャンデータを生成するスキャン処理を実行する。スキャン処理では、CPU210は、ユーザが用意した原稿を2回に分けて読み取ることによって、2個のスキャンデータを生成する。本実施例のスキャンデータは、RGBの各成分の値(例えば、0〜255の256階調の値)を画素ごとに含むRGB画像データである。   In S15, the CPU 210 executes a scan process for generating a plurality of scan data based on the received UI data. In the scan process, the CPU 210 generates two pieces of scan data by reading the document prepared by the user in two steps. The scan data according to the present embodiment is RGB image data including RGB component values (for example, values of 256 gradations from 0 to 255) for each pixel.

図3は、本実施例で用いられる原稿の一例を示す図である。図3の原稿10のサイズは、スキャナ部250が1回で読み取り可能なサイズ(本実施例では、A4サイズより少し大きなサイズ)の約2倍のサイズ(本実施例では、A3サイズ)である。   FIG. 3 is a diagram illustrating an example of a document used in this embodiment. The size of the original 10 in FIG. 3 is about twice the size (A3 size in this embodiment) that is readable by the scanner unit 250 at one time (in this embodiment, a size slightly larger than the A4 size). .

図4は、UI画面の一例を示す図である。先ず、CPU210は、図4のUI画面UG1を表示部270に表示する。例えば、UI画面UG1は、原稿台への原稿10の適切な設置を促すメッセージMS1と、スキャンボタンSBと、キャンセルボタンCBと、を含んでいる。ユーザは、UI画面UG1に従って、原稿10の左側の約半分の領域10L(図3)を読み取ることができるように、原稿10を原稿台に設置し、スキャンボタンSBを押下する。スキャンボタンSBの押下に応じて、CPU210は、スキャナ部250を制御して原稿を読み取ることによって、左側スキャンデータを生成する。   FIG. 4 is a diagram illustrating an example of a UI screen. First, the CPU 210 displays the UI screen UG1 of FIG. For example, the UI screen UG1 includes a message MS1 for prompting appropriate placement of the document 10 on the document table, a scan button SB, and a cancel button CB. The user places the document 10 on the document table and presses the scan button SB so that the left half 10L (FIG. 3) of the left side of the document 10 can be read according to the UI screen UG1. In response to the pressing of the scan button SB, the CPU 210 controls the scanner unit 250 to read the original, thereby generating left scan data.

図5は、スキャン画像の一例を示す図である。図5(A)には、左側スキャンデータによって表される左側スキャン画像20Lが示されている。左側スキャン画像20Lは、原稿10の左側の約半分の領域10L(図3)を示す左側原稿画像HILと、余白WBLと、を含んでいる。   FIG. 5 is a diagram illustrating an example of a scanned image. FIG. 5A shows a left scan image 20L represented by the left scan data. The left-side scanned image 20L includes a left-side original image HIL that shows an approximately half area 10L (FIG. 3) on the left side of the original 10, and a margin WBL.

次に、CPU210は、所定のUI画面(図示省略)を表示部270に表示する。このUI画面は、UI画面UG1と同様に、原稿台への原稿10の適切な設置を促すメッセージと、スキャンボタンと、キャンセルボタンと、を含んでいる。ユーザは、UI画面に従って、原稿10の右側の約半分の領域10R(図3)を読み取ることができるように、原稿10を原稿台に設置し、スキャンボタンを押下する。CPU210は、スキャンボタンの押下に応じて、スキャナ部250を制御して原稿を読み取ることによって、右側スキャンデータを生成する。   Next, the CPU 210 displays a predetermined UI screen (not shown) on the display unit 270. Similar to the UI screen UG1, this UI screen includes a message for prompting appropriate placement of the document 10 on the document table, a scan button, and a cancel button. In accordance with the UI screen, the user places the document 10 on the document table and presses the scan button so that the half area 10R (FIG. 3) on the right side of the document 10 can be read. The CPU 210 generates right-side scan data by controlling the scanner unit 250 and reading a document in response to pressing of the scan button.

図5(B)には、右側スキャンデータによって表される右側スキャン画像20Rが示されている。右側スキャン画像20Rは、原稿10の右側の約半分の領域10R(図3)を示す右側原稿画像HIRと、余白WBRと、を含んでいる。   FIG. 5B shows a right scan image 20R represented by the right scan data. The right-side scanned image 20R includes a right-side original image HIR that shows an approximately half area 10R (FIG. 3) on the right side of the original 10, and a margin WBR.

ここで、図3の原稿10の横方向の中央部CAを表す画像は、左側スキャン画像20Lの右辺に沿った領域と、右側スキャン画像20Rの左辺に沿った領域と、の両方に含まれている。すなわち、図5にハッチングで示すように、左側スキャン画像20Lは、原稿10の中央部CAを表す画像CILを含み、右側スキャン画像20Rは、原稿10の中央部CAを表す画像CIRを含んでいる。これは、例えば、UI画面や説明書などによって、原稿10の中央部CAが、右側スキャンデータの生成時と左側スキャンデータの生成時との両方で読み取られるように、原稿10を原稿台に設置するように、ユーザに指示することによって、実現される。なお、左側スキャン画像20L内の画像CILと、右側スキャン画像20R内の画像CIRとは、ともに原稿10の部分CIAを表しているが、ユーザの操作などにおって、面積や色などに多少の差は、生じ得る。   Here, the image representing the center CA in the horizontal direction of the document 10 in FIG. 3 is included in both the region along the right side of the left scan image 20L and the region along the left side of the right scan image 20R. Yes. That is, as shown by hatching in FIG. 5, the left-side scan image 20L includes an image CIL that represents the center portion CA of the document 10, and the right-side scan image 20R includes an image CIR that represents the center portion CA of the document 10. . This is because, for example, the document 10 is placed on the document table so that the center CA of the document 10 can be read both when generating right-side scan data and when generating left-side scan data by using a UI screen or a manual. This is realized by instructing the user. Note that the image CIL in the left-side scan image 20L and the image CIR in the right-side scan image 20R both represent the partial CIA of the document 10, but there are some areas and colors depending on the user's operation. Differences can occur.

図2のS20では、CPU210は、右側スキャン画像20Rを表す右側スキャンデータと、左側スキャン画像20Lを表す左側スキャンデータと、をサーバ400に対して送信する。この結果、S25にて、サーバ400のCPU410は、右側スキャンデータと、左側スキャンデータと、取得して、バッファ領域421に格納する。   In S20 of FIG. 2, the CPU 210 transmits right scan data representing the right scan image 20R and left scan data representing the left scan image 20L to the server 400. As a result, in S25, the CPU 410 of the server 400 acquires the right side scan data and the left side scan data, and stores them in the buffer area 421.

S30では、CPU410は、右側スキャンデータを用いて、参照画素決定処理を実行する。図6は、参照画素決定処理のフローチャートである。   In S30, the CPU 410 executes reference pixel determination processing using the right side scan data. FIG. 6 is a flowchart of the reference pixel determination process.

S105では、CPU410は、右側スキャン画像20R内の一部の領域である基準領域SPを決定する。基準領域SPは、右側スキャン画像20R内の所定の位置に配置された所定のサイズの矩形領域に決定される。また、基準領域SPは、右側スキャン画像20Rにおいて、原稿10の中央部CAを表す画像CIR内に配置される。例えば、基準領域SPは、右側スキャン画像20Rの4つの辺のうち、中央部CAを表す画像CIRに沿った辺(本実施例では、左辺)に沿って配置される。より具体的には、基準領域SPは、右側スキャン画像20Rの左上角の近傍であって、左端および上端から所定のマージン(例えば、5画素〜20画素のマージン)だけ離れた位置に配置される。基準領域SPの横方向のサイズは、例えば、5画素〜20画素であり、基準領域SPの縦方向のサイズは、右側スキャン画像20Rの縦方向の画素数の1/4〜1/2である。所定のマージンを確保して、基準領域SPが配置されるのは、右側スキャン画像20Rの端部は、原稿の端部の影などが写るなどの理由から、内側の部分と比較してノイズが多い領域であるので、当該ノイズの多い領域が基準領域SP内に含まれることを避けるためである。   In S105, the CPU 410 determines a reference area SP that is a partial area in the right-side scan image 20R. The reference area SP is determined as a rectangular area having a predetermined size arranged at a predetermined position in the right scan image 20R. Further, the reference area SP is arranged in an image CIR representing the center CA of the document 10 in the right-side scan image 20R. For example, the reference region SP is arranged along the side (in the present embodiment, the left side) along the image CIR representing the central portion CA among the four sides of the right scanned image 20R. More specifically, the reference region SP is arranged in the vicinity of the upper left corner of the right scan image 20R and at a position separated from the left end and the upper end by a predetermined margin (for example, a margin of 5 to 20 pixels). . The horizontal size of the reference region SP is, for example, 5 to 20 pixels, and the vertical size of the reference region SP is 1/4 to 1/2 of the number of pixels in the vertical direction of the right scan image 20R. . The reference area SP is arranged with a predetermined margin, because the edge of the right-side scan image 20R has noise compared to the inner part because the shadow of the edge of the document is reflected. This is because it is a large area, so that the noisy area is not included in the reference area SP.

図7は、参照画素決定処理の説明図である。図7(A)には、S105にて決定された基準領域SP内の画像が示されている。   FIG. 7 is an explanatory diagram of the reference pixel determination process. FIG. 7A shows an image in the reference area SP determined in S105.

S110では、CPU410は、基準領域SP内の複数個の画素を、2種類の画素、すなわち、ばらつき画素と、その他の画素(非ばらつき画素とも呼ぶ)と、に分類する。   In S110, the CPU 410 classifies the plurality of pixels in the reference region SP into two types of pixels, that is, a variation pixel and another pixel (also referred to as a non-variation pixel).

図8は、ばらつき画素と非ばらつき画素とを説明する図である。CPU410は、基準領域SP内の複数個の画素を1個ずつ注目画素TPとして選択して、注目画素TPがばらつき画素であるか非ばらつき画素であるかを判断する。具体的には、図8に示すように、CPU410は、注目画素TPを中心とする横3画素×3画素分の領域FL内の画素を用いて、当該判断を実行する。まず、図8の式に示すように、CPU410は、注目画素TPの値(R0、B0、B0)と、周囲の8個の画素の値(Rn、Gn、Bn)のそれぞれと、の差分ΔVnを算出する。nは、注目画素の周囲の8個の画素を識別する1〜8までの番号であり、図8の領域FL内の各画素に付された番号である。ΔVnは、図8に式で示すように、3種類の成分値の差分の絶対値の和で表される。すなわち、ΔVnは、(Rn−R0)の絶対値と、(Gn−G0)の絶対値と、(Bn−B0)の絶対値と、の合計値で表される。CPU410は、図8に式で示すように、算出された8個の差分ΔVnの合計値を、注目画素TPのばらつき値Vとして算出する。   FIG. 8 is a diagram for explaining a variation pixel and a non-variation pixel. The CPU 410 selects a plurality of pixels in the reference area SP one by one as the target pixel TP, and determines whether the target pixel TP is a variation pixel or a non-variation pixel. Specifically, as illustrated in FIG. 8, the CPU 410 performs the determination using pixels in the region FL corresponding to 3 horizontal pixels × 3 pixels centering on the target pixel TP. First, as shown in the equation of FIG. 8, the CPU 410 determines the difference ΔVn between the value of the target pixel TP (R0, B0, B0) and the values of the surrounding eight pixels (Rn, Gn, Bn). Is calculated. n is a number from 1 to 8 that identifies eight pixels around the pixel of interest, and is a number assigned to each pixel in the region FL of FIG. ΔVn is represented by the sum of the absolute values of the differences between the three types of component values, as shown in FIG. That is, ΔVn is represented by the sum of the absolute value of (Rn−R0), the absolute value of (Gn−G0), and the absolute value of (Bn−B0). The CPU 410 calculates the total value of the calculated eight differences ΔVn as the variation value V of the target pixel TP, as shown by an equation in FIG.

注目画素TPのばらつき値Vが、所定の閾値Vth以上である場合には、注目画素TPは、ばらつき画素であると判断される。注目画素TPのばらつき値Vが、所定の閾値Vth未満である場合には、注目画素TPは、非ばらつき画素であると判断される。これによって、基準領域SP内の全ての画素が、ばらつき画素と非ばらつき画素とのいずれかに分類される。以上の説明から解るように、ばらつき画素は、周囲の複数個の画素との値の差が基準以上の画素である、と言うことができる。非ばらつき画素は、周囲の複数個の画素との値の差が基準未満の画素である、と言うことができる。   When the variation value V of the target pixel TP is equal to or greater than the predetermined threshold Vth, the target pixel TP is determined to be a variation pixel. When the variation value V of the target pixel TP is less than the predetermined threshold Vth, it is determined that the target pixel TP is a non-variable pixel. Thereby, all the pixels in the reference region SP are classified into either a variation pixel or a non-variation pixel. As can be understood from the above description, it can be said that the variation pixel is a pixel whose value difference with a plurality of surrounding pixels is greater than or equal to the reference. It can be said that the non-uniform pixel is a pixel whose value difference with a plurality of surrounding pixels is less than the reference.

図7(B)には、基準領域SP内の複数個の画素を、ばらつき画素と非ばらつき画素とに分類することによって得られる二値画像EPが示されている。二値画像EPは、例えば、ばらつき画素と判断された画素の値を「1」とし、非ばらつき画素と判断された画素の値を「0」とすることによって、得られる。二値画像EP内のシングルハッチングされた第1の領域SVは、複数個の非ばらつき画素によって構成される領域、すなわち、内部の複数個の画素の値のばらつきが比較的小さな領域を示す。二値画像EP内のクロスハッチングされた第2の領域BVは、複数個のばらつき画素によって構成される領域、すなわち、内部の複数個の画素の値のばらつきが比較的大きな領域を示す。例えば、第2の領域BVは、基準領域SPのうち、オブジェクトのエッジを多く含む領域が含まれる。また、第1の領域SVには、背景を示す領域や、オブジェクトの内部の色の変化が乏しい領域が含まれる。   FIG. 7B shows a binary image EP obtained by classifying a plurality of pixels in the reference region SP into a variation pixel and a non-variation pixel. The binary image EP is obtained, for example, by setting the value of a pixel determined as a variation pixel to “1” and the value of a pixel determined as a non-variation pixel to “0”. The single hatched first region SV in the binary image EP indicates a region constituted by a plurality of non-variable pixels, that is, a region in which variations in values of a plurality of internal pixels are relatively small. The cross-hatched second region BV in the binary image EP indicates a region constituted by a plurality of variation pixels, that is, a region in which variations in values of a plurality of internal pixels are relatively large. For example, the second area BV includes an area that includes many object edges in the reference area SP. In addition, the first area SV includes an area indicating a background and an area where the color change inside the object is poor.

したがって、基準領域SPに占める第2の領域BVの割合、すなわち、基準領域SP内の画素の総数Ntに対するばらつき画素の個数Nvの割合(Nv/Nt)は、処理対象の右側スキャン画像20Rごとに異なる。具体的には、基準領域SPが配置される位置に、オブジェクトのエッジなどの特徴的な部分が比較的多いスキャン画像が処理対象である場合には、(Nv/Nt)は比較的大きくなる。また、基準領域SPが配置される位置に、背景を示す領域や、オブジェクトの内部の色の変化が乏しい部分が比較的多いスキャン画像が処理対象である場合には、(Nv/Nt)は比較的小さくなる。   Accordingly, the ratio of the second area BV occupying the reference area SP, that is, the ratio of the number Nv of variation pixels to the total number Nt of pixels in the reference area SP (Nv / Nt) is determined for each right-side scan image 20R to be processed. Different. Specifically, (Nv / Nt) is relatively large when a scan image having a relatively large number of characteristic parts such as an edge of an object is a processing target at a position where the reference region SP is arranged. In addition, when a scan image having a relatively large amount of a region showing a background or a portion with little color change inside an object is a processing target at a position where the reference region SP is arranged, (Nv / Nt) is compared. Become smaller.

S115では、CPU410は、基準領域SP内の画素の総数Ntに対するばらつき画素の個数Nvの割合(Nv/Nt)を算出する。S120では、CPU410は、間引率TR(単位は%)を算出する。間引率TRは、以下の式(1)を用いて算出される。
TR={0.2+0.7×(Nv/Nt)}×100 ...(1)
In S115, the CPU 410 calculates a ratio (Nv / Nt) of the number Nv of variation pixels to the total number Nt of pixels in the reference region SP. In S120, the CPU 410 calculates a thinning rate TR (unit:%). The thinning rate TR is calculated using the following equation (1).
TR = {0.2 + 0.7 × (Nv / Nt)} × 100 (1)

S125では、CPU410は、間引率TRに基づいてマスクデータを生成するマスクデータ生成処理を実行する。図9は、マスクデータ生成処理のフローチャートである。図10は、マスクデータ生成処理の説明図である。マスクデータは、参照画素を示す値(「ON」)と、非参照画素を示す値(「OFF」)と、のいずれかの値を、画素ごとに有する二値画像データである。すなわち、マスクデータ生成処理は、間引率TRに基づいて、基準領域SP内の複数個の画素のそれぞれを、参照画素と非参照画素とのいずれかに決定する処理である、と言うことができる。   In S125, the CPU 410 executes a mask data generation process for generating mask data based on the thinning rate TR. FIG. 9 is a flowchart of the mask data generation process. FIG. 10 is an explanatory diagram of the mask data generation process. The mask data is binary image data having a value indicating a reference pixel (“ON”) and a value indicating a non-reference pixel (“OFF”) for each pixel. That is, it can be said that the mask data generation process is a process of determining each of the plurality of pixels in the reference region SP as either a reference pixel or a non-reference pixel based on the thinning rate TR. .

図9のS200では、CPU410は、マスクデータの初期データをバッファ領域421内に準備する。初期データは、基準領域SPと同じサイズ(縦方向および横方向の画素数)の領域を表す二値画像データであり、全ての画素の値が、初期値、すなわち、「OFF」にセットされている。図10(A)には、初期データによって表される初期状態のマスク画像MPaが示されている。   In S200 of FIG. 9, the CPU 410 prepares initial data of mask data in the buffer area 421. The initial data is binary image data representing an area having the same size (number of pixels in the vertical and horizontal directions) as the reference area SP, and the values of all the pixels are set to the initial value, that is, “OFF”. Yes. FIG. 10A shows an initial mask image MPa represented by initial data.

S205では、CPU410は、誤差値EVを初期化する(ゼロにする)。誤差値EVは、マスクデータを生成するために用いられるパラメータである。   In S205, the CPU 410 initializes the error value EV (sets it to zero). The error value EV is a parameter used for generating mask data.

S210では、初期状態のマスク画像MPa内の複数個の画素PXから1個の注目画素を選択する。図10(A)において矢印で示すように、例えば、マスク画像MPa内の複数個の画素PXは、左上の端から右方向に順次に1個ずつ注目画素として選択され、横方向の1行分の画素が選択されると、1行下の複数個の画素が左上の端から右方向に順次に1個ずつ選択される。   In S210, one pixel of interest is selected from a plurality of pixels PX in the initial mask image MPa. As shown by the arrows in FIG. 10A, for example, a plurality of pixels PX in the mask image MPa are selected one pixel at a time sequentially from the upper left end in the right direction, and one row in the horizontal direction. Are selected one by one in order from the upper left end in the right direction.

S215では、現在の誤差値EVに間引率TRが加算される(EV←EV+TR)。S220では、CPU410は、加算後の誤差値EVが100以上であるか否かを判断する。誤差値EVが100以上である場合には(S220:YES)、CPU410は、S225において、注目画素の値を「OFF」に決定する。すなわち、CPU410は、注目画素の値を、初期値「OFF」のまま維持する。続くS230では、CPU410は、誤差値EVを初期化する(ゼロにする)。   In S215, the thinning-out rate TR is added to the current error value EV (EV ← EV + TR). In S220, CPU 410 determines whether or not error value EV after addition is 100 or more. When the error value EV is 100 or more (S220: YES), the CPU 410 determines the value of the target pixel as “OFF” in S225. That is, the CPU 410 maintains the value of the target pixel as the initial value “OFF”. In subsequent S230, the CPU 410 initializes (sets to zero) the error value EV.

誤差値EVが100未満である場合には(S220:NO)、CPU410は、S235において、注目画素の値を「ON」に決定する。すなわち、CPU410は、注目画素の値を、初期値「OFF」から「ON」に変更する。   When the error value EV is less than 100 (S220: NO), the CPU 410 determines that the value of the target pixel is “ON” in S235. That is, the CPU 410 changes the value of the target pixel from the initial value “OFF” to “ON”.

S240では、CPU410は、マスク画像MPa内の全ての画素を注目画素として処理したか否かを判断する。未処理の画素がある場合には(S240:NO)、CPU410は、S210に戻って、未処理の画素を注目画素として選択する。全ての画素が処理された場合には(S240:YES)、CPU410は、マスクデータ生成処理を終了する。マスクデータ生成処理が終了した時点で、マスクデータが生成されている。   In S240, the CPU 410 determines whether or not all the pixels in the mask image MPa have been processed as the target pixel. When there is an unprocessed pixel (S240: NO), the CPU 410 returns to S210 and selects an unprocessed pixel as a target pixel. If all the pixels have been processed (S240: YES), the CPU 410 ends the mask data generation process. When the mask data generation process is completed, the mask data is generated.

図10(B)、図10(C)には、マスクデータ生成処理によって生成されたマスクデータによって表されるマスク画像の一例が示されている。図10(B)、図10(C)のマスク画像MPb、MPc内のハッチングされた画素は、「ON」の画素であり、ハッチングされていない画素は、「OFF」の画素である。図10(B)のマスク画像MPbは、間引率TRが25%である場合のマスク画像である。このマスク画像MPbでは、25%の画素が「OFF」の画素とされ、75%の画素が「ON」の画素とされている。図10(C)のマスク画像MPcは、間引率TRが50%である場合のマスク画像である。このマスク画像MPcでは、50%の画素が「OFF」の画素とされ、50%の画素が「ON」の画素とされている。なお、図7(C)にも、図7(A)に示す基準領域SPに対応して、図9のマスクデータ生成処理にて生成されるマスク画像MPが例示されている。図9のマスク画像MPは、間引率TRが50%である場合の例である。   FIGS. 10B and 10C show an example of a mask image represented by the mask data generated by the mask data generation process. The hatched pixels in the mask images MPb and MPc in FIGS. 10B and 10C are “ON” pixels, and the non-hatched pixels are “OFF” pixels. The mask image MPb in FIG. 10B is a mask image when the thinning rate TR is 25%. In this mask image MPb, 25% of the pixels are “OFF” pixels and 75% of the pixels are “ON” pixels. The mask image MPc in FIG. 10C is a mask image when the thinning rate TR is 50%. In this mask image MPc, 50% of the pixels are “OFF” pixels and 50% of the pixels are “ON” pixels. FIG. 7C also illustrates the mask image MP generated by the mask data generation process of FIG. 9 corresponding to the reference region SP shown in FIG. The mask image MP in FIG. 9 is an example when the thinning rate TR is 50%.

以上の説明から解るように、基準領域SP内の画素の総数に占める参照画素の割合を参照率RRとすると、間引率TRが25%であることは、参照率RRが75%であることを意味し、間引率TRが50%であることは、参照率RRが50%であることを意味する。すなわち、RR=(100−TR)である。参照率RRは、後述する対応領域決定処理において、類似度を算出する際に、基準領域SP内の複数の画素の値を参照する程度を示す値である、と言うことができる。   As can be understood from the above description, when the ratio of the reference pixels in the total number of pixels in the reference region SP is the reference rate RR, the thinning rate TR is 25%, and the reference rate RR is 75%. This means that the thinning rate TR is 50%, which means that the reference rate RR is 50%. That is, RR = (100−TR). It can be said that the reference rate RR is a value indicating the degree to which the values of a plurality of pixels in the reference region SP are referred to when calculating the similarity in the corresponding region determination process described later.

上述した式(1)に示すように、間引率TRは、基準領域SP内の画素の総数Ntに対するばらつき画素の個数Nvの比率(Nv/Nt)、すなわち、基準領域SP内に占めるばらつき画素の割合(Nv/Nt)に応じて、20%〜90%の値に決定される。(Nv/Nt)が大きいほど、間引率TRは大きくなり、(Nv/Nt)が小さいほど、間引率TRは小さくなる。   As shown in the above equation (1), the thinning rate TR is a ratio (Nv / Nt) of the number Nv of the variation pixels to the total number Nt of the pixels in the reference region SP, that is, the variation pixels occupying the reference region SP. A value of 20% to 90% is determined according to the ratio (Nv / Nt). As (Nv / Nt) increases, the thinning rate TR increases. As (Nv / Nt) decreases, the thinning rate TR decreases.

したがって、参照率RRは、基準領域SP内に占めるばらつき画素の割合(Nv/Nt)に応じて、10%〜80%の値に決定される。(Nv/Nt)が大きいほど、参照率RRは小さくなり、(Nv/Nt)が小さいほど、参照率RRは大きくなる。   Therefore, the reference rate RR is determined to be a value of 10% to 80% according to the ratio (Nv / Nt) of the variation pixels occupying in the standard region SP. The larger the (Nv / Nt), the smaller the reference rate RR, and the smaller the (Nv / Nt), the larger the reference rate RR.

マスクデータ生成処理が終了されると、図6の参照画素決定処理は終了される。参照画素決定処理が終了されると、図2のS35では、CPU410は、対応領域決定処理を実行する。対応領域決定処理は、右側スキャン画像20R内の基準領域SPに対応する左側スキャン画像20L内の対応領域CPを決定する処理である。基準領域SPに対応する対応領域CPは、次のように定義できる。右側スキャン画像20R内の基準領域SP内に表されている原稿10の一部分を特定部分SPT(図3)とする。基準領域SPに対応する対応領域CPは、左側スキャン画像20Lにおいて、原稿10の特定部分SPTを表す領域である。   When the mask data generation process ends, the reference pixel determination process in FIG. 6 ends. When the reference pixel determination process is completed, the CPU 410 executes the corresponding area determination process in S35 of FIG. The corresponding area determination process is a process for determining the corresponding area CP in the left scan image 20L corresponding to the reference area SP in the right scan image 20R. The corresponding area CP corresponding to the reference area SP can be defined as follows. A part of the document 10 shown in the reference area SP in the right scanned image 20R is defined as a specific portion SPT (FIG. 3). The corresponding area CP corresponding to the reference area SP is an area representing the specific portion SPT of the document 10 in the left scan image 20L.

図11は、対応領域決定処理のフローチャートである。S300では、CPU410は、左側スキャン画像20L内に探索領域SAを決定する。図5(A)の左側スキャン画像20L内には、探索領域SAが示されている。探索領域SAは、予め定められた領域である。探索領域SAの縦方向の長さは、左側スキャン画像20Lの縦方向の全長に等しい。探索領域SAの左右方向の長さは、例えば、左側スキャン画像20Lの左右方向の長さの20%〜50%である。   FIG. 11 is a flowchart of the corresponding area determination process. In S300, the CPU 410 determines a search area SA in the left scan image 20L. A search area SA is shown in the left-side scan image 20L of FIG. The search area SA is a predetermined area. The length in the vertical direction of the search area SA is equal to the total length in the vertical direction of the left scan image 20L. The length in the left-right direction of the search area SA is, for example, 20% to 50% of the length in the left-right direction of the left scan image 20L.

S305では、CPU410は、探索領域SA内に配置可能な複数個の候補領域の中から、1個の注目候補領域を選択する。図12は、探索領域SA内に配置可能な複数個の候補領域について説明する図である。   In S305, the CPU 410 selects one target candidate area from among a plurality of candidate areas that can be arranged in the search area SA. FIG. 12 is a diagram illustrating a plurality of candidate areas that can be arranged in the search area SA.

候補領域のサイズは、右側スキャン画像20R内の基準領域SP(図5)のサイズと同じである。探索領域SAの上辺および右辺と、上辺および右辺が一致する候補領域NPaの右上の点Paの座標を(1、1)とする。探索領域SAの下辺および右辺と、下辺および右辺が一致する候補領域NPbの右上の点Pbの座標を(1、m)とする。探索領域SAの上辺および左辺と、上辺および左辺が一致する候補領域NPcの右上の点Pcの座標を(k、1)とする。探索領域SAの下辺および左辺と、下辺および左辺が一致する候補領域NPdの右上の点Pdの座標を(k、m)とする。   The size of the candidate area is the same as the size of the reference area SP (FIG. 5) in the right-side scan image 20R. The coordinates of the upper right point Pa of the candidate area NPa in which the upper side and the right side of the search area SA coincide with the upper side and the right side are (1, 1). Let (1, m) be the coordinates of the upper right point Pb of the candidate area NPb where the lower and right sides of the search area SA coincide with the lower and right sides. The coordinates of the upper right point Pc of the candidate area NPc where the upper side and the left side of the search area SA coincide with the upper side and the left side are (k, 1). The coordinates of the upper right point Pd of the candidate area NPd in which the lower side and the left side of the search area SA coincide with the lower side and the left side are defined as (k, m).

候補領域の右上の点は、(p、q)で表される(k×m)個の座標のうち、任意の座標に位置することができる。ここで、pは、1以上k以下の任意の整数であり、qは、1以上m以下の任意の整数である。したがって、探索領域SA内には、(k×m)個の候補領域が設定可能である。   The upper right point of the candidate area can be located at an arbitrary coordinate among (k × m) coordinates represented by (p, q). Here, p is an arbitrary integer from 1 to k, and q is an arbitrary integer from 1 to m. Therefore, (k × m) candidate areas can be set in the search area SA.

図12に矢印で示すように、これらの(k×m)個の候補領域の中から、右上の端の候補領域NPaが最初の注目候補領域として選択される。そして、1画素ずつ下方向に位置がずれた候補領域が、順次に選択される。そして、右下の端の候補領域NPbが選択されると、右上の端の候補領域NPaの位置から1画素だけ左方向にずれた候補領域が選択される。その後は、再び1画素ずつ下方向に位置がずれた候補領域が、順次に選択される。最後に選択される候補領域は、左下の端の候補領域NPdである。   As indicated by an arrow in FIG. 12, the candidate area NPa at the upper right end is selected as the first attention candidate area from these (k × m) candidate areas. Then, candidate areas whose positions are shifted downward by one pixel are sequentially selected. When the lower right candidate area NPb is selected, a candidate area shifted by one pixel to the left from the position of the upper right candidate area NPa is selected. After that, candidate areas whose positions are shifted downward by one pixel again are sequentially selected. The candidate region selected last is the candidate region NPd at the lower left end.

1個の注目候補領域が選択されると、S310では、CPU410は、右側スキャン画像20R内の基準領域SP(図7(A))内の全ての画素のうち、1個の画素を注目画素として選択する。   When one attention candidate area is selected, in S310, the CPU 410 sets one pixel as the attention pixel among all the pixels in the reference area SP (FIG. 7A) in the right scan image 20R. select.

S320では、CPU410は、注目画素に対応するマスク画像MP(図7(C))内の画素(以下、対応マスク画素とも呼ぶ。)の値に基づいて、注目画素が参照画素であるか否かを判断する。具体的には、対応マスク画素の値が、「ON」である場合には、注目画素は参照画素であると判断される。対応マスク画素の値が、「OFF」である場合には、注目画素は参照画素でないと判断される。   In S320, the CPU 410 determines whether or not the target pixel is a reference pixel based on the value of a pixel (hereinafter also referred to as a corresponding mask pixel) in the mask image MP (FIG. 7C) corresponding to the target pixel. Judging. Specifically, when the value of the corresponding mask pixel is “ON”, it is determined that the target pixel is a reference pixel. When the value of the corresponding mask pixel is “OFF”, it is determined that the target pixel is not a reference pixel.

注目画素が、参照画素である場合には(S320:YES)、S325において、CPU410は、基準領域SP内の注目画素の値と、当該注目画素に対応する注目候補領域内の画素の値と、の差ΔVPを算出する。差ΔVPを算出すべき2個の画素の値を、(R1、G1、B1)と(R2、G2、B2)とする。差ΔVPは、3種類の成分値間の差分の絶対値の和で表される。すなわち、差ΔVPは、(R1−R2)の絶対値と、(G1−G2)の絶対値と、(B1−B2)の絶対値と、の合計値で表される。これに代えて、差ΔVPには、(R1、G1、B1)と(R2、G2、B2)とのユークリッド距離が用いられても良い。   When the target pixel is a reference pixel (S320: YES), in S325, the CPU 410 determines the value of the target pixel in the reference region SP, the value of the pixel in the target candidate region corresponding to the target pixel, The difference ΔVP is calculated. The values of the two pixels for which the difference ΔVP is to be calculated are (R1, G1, B1) and (R2, G2, B2). The difference ΔVP is represented by the sum of absolute values of differences between the three types of component values. That is, the difference ΔVP is represented by the sum of the absolute value of (R1−R2), the absolute value of (G1−G2), and the absolute value of (B1−B2). Instead, the Euclidean distance between (R1, G1, B1) and (R2, G2, B2) may be used for the difference ΔVP.

続くS330では、CPU410は、算出された差ΔVPが、所定の基準値TH1以下であるか否かを判断する。差ΔVPが、所定の基準値TH1以下である場合には(S330:YES)、S335において、CPU410は、類似画素数SCをカウントアップする。差ΔVPが、所定の基準値TH1以下である場合には、基準領域SP内の注目画素と、当該注目画素に対応する注目候補領域内の画素とは、類似する画素であると判断できるからである。   In subsequent S330, CPU 410 determines whether or not calculated difference ΔVP is equal to or smaller than a predetermined reference value TH1. When the difference ΔVP is equal to or smaller than the predetermined reference value TH1 (S330: YES), in S335, the CPU 410 counts up the number of similar pixels SC. When the difference ΔVP is equal to or smaller than the predetermined reference value TH1, it is possible to determine that the target pixel in the reference region SP and the pixel in the target candidate region corresponding to the target pixel are similar pixels. is there.

差ΔVPが、所定の基準値TH1より大きい場合には(S330:NO)、CPU410は、S335をスキップして、処理をS340に進める。   When the difference ΔVP is larger than the predetermined reference value TH1 (S330: NO), the CPU 410 skips S335 and advances the process to S340.

上述したS320にて、注目画素が、非参照画素である場合には(S320:NO)、S325において、CPU410は、S325〜S335をスキップして、処理をS340に進める。   When the target pixel is a non-reference pixel in S320 described above (S320: NO), in S325, the CPU 410 skips S325 to S335 and advances the process to S340.

S340では、CPU410は、基準領域SP内の全ての画素を注目画素として処理したか否かを判断する。未処理の画素がある場合には(S340:NO)、CPU410は、S310に戻って、未処理の画素を注目画素として選択する。全ての画素が処理された場合には(S340:YES)、CPU410は、S342に処理を進める。   In S340, the CPU 410 determines whether or not all the pixels in the reference area SP have been processed as the target pixel. When there is an unprocessed pixel (S340: NO), the CPU 410 returns to S310 and selects an unprocessed pixel as a target pixel. If all the pixels have been processed (S340: YES), the CPU 410 advances the process to S342.

S342では、CPU410は、基準領域SPと、注目候補領域と、の類似度(SC/Nrt)を算出する。類似度(SC/Nrt)は、基準領域SP内の参照画素の総数Nrtに対する類似画素数SCの割合である。類似度(SC/Nrt)が大きいほど、基準領域SPと、注目候補領域とは、類似している。   In S342, the CPU 410 calculates the similarity (SC / Nrt) between the reference area SP and the candidate area of interest. The similarity (SC / Nrt) is a ratio of the number of similar pixels SC to the total number Nrt of reference pixels in the standard region SP. As the similarity (SC / Nrt) is larger, the reference region SP and the candidate region of interest are more similar.

S345では、CPU410は、類似度(SC/Nrt)が、閾値TH2以上であるか否かを判断する。   In S345, CPU 410 determines whether the similarity (SC / Nrt) is equal to or higher than threshold value TH2.

類似度(SC/Nrt)が、閾値TH2以上である場合には(S345:YES)、S350において、CPU410は、現在の注目候補領域を、基準領域SPに対応する対応領域CPとして決定して、対応領域決定処理を終了する。   When the similarity (SC / Nrt) is equal to or greater than the threshold value TH2 (S345: YES), in S350, the CPU 410 determines the current candidate region of interest as the corresponding region CP corresponding to the reference region SP, and The corresponding area determination process ends.

類似度(SC/Nrt)が、閾値TH2未満である場合には(S345:NO)、S355において、CPU410は、探索領域SA内の全ての候補領域(図12)を注目候補領域として処理したか否かを判断する。未処理の候補領域がある場合には(S355:NO)、CPU410は、S360において、類似画素数SCを初期化したうえで、S305に戻って、未処理の候補領域を注目候補領域として選択する。全ての候補領域が処理された場合には(S355:YES)、CPU410は、基準領域SPに対応する対応領域CPを決定できないまま、対応領域決定処理を終了する。   If the similarity (SC / Nrt) is less than the threshold value TH2 (S345: NO), in S355, has the CPU 410 processed all candidate areas (FIG. 12) in the search area SA as attention candidate areas? Judge whether or not. If there is an unprocessed candidate area (S355: NO), the CPU 410 initializes the number of similar pixels SC in S360, and returns to S305 to select the unprocessed candidate area as the attention candidate area. . When all the candidate areas have been processed (S355: YES), the CPU 410 ends the corresponding area determination process without determining the corresponding area CP corresponding to the reference area SP.

図5(A)には、左側スキャン画像20Lの探索領域SA内に、決定された対応領域CPが図示されている。   FIG. 5A shows the determined corresponding area CP in the search area SA of the left scan image 20L.

対応領域決定処理が終了すると、図2のS40では、CPU410は、合成処理を実行する。合成処理は、右側スキャンデータと左側スキャンデータとを用いて、右側スキャン画像20R内の右側原稿画像HIRと、左側スキャン画像20L内の左側原稿画像HILと合成された合成画像を表す合成画像データが生成される。   When the corresponding area determination process is completed, the CPU 410 executes a composition process in S40 of FIG. In the synthesis process, using the right scan data and the left scan data, composite image data representing a composite image synthesized with the right original image HIR in the right scan image 20R and the left original image HIL in the left scan image 20L is obtained. Generated.

図13は、合成画像30の一例を示す図である。図13に示すように、合成画像30において、右側原稿画像HIRと左側原稿画像HILとは、右側原稿画像HIR内の基準領域SPと、左側原稿画像HIL内の対応領域CPと、が重なるように、合成される。合成画像30において、右側原稿画像HIRと左側原稿画像HILとが互いに重なり合う領域内の画素の値には、例えば、右側原稿画像HIR(右側スキャン画像20R)内の画素の値が優先的に採用される。これによって、右側原稿画像HIRと左側原稿画像HILとが合成されて、図3の原稿10を表す合成画像30が生成される。   FIG. 13 is a diagram illustrating an example of the composite image 30. As shown in FIG. 13, in the composite image 30, the right original image HIR and the left original image HIL are such that the reference area SP in the right original image HIR and the corresponding area CP in the left original image HIL overlap. Is synthesized. In the composite image 30, for example, the pixel value in the right original image HIR (right scan image 20R) is preferentially adopted as the pixel value in the region where the right original image HIR and the left original image HIL overlap each other. The As a result, the right original image HIR and the left original image HIL are combined to generate a combined image 30 representing the original 10 in FIG.

なお、図11の対応領域決定処理において、基準領域SPに対応する対応領域CPを決定できなかった場合には(図11のS355:YES)、例えば、機械的に、左側スキャン画像20Lの右端の辺と、右側スキャン画像20Rの左端の辺と、が接するように、2個のスキャン画像が合成された合成画像を表す合成画像データが生成される(図示省略)。   If the corresponding region CP corresponding to the reference region SP cannot be determined in the corresponding region determination process in FIG. 11 (S355 in FIG. 11: YES), for example, mechanically, the right end of the left scanned image 20L Composite image data representing a composite image obtained by combining the two scan images is generated so that the side and the left end side of the right scan image 20R are in contact with each other (not shown).

図2のS45では、CPU410は、生成された合成画像データを複合機200に対して送信する。複合機200のCPU210は、合成画像データを受信すると、受信した合成画像データを不揮発性記憶装置230に格納するとともに、ユーザに合成画像データを受信したことを通知する。合成画像データは、ユーザの利用に供される。ユーザは、例えば、複合機200に、これらの合成画像データを用いて、合成画像30を印刷させることができる。   In S <b> 45 of FIG. 2, the CPU 410 transmits the generated composite image data to the multifunction device 200. When the composite image data is received, the CPU 210 of the multifunction device 200 stores the received composite image data in the nonvolatile storage device 230 and notifies the user that the composite image data has been received. The composite image data is used for the user. For example, the user can cause the MFP 200 to print the composite image 30 using these composite image data.

上記実施例によれば、右側スキャン画像20R内の基準領域SP内の複数個の画素の値のばらつきを示す値、すなわち、上述した基準領域SP内の画素の総数Ntに対するばらつき画素の個数Nvの割合(Nv/Nt)が算出される(図6のS115)。そして、ばらつきを示す値(Nv/Nt)に基づいて、間引率TRが算出される(図6のS120)。上述したように、間引率TRは、基準領域SP内の画素の総数に占める参照画素の割合を示す参照率RRと、RR=(100−TR)という関係がある。すなわち、図6のS120にて、間引率TRが決定されることは、参照率RRが決定されることと同義である。   According to the above embodiment, the value indicating the variation in the values of the plurality of pixels in the reference region SP in the right scan image 20R, that is, the number Nv of the variation pixels with respect to the total number Nt of pixels in the reference region SP described above. The ratio (Nv / Nt) is calculated (S115 in FIG. 6). Then, the thinning rate TR is calculated based on the value (Nv / Nt) indicating the variation (S120 in FIG. 6). As described above, the thinning rate TR has a relationship of RR = (100−TR) with the reference rate RR indicating the ratio of the reference pixels to the total number of pixels in the reference region SP. That is, determining the thinning rate TR in S120 of FIG. 6 is synonymous with determining the reference rate RR.

そして、間引率TRに基づいて(換言すれば、参照率RRに基づいて)、基準領域SPと、複数個の候補領域のそれぞれと、の類似度(SC/Nrt)が算出される。より具体的には、間引率TRに基づいて、マスク画像データが生成され(図6のS125)、マスク画像データを参照して、類似度(SC/Nrt)が算出される(図11のS310〜S342)。そして、類似度(SC/Nrt)に基づいて、複数の候補領域のうちの1つの候補領域が、対応領域CPとして決定される(図11のS350)。したがって、合成画像30(図13)において、右側原稿画像HIRと左側原稿画像HILとを合成する位置を決定する精度(以下、単に合成精度と呼ぶ)の低下を抑制することができる。   Then, based on the thinning rate TR (in other words, based on the reference rate RR), the similarity (SC / Nrt) between the reference region SP and each of the plurality of candidate regions is calculated. More specifically, mask image data is generated based on the thinning rate TR (S125 in FIG. 6), and the similarity (SC / Nrt) is calculated with reference to the mask image data (S310 in FIG. 11). ~ S342). Then, based on the similarity (SC / Nrt), one candidate region among the plurality of candidate regions is determined as the corresponding region CP (S350 in FIG. 11). Therefore, in the synthesized image 30 (FIG. 13), it is possible to suppress a decrease in accuracy (hereinafter simply referred to as synthesis accuracy) for determining a position where the right original image HIR and the left original image HIL are synthesized.

換言すれば、CPU410は、基準領域SP内の複数個の画素の値のばらつきに基づいて、基準領域SP内のN個(Nは3以上の整数)の画素(具体的には、基準領域SP内の全ての画素)の中から、類似度の算出に用いられるM個(Mは1以上N未満の整数)の画素(具体的には、参照画像)を決定する(図6のS125)。そして、CPU410は、基準領域SP内のM個の画素と、基準領域SP内のM個の画素に対応する各候補領域内のM個の画素と、を用いて、類似度(SC/Nrt)が算出される(図11のS310〜S342)。この結果、適切な個数の画素を用いて類似度(SC/Nrt)が算出されるので、対応領域CPを適切に決定することができる。したがって、合成画像30における右側スキャン画像20Rと左側スキャン画像20Lとの合成位置を決定する精度の低下を抑制することができる。   In other words, the CPU 410 determines N pixels (N is an integer of 3 or more) in the reference area SP (specifically, the reference area SP based on the variation in the values of the plurality of pixels in the reference area SP. M pixels (specifically, reference images) used for calculating the similarity are determined (specifically, reference images) (S125 in FIG. 6). Then, the CPU 410 uses the M pixels in the reference area SP and the M pixels in each candidate area corresponding to the M pixels in the reference area SP, and uses the similarity (SC / Nrt). Is calculated (S310 to S342 in FIG. 11). As a result, since the similarity (SC / Nrt) is calculated using an appropriate number of pixels, the corresponding region CP can be appropriately determined. Therefore, it is possible to suppress a decrease in accuracy in determining the composite position of the right scan image 20R and the left scan image 20L in the composite image 30.

具体的には、図11の対応領域決定処理において、基準領域SP内の全ての画素を参照画素とすると、計算負荷が過度に高くなる可能性がある。しかしながら、参照率RRを単純に低くする場合には、計算負荷を低減することはできるが、合成精度が低下する可能性があった。一方で、基準領域SP内の複数個の画素のばらつきが比較的大きい場合には、基準領域SP内にエッジなどの特徴的な要素が比較的多く含まれていると考えられる。この場合には、参照率RRを低くしても十分な合成精度を達成できる可能性が高い。一方、基準領域SP内の複数個の画素のばらつきが比較的小さい場合には、基準領域SP内は、背景を示す領域や、オブジェクトの内部の色の変化が乏しい領域などの比較的特徴がない画像が比較的多く含まれていると考えられる。この場合には、合成精度を確保することが困難になるので、参照率RRを低くすると十分な合成精度を達成できない可能性がある。このため、この場合には、参照率RRを高くすることが好ましい。本実施例では、CPU410は、基準領域SP内の複数個のばらつきを示す値(Nv/Nt)が小さいほど、高い参照率RRを決定している、換言すれば、値(Nv/Nt)が小さいほど、低い間引率TRを決定している(図6のS120)。そして、CPU410は、参照率RRが高いほど、基準領域SP内の多数の画素の値を用いて、類似度(SC/Nrt)を算出している(図11)。換言すれば、基準領域SP内の複数個の画素の値のばらつきが小さいほど、類似度(SC/Nrt)の算出に用いられる基準領域SP内の画素の個数Mが大きくされる。この結果、合成精度の低下を抑制しつつ、処理速度の向上を図ることができる。   Specifically, in the corresponding area determination process in FIG. 11, if all the pixels in the reference area SP are set as reference pixels, the calculation load may be excessively increased. However, when the reference rate RR is simply lowered, the calculation load can be reduced, but the synthesis accuracy may be lowered. On the other hand, when the variation of a plurality of pixels in the reference region SP is relatively large, it is considered that a relatively large number of characteristic elements such as edges are included in the reference region SP. In this case, there is a high possibility that sufficient synthesis accuracy can be achieved even if the reference rate RR is lowered. On the other hand, when the variation of the plurality of pixels in the reference area SP is relatively small, the reference area SP has relatively no features such as an area indicating the background and an area in which the color change inside the object is scarce. It is considered that a relatively large number of images are included. In this case, it is difficult to ensure the synthesis accuracy. Therefore, if the reference rate RR is lowered, sufficient synthesis accuracy may not be achieved. For this reason, in this case, it is preferable to increase the reference rate RR. In this embodiment, the CPU 410 determines a higher reference rate RR as the value (Nv / Nt) indicating a plurality of variations in the reference area SP is smaller. In other words, the value (Nv / Nt) is higher. The smaller the value is, the lower the thinning-out rate TR is determined (S120 in FIG. 6). Then, the CPU 410 calculates the similarity (SC / Nrt) using the values of a large number of pixels in the reference area SP as the reference rate RR is higher (FIG. 11). In other words, the smaller the variation in the values of the plurality of pixels in the reference area SP, the larger the number M of pixels in the reference area SP used for calculating the similarity (SC / Nrt). As a result, it is possible to improve the processing speed while suppressing a decrease in synthesis accuracy.

さらに、上記実施例では、CPU410は、参照率RRに基づいて、換言すれば、間引率TRに基づいて、参照画素と非参照画素とを定義するマスクデータを生成している(図9、図10)。すなわち、参照率RRに基づいて、基準領域SPの複数個の画素の中から、複数個の参照画素が決定される。そして、決定された複数個の参照画素の値を用いて類似度(SC/Nrt)が算出される(図11)。そして、決定される参照画素の個数は、参照率RRが高いほど多い、換言すれば、間引率TRが低いほど多い(図10)。したがって、基準領域SP内の複数個の画素のうち、適切な個数の参照画素の値を用いて、類似度(SC/Nrt)を適切に算出できる。この結果、合成精度の低下を抑制しつつ、処理速度の向上を図ることができる。   Furthermore, in the above embodiment, the CPU 410 generates mask data that defines reference pixels and non-reference pixels based on the reference rate RR, in other words, based on the thinning rate TR (FIG. 9, FIG. 9). 10). That is, based on the reference rate RR, a plurality of reference pixels are determined from a plurality of pixels in the standard region SP. Then, the similarity (SC / Nrt) is calculated using the determined values of the plurality of reference pixels (FIG. 11). The number of reference pixels to be determined increases as the reference rate RR increases, in other words, as the decimation rate TR decreases (FIG. 10). Therefore, the similarity (SC / Nrt) can be appropriately calculated using the values of an appropriate number of reference pixels among a plurality of pixels in the standard region SP. As a result, it is possible to improve the processing speed while suppressing a decrease in synthesis accuracy.

また、類似度は、基準領域SP内の参照画素の値と、当該参照画素に対応する候補領域内の画素の値と、の差ΔVPに基づいて算出される(図11のS325)。したがって、基準領域SP内の複数個の画素のうち、類似度の算出に用いられる画素の個数が多くなれば、候補領域内の複数個の画素のうち、類似度の算出に用いられる画素の個数も多くなる。すなわち、CPU410は、参照率RRが高いほど、類似度を算出する際に用いる基準領域SP内の画素の個数と、類似度を算出する際に用いる候補領域内の画素の個数と、をそれぞれ多くする。したがって、参照率RRに応じて適切な個数の画素を用いて、類似度が算出されるので、合成精度の低下を適切に抑制することができる。   The similarity is calculated based on the difference ΔVP between the value of the reference pixel in the standard area SP and the value of the pixel in the candidate area corresponding to the reference pixel (S325 in FIG. 11). Therefore, if the number of pixels used for calculating the similarity among a plurality of pixels in the reference region SP increases, the number of pixels used for calculating the similarity among the plurality of pixels in the candidate region. Will also increase. That is, as the reference rate RR is higher, the CPU 410 increases the number of pixels in the reference area SP used when calculating the similarity and the number of pixels in the candidate area used when calculating the similarity. To do. Therefore, since the similarity is calculated using an appropriate number of pixels according to the reference rate RR, it is possible to appropriately suppress a decrease in synthesis accuracy.

B.第2実施例
第2実施例の参照画素決定処理は、第1実施例の参照画素決定処理と異なる処理を含んでいる。第2実施例のその他の点は、第1実施例と同じである。図14は、第2実施例の参照画素決定処理のフローチャートである。図15は、第2実施例の参照画素決定処理の説明図である。
B. Second Embodiment The reference pixel determination process of the second embodiment includes a process different from the reference pixel determination process of the first embodiment. The other points of the second embodiment are the same as those of the first embodiment. FIG. 14 is a flowchart of reference pixel determination processing according to the second embodiment. FIG. 15 is an explanatory diagram of reference pixel determination processing according to the second embodiment.

図14の第2実施例の参照画素決定処理では、図6の第1実施例の参照画素決定処理と同様にS105とS110の処理が実行される。この結果、第1実施例と同様に、基準領域SP内の複数個の画素は、ばらつき画素と、非ばらつき画素と、に分類される。図15(B)には、ばらつき画素と非ばらつき画素とに分類することによって得られる二値画像EPが示されている。図15(B)に示す二値画像EPによって、基準領域SPは、複数個の非ばらつき画素によって構成される第1の領域SVと、複数個のばらつき画素によって構成される第2の領域BVと、に分離される。換言すれば、基準領域SPは、内部の複数個の画素の値のばらつきが比較的小さな第1の領域SVと、内部の複数個の画素の値のばらつきが比較的大きな第2の領域BVと、に分離される。   In the reference pixel determination process of the second embodiment shown in FIG. 14, the processes of S105 and S110 are executed in the same manner as the reference pixel determination process of the first embodiment shown in FIG. As a result, as in the first embodiment, the plurality of pixels in the reference region SP are classified into a variation pixel and a non-variation pixel. FIG. 15B shows a binary image EP obtained by classifying into a variation pixel and a non-variation pixel. With the binary image EP shown in FIG. 15B, the reference region SP includes a first region SV composed of a plurality of non-variable pixels and a second region BV composed of a plurality of variation pixels. , Separated. In other words, the reference region SP includes a first region SV in which the variation in the values of the plurality of internal pixels is relatively small, and a second region BV in which the variation in the values of the plurality of internal pixels is relatively large. , Separated.

図14の第2実施例の参照画素決定処理では、図6のS115〜S125に代えて、S120Bの処理が実行される。S120Bでは、CPU410は、基準領域SPのうち、複数個の非ばらつき画素で構成される第1の領域SV内の複数個の画素が間引かれたマスクデータを生成する。具体的には、CPU410は、第1の領域SVの参照率RR1を50%に設定し、第2の領域BV内の参照率RR2を100%に設定する。そして、CPU410は、当該参照率RR1、RR2に従って、マスクデータを生成する。生成されるマスクデータによって表されるマスク画像MP内の第1の領域SV内には、参照画素を示す「ON」の画素と、非参照画素を示す「OFF」の画素と、が50%ずつ配置され、第2の領域BV内には、参照画素を示す「ON」の画素のみが配置される(図15(C))。   In the reference pixel determination process of the second embodiment of FIG. 14, the process of S120B is executed instead of S115 to S125 of FIG. In S120B, the CPU 410 generates mask data in which a plurality of pixels in the first region SV composed of a plurality of non-variable pixels in the reference region SP are thinned out. Specifically, the CPU 410 sets the reference rate RR1 of the first region SV to 50%, and sets the reference rate RR2 in the second region BV to 100%. Then, the CPU 410 generates mask data according to the reference rates RR1 and RR2. In the first area SV in the mask image MP represented by the generated mask data, “ON” pixels indicating reference pixels and “OFF” pixels indicating non-reference pixels are 50% each. In the second region BV, only “ON” pixels indicating reference pixels are arranged (FIG. 15C).

以上説明した第2実施例によれば、基準領域SPの第1の領域SVの参照率と、第2の領域の参照率とが、互いに異なるレベルに決定される。すなわち、ばらつきが互いに異なる第1の領域SVと第2の領域BVとに対して、それぞれ異なる参照率が決定される。   According to the second embodiment described above, the reference rate of the first region SV of the standard region SP and the reference rate of the second region are determined at different levels. That is, different reference rates are determined for the first region SV and the second region BV, which have different variations.

換言すれば、CPU410は、基準領域SP内の複数個の画素のばらつきに基づいて、第1の領域SVと、第2の領域BVと、を特定している(図14のS110、図15(B))。そして、類似度(SC/Nrt)の算出に用いられるM個の画素の一部として、第1の領域SV内のN1個(N1は2以上の整数)の画素の中から、M1個(M1は1以上N1未満の整数)の画素が定されるとともに、第2の領域BV内のN2個(N2は2以上の整数)の画素の中から、M2個(M2は1以上N2未満の整数)の画素が決定される(図14のS120B)。そして、第1の領域SV内のN1個の画素に対するM1個の画素の割合(M1/N1)、すなわち、第1の領域SVの参照率RR1(具体的には、50%)と、第2の領域BV内のN2個の画素に対するM2個の画素の割合(M2/N2)、すなわち、第2の領域BVの参照率RR2(具体的には、100%)とは、互いに異なる。その結果、合成画像データによって表される合成画像における右側原稿画像HIRと左側原稿画像HILとの合成精度を向上することができる。   In other words, the CPU 410 identifies the first area SV and the second area BV based on the variation of the plurality of pixels in the reference area SP (S110 in FIG. 14, FIG. 15 ( B)). Then, as a part of the M pixels used for the calculation of the similarity (SC / Nrt), M1 (M1) of N1 (N1 is an integer of 2 or more) pixels in the first area SV. Is an integer of 1 or more and less than N1, and M2 pixels (M2 is an integer of 1 or more and less than N2) out of N2 pixels (N2 is an integer of 2 or more) in the second region BV. ) Is determined (S120B in FIG. 14). The ratio (M1 / N1) of M1 pixels to N1 pixels in the first region SV, that is, the reference rate RR1 (specifically, 50%) of the first region SV, and the second The ratio (M2 / N2) of M2 pixels to N2 pixels in the region BV of the second region BV, that is, the reference rate RR2 (specifically, 100%) of the second region BV is different from each other. As a result, the synthesis accuracy of the right original image HIR and the left original image HIL in the composite image represented by the composite image data can be improved.

より具体的には、ばらつきが比較的大きな第2の領域BVの参照率RR2(すなわち、割合(M2/N2))は、ばらつきが比較的小さな第1の領域SVの参照率RR1(すなわち、割合(M1/N1))より大きい。この結果、合成画像における合成精度を向上することができる。   More specifically, the reference rate RR2 (that is, the ratio (M2 / N2)) of the second region BV having a relatively large variation is the reference rate RR1 (that is, the rate) of the first region SV having a relatively small variation. Larger than (M1 / N1)). As a result, the synthesis accuracy in the synthesized image can be improved.

画素のばらつきが比較的小さい領域内の画素の値に基づいて、基準領域SPに対応する対応領域CPが決定されると、ばらつきが比較的大きな領域内の画素の値に基づいて、基準領域SPに対応する対応領域CPが決定される場合と比較して、誤った領域が対応領域CPに決定されやすい。換言すれば、エッジなどがあまり存在しない領域を基準にして、類似する領域を探索するよりも、エッジが多く存在する領域を基準にして、類似する領域を探索するほうが、精度良く類似する領域を探索できる。第2実施例によれば、画素のばらつきが第1の領域SVより大きい第2の領域BVの参照率を第1の領域より高くするので、基準領域SPに対応する対応領域CPをより精度良く決定することができる。したがって、合成画像における合成精度を向上することができる。   When the corresponding region CP corresponding to the reference region SP is determined based on the value of the pixel in the region where the pixel variation is relatively small, the reference region SP is determined based on the value of the pixel in the region where the variation is relatively large. Compared with the case where the corresponding region CP corresponding to is determined, an erroneous region is easily determined as the corresponding region CP. In other words, it is more accurate to search for similar regions with reference to regions with many edges than to search for similar regions based on regions with few edges. You can explore. According to the second embodiment, since the reference rate of the second area BV in which the pixel variation is larger than the first area SV is higher than that of the first area, the corresponding area CP corresponding to the reference area SP is more accurately determined. Can be determined. Therefore, the synthesis accuracy in the synthesized image can be improved.

第2実施例では、第1の領域SV内の複数個の画素のうちの第1の割合(具体的には、50%)の画素の値と、第2の領域BV内の複数個の画素のうちの第2の割合(具体的には100%)の画素の値と、を用いて、類似度(SC/Nrt)が算出される。そして、
第2の割合は、第1の割合より高く設定されている。これによって、第1の領域SVの参照率が、第2の領域BVの参照率より高くなる。この結果、合成画像30における合成精度が向上できる。
In the second embodiment, the pixel value of the first ratio (specifically, 50%) of the plurality of pixels in the first region SV and the plurality of pixels in the second region BV. The degree of similarity (SC / Nrt) is calculated using the second ratio (specifically, 100%) of pixel values. And
The second ratio is set higher than the first ratio. Thereby, the reference rate of the first region SV becomes higher than the reference rate of the second region BV. As a result, the synthesis accuracy in the synthesized image 30 can be improved.

C.第3実施例
第3実施例では、図14の第2実施例の参照画素決定処理のS120Bの処理は、省略される。したがって、第3実施例の参照画素決定処理は、図15(B)に示すように、基準領域SPの内部の複数個の画素が、ばらつき画素と非ばらつき画素とに分類された時点で終了される。
C. Third Example In the third example, the process of S120B of the reference pixel determination process of the second example of FIG. 14 is omitted. Therefore, the reference pixel determination process of the third embodiment is finished when a plurality of pixels in the reference region SP are classified into a variation pixel and a non-variation pixel, as shown in FIG. The

第3実施例の対応領域決定処理は、第1実施例および第2実施例の対応領域決定処理(図11)と異なる処理を含んでいる。第3実施例のその他の点は、第2実施例と同じである。図16は、第3実施例の対応領域決定処理のフローチャートである。図16のフローチャートにおいて、図11の対応領域決定処理と異なるステップについては、符号の末尾に「C」を付し、図11の対応領域決定処理と同一のステップについては、図11のフローチャートと同じ符号を付した。   The corresponding area determining process of the third embodiment includes a process different from the corresponding area determining process (FIG. 11) of the first and second embodiments. The other points of the third embodiment are the same as those of the second embodiment. FIG. 16 is a flowchart of the corresponding area determining process according to the third embodiment. In the flowchart of FIG. 16, steps different from the corresponding area determination process of FIG. 11 are denoted by “C” at the end of the reference numerals, and the same steps as the corresponding area determination process of FIG. A reference is attached.

図16の第3実施例の対応領域決定処理では、第1の類似画素数SC1と、第2の類似画素数SC2と、の2種類のパラメータが用いられる。図16の第3実施例の対応領域決定処理では、S320Cにおいて、CPU410は、図15(B)の二値画像EPを参照して、注目画素がばらつき画素であるか否かを判断する。   In the corresponding area determination process of the third embodiment of FIG. 16, two types of parameters, the first similar pixel number SC1 and the second similar pixel number SC2, are used. In the corresponding area determination process of the third example of FIG. 16, in S320C, the CPU 410 refers to the binary image EP of FIG. 15B to determine whether or not the target pixel is a variation pixel.

そして、注目画素がばらつき画素である場合には(S320C:YES)、すなわち、注目画素が、ばらつき画素で構成される第2の領域BVに属する場合には、CPU410は、図11のS325、S330と同様に、基準領域SP内の注目画素の値と、当該注目画素に対応する注目候補領域内の画素の値と、の差ΔVPを算出し(S325)、差ΔVPが、所定の基準値TH1以下であるか否かを判断する(S330)。そして、差ΔVPが、所定の基準値TH1以下である場合には(S330:YES)、S335Cにおいて、CPU410は、第2の類似画素数SC2をカウントアップする。また、差ΔVPが、所定の基準値TH1より大きい場合には(S330:NO)、CPU410は、S335Cをスキップして、処理をS340に進める。   If the target pixel is a variation pixel (S320C: YES), that is, if the target pixel belongs to the second region BV composed of the variation pixel, the CPU 410 performs S325 and S330 in FIG. Similarly, the difference ΔVP between the value of the target pixel in the reference region SP and the value of the pixel in the target candidate region corresponding to the target pixel is calculated (S325), and the difference ΔVP is the predetermined reference value TH1. It is determined whether or not the following is true (S330). If the difference ΔVP is equal to or smaller than the predetermined reference value TH1 (S330: YES), in S335C, the CPU 410 counts up the second number of similar pixels SC2. On the other hand, when the difference ΔVP is larger than the predetermined reference value TH1 (S330: NO), the CPU 410 skips S335C and advances the process to S340.

注目画素が非ばらつき画素である場合には(S320C:NO)、すなわち、注目画素が、非ばらつき画素で構成される第1の領域SVに属する場合には、CPU410は、図11のS325、S330と同様に、基準領域SP内の注目画素の値と、当該注目画素に対応する注目候補領域内の画素の値と、の差ΔVPを算出し(S336C)、差ΔVPが、所定の基準値TH1以下であるか否かを判断する(S337C)。そして、差ΔVPが、所定の基準値TH1以下である場合には(S337C:YES)、S338Cにおいて、CPU410は、第1の類似画素数SC1をカウントアップする。また、差ΔVPが、所定の基準値TH1より大きい場合には(S337C:NO)、CPU410は、S338Cをスキップして、処理をS340に進める。   When the target pixel is a non-variable pixel (S320C: NO), that is, when the target pixel belongs to the first region SV composed of non-variable pixels, the CPU 410 performs S325 and S330 in FIG. Similarly, the difference ΔVP between the value of the target pixel in the reference region SP and the value of the pixel in the target candidate region corresponding to the target pixel is calculated (S336C), and the difference ΔVP is a predetermined reference value TH1. It is determined whether or not the following is true (S337C). When the difference ΔVP is equal to or smaller than the predetermined reference value TH1 (S337C: YES), in S338C, the CPU 410 counts up the first similar pixel number SC1. On the other hand, when the difference ΔVP is larger than the predetermined reference value TH1 (S337C: NO), the CPU 410 skips S338C and advances the process to S340.

すなわち、第3実施例の対応領域決定処理では、注目画素が、図15(B)の第1の領域SVに属する画素(すなわち、非ばらつき画素)である場合には、注目画素と注目画素に対応する注目候補領域内の画素とが類似していることを条件に、第1の類似画素数SC1がカウントアップされる。そして、注目画素が、図15(B)の第2の領域BVに属する画素(すなわち、ばらつき画素)である場合には、注目画素と注目画素に対応する注目候補領域内の画素とが類似していることを条件に、第2の類似画素数SC2がカウントアップされる。   That is, in the corresponding region determination process of the third embodiment, when the target pixel is a pixel belonging to the first region SV in FIG. 15B (that is, a non-variable pixel), the target pixel and the target pixel are determined. The first similar pixel number SC1 is counted up on condition that the corresponding pixel in the candidate region of interest is similar. When the target pixel is a pixel belonging to the second region BV in FIG. 15B (that is, a variation pixel), the target pixel and the pixel in the target candidate region corresponding to the target pixel are similar. The second similar pixel number SC2 is counted up.

S340では、CPU410は、基準領域SP内の全ての画素を注目画素として処理したか否かを判断する。未処理の画素がある場合には(S340:NO)、CPU410は、S310に戻って、未処理の画素を注目画素として選択する。全ての画素が処理された場合には(S340:YES)、CPU410は、S342Cに処理を進める。   In S340, the CPU 410 determines whether or not all the pixels in the reference area SP have been processed as the target pixel. When there is an unprocessed pixel (S340: NO), the CPU 410 returns to S310 and selects an unprocessed pixel as a target pixel. When all the pixels have been processed (S340: YES), the CPU 410 advances the process to S342C.

S342Cでは、CPU410は、第1の類似画素数SC1と、第2の類似画素数SC2と、を用いて、トータルの類似度SCtotalを算出する。類似度SCtotalは、以下の式(2)を用いて算出される。
SCtotal=WT1×SC1+WT2×SC2 ...(2)
In S342C, the CPU 410 calculates the total similarity SCtotal using the first similar pixel number SC1 and the second similar pixel number SC2. The similarity SCtotal is calculated using the following equation (2).
SCtotal = WT1 * SC1 + WT2 * SC2 (2)

ここで、WT1は、第1の領域SV内の画素、すなわち、非ばらつき画素に対する重み付けである。WT2は、第2の領域BV内の画素、すなわち、ばらつき画素に対する重み付けである。第2の領域BV内の画素に対する重み付けWT2は、第1の領域SV内の画素に対する重み付けWT1より大きい。本実施例では、WT1=0.5、WT2=1.0である。トータルの類似度SCtotalが大きいほど、基準領域SPと、注目候補領域とは、類似している。   Here, WT1 is a weight for the pixels in the first region SV, that is, non-variable pixels. WT2 is a weight for the pixels in the second region BV, that is, the variation pixels. The weighting WT2 for the pixels in the second area BV is larger than the weighting WT1 for the pixels in the first area SV. In this embodiment, WT1 = 0.5 and WT2 = 1.0. As the total similarity SCtotal is larger, the reference region SP and the candidate region of interest are more similar.

上記式(2)の第1項(WT1×SC1)は、基準領域SP内の第1の領域SVと、第1の領域SVに対応する注目候補領域内の部分領域(第1の部分候補領域とも呼ぶ)と、の間の類似度(第1の部分類似度とも呼ぶ)と、言うことができる。上記式(2)の第2項(WT2×SC2)は、基準領域SP内の第2の領域BVと、第2の領域BVに対応する注目候補領域内の部分領域(第2の部分候補領域とも呼ぶ)と、の間の類似度(第2の部分類似度とも呼ぶ)と、言うことができる。   The first term (WT1 × SC1) of the above formula (2) includes the first region SV in the reference region SP and the partial region (first partial candidate region) in the candidate region of interest corresponding to the first region SV. And a similarity between them (also referred to as a first partial similarity). The second term (WT2 × SC2) of the above formula (2) includes the second region BV in the reference region SP and a partial region (second partial candidate region) in the target candidate region corresponding to the second region BV. And the similarity between them (also referred to as the second partial similarity).

S345Cでは、CPU410は、トータルの類似度SCtotalが、閾値TH3以上であるか否かを判断する。   In S345C, CPU 410 determines whether or not total similarity SCtotal is equal to or greater than threshold value TH3.

トータルの類似度SCtotalが、閾値TH3以上である場合には(S345C:YES)、S350において、CPU410は、現在の注目候補領域を、基準領域SPに対応する対応領域CPとして決定して、対応領域決定処理を終了する。   If the total similarity SCtotal is equal to or greater than the threshold value TH3 (S345C: YES), in S350, the CPU 410 determines the current candidate region of interest as the corresponding region CP corresponding to the reference region SP, and the corresponding region. The decision process is terminated.

トータルの類似度SCtotalが、閾値TH3未満である場合には(S345:NO)、S355において、CPU410は、探索領域SA内の全ての候補領域(図12)を注目候補領域として処理したか否かを判断する。未処理の候補領域がある場合には(S355:NO)、CPU410は、S360Cにおいて、2個の類似画素数SC1、SC2を初期化したうえで、S305に戻って、未処理の候補領域を注目候補領域として選択する。全ての候補領域が処理された場合には(S355:YES)、CPU410は、基準領域SPに対応する対応領域CPを決定できないまま、対応領域決定処理を終了する。   When the total similarity SCtotal is less than the threshold value TH3 (S345: NO), in S355, the CPU 410 has processed all candidate areas (FIG. 12) in the search area SA as attention candidate areas. Judging. When there is an unprocessed candidate area (S355: NO), the CPU 410 initializes two similar pixel numbers SC1 and SC2 in S360C, and returns to S305 to focus on the unprocessed candidate area. Select as a candidate area. When all the candidate areas have been processed (S355: YES), the CPU 410 ends the corresponding area determination process without determining the corresponding area CP corresponding to the reference area SP.

以上説明した第3実施例によれば、CPU410は、第1の重み値WT1を用いて、第1の部分類似度(WT1×SC1)を算出し、かつ、第2の重み値を用いて、第2の部分類似度(WT2×SC2)を算出することによって、基準領域SPと、基準領域SPに対応する左側スキャン画像20L内の各候補領域と、の間の類似度SCtotalを算出する。この結果、ばらつきが異なる2個の領域SV、BVについての2個の部分類似度を適切に用いて類似度が算出されるので、対応領域CPを適切に決定することができる。したがって、合成画像30における右側スキャン画像20Rと、左側スキャン画像20Lとの合成位置を決定する精度を向上することができる。   According to the third embodiment described above, the CPU 410 calculates the first partial similarity (WT1 × SC1) using the first weight value WT1, and uses the second weight value, By calculating the second partial similarity (WT2 × SC2), the similarity SCtotal between the reference region SP and each candidate region in the left scan image 20L corresponding to the reference region SP is calculated. As a result, since the similarity is calculated by appropriately using the two partial similarities for the two areas SV and BV having different variations, the corresponding area CP can be appropriately determined. Accordingly, it is possible to improve the accuracy of determining the composite position of the right scan image 20R and the left scan image 20L in the composite image 30.

そして、CPU410は、類似度SCtotalを算出する際に、第2の領域BV内の複数個の画素WT2に対する重み付けを、第1の領域SV内の複数個の画素に対する重み付けWT1より大きくしている。これによって、類似度SCtotalを算出する際に、第2の領域BV内の画素の値を参照する程度が、第1の領域SV内の画素の値を参照する程度より高くされる。この結果、第2の領域BV内の画素の値(すなわち、ばらつき画素の値)の類似度SCtotalに対する影響を比較的大きくすることによって、第2実施例と同様に、合成画像における合成精度を向上できる。   Then, when calculating the similarity SCtotal, the CPU 410 makes the weighting for the plurality of pixels WT2 in the second region BV larger than the weighting WT1 for the plurality of pixels in the first region SV. Thereby, when calculating the similarity SCtotal, the degree of referring to the value of the pixel in the second area BV is made higher than the degree of referring to the value of the pixel in the first area SV. As a result, the effect of the value of the pixel in the second region BV (that is, the value of the variation pixel) on the similarity SCtotal is made relatively large, so that the composition accuracy in the composite image is improved as in the second embodiment. it can.

D.第4実施例:
第4実施例の参照画素決定処理は、第1実施例の参照画素決定処理(図6)と異なる処理を含んでいる。第4実施例の対応領域決定処理は、第1実施例の対応領域決定処理(図11)と異なる処理を含んでいる。第4実施例のその他の点は、第1実施例と同じである。
D. Fourth embodiment:
The reference pixel determining process of the fourth embodiment includes a process different from the reference pixel determining process (FIG. 6) of the first embodiment. The corresponding area determining process of the fourth embodiment includes a process different from the corresponding area determining process (FIG. 11) of the first embodiment. The other points of the fourth embodiment are the same as those of the first embodiment.

図17は、第4実施例の参照画素決定処理のフローチャートである。第4実施例の参照画素決定処理では、図6のS120、S125に代えて、S120D、S125Dの処理が行われる。S120Dでは、CPU410は、縮小率SRを決定する。縮小率SR(単位は%)には、第1実施例の参照率RRと同じ値が用いられる。すなわち、縮小率SRは、基準領域SP内の複数個の画素の値のばらつきに基づいて決定される。具体的には、縮小率SRは、第1実施例の参照率RRと同様に、基準領域SP内の複数個の画素の値のばらつきが小さいほど、大きな値になる。   FIG. 17 is a flowchart of reference pixel determination processing according to the fourth embodiment. In the reference pixel determination process of the fourth embodiment, the processes of S120D and S125D are performed instead of S120 and S125 of FIG. In S120D, CPU 410 determines reduction ratio SR. The same value as the reference rate RR of the first embodiment is used for the reduction rate SR (unit:%). That is, the reduction ratio SR is determined based on the variation in the values of the plurality of pixels in the reference region SP. Specifically, like the reference rate RR in the first embodiment, the reduction rate SR increases as the variation in the values of the plurality of pixels in the reference region SP decreases.

S125Dでは、CPU410は、右側スキャン画像20Rの基準領域SP内の画像を、S120で決定した縮小率SRで縮小した縮小基準画像を生成する。具体的には、CPU410は、基準領域SP内の画像の複数個の画素を適宜に間引くことによって、例えば、ニアレストネイバー法を用いて縮小率SRに応じた個数の画素を間引くことによって、縮小基準画像を生成する。例えば、縮小基準画像の画素の個数は、縮小前の基準領域SP内の画像の画素の個数に、縮小率SRを乗じた個数である。したがって、縮小基準画像の画素の個数は、縮小率SRが高いほど、大きくなる。すなわち、縮小基準画像の画素の個数は、基準領域SP内の複数個の画素の値のばらつきが小さいほど、大きくなる。   In S125D, the CPU 410 generates a reduced reference image obtained by reducing the image in the reference region SP of the right-side scan image 20R with the reduction rate SR determined in S120. Specifically, the CPU 410 reduces the number of pixels of the image in the reference area SP as appropriate, for example, by reducing the number of pixels corresponding to the reduction rate SR using the nearest neighbor method. A reference image is generated. For example, the number of pixels of the reduced reference image is the number obtained by multiplying the number of pixels of the image in the reference region SP before reduction by the reduction ratio SR. Therefore, the number of pixels of the reduced reference image increases as the reduction ratio SR increases. That is, the number of pixels of the reduced reference image increases as the variation in the values of the plurality of pixels in the reference region SP decreases.

図18は、第4実施例の対応領域決定処理のフローチャートである。図18のS400、S405の処理は、図11のS300、S305の処理と同一である。S407では、CPU410は、注目候補領域内の画像を、S120で決定した縮小率SRで縮小した縮小候補画像を生成する。縮小候補画像の生成法は、縮小基準画像の生成方法と同じである(例えば、ニアレストネイバー法)。縮小候補画像のサイズ(縦および横方向の画素数)は、図6のS125Dにて生成される縮小基準画像のサイズと同じである。すなわち、図6のS125Dにて生成される縮小基準画像内の各画素は、S407にて生成される縮小候補画像内の各画素と1対1で対応している。   FIG. 18 is a flowchart of the corresponding area determining process according to the fourth embodiment. The processes in S400 and S405 in FIG. 18 are the same as the processes in S300 and S305 in FIG. In S407, the CPU 410 generates a reduced candidate image obtained by reducing the image in the attention candidate area with the reduction rate SR determined in S120. The generation method of the reduction candidate image is the same as the generation method of the reduction reference image (for example, the nearest neighbor method). The size (number of pixels in the vertical and horizontal directions) of the reduction candidate image is the same as the size of the reduction reference image generated in S125D of FIG. That is, each pixel in the reduced reference image generated in S125D in FIG. 6 has a one-to-one correspondence with each pixel in the reduced candidate image generated in S407.

S410では、CPU410は、縮小基準画像の全ての画素のうち、1個の画素を注目画素として選択する。   In S410, the CPU 410 selects one pixel among all the pixels of the reduced reference image as a target pixel.

S425では、CPU410は、縮小基準画像内の注目画素の値と、当該注目画素に対応する縮小候補画像内の画素の値と、の差ΔVPを算出する。差ΔVPの算出法は、図11のS325における差ΔVPの算出と同様である。続くS430では、CPU410は、算出された差ΔVPが、所定の基準値TH1以下であるか否かを判断する。差ΔVPが、所定の基準値TH1以下である場合には(S430:YES)、S435において、CPU410は、類似画素数SCmをカウントアップする。差ΔVPが、所定の基準値TH1より大きい場合には(S430:NO)、CPU410は、S435をスキップして、処理をS440に進める。   In S425, the CPU 410 calculates a difference ΔVP between the value of the target pixel in the reduced reference image and the value of the pixel in the reduced candidate image corresponding to the target pixel. The calculation method of the difference ΔVP is the same as the calculation of the difference ΔVP in S325 of FIG. In subsequent S430, CPU 410 determines whether or not calculated difference ΔVP is equal to or smaller than a predetermined reference value TH1. When the difference ΔVP is equal to or smaller than the predetermined reference value TH1 (S430: YES), in S435, the CPU 410 counts up the number of similar pixels SCm. When the difference ΔVP is larger than the predetermined reference value TH1 (S430: NO), the CPU 410 skips S435 and advances the process to S440.

S440では、CPU410は、縮小基準画像内の全ての画素を注目画素として処理したか否かを判断する。未処理の画素がある場合には(S440:NO)、CPU410は、S410に戻って、未処理の画素を注目画素として選択する。全ての画素が処理された場合には(S440:YES)、CPU410は、S442に処理を進める。   In S440, the CPU 410 determines whether or not all the pixels in the reduced reference image have been processed as the target pixel. When there is an unprocessed pixel (S440: NO), the CPU 410 returns to S410 and selects an unprocessed pixel as a target pixel. When all the pixels have been processed (S440: YES), the CPU 410 advances the process to S442.

S442では、CPU410は、縮小基準画像と、注目候補領域の縮小候補画像と、の類似度(SCm/Nmt)を算出する。類似度(SCm/Nmt)は、縮小基準画像内の画素の個数Nmtに対する類似画素数SCmの割合である。類似度(SCm/Nmt)が大きいほど、縮小基準画像と、注目候補領域の縮小候補画像とは、類似している。また、類似度(SCm/Nmt)が大きいほど、基準領域SPと、注目候補領域とは、類似している。   In S442, the CPU 410 calculates the similarity (SCm / Nmt) between the reduced reference image and the reduced candidate image of the candidate region of interest. The similarity (SCm / Nmt) is the ratio of the number of similar pixels SCm to the number of pixels Nmt in the reduced reference image. As the similarity (SCm / Nmt) is larger, the reduced reference image and the reduced candidate image in the candidate region of interest are more similar. Further, as the similarity (SCm / Nmt) is larger, the reference area SP and the attention candidate area are more similar.

S445では、CPU410は、類似度(SCm/Nmt)が、閾値THm以上であるか否かを判断する。類似度(SCm/Nmt)が、閾値THm以上である場合には(S445:YES)、S450において、CPU410は、現在の注目候補領域を、基準領域SPに対応する対応領域CPとして決定して、対応領域決定処理を終了する。   In S445, CPU 410 determines whether the similarity (SCm / Nmt) is equal to or higher than threshold value THm. When the similarity (SCm / Nmt) is equal to or greater than the threshold THm (S445: YES), in S450, the CPU 410 determines the current attention candidate region as the corresponding region CP corresponding to the reference region SP, and The corresponding area determination process ends.

類似度(SCm/Nmt)が、閾値THm未満である場合には(S445:NO)、S455において、CPU410は、探索領域SA内の全ての候補領域(図12)を注目候補領域として処理したか否かを判断する。未処理の候補領域がある場合には(S455:NO)、CPU410は、S460において、類似画素数SCmを初期化したうえで、S405に戻って、未処理の候補領域を注目候補領域として選択する。全ての候補領域が処理された場合には(S455:YES)、CPU410は、基準領域SPに対応する対応領域CPを決定できないまま、対応領域決定処理を終了する。   If the similarity (SCm / Nmt) is less than the threshold value THm (S445: NO), in S455, has the CPU 410 processed all candidate areas (FIG. 12) in the search area SA as attention candidate areas? Judge whether or not. If there is an unprocessed candidate area (S455: NO), the CPU 410 initializes the number of similar pixels SCm in S460, and returns to S405 to select the unprocessed candidate area as the attention candidate area. . When all candidate areas have been processed (S455: YES), the CPU 410 ends the corresponding area determination process without determining the corresponding area CP corresponding to the reference area SP.

以上説明した第4実施例によれば、基準領域SP内の複数個の画素の値のばらつきに基づいて決定された縮小率SRで縮小した縮小基準画像と縮小候補画像との間の類似度(SCm/Nmt)が算出される。この結果、適切なサイズ(すなわち、画素数)の縮小基準画像を用いて、類似度(SCm/Nmt)が算出されるので、第1実施例と同様に、対応領域を適切に決定することができる。したがって、合成画像30における右側スキャン画像20Rと左側スキャン画像20Lとの合成位置を決定する精度の低下を抑制することができる。   According to the fourth embodiment described above, the degree of similarity between the reduced reference image and the reduced candidate image reduced at the reduction rate SR determined based on the variation in the values of the plurality of pixels in the reference region SP ( SCm / Nmt) is calculated. As a result, since the similarity (SCm / Nmt) is calculated using a reduced reference image having an appropriate size (that is, the number of pixels), the corresponding region can be appropriately determined as in the first embodiment. it can. Therefore, it is possible to suppress a decrease in accuracy in determining the composite position of the right scan image 20R and the left scan image 20L in the composite image 30.

具体的には、CPU410は、右側スキャン画像20Rの基準領域SP内の複数個の画素の値のばらつきが小さいほど、縮小基準画像の画素の個数が大きくなるように、縮小率SRを決定する。この結果、第1実施例と同様に、合成精度の低下を抑制しつつ、処理速度の向上を図ることができる。   Specifically, the CPU 410 determines the reduction rate SR so that the smaller the variation in the values of the plurality of pixels in the reference area SP of the right-side scan image 20R, the larger the number of pixels in the reduced reference image. As a result, as in the first embodiment, the processing speed can be improved while suppressing a decrease in the synthesis accuracy.

なお、縮小候補画像や縮小基準画像の生成法は、ニアレストネイバー法に限られない。例えば、縮小候補画像や縮小基準画像の生成法に、縮小前の画像内の複数個の画素の値の単純平均値や重み付き平均値を、縮小後の画像内の1個の画素の値として採用する方法、例えば、バイリニア法が用いられても良い。ただし、ニアレストネイバー法では、縮小前の画像内の特徴的な画素の値が平均化されて失われることを抑制できるので、より好ましい。   Note that the generation method of the reduced candidate image and the reduced reference image is not limited to the nearest neighbor method. For example, in the generation method of the reduction candidate image or the reduction reference image, a simple average value or a weighted average value of a plurality of pixels in the image before reduction is used as a value of one pixel in the image after reduction. A method to be employed, for example, a bilinear method may be used. However, the nearest neighbor method is more preferable because it can suppress that characteristic pixel values in the image before reduction are averaged and lost.

E.変形例
(1)上記各実施例では、2個のスキャンデータを用いて、2個のスキャン画像が合成された合成画像を表す合成画像データが生成されている。これに限らず、任意の個数のスキャンデータを用いて合成画像データが生成されても良い。例えば、4個のスキャン画像データを用いて、4個のスキャン画像が合成された合成画像を表す合成画像データが生成されてもよい。
E. Modified Example (1) In each of the above-described embodiments, composite image data representing a composite image obtained by combining two scan images is generated using two scan data. The present invention is not limited to this, and the composite image data may be generated using an arbitrary number of scan data. For example, composite image data representing a composite image obtained by combining four scan images may be generated using the four scan image data.

(2)上記各実施例では、右側スキャン画像20Rの基準領域SP内の複数個の画素の値のばらつきを示す値として、基準領域SP内の画素の総数Ntに対するばらつき画素の個数Nvの割合(Nv/Nt)が用いられている(図6のS115)。基準領域SP内の複数個の画素の値のばらつきを示す値には、(Nv/Nt)の値に代えて、例えば、基準領域SP内の複数個の画素の値の分散σ、標準偏差σ、エッジ量が用いられても良い。 (2) In each of the above embodiments, the ratio of the number Nv of the variation pixels to the total number Nt of the pixels in the reference region SP is used as a value indicating the variation in the values of the plurality of pixels in the reference region SP of the right scan image 20R ( Nv / Nt) is used (S115 in FIG. 6). Instead of the value of (Nv / Nt), for example, the value indicating the variation in the values of the plurality of pixels in the reference region SP, for example, the variance σ 2 of the values of the plurality of pixels in the reference region SP, the standard deviation σ and edge amount may be used.

(3)上記各実施例の対応領域決定処理において、基準領域SPに対応する対応領域CPを決定するアルゴリズムは、一例であり、他のアルゴリズムが採用されても良い。例えば、第1実施例や第2実施例の対応領域決定処理では、CPU410は、基準領域SP内の各参照画素の値と、当該参照画素に対応する注目候補領域内の画素の値と、の差ΔVPを、基準領域SP内の全ての参照画素について合計した値VPtotalを算出しても良い。そして、探索領域SA内に配置可能な複数個の候補領域のうち、当該合計値VPtotalが最小である候補領域が、対応領域CPとして決定されても良い。 (3) In the corresponding area determination processing in each of the above embodiments, the algorithm for determining the corresponding area CP corresponding to the reference area SP is an example, and other algorithms may be adopted. For example, in the corresponding region determination process of the first embodiment or the second embodiment, the CPU 410 calculates the value of each reference pixel in the reference region SP and the value of the pixel in the attention candidate region corresponding to the reference pixel. A value VPtotal obtained by summing the difference ΔVP for all reference pixels in the reference region SP may be calculated. And the candidate area | region where the said total value VPtotal is the minimum among the several candidate area | regions which can be arrange | positioned in search area | region SA may be determined as corresponding | compatible area | region CP.

(4)上記第1実施例で間引率TRの算出式(1)、すなわち、TR={0.2+0.7×(Nv/Nt)}×100は、一例である。間引率TRは、基準領域SP内のばらつきが大きいほど大きくなるように規定された任意の式で算出され得る。例えば、式(1)の「0.2」と「0.7」のパラメータの値は、異なる値でも良く、具体的には、「0.3」と「0.6」の組み合わせでも良く、「0.1」と「0.8」の組み合わせでも良い。 (4) Formula (1) for calculating the thinning rate TR in the first embodiment, that is, TR = {0.2 + 0.7 × (Nv / Nt)} × 100 is an example. The thinning rate TR can be calculated by an arbitrary formula that is defined so as to increase as the variation in the reference region SP increases. For example, the values of the parameters “0.2” and “0.7” in Equation (1) may be different values, specifically, a combination of “0.3” and “0.6” may be used. A combination of “0.1” and “0.8” may be used.

(5)上各記実施例では、合成画像データの生成に用いられる2個の画像データは、複合機200のスキャナ部250によって原稿が読み取られることによって生成される2個のスキャンデータである。これに代えて、2個の画像データは、デジタルカメラによって原稿の複数個の領域を撮影することによって、2個の画像データが生成されても良い。 (5) In the above embodiments, the two pieces of image data used for generating the composite image data are two pieces of scan data generated when the original is read by the scanner unit 250 of the multifunction device 200. Instead of this, two pieces of image data may be generated by photographing a plurality of areas of a document with a digital camera.

(6)上記各実施例においてサーバ400のCPU410によって実行される処理(例えば、図2のS25〜S40の処理)は、例えば、複合機200のCPU210によって実行されても良い。この場合には、サーバ400は不要であり、複合機200が単体で図3の処理を実行すればよい。また、サーバ400のCPU410によって実行される処理は、複合機200と接続されたパーソナルコンピュータ500(図1)のCPU(図示省略)によって実行されても良い。例えば、パーソナルコンピュータ500のCPUは、パーソナルコンピュータ500にインストールされたスキャナドライバプログラムを実行することによって、これらの処理を実行しても良い。また、サーバ400は、本実施例のように1つの計算機で構成されても良く、複数個の計算機を含む計算システムによって構成されていても良い。 (6) The processing (for example, the processing of S25 to S40 in FIG. 2) executed by the CPU 410 of the server 400 in each of the above embodiments may be executed by the CPU 210 of the multifunction device 200, for example. In this case, the server 400 is unnecessary, and the multi-function device 200 may execute the processing of FIG. 3 alone. Further, the processing executed by the CPU 410 of the server 400 may be executed by the CPU (not shown) of the personal computer 500 (FIG. 1) connected to the multifunction device 200. For example, the CPU of the personal computer 500 may execute these processes by executing a scanner driver program installed in the personal computer 500. Further, the server 400 may be configured with one computer as in the present embodiment, or may be configured with a computer system including a plurality of computers.

(7)上記各実施例において、ハードウェアによって実現されていた構成の一部をソフトウェアに置き換えるようにしてもよく、逆に、ソフトウェアによって実現されていた構成の一部をハードウェアに置き換えるようにしてもよい。 (7) In each of the above embodiments, a part of the configuration realized by hardware may be replaced with software, and conversely, a part of the configuration realized by software may be replaced with hardware. May be.

200...複合機、210...CPU、220...揮発性記憶装置、221...バッファ領域、230...不揮発性記憶装置、231...制御プログラム、240...プリンタ部、250...スキャナ部、260...操作部、270...表示部、280...通信部、400...サーバ、410...CPU、420...揮発性記憶装置、421...バッファ領域、430...不揮発性記憶装置、431...コンピュータプログラム、433...UIデータ群、480...通信部、500...パーソナルコンピュータ、1000...画像処理システム   200 ... multifunction device, 210 ... CPU, 220 ... volatile storage device, 221 ... buffer area, 230 ... nonvolatile storage device, 231 ... control program, 240 ... printer , 250 ... scanner unit, 260 ... operation unit, 270 ... display unit, 280 ... communication unit, 400 ... server, 410 ... CPU, 420 ... volatile storage device 421 ... buffer area, 430 ... nonvolatile storage device, 431 ... computer program, 433 ... UI data group, 480 ... communication unit, 500 ... personal computer, 1000 ... Image processing system

Claims (11)

画像処理装置であって、
第1の画像を表す第1の画像データと、第2の画像を表す第2の画像データと、を取得する取得部と、
前記第1の画像内の一部の領域である基準領域を決定する基準領域決定部と、
前記第1の画像内の前記基準領域と、前記第2の画像内の複数個の候補領域と、の間の複数個の類似度を算出する算出部と、
前記複数個の類似度に基づいて、前記複数の候補領域のうちの1つの候補領域を前記基準領域に対応する対応領域として決定する対応領域決定部と、
前記第1の画像データと前記第2の画像データとを用いて、前記基準領域と前記対応領域とが重なるように、前記第1の画像と前記第2の画像とが合成された合成画像を表す合成画像データを生成する生成部と、
を備え、
前記算出部は、
前記基準領域内の複数個の画素の値のばらつきに基づいて、前記基準領域内の前記N個(Nは3以上の整数)の画素の中から、前記類似度の算出に用いられるM個(Mは1以上N未満の整数)の画素を決定し、
前記基準領域内のM個の画素と、前記基準領域内のM個の画素に対応する前記各候補領域内のM個の画素と、を用いて、前記類似度を算出する、画像処理装置。
An image processing apparatus,
An acquisition unit that acquires first image data representing a first image and second image data representing a second image;
A reference area determination unit that determines a reference area that is a partial area in the first image;
A calculation unit that calculates a plurality of similarities between the reference region in the first image and a plurality of candidate regions in the second image;
A corresponding region determining unit that determines one candidate region of the plurality of candidate regions as a corresponding region corresponding to the reference region based on the plurality of similarities;
Using the first image data and the second image data, a synthesized image obtained by synthesizing the first image and the second image so that the reference area and the corresponding area overlap each other is obtained. A generating unit that generates composite image data to be represented;
With
The calculation unit includes:
Based on variations in the values of a plurality of pixels in the reference region, M pixels (N is an integer of 3 or more) used in the calculation of the similarity among the N pixels (N is an integer of 3 or more) in the reference region. M is an integer of 1 or more and less than N),
An image processing apparatus that calculates the degree of similarity using M pixels in the reference area and M pixels in each candidate area corresponding to the M pixels in the reference area.
請求項1に記載の画像処理装置であって、
前記算出部は、前記第1の画像の前記基準領域内の複数個の画素の値のばらつきが小さいほど、前記類似度の算出に用いられる前記基準領域内の画素の個数Mを大きくする、画像処理装置。
The image processing apparatus according to claim 1,
The calculation unit increases the number M of pixels in the reference region used for calculating the similarity as the variation in values of the plurality of pixels in the reference region of the first image is smaller. Processing equipment.
請求項1に記載の画像処理装置であって、
前記第1の画像内の前記基準領域は、第1の部分基準領域と、内部に含まれる複数個の画素の値のばらつきが前記第1の部分基準領域とは異なる第2の部分基準領域と、を含み
前記算出部は、
前記基準領域内の複数個の画素のばらつきに基づいて、前記第1の部分基準領域と、前記第2の部分基準領域と、を特定し、
前記類似度の算出に用いられる前記M個の画素の一部として、前記第1の部分基準領域内のN1個(N1は2以上の整数)の画素の中から、M1個(M1は1以上N1以下の整数)の画素を決定し、
前記類似度の算出に用いられる前記M個の画素の一部として、前記第2の部分基準領域内のN2個(N2は2以上の整数)の画素の中から、M2個(M2は1以上N2以下の整数)の画素を決定し、
前記第1の部分基準領域内の前記N1個の画素に対する前記M1個の画素の割合(M1/N1)と、前記第2の部分基準領域内の前記N2個の画素に対する前記M2個の画素の割合(M2/N2)とは、互いに異なる、画像処理装置。
The image processing apparatus according to claim 1,
The reference region in the first image, a first partial reference area, and a different second portion reference area and a plurality of pixels of variation of the first value of the partial reference region contained within The calculation unit includes:
Identifying the first partial reference region and the second partial reference region based on variations of a plurality of pixels in the reference region;
As a part of the M pixels used for calculating the similarity, M1 (M1 is 1 or more) out of N1 (N1 is an integer of 2 or more) pixels in the first partial reference region. N1 or less pixels),
As a part of the M pixels used for the calculation of the similarity, M2 (M2 is 1 or more) out of N2 (N2 is an integer of 2 or more) pixels in the second partial reference region. N2 or less integer) pixels,
The ratio (M1 / N1) of the M1 pixels to the N1 pixels in the first partial reference region, and the M2 pixels relative to the N2 pixels in the second partial reference region. An image processing apparatus different from the ratio (M2 / N2).
請求項3に記載の画像処理装置であって、
前記第2の部分基準領域は、内部に含まれる複数個の画素の値のばらつきが前記第1の部分基準領域より大きく、
前記割合(M2/N2)は、前記割合(M1/N1)より大きい、画像処理装置。
The image processing apparatus according to claim 3,
The second partial reference region has a larger variation in the values of a plurality of pixels contained therein than the first partial reference region.
The image processing apparatus, wherein the ratio (M2 / N2) is greater than the ratio (M1 / N1).
画像処理装置であって、
第1の画像を表す第1の画像データと、第2の画像を表す第2の画像データと、を取得する取得部と、
前記第1の画像内の一部の領域である基準領域を決定する基準領域決定部と、
前記第1の画像内の前記基準領域と、前記第1の画像内の前記基準領域に対応する前記第2の画像内の複数個の候補領域と、の間の複数個の類似度を算出する算出部と、
前記複数個の類似度に基づいて、前記複数の候補領域のうちの1つの候補領域を前記基準領域に対応する対応領域として決定する対応領域決定部と、
前記第1の画像データと前記第2の画像データとを用いて、前記基準領域と前記対応領域とが重なるように、前記第1の画像と前記第2の画像とが合成された合成画像を表す合成画像データを生成する生成部と、
を備え、
前記第1の画像内の前記基準領域は、第1の部分基準領域と、内部に含まれる複数個の画素の値のばらつきが前記第1の部分基準領域とは異なる第2の部分基準領域と、を含み、
前記第2の画像内の前記各候補領域は、前記第1の画像内の前記第1の部分基準領域と前記第2の部分基準領域とにそれぞれ対応する第1の部分候補領域と第2の部分候補領域とを含み、
前記算出部は、
前記基準領域内の複数個の画素のばらつきに基づいて、前記第1の部分基準領域と、前記第2の部分基準領域と、を特定し、
第1の重み値を用いて、前記第1の部分基準領域と前記第1の部分基準領域に対応する前記第1の部分候補領域との間の第1の部分類似度を算出し、かつ、第2の重み値を用いて、前記第2の部分基準領域と前記第2の部分基準領域に対応する前記第2の部分候補領域との間の第2の部分類似度を算出することによって、前記第1の画像内の前記基準領域と、前記第1の画像内の前記基準領域に対応する前記第2の画像内の前記各候補領域と、の間の前記類似度を算出する、画像処理装置。
An image processing apparatus,
An acquisition unit that acquires first image data representing a first image and second image data representing a second image;
A reference area determination unit that determines a reference area that is a partial area in the first image;
Calculating a plurality of similarities between the reference region in the first image and a plurality of candidate regions in the second image corresponding to the reference region in the first image; A calculation unit;
A corresponding region determining unit that determines one candidate region of the plurality of candidate regions as a corresponding region corresponding to the reference region based on the plurality of similarities;
Using the first image data and the second image data, a synthesized image obtained by synthesizing the first image and the second image so that the reference area and the corresponding area overlap each other is obtained. A generating unit that generates composite image data to be represented;
With
The reference area in the first image includes a first partial reference area, a second partial reference area in which variations in values of a plurality of pixels included in the first image are different from the first partial reference area, Including,
Each of the candidate regions in the second image includes a first partial candidate region and a second partial region corresponding respectively to the first partial reference region and the second partial reference region in the first image. Partial candidate areas,
The calculation unit includes:
Identifying the first partial reference region and the second partial reference region based on variations of a plurality of pixels in the reference region;
Using a first weight value to calculate a first partial similarity between the first partial reference region and the first partial candidate region corresponding to the first partial reference region; and By calculating a second partial similarity between the second partial reference region and the second partial candidate region corresponding to the second partial reference region using a second weight value, Image processing for calculating the similarity between the reference region in the first image and each candidate region in the second image corresponding to the reference region in the first image apparatus.
請求項5に記載の画像処理装置であって、
前記第2の部分基準領域は、内部に含まれる複数個の画素の値のばらつきが前記第1の部分基準領域より大きく、
前記第2の重み値は、前記第の重み値より大きい、画像処理装置。
The image processing apparatus according to claim 5,
The second partial reference region has a larger variation in the values of a plurality of pixels contained therein than the first partial reference region.
The image processing apparatus, wherein the second weight value is larger than the first weight value.
画像処理装置であって、
第1の画像を表す第1の画像データと、第2の画像を表す第2の画像データと、を取得する取得部と、
前記第1の画像内の一部の領域である基準領域を決定する基準領域決定部と、
前記基準領域内の複数個の画素の値のばらつきに基づいて、縮小率を決定する縮小率決定部と、
前記第1の画像内の前記基準領域内の画像を前記縮小率で縮小した縮小基準画像と、前記第2の画像内の複数個の候補領域内の画像を前記縮小率で縮小した複数個の縮小候補画像と、の間の複数個の類似度を算出する算出部と、
前記複数個の類似度に基づいて、前記複数の候補領域のうちの1つの候補領域を前記基準領域に対応する対応領域として決定する対応領域決定部と、
前記第1の画像データと前記第2の画像データとを用いて、前記基準領域と前記対応領域とが重なるように、前記第1の画像と前記第2の画像とが合成された合成画像を表す合成画像データを生成する生成部と、
を備える、画像処理装置。
An image processing apparatus,
An acquisition unit that acquires first image data representing a first image and second image data representing a second image;
A reference area determination unit that determines a reference area that is a partial area in the first image;
A reduction rate determination unit that determines a reduction rate based on variations in values of a plurality of pixels in the reference region;
A reduced reference image obtained by reducing an image in the reference area in the first image at the reduction ratio, and a plurality of images obtained by reducing images in a plurality of candidate areas in the second image at the reduction ratio. A calculation unit that calculates a plurality of similarities between the reduced candidate images;
A corresponding region determining unit that determines one candidate region of the plurality of candidate regions as a corresponding region corresponding to the reference region based on the plurality of similarities;
Using the first image data and the second image data, a synthesized image obtained by synthesizing the first image and the second image so that the reference area and the corresponding area overlap each other is obtained. A generating unit that generates composite image data to be represented;
An image processing apparatus comprising:
請求項7に記載の画像処理装置であって、
前記縮小率決定部は、前記第1の画像内の前記基準領域内の複数個の画素の値のばらつきが小さいほど、前記縮小基準画像の画素の個数が大きくなるように、前記縮小率を決定する、画像処理装置。
The image processing apparatus according to claim 7,
The reduction ratio determining unit determines the reduction ratio such that the smaller the variation in the values of the plurality of pixels in the reference area in the first image, the larger the number of pixels in the reduced reference image. An image processing apparatus.
コンピュータプログラムであって、
第1の画像を表す第1の画像データと、第2の画像を表す第2の画像データと、を取得する取得機能と、
前記第1の画像内の一部の領域である基準領域を決定する基準領域決定機能と、
前記第1の画像内の前記基準領域と、前記第2の画像内の複数個の候補領域と、の間の複数個の類似度を算出する算出機能と、
前記複数個の類似度に基づいて、前記複数の候補領域のうちの1つの候補領域を前記基準領域に対応する対応領域として決定する対応領域決定機能と、
前記第1の画像データと前記第2の画像データとを用いて、前記基準領域と前記対応領域とが重なるように、前記第1の画像と前記第2の画像とが合成された合成画像を表す合成画像データを生成する生成機能と、
をコンピュータに実現させ、
前記算出機能は、
前記基準領域内の複数個の画素の値のばらつきに基づいて、前記基準領域内の前記N個(Nは3以上の整数)の画素の中から、前記類似度の算出に用いられるM個(Mは1以上N未満の整数)の画素を決定し、
前記基準領域内のM個の画素と、前記基準領域内のM個の画素に対応する前記各候補領域内のM個の画素と、を用いて、前記類似度を算出する、コンピュータプログラム。
A computer program,
An acquisition function for acquiring first image data representing a first image and second image data representing a second image;
A reference area determination function for determining a reference area which is a partial area in the first image;
A calculation function for calculating a plurality of similarities between the reference region in the first image and a plurality of candidate regions in the second image;
A corresponding area determination function for determining one candidate area of the plurality of candidate areas as a corresponding area corresponding to the reference area based on the plurality of similarities;
Using the first image data and the second image data, a synthesized image obtained by synthesizing the first image and the second image so that the reference area and the corresponding area overlap each other is obtained. A generating function for generating composite image data to be represented;
Is realized on a computer,
The calculation function is
Based on variations in the values of a plurality of pixels in the reference region, M pixels (N is an integer of 3 or more) used in the calculation of the similarity among the N pixels (N is an integer of 3 or more) in the reference region. M is an integer of 1 or more and less than N),
A computer program that calculates the similarity using M pixels in the reference area and M pixels in each candidate area corresponding to the M pixels in the reference area.
コンピュータプログラムであって、
第1の画像を表す第1の画像データと、第2の画像を表す第2の画像データと、を取得する取得機能と、
前記第1の画像内の一部の領域である基準領域を決定する基準領域決定機能と、
前記第1の画像内の前記基準領域と、前記第1の画像内の前記基準領域に対応する前記第2の画像内の複数個の候補領域と、の間の複数個の類似度を算出する算出機能と、
前記複数個の類似度に基づいて、前記複数の候補領域のうちの1つの候補領域を前記基準領域に対応する対応領域として決定する対応領域決定機能と、
前記第1の画像データと前記第2の画像データとを用いて、前記基準領域と前記対応領域とが重なるように、前記第1の画像と前記第2の画像とが合成された合成画像を表す合成画像データを生成する生成機能と、
をコンピュータに実現させ、
前記第1の画像内の前記基準領域は、第1の部分基準領域と、内部に含まれる複数個の画素の値のばらつきが前記第1の部分基準領域とは異なる第2の部分基準領域と、を含み、
前記第2の画像内の前記各候補領域は、前記第1の画像内の前記第1の部分基準領域と前記第2の部分基準領域とにそれぞれ対応する第1の部分候補領域と第2の部分候補領域とを含み、
前記算出機能は、
前記基準領域内の複数個の画素のばらつきに基づいて、前記第1の部分基準領域と、前記第2の部分基準領域と、を特定し、
第1の重み値を用いて、前記第1の部分基準領域と前記第1の部分基準領域に対応する前記第1の部分候補領域との間の第1の部分類似度を算出し、かつ、第2の重み値を用いて、前記第2の部分基準領域と前記第2の部分基準領域に対応する前記第2の部分候補領域との間の第2の部分類似度を算出することによって、前記第1の画像内の前記基準領域と、前記第1の画像内の前記基準領域に対応する前記第2の画像内の前記各候補領域と、の間の前記類似度を算出する、コンピュータプログラム。
A computer program,
An acquisition function for acquiring first image data representing a first image and second image data representing a second image;
A reference area determination function for determining a reference area which is a partial area in the first image;
Calculating a plurality of similarities between the reference region in the first image and a plurality of candidate regions in the second image corresponding to the reference region in the first image; A calculation function;
A corresponding area determination function for determining one candidate area of the plurality of candidate areas as a corresponding area corresponding to the reference area based on the plurality of similarities;
Using the first image data and the second image data, a synthesized image obtained by synthesizing the first image and the second image so that the reference area and the corresponding area overlap each other is obtained. A generating function for generating composite image data to be represented;
Is realized on a computer,
The reference area in the first image includes a first partial reference area, a second partial reference area in which variations in values of a plurality of pixels included in the first image are different from the first partial reference area, Including,
Each of the candidate regions in the second image includes a first partial candidate region and a second partial region corresponding respectively to the first partial reference region and the second partial reference region in the first image. Partial candidate areas,
The calculation function is
Identifying the first partial reference region and the second partial reference region based on variations of a plurality of pixels in the reference region;
Using a first weight value to calculate a first partial similarity between the first partial reference region and the first partial candidate region corresponding to the first partial reference region; and By calculating a second partial similarity between the second partial reference region and the second partial candidate region corresponding to the second partial reference region using a second weight value, A computer program for calculating the similarity between the reference region in the first image and each candidate region in the second image corresponding to the reference region in the first image .
コンピュータプログラムであって、
第1の画像を表す第1の画像データと、第2の画像を表す第2の画像データと、を取得する取得機能と、
前記第1の画像内の一部の領域である基準領域を決定する基準領域決定機能と、
前記基準領域内の複数個の画素の値のばらつきに基づいて、縮小率を決定する縮小率決定機能と、
前記第1の画像内の前記基準領域内の画像を前記縮小率で縮小した縮小基準画像と、前記第2の画像内の複数個の候補領域内の画像を前記縮小率で縮小した複数個の縮小候補画像と、の間の複数個の類似度を算出する算出機能と、
前記複数個の類似度に基づいて、前記複数の候補領域のうちの1つの候補領域を前記基準領域に対応する対応領域として決定する対応領域決定機能と、
前記第1の画像データと前記第2の画像データとを用いて、前記基準領域と前記対応領域とが重なるように、前記第1の画像と前記第2の画像とが合成された合成画像を表す合成画像データを生成する生成機能と、
をコンピュータに実現させる、コンピュータプログラム。
A computer program,
An acquisition function for acquiring first image data representing a first image and second image data representing a second image;
A reference area determination function for determining a reference area which is a partial area in the first image;
A reduction rate determination function for determining a reduction rate based on variations in values of a plurality of pixels in the reference region;
A reduced reference image obtained by reducing an image in the reference area in the first image at the reduction ratio, and a plurality of images obtained by reducing images in a plurality of candidate areas in the second image at the reduction ratio. A calculation function for calculating a plurality of similarities between the reduced candidate images;
A corresponding area determination function for determining one candidate area of the plurality of candidate areas as a corresponding area corresponding to the reference area based on the plurality of similarities;
Using the first image data and the second image data, a synthesized image obtained by synthesizing the first image and the second image so that the reference area and the corresponding area overlap each other is obtained. A generating function for generating composite image data to be represented;
A computer program that causes a computer to realize
JP2014073901A 2014-03-31 2014-03-31 Image processing apparatus and computer program Active JP6149782B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014073901A JP6149782B2 (en) 2014-03-31 2014-03-31 Image processing apparatus and computer program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2014073901A JP6149782B2 (en) 2014-03-31 2014-03-31 Image processing apparatus and computer program

Publications (2)

Publication Number Publication Date
JP2015198274A JP2015198274A (en) 2015-11-09
JP6149782B2 true JP6149782B2 (en) 2017-06-21

Family

ID=54547768

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2014073901A Active JP6149782B2 (en) 2014-03-31 2014-03-31 Image processing apparatus and computer program

Country Status (1)

Country Link
JP (1) JP6149782B2 (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3223384B2 (en) * 1992-06-19 2001-10-29 オムロン株式会社 Pattern matching device for grayscale images
JP3747183B2 (en) * 2002-04-18 2006-02-22 キヤノン株式会社 Image processing apparatus and image processing method
JP2009136421A (en) * 2007-12-05 2009-06-25 Toshiba Corp Diagnostic x-ray apparatus and x-ray image processing method, and storage medium

Also Published As

Publication number Publication date
JP2015198274A (en) 2015-11-09

Similar Documents

Publication Publication Date Title
US7684617B2 (en) Apparatus and methods for processing images
JP5853470B2 (en) Image processing device, image processing program
JP6344064B2 (en) Image processing apparatus and computer program
JP6747224B2 (en) Image processing device and computer program
JP5842441B2 (en) Image processing apparatus and program
JP6331817B2 (en) Image processing apparatus, image processing method, and program
JP6108220B2 (en) Image processing apparatus and image processing program
JP6256206B2 (en) Image processing apparatus and computer program
JP6152818B2 (en) Image processing apparatus and computer program
JP6149782B2 (en) Image processing apparatus and computer program
JP5543406B2 (en) Image processing apparatus and image forming apparatus
JP2010026734A (en) Image processor and its method
JP6330458B2 (en) Image processing apparatus and computer program
JP2016201037A (en) Image processing device, image processing method, and program
JP6409460B2 (en) Image processing apparatus and computer program
JP6394060B2 (en) Image processing apparatus and computer program
JP6314633B2 (en) Image processing apparatus and computer program
JP2016092672A (en) Image processing apparatus and computer program
JP6372397B2 (en) Image processing apparatus and computer program
JP6467824B2 (en) Imaging device
JP5539561B2 (en) Image processing apparatus and method
JP6079371B2 (en) Image processing apparatus and image processing program
JP2006039628A (en) Image processor, image processing method and image processing program
JP2016178367A (en) Image processing device and computer program
JP6841254B2 (en) Image processing equipment and computer programs

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20160324

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20170130

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20170214

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20170411

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20170508

R150 Certificate of patent or registration of utility model

Ref document number: 6149782

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150