JP5915296B2 - Code image reading apparatus, operation method of code image reading apparatus, and code image reading program - Google Patents

Code image reading apparatus, operation method of code image reading apparatus, and code image reading program Download PDF

Info

Publication number
JP5915296B2
JP5915296B2 JP2012061777A JP2012061777A JP5915296B2 JP 5915296 B2 JP5915296 B2 JP 5915296B2 JP 2012061777 A JP2012061777 A JP 2012061777A JP 2012061777 A JP2012061777 A JP 2012061777A JP 5915296 B2 JP5915296 B2 JP 5915296B2
Authority
JP
Japan
Prior art keywords
code
image reading
code image
state
reading device
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
JP2012061777A
Other languages
Japanese (ja)
Other versions
JP2013196281A (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.)
Fujitsu Ltd
Original Assignee
Fujitsu 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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2012061777A priority Critical patent/JP5915296B2/en
Publication of JP2013196281A publication Critical patent/JP2013196281A/en
Application granted granted Critical
Publication of JP5915296B2 publication Critical patent/JP5915296B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、コード画像読み取り装置、コード画像読み取り装置の動作方法およびコード画像読み取りプログラムに関する。   The present invention relates to a code image reading apparatus, an operation method of the code image reading apparatus, and a code image reading program.

コード画像読み取り装置は、コードを撮影するカメラを有している。撮影したコード画像の光学分解能および解像度が低いときには、コードを正しく認識できないおそれがある。光学分解能は、焦点のずれが大きくなるにしたがい低くなる。したがって、ユーザは、カメラの設計時に設定された合焦距離に対応する撮影距離で、コードを撮影する。撮影距離が適切でないとき、コード画像読み取り装置は、コードを正しく認識できない。   The code image reading apparatus has a camera for photographing a code. When the code resolution of the photographed code image is low, the code may not be recognized correctly. The optical resolution decreases as the defocus increases. Therefore, the user shoots the code at the shooting distance corresponding to the in-focus distance set at the time of designing the camera. When the shooting distance is not appropriate, the code image reading apparatus cannot correctly recognize the code.

また、解像度は、例えば、コードの最小構成単位の図形当たりの画素数に対応している。1次元コードや2次元コードでは、コードの印刷時の物理サイズに対する規定がないため、様々なサイズや解像度のコードが存在する。このため、コード画像読み取り装置のカメラは、予め想定した標準解像度およびサイズのコード(以下、想定コードとも称する)に合わせて設計される。このため、想定コードと異なるサイズや解像度のコードは、認識されないおそれがある。   The resolution corresponds to, for example, the number of pixels per figure of the minimum structural unit of the code. In the one-dimensional code and the two-dimensional code, there are no regulations regarding the physical size at the time of printing the code, and therefore codes of various sizes and resolutions exist. For this reason, the camera of the code image reading apparatus is designed according to a standard resolution and size code (hereinafter also referred to as an assumed code) assumed in advance. For this reason, a code having a size or resolution different from the assumed code may not be recognized.

近年、コードの認識に失敗したとき、合焦ずれや解像度不足等の原因を判定し、端末(コード画像読み取り装置)の移動をユーザに指示するコード画像読み取り装置が提案されている(例えば、特許文献1参照。)。また、撮影画像内のコードの大きさを判定し、焦点位置を制御するコード画像読み取り装置が提案されている(例えば、特許文献2参照。)。   In recent years, there has been proposed a code image reading apparatus that determines the cause of out-of-focus or insufficient resolution and instructs the user to move the terminal (code image reading apparatus) when code recognition fails (for example, a patent) Reference 1). Also, a code image reading device that determines the size of a code in a captured image and controls the focal position has been proposed (for example, see Patent Document 2).

特開2006−344066号公報JP 2006-344066 A 特開2010−204792号公報JP 2010-204792 A

オートフォーカス(以下、AFとも称する)機能を有するカメラでは、例えば、ユーザのボタン操作でAFを実施することにより、光学分解能を所定レベル以上にできる。換言すれば、ユーザは、AFを実施させるために、煩わしいボタン操作等を実施する必要がある。また、ユーザは、どのような撮影状況のときにAFを実施させればよいか分からない。このため、コード画像の読み取り操作を効率よく実施できない。また、撮影画像内のコードの大きさに基づいて焦点位置を合わせる方法では、様々な印刷サイズのコードに対応させることが困難である。   In a camera having an autofocus (hereinafter also referred to as AF) function, for example, by performing AF by a user's button operation, the optical resolution can be increased to a predetermined level or more. In other words, the user needs to perform troublesome button operations and the like in order to perform AF. Further, the user does not know in what shooting situation the AF should be performed. For this reason, the code image reading operation cannot be performed efficiently. Further, in the method of adjusting the focal position based on the size of the code in the photographed image, it is difficult to correspond to codes of various print sizes.

本発明の目的は、コード画像の読み取り操作の効率を向上させることである。   An object of the present invention is to improve the efficiency of a code image reading operation.

本発明の一形態では、コード画像読み取り装置は、画像を撮影する撮影部と、撮影された画像の任意の検査領域にコードが含まれているか否かを検出し、検査領域内のコードがぼけた画像か否かを判定するコード検出部と、コード画像読み取り装置の移動状態を検出する移動状態検出部と、コードがぼけた画像のとき、オートフォーカス調整の開始タイミングを移動状態検出部の検出結果に基づいて検出し、コードがぼけた画像でないとき、ズーム調整が必要か否かを検査領域内のコードの解像度に基づいて判定する制御部と、開始タイミングの検出に応答して、オートフォーカス調整を実施するオートフォーカス部と、ズーム調整が必要であると制御部で判定されたとき、ズーム調整を実施するズーム調整部と、コードの認識不可の原因に応じたユーザ通知をユーザに通知する通知部と、コードに格納されているデータを取り出すコード処理部とを有している。   In one embodiment of the present invention, a code image reading device detects an image capturing unit that captures an image and whether or not a code is included in an arbitrary inspection region of the captured image, and the code in the inspection region is blurred. A code detection unit that determines whether or not the image is a moving image, a movement state detection unit that detects the movement state of the code image reading device, and detection of the start timing of autofocus adjustment when the code is blurred When the detection is based on the result and the code is not a blurred image, the control unit determines whether or not the zoom adjustment is necessary based on the resolution of the code in the inspection area, and the autofocus in response to the detection of the start timing When the control unit determines that an autofocus unit that performs adjustment and zoom adjustment is necessary, the zoom adjustment unit that performs zoom adjustment and the cause of unrecognizable code A notification unit for notifying the user user notification Flip, and a code processing unit to retrieve the data stored in the code.

コード画像の読み取り操作の効率を向上できる。   The efficiency of the code image reading operation can be improved.

一実施形態におけるコード画像読み取り装置の例を示している。1 illustrates an example of a code image reading device according to an embodiment. コードのサイズと解像度の関係の一例を示している。An example of the relationship between code size and resolution is shown. 図1に示したコード画像読み取り装置のコード認識条件の一例を示している。An example of the code recognition conditions of the code image reading apparatus shown in FIG. 1 is shown. 図1に示したコード画像読み取り装置がAF調整を実施するときの一例を示している。2 illustrates an example when the code image reading apparatus illustrated in FIG. 1 performs AF adjustment. 図1に示したコード画像読み取り装置がズーム調整を実施するときの一例を示している。An example when the code image reading apparatus shown in FIG. 1 performs zoom adjustment is shown. 図1に示したコード画像読み取り装置のユーザ通知の一例を示している。An example of the user notification of the code image reading apparatus shown in FIG. 1 is shown. 図1に示したコード画像読み取り装置の動作の一例を示している。2 shows an example of the operation of the code image reading apparatus shown in FIG. 図1に示したコード検出部の動作の一例を示している。An example of the operation of the code detector shown in FIG. 1 is shown. AFタイミング検出の一例を示している。An example of AF timing detection is shown. 解像度条件に関する処理の一例を示している。An example of processing related to resolution conditions is shown.

以下、実施形態を図面を用いて説明する。   Hereinafter, embodiments will be described with reference to the drawings.

図1は、一実施形態におけるコード画像読み取り装置10の例を示している。コード画像読み取り装置10は、JANコード等の1次元コードやQRコード(登録商標)等の2次元コードを撮影し、コードに格納されているデータを取り出す。例えば、コード画像読み取り装置10には、オートフォーカス機能およびズーム機能を有するデジタルカメラが搭載されている。コード画像読み取り装置10は、例えば、撮影部20、コード検出部30、移動状態検出部40、制御部50、オートフォーカス部60(以下、AF部とも称する)、ズーム調整部70、通知部80、コード処理部90および表示部100を有している。以下、オートフォーカスをAFとも称する。   FIG. 1 shows an example of a code image reading apparatus 10 according to an embodiment. The code image reading device 10 captures a one-dimensional code such as a JAN code or a two-dimensional code such as a QR code (registered trademark) and takes out data stored in the code. For example, the code image reading apparatus 10 is equipped with a digital camera having an autofocus function and a zoom function. The code image reading device 10 includes, for example, an imaging unit 20, a code detection unit 30, a moving state detection unit 40, a control unit 50, an autofocus unit 60 (hereinafter also referred to as an AF unit), a zoom adjustment unit 70, a notification unit 80, A code processing unit 90 and a display unit 100 are provided. Hereinafter, autofocus is also referred to as AF.

撮影部20は、例えば、読み取り対象のコード等の被写体を撮影し、画像データIMGDを生成する。そして、撮影部20は、画像データIMGDをコード検出部30、制御部50およびコード処理部90に出力する。なお、制御部50およびコード処理部90は、コード検出部30を介して画像データIMGDを受けてもよい。   The imaging unit 20 shoots a subject such as a code to be read, for example, and generates image data IMGD. Then, the imaging unit 20 outputs the image data IMGD to the code detection unit 30, the control unit 50, and the code processing unit 90. The control unit 50 and the code processing unit 90 may receive the image data IMGD via the code detection unit 30.

コード検出部30は、画像データIMGに対応する撮影画像から検査領域を任意に選択する。例えば、コード検出部30は、撮影画像の中央部を検査領域として選択してもよいし、撮影画像の任意の位置から検査領域を順次選択してもよい。また、コード検出部30は、任意の検査領域に、コードが含まれているか否かを検出する。そして、コード検出部30は、検査領域にコードが含まれているとき、コードがぼけた画像か否かを判定する。   The code detection unit 30 arbitrarily selects an inspection area from the captured image corresponding to the image data IMG. For example, the code detection unit 30 may select the central portion of the captured image as the inspection region, or may sequentially select the inspection region from any position of the captured image. Further, the code detection unit 30 detects whether or not a code is included in an arbitrary inspection region. Then, the code detection unit 30 determines whether the code is a blurred image when the code is included in the inspection area.

移動状態検出部40は、例えば、コード画像読み取り装置10の移動状態を加速度センサの出力を用いて検出する。例えば、移動状態検出部40は、ユーザによるコード画像読み取り装置10の移動状態を移動方向および移動速度として検出する。なお、移動状態検出部40は、角速度センサや地磁気センサ等の出力を用いて、コード画像読み取り装置10の移動状態を検出してもよい。例えば、コード画像読み取り装置10には、移動状態の検出に利用可能なセンサ(加速度センサ、角速度センサおよび地磁気センサ等のセンサ)が搭載されている。加速度センサ、角速度センサおよび地磁気センサ等のセンサは、移動状態検出部40内に設けられてもよいし、移動状態検出部40の外部に設けられてもよい。   For example, the movement state detection unit 40 detects the movement state of the code image reading device 10 using the output of the acceleration sensor. For example, the movement state detection unit 40 detects the movement state of the code image reading device 10 by the user as the movement direction and the movement speed. The movement state detection unit 40 may detect the movement state of the code image reading device 10 using the output of an angular velocity sensor, a geomagnetic sensor, or the like. For example, the code image reading apparatus 10 is equipped with sensors (sensors such as an acceleration sensor, an angular velocity sensor, and a geomagnetic sensor) that can be used to detect a moving state. Sensors such as an acceleration sensor, an angular velocity sensor, and a geomagnetic sensor may be provided in the movement state detection unit 40 or may be provided outside the movement state detection unit 40.

制御部50は、コード検出部30の判定結果IINF、移動状態検出部40の検出結果MINFおよび画像データIMGDを受ける。そして、制御部50は、コードの認識が可能になる処理方法を、コード検出部30の判定結果IINFおよび移動状態検出部40の検出結果MINFに基づいて決定する。   The control unit 50 receives the determination result IINF of the code detection unit 30, the detection result MINF of the movement state detection unit 40, and the image data IMGD. Then, the control unit 50 determines a processing method that enables code recognition based on the determination result IINF of the code detection unit 30 and the detection result MINF of the movement state detection unit 40.

例えば、制御部50は、コードがぼけた画像であることを示す判定結果IINFをコード検出部30から受けたとき、オートフォーカス調整の開始タイミングを検出結果MINFに基づいて検出する。すなわち、制御部50は、撮影画像(より詳細には、検査領域)内のコードがぼけた画像のとき、オートフォーカス調整の開始タイミングを移動状態検出部40の検出結果MINFに基づいて検出する。そして、制御部50は、オートフォーカス調整の開始タイミングを示す信号ACNTをAF部60に出力する。   For example, when receiving the determination result IINF indicating that the code is a blurred image from the code detection unit 30, the control unit 50 detects the start timing of the autofocus adjustment based on the detection result MINF. That is, the control unit 50 detects the start timing of the autofocus adjustment based on the detection result MINF of the moving state detection unit 40 when the code in the captured image (more specifically, the inspection region) is blurred. Then, the control unit 50 outputs a signal ACNT indicating the start timing of the autofocus adjustment to the AF unit 60.

また、制御部50は、コードがぼけた画像でないことを示す判定結果IINFをコード検出部30から受けたとき、撮影画像(より詳細には、検査領域)内のコードの解像度に基づいて、ズーム調整が必要か否かを判定する。解像度は、コードの最小構成単位の図形当たりの画素数に対応している。例えば、解像度は、コードの最小構成単位の図形の1辺当たりの画素数である。以下、コードの最小構成単位の図形を単位図形とも称する。   When the control unit 50 receives the determination result IINF indicating that the code is not a blurred image from the code detection unit 30, the control unit 50 performs zooming based on the resolution of the code in the photographed image (more specifically, the inspection region). It is determined whether adjustment is necessary. The resolution corresponds to the number of pixels per figure of the minimum constituent unit of the code. For example, the resolution is the number of pixels per side of the graphic of the minimum structural unit of the code. Hereinafter, the graphic of the minimum constituent unit of the code is also referred to as a unit graphic.

例えば、制御部50は、単位図形の1辺当たりの画素数が予め設定された最小値より小さいとき、ズーム調整が必要であると判定する。このように、制御部50は、コードがぼけた画像でないとき、ズーム調整が必要か否かを検査領域内のコードの解像度に基づいて判定する。そして、制御部50は、ズーム調整が必要か否か等を示す信号ZCNTをズーム調整部70に出力する。   For example, the control unit 50 determines that zoom adjustment is necessary when the number of pixels per side of the unit graphic is smaller than a preset minimum value. Thus, when the code is not a blurred image, the control unit 50 determines whether or not zoom adjustment is necessary based on the resolution of the code in the inspection area. Then, the control unit 50 outputs a signal ZCNT indicating whether or not zoom adjustment is necessary to the zoom adjustment unit 70.

さらに、制御部50は、コード画像読み取り装置10の操作方法等のユーザ通知に関する信号ICNTを通知部80に出力する。また、制御部50は、例えば、認識可能なコードが検出されたことを示す信号CCNTをコード処理部90に出力する。   Further, the control unit 50 outputs a signal ICNT related to user notification such as an operation method of the code image reading device 10 to the notification unit 80. For example, the control unit 50 outputs a signal CCNT indicating that a recognizable code has been detected to the code processing unit 90.

AF部60は、デジタルカメラのオートフォーカス調整が必要であると制御部50で判定されたときに、オートフォーカス調整を実施する。例えば、AF部60は、制御部50から受ける信号ACNTに応答して、オートフォーカス調整を実施する。   The AF unit 60 performs autofocus adjustment when the control unit 50 determines that autofocus adjustment of the digital camera is necessary. For example, the AF unit 60 performs autofocus adjustment in response to the signal ACNT received from the control unit 50.

ズーム調整部70は、デジタルカメラのズーム調整が必要であると制御部50で判定されたとき、ズーム調整を実施する。例えば、ズーム調整部70は、ズーム調整が必要であることを示す信号ZCNTを制御部50から受けたとき、ズーム調整を実施する。   The zoom adjustment unit 70 performs zoom adjustment when the control unit 50 determines that zoom adjustment of the digital camera is necessary. For example, the zoom adjustment unit 70 performs zoom adjustment when receiving a signal ZCNT indicating that zoom adjustment is necessary from the control unit 50.

通知部80は、制御部50からの信号ICNTに基づいて、ユーザに処理の状況や操作方法を通知するか否かを決定する。そして、通知部80は、ユーザに通知を実施するときには、通知内容を決定する。例えば、通知部80は、コード画像読み取り装置10の移動方向等を、表示部100を用いてユーザに通知する。   The notification unit 80 determines whether to notify the user of the processing status and operation method based on the signal ICNT from the control unit 50. And the notification part 80 determines the content of notification, when notifying a user. For example, the notification unit 80 notifies the user of the moving direction and the like of the code image reading device 10 using the display unit 100.

例えば、通知部80は、オートフォーカス調整を実施した後のコードがぼけた画像であることを示す信号ICNTを制御部50から受けたとき、コード画像読み取り装置10をコードから遠ざけるようにするためのユーザ通知DINFを表示部100に出力する。これにより、コード画像読み取り装置10をコードから遠ざける指示(ユーザ通知DINF)が表示部100に表示される。すなわち、通知部80は、オートフォーカス調整を実施した後のコードがぼけた画像のとき、コード画像読み取り装置10をコードから遠ざけるようにするための情報(ユーザ通知DINF)を、表示部100を介してユーザに通知する。   For example, the notification unit 80 is configured to keep the code image reading device 10 away from the code when the signal ICNT indicating that the code after the autofocus adjustment is performed is a blurred image from the control unit 50. The user notification DINF is output to the display unit 100. Thereby, an instruction (user notification DINF) to move the code image reading device 10 away from the code is displayed on the display unit 100. That is, the notification unit 80 provides information (user notification DINF) for keeping the code image reading device 10 away from the code via the display unit 100 when the code after the autofocus adjustment is blurred. To notify the user.

あるいは、通知部80は、ズーム調整部70でのズーム調整が不可であることを示す信号ICNTを制御部50から受けたとき、コード画像読み取り装置10をコードに近づけるようにするためのユーザ通知DINFを表示部100に出力する。例えば、コードの解像度に基づいて算出されたズーム値(撮影倍率)がズーム調整部70での調整範囲外のズーム値のとき、ズーム調整部70でのズーム調整は不可である。   Alternatively, when the notification unit 80 receives from the control unit 50 a signal ICNT indicating that zoom adjustment by the zoom adjustment unit 70 is not possible, a user notification DINF for causing the code image reading device 10 to approach the code. Is output to the display unit 100. For example, when the zoom value (imaging magnification) calculated based on the resolution of the code is a zoom value outside the adjustment range in the zoom adjustment unit 70, zoom adjustment in the zoom adjustment unit 70 is impossible.

すなわち、通知部80は、コードの解像度に基づいて算出されたズーム値がズーム調整部70での調整範囲外のズーム値のとき、コード画像読み取り装置10をコードに近づけるようにするための情報(ユーザ通知DINF)を、表示部100を介してユーザに通知する。このように、通知部80は、コードが認識不可のとき、コードの認識不可の原因に応じたユーザ通知DINF(例えば、コード画像読み取り装置の移動方向)をユーザに通知する。   In other words, when the zoom value calculated based on the resolution of the code is a zoom value outside the adjustment range in the zoom adjustment unit 70, the notification unit 80 is configured to provide information for causing the code image reading device 10 to approach the code ( User notification DINF) is notified to the user via the display unit 100. As described above, when the code cannot be recognized, the notification unit 80 notifies the user of the user notification DINF (for example, the moving direction of the code image reading device) corresponding to the cause of the unrecognized code.

コード処理部90は、コードに格納されているデータを取り出す。例えば、コード処理部90は、認識可能なコードが検出されたことを示す信号CCNTを制御部50から受けたとき、画像データIMGDに対応する撮影画像内のコードに格納されているデータを取り出す。すなわち、コード処理部90は、コードの認識が可能であると制御部50で判定されたとき、画像データIMGDを用いて、読み取り対象のコードに格納されているデータを取り出す。   The code processing unit 90 takes out data stored in the code. For example, when receiving a signal CCNT indicating that a recognizable code has been detected from the control unit 50, the code processing unit 90 extracts data stored in the code in the captured image corresponding to the image data IMGD. That is, when the control unit 50 determines that the code can be recognized, the code processing unit 90 uses the image data IMGD to extract the data stored in the code to be read.

そして、コード処理部90は、取り出したデータDOUTを表示部100に出力する。これにより、コードに格納されているデータDOUTが表示部100に表示される。表示部100は、例えば、液晶ディスプレイであり、コード処理部90の処理結果DOUTおよび通知部80で決定されたユーザ通知DINF等を表示する。   Then, the code processing unit 90 outputs the extracted data DOUT to the display unit 100. Thereby, the data DOUT stored in the code is displayed on the display unit 100. The display unit 100 is, for example, a liquid crystal display, and displays the processing result DOUT of the code processing unit 90, the user notification DINF determined by the notification unit 80, and the like.

なお、コード画像読み取り装置10の構成は、この例に限定されない。例えば、ズーム調整部70は、省かれてもよい。このときには、制御部50は、ズーム調整が必要か否かを判定する必要がない。したがって、制御部50の動作を簡易にできる。   The configuration of the code image reading device 10 is not limited to this example. For example, the zoom adjustment unit 70 may be omitted. At this time, the controller 50 does not need to determine whether or not zoom adjustment is necessary. Therefore, the operation of the control unit 50 can be simplified.

図2は、コードCODのサイズと解像度の関係の一例を示している。なお、図2は、QRコードのサイズと解像度の関係の一例を示している。QRコードでは、40種類のバージョン毎にセル数が決められている。セルは、コードの最小構成単位である。例えば、QRコードの1辺当たりのセル数は、21個から177個までバージョン毎に設定されている。解像度(例えば、セルの1辺当たりの画素数)は、QRコードの印刷時の物理サイズに依存する。1次元コードや2次元コードでは、コードの印刷時の物理サイズに対する規定がないため、様々なサイズや解像度のコードが存在する。   FIG. 2 shows an example of the relationship between the size and resolution of the code COD. FIG. 2 shows an example of the relationship between QR code size and resolution. In the QR code, the number of cells is determined for each of 40 types of versions. A cell is the smallest unit of code. For example, the number of cells per side of the QR code is set for each version from 21 to 177. The resolution (for example, the number of pixels per side of the cell) depends on the physical size when the QR code is printed. In the one-dimensional code and the two-dimensional code, there are no regulations regarding the physical size at the time of printing the code, and therefore codes of various sizes and resolutions exist.

コードCODa、CODb、CODcは、サイズ(コード全体の1辺の長さ)が互いに同じであり、解像度が互いに異なる。例えば、コードCODaのセルの1辺当たりの画素数は、コードCODbのセルの1辺当たりの画素数より多い。また、コードCODcのセルの1辺当たりの画素数は、コードCODbのセルの1辺当たりの画素数より少ない。   The codes CODAa, CODb, and CODc have the same size (the length of one side of the entire code) and have different resolutions. For example, the number of pixels per side of the code CODb cell is larger than the number of pixels per side of the code CODb cell. The number of pixels per side of the code CODc cell is smaller than the number of pixels per side of the code CODb cell.

コードCODd、CODb、CODeは、サイズが互いに異なり、解像度が互いに同じである。例えば、コードCODdの1辺の長さは、コードCODbの1辺の長さより短い。また、コードCODeの1辺の長さは、コードCODbの1辺の長さより長い。   The codes CODd, CODb, and CODe have different sizes and the same resolution. For example, the length of one side of the code CODd is shorter than the length of one side of the code CODb. The length of one side of the code CODe is longer than the length of one side of the code CODb.

図3は、図1に示したコード画像読み取り装置10のコード認識条件の一例を示している。なお、図3は、撮影距離(コードとコード画像読み取り装置10の距離)が変化したときのコード画像の光学分解能および解像度を示している。光学分解能の破線は、AFを使用しないときの光学分解能の一例を示している。また、解像度の実線は、ズームを使用しないとき(ズーム値を最小にしたとき)の解像度の一例を示し、解像度の破線は、ズーム値を最大にしたときの解像度の一例を示している。すなわち、図の網掛けは、ズーム調整可能な範囲を示している。   FIG. 3 shows an example of code recognition conditions of the code image reading apparatus 10 shown in FIG. FIG. 3 shows the optical resolution and resolution of the code image when the shooting distance (distance between the code and the code image reading device 10) changes. The broken line of the optical resolution shows an example of the optical resolution when AF is not used. The solid line of resolution indicates an example of resolution when zoom is not used (when the zoom value is minimized), and the broken line of resolution indicates an example of resolution when the zoom value is maximized. That is, the shaded area in the figure indicates a range in which zoom adjustment is possible.

光学分解能が高いことは、焦点のずれが小さいことを示している。すなわち、光学分解能が低くなるにしたがい、ぼけた画像が撮影される。また、解像度が高いことは、単位図形(例えば、QRコードのセル)の1辺当たりの画素数が多いことを示している。解像度は、撮影距離が遠くなるにしたがい、低くなる。コード画像読み取り装置10は、撮影したコード画像の光学分解能および解像度が低いときには、コードを正しく認識できない。   A high optical resolution indicates a small focus shift. That is, as the optical resolution becomes lower, a blurred image is taken. A high resolution indicates that the number of pixels per side of a unit graphic (for example, a QR code cell) is large. The resolution decreases as the shooting distance increases. The code image reading apparatus 10 cannot correctly recognize the code when the optical resolution and resolution of the photographed code image are low.

例えば、コード画像読み取り装置10は、光学分解能が所定の下限レベルTH10より高く、かつ、解像度が所定の下限レベルTH20より高いとき、コードを認識できる。すなわち、コード画像読み取り装置10は、撮影距離が距離D10より近いときには、光学分解能を下限レベルTH10より高くできないため、コードを認識できない。また、コード画像読み取り装置10は、撮影距離が距離D20より遠いときには、解像度を下限レベルTH20より高くできないため、コードを認識できない。   For example, the code image reading apparatus 10 can recognize a code when the optical resolution is higher than a predetermined lower limit level TH10 and the resolution is higher than a predetermined lower limit level TH20. That is, the code image reading device 10 cannot recognize the code when the shooting distance is closer than the distance D10 because the optical resolution cannot be higher than the lower limit level TH10. Also, the code image reading device 10 cannot recognize the code when the shooting distance is longer than the distance D20 because the resolution cannot be higher than the lower limit level TH20.

例えば、コード画像読み取り装置10は、撮影距離が距離D10から距離D16までの範囲では、ズーム調整を実施しなくても、コードを認識できる。また、コード画像読み取り装置10は、撮影距離が距離D16から距離D20までの範囲では、ズーム調整を実施した後、コードを認識できる。したがって、コード画像読み取り装置10は、撮影距離が距離D10から距離D20までの範囲のとき、コードを認識できる。   For example, the code image reading apparatus 10 can recognize the code without performing zoom adjustment when the shooting distance is in the range from the distance D10 to the distance D16. Further, the code image reading apparatus 10 can recognize the code after performing zoom adjustment when the shooting distance is in the range from the distance D16 to the distance D20. Therefore, the code image reading apparatus 10 can recognize the code when the shooting distance is in the range from the distance D10 to the distance D20.

なお、AFを使用しないときには、光学分解能が下限レベルTH10より高くなる撮影距離は、距離D12から距離D14の狭い範囲である。すなわち、AFを使用しないときには、コードを認識するための光学分解能の条件を満たす撮影距離は、距離D12から距離D14の狭い範囲である。AFを使用することにより、光学分解能が下限レベルTH10より高くなる撮影距離の範囲を広くできる。例えば、コード画像読み取り装置10は、AFを使用するときには、撮影距離を距離D10以上にすることにより、光学分解能を下限レベルTH10より高くできる。すなわち、AF調整を実施することにより、コードを認識するための光学分解能の条件を満たす撮影距離は、距離D10以上に拡大される。   When AF is not used, the shooting distance at which the optical resolution is higher than the lower limit level TH10 is a narrow range from the distance D12 to the distance D14. That is, when AF is not used, the shooting distance that satisfies the optical resolution condition for recognizing the code is a narrow range from the distance D12 to the distance D14. By using AF, the range of the photographing distance where the optical resolution is higher than the lower limit level TH10 can be widened. For example, when using the AF, the code image reading apparatus 10 can make the optical resolution higher than the lower limit level TH10 by setting the shooting distance to the distance D10 or more. That is, by performing the AF adjustment, the shooting distance that satisfies the optical resolution condition for recognizing the code is expanded to the distance D10 or more.

また、ズームを使用しないときには、解像度が下限レベルTH20より高くなる撮影距離は、距離D16以下である。ズームを使用することにより、解像度が下限レベルTH20より高くなる撮影距離の範囲を広くできる。例えば、コード画像読み取り装置10は、距離D16から距離D20の範囲の撮影距離でコードを撮影したとき、ズームを使用することにより、解像度を下限レベルTH20より高くできる。すなわち、ズーム調整を実施することにより、コードを認識するための解像度の条件を満たす撮影距離は、距離D20までに拡大される。   When the zoom is not used, the shooting distance at which the resolution is higher than the lower limit level TH20 is the distance D16 or less. By using the zoom, the range of the photographing distance where the resolution is higher than the lower limit level TH20 can be widened. For example, when the code image reading apparatus 10 captures a code at an imaging distance in the range of the distance D16 to the distance D20, the resolution can be made higher than the lower limit level TH20 by using the zoom. That is, by performing the zoom adjustment, the photographing distance that satisfies the resolution condition for recognizing the code is expanded to the distance D20.

なお、図の解像度のレベルTH22は、解像度の上限を示している。例えば、レベルTH22は、コードが画面(例えば、表示部100の画面)からはみ出さないようにしたときの解像度の上限に対応している。このときには、コード画像読み取り装置10は、コードが画面からはみ出すか否かの判定を、撮影画像(より詳細には、検査領域)内のコードの解像度に基づいて実施できる。なお、コードが画面からはみ出すか否かの判定は、解像度を用いずに実施されてもよい。すなわち、解像度の上限レベルTH22は、設定されなくてもよい。   The resolution level TH22 in the figure indicates the upper limit of the resolution. For example, the level TH22 corresponds to the upper limit of the resolution when the code is prevented from protruding from the screen (for example, the screen of the display unit 100). At this time, the code image reading apparatus 10 can determine whether or not the code protrudes from the screen based on the resolution of the code in the photographed image (more specifically, the inspection region). Note that the determination of whether or not the code protrudes from the screen may be performed without using the resolution. In other words, the upper limit level TH22 of resolution may not be set.

図4は、図1に示したコード画像読み取り装置10がAF調整を実施するときの一例を示している。なお、図4は、カメラ設計時に想定した最適な撮影距離D13より遠い位置(距離D18)でコードCODbを撮影したときのAF調整およびズーム調整の一例を示している。図の破線は、AF調整およびズーム調整を実施していないときのコード画像の光学分解能および解像度を示している。また、図のコードCODb’は、コードCODbを撮影距離D18で撮影したときのコード画像に対応している。   FIG. 4 shows an example when the code image reading apparatus 10 shown in FIG. 1 performs AF adjustment. FIG. 4 shows an example of AF adjustment and zoom adjustment when the code CODb is photographed at a position (distance D18) far from the optimum photographing distance D13 assumed at the time of designing the camera. The broken line in the figure indicates the optical resolution and resolution of the code image when AF adjustment and zoom adjustment are not performed. The code CODb 'in the figure corresponds to a code image when the code CODb is photographed at the photographing distance D18.

先ず、コード画像読み取り装置10は、コードCODb’を認識するための光学分解能の条件(光学分解能が下限レベルTH10より高いか否か)を確認する。AFを使用しないで撮影されたコードCODb’の光学分解能は、光学分解能の条件(下限レベルTH10より高い光学分解能)を満たしていない。この状態では、コードCODb’は、認識不可である。このため、コード画像読み取り装置10は、AF調整を実施し、コードCODb’に焦点を合わせる。すなわち、コード画像読み取り装置10は、AFを使用した撮影を実施し、光学分解能が下限レベルTH10より高い撮影画像を生成する。   First, the code image reading apparatus 10 checks the condition of the optical resolution for recognizing the code CODb '(whether the optical resolution is higher than the lower limit level TH10). The optical resolution of the code CODb ′ captured without using AF does not satisfy the optical resolution condition (optical resolution higher than the lower limit level TH10). In this state, the code CODb 'cannot be recognized. Therefore, the code image reading apparatus 10 performs AF adjustment and focuses on the code CODb ′. That is, the code image reading apparatus 10 performs shooting using AF, and generates a shot image having an optical resolution higher than the lower limit level TH10.

次に、コード画像読み取り装置10は、コードCODb’を認識するための解像度の条件(解像度が下限レベルTH20より高いか否か)を確認する。図の例では、撮影距離が遠いため、ズームを使用しないで撮影されたコードCODb’の解像度は、コードを認識可能な解像度の範囲からはずれている。この状態では、コードCODb’は、認識不可である。このため、コード画像読み取り装置10は、解像度を下限レベルTH20より高くするためのズーム値を算出し、ズーム調整を実施する。   Next, the code image reading apparatus 10 checks a resolution condition (whether or not the resolution is higher than the lower limit level TH20) for recognizing the code CODb '. In the example in the figure, since the shooting distance is long, the resolution of the code CODb 'shot without using the zoom is out of the resolution range where the code can be recognized. In this state, the code CODb 'cannot be recognized. For this reason, the code image reading apparatus 10 calculates a zoom value for making the resolution higher than the lower limit level TH20, and performs zoom adjustment.

そして、コード画像読み取り装置10は、ズーム調整で設定したズーム値で、コードCODb’を撮影する。この撮影の焦点距離は、例えば、ズーム調整の前に実施された撮影の焦点距離(AF調整で設定した焦点距離)に基づいて設定される。これにより、光学分解能および解像度の両方の条件を満たす撮影画像(コードCODb)が生成される。   Then, the code image reading apparatus 10 captures the code CODb ′ with the zoom value set by the zoom adjustment. The focal length of this shooting is set based on, for example, the focal length of the shooting performed before zoom adjustment (focal length set by AF adjustment). Thus, a captured image (code CODb) that satisfies both the optical resolution and the resolution is generated.

このように、コード画像読み取り装置10は、撮影距離D13より遠い距離D18で撮影したコードCODb’の光学分解能および解像度をそれぞれ下限レベルTH10、TH20より高くできる。これにより、コード画像読み取り装置10は、コードCODb’を認識できる。すなわち、カメラ設計時に想定した最適な撮影距離D13より遠い位置(距離D18)にコード画像読み取り装置10をユーザが合わせたときにも、コード画像読み取り装置10は、コードCODb’に格納されているデータを取り出すことができる。   As described above, the code image reading apparatus 10 can set the optical resolution and resolution of the code CODb ′ photographed at the distance D18 farther than the photographing distance D13 higher than the lower limit levels TH10 and TH20, respectively. Thereby, the code image reading apparatus 10 can recognize the code CODb ′. That is, even when the user places the code image reading device 10 at a position (distance D18) farther than the optimum shooting distance D13 assumed at the time of designing the camera, the code image reading device 10 also stores the data stored in the code CODb ′. Can be taken out.

図5は、図1に示したコード画像読み取り装置10がズーム調整を実施するときの一例を示している。なお、図5は、カメラ設計時に想定した標準解像度およびサイズのコード(以下、想定コードとも称する)と異なる解像度のコードCODcを撮影したときのズーム調整の一例を示している。想定コードは、例えば、コードCODbである。図の太い破線は、ズーム調整を実施せずに撮影したときのコードCODcの解像度を示し、図の細い破線は、ズーム調整を実施せずに撮影したときの想定コードCODbの解像度を示している。例えば、コードCODb、CODcの撮影距離は、カメラ設計時に想定した最適な距離D13である。   FIG. 5 shows an example when the code image reading apparatus 10 shown in FIG. 1 performs zoom adjustment. FIG. 5 shows an example of zoom adjustment when a code CODc having a resolution different from that of a standard resolution and size code assumed at the time of camera design (hereinafter also referred to as an assumed code) is photographed. The assumed code is, for example, the code CODb. The thick broken line in the figure indicates the resolution of the code CODc when imaged without zoom adjustment, and the thin broken line in the figure indicates the resolution of the assumed code CODb when imaged without zoom adjustment. . For example, the photographing distance of the codes CODb and CODc is the optimum distance D13 assumed at the time of designing the camera.

コードCODcのセルは、コードCODbのセルに比べて、小さい。したがって、ユーザが最適な距離D13でコードCODcを撮影したときにも、撮影されたコードCODcの解像度は、想定コードCODbの解像度より低くなる(図の破線)。このため、ズームを使用しないで撮影されたコードCODcの解像度は、コードを認識可能な解像度の範囲からはずれている。この状態では、コードCODcは、認識不可である。このため、コード画像読み取り装置10は、解像度を下限レベルTH20より高くするためのズーム値を算出し、ズーム調整を実施する。   The code CODc cell is smaller than the code CODb cell. Therefore, even when the user captures the code CODc at the optimum distance D13, the resolution of the captured code CODc is lower than the resolution of the assumed code CODb (broken line in the figure). For this reason, the resolution of the code CODc photographed without using the zoom is out of the resolution range in which the code can be recognized. In this state, the code CODc cannot be recognized. For this reason, the code image reading apparatus 10 calculates a zoom value for making the resolution higher than the lower limit level TH20, and performs zoom adjustment.

そして、コード画像読み取り装置10は、ズーム調整で設定したズーム値で、コードCODcを撮影する。ズーム調整を実施して撮影されたコードCODcの解像度は、下限レベルTH20より高くなる(図の実線)。すなわち、解像度の条件を満たす撮影画像(コードCODc)が生成される。なお、図5の例では、最適な距離D13でコードCODcが撮影されているため、AF調整を実施しなくても、光学分解能は、下限レベルTH10より高い。   Then, the code image reading apparatus 10 captures the code CODc with the zoom value set by the zoom adjustment. The resolution of the code CODc photographed by performing the zoom adjustment becomes higher than the lower limit level TH20 (solid line in the figure). That is, a captured image (code CODc) that satisfies the resolution condition is generated. In the example of FIG. 5, since the code CODc is photographed at the optimum distance D13, the optical resolution is higher than the lower limit level TH10 without performing AF adjustment.

このように、コード画像読み取り装置10は、読み出し対象のコードCODcの解像度が想定コードCODbの解像度と異なるときにも、撮影したコードCODcの光学分解能および解像度をそれぞれ下限レベルTH10、TH20より高くできる。したがって、コード画像読み取り装置10は、想定コードCODbの解像度と異なる解像度のコードCODcを認識でき、コードCODcに格納されているデータを取り出すことができる。   Thus, the code image reading apparatus 10 can make the optical resolution and resolution of the photographed code CODc higher than the lower limit levels TH10 and TH20, respectively, even when the resolution of the code CODc to be read is different from the resolution of the assumed code CODb. Therefore, the code image reading apparatus 10 can recognize the code CODc having a resolution different from the resolution of the assumed code CODb, and can extract the data stored in the code CODc.

なお、コード画像読み取り装置10は、想定コードCODbのサイズと異なるサイズのコード(例えば、図2に示したコードCODe)も、AF調整やズーム調整を実施することにより、認識できる。すなわち、コード画像読み取り装置10は、想定コードCODbと異なる解像度やサイズのコードに格納されているデータを取り出すことができる。   Note that the code image reading apparatus 10 can recognize a code having a size different from the size of the assumed code CODb (for example, the code CODe shown in FIG. 2) by performing AF adjustment and zoom adjustment. That is, the code image reading apparatus 10 can extract data stored in a code having a resolution or size different from that of the assumed code CODb.

図6は、図1に示したコード画像読み取り装置10のユーザ通知の一例を示している。コードCOD(10)は、距離D10より近い位置で撮影されたコードCODである。また、コードCOD(20)は、光学分解能および解像度の両方の条件を満たす撮影距離(例えば、距離D10から距離D20までの範囲)で撮影されたコードCODである。コードCOD(30)は、距離D20より遠い位置で撮影されたコードCODである。また、図6の解像度の実線、破線および網掛けの意味は、図3と同じである。   FIG. 6 shows an example of a user notification of the code image reading apparatus 10 shown in FIG. The code COD (10) is a code COD photographed at a position closer than the distance D10. The code COD (20) is a code COD photographed at a photographing distance (for example, a range from the distance D10 to the distance D20) that satisfies both the optical resolution and the resolution. The code COD (30) is a code COD photographed at a position farther than the distance D20. Also, the meanings of the solid line, broken line, and hatching in the resolution of FIG. 6 are the same as in FIG.

撮影距離が距離D10より近いときには、AF調整を実施しても、焦点は合わない。すなわち、コード画像読み取り装置10は、撮影距離が距離D10より近いとき、撮影画像の光学分解能を下限レベルTH10より高くできない。このため、コード画像読み取り装置10は、コード画像読み取り装置10をコードCODから遠ざけるようにするためのユーザ通知DINFを表示部100に出力する。例えば、コード画像読み取り装置10は、表示部100に“遠ざけて下さい”と表示する。   When the shooting distance is shorter than the distance D10, even if AF adjustment is performed, the focus is not achieved. That is, the code image reading device 10 cannot increase the optical resolution of the photographed image above the lower limit level TH10 when the photographing distance is shorter than the distance D10. For this reason, the code image reading device 10 outputs a user notification DINF for keeping the code image reading device 10 away from the code COD to the display unit 100. For example, the code image reading apparatus 10 displays “Please move away” on the display unit 100.

また、撮影距離が距離D20より遠いときには、ズーム調整を実施しても、撮影されるコードCOD(30)の解像度は、下限レベルTH20より高くならない。すなわち、コード画像読み取り装置10は、撮影距離が距離D20より遠いとき、コードCODの解像度を下限レベルTH20より高くできない。このため、コード画像読み取り装置10は、コード画像読み取り装置10をコードCODに近づけるようにするためのユーザ通知DINFを表示部100に出力する。例えば、コード画像読み取り装置10は、表示部100に“近づけて下さい”と表示する。   Further, when the shooting distance is longer than the distance D20, the resolution of the code COD (30) to be shot does not become higher than the lower limit level TH20 even if zoom adjustment is performed. That is, the code image reading apparatus 10 cannot increase the resolution of the code COD above the lower limit level TH20 when the shooting distance is longer than the distance D20. Therefore, the code image reading device 10 outputs a user notification DINF for causing the code image reading device 10 to approach the code COD to the display unit 100. For example, the code image reading apparatus 10 displays “Please move closer” to the display unit 100.

このように、コード画像読み取り装置10は、コードCODの認識不可の原因に応じた対応方法(例えば、光学分解能の条件を満たさないときの対応方法、解像度の条件を満たさないときとの対応方法)をユーザに通知する。これにより、この実施形態では、コード画像読み取り装置10の利便性を向上できる。   As described above, the code image reading apparatus 10 responds according to the cause of the inability to recognize the code COD (for example, a response method when the optical resolution condition is not satisfied, and a response method when the resolution condition is not satisfied). To the user. Thereby, in this embodiment, the convenience of the code image reading apparatus 10 can be improved.

例えば、コードCODの認識不可の原因に応じた対応方法がユーザに通知されないコード画像読み取り装置では、ユーザは、コードの認識不可の理由を理解することが困難である。このため、誤った方向にコード画像読み取り装置10を移動する等の不適切な操作が実施されるおそれがある。これに対し、この実施形態では、コードCODの認識不可の原因に応じた対応方法がユーザに通知されるため、コードが認識されないときにも、ユーザは、コード画像読み取り装置10を適切に操作できる。   For example, in a code image reading apparatus in which a user is not notified of a countermeasure according to the cause of the inability to recognize the code COD, it is difficult for the user to understand the reason why the code cannot be recognized. For this reason, an inappropriate operation such as moving the code image reading device 10 in the wrong direction may be performed. On the other hand, in this embodiment, since the user is notified of a handling method according to the cause of the unrecognizable code COD, the user can appropriately operate the code image reading device 10 even when the code is not recognized. .

なお、撮影距離が距離D10から距離D20までの範囲では、コード画像読み取り装置10がコードCOD(20)を認識できるため、ユーザの対応方法は指示されない。例えば、コード画像読み取り装置10がコードCODを認識しているときには、コード画像読み取り装置10は、データ読み出し中等の処理内容を表示部100に表示してもよい。   In the range where the shooting distance is from the distance D10 to the distance D20, the code image reading apparatus 10 can recognize the code COD (20), and therefore the user's handling method is not instructed. For example, when the code image reading apparatus 10 recognizes the code COD, the code image reading apparatus 10 may display processing contents such as data reading on the display unit 100.

また、ユーザ通知の内容は、この例に限定されない。例えば、コード画像読み取り装置10は、対応方法の代わりに、認識不可の理由をユーザに通知してもよい。あるいは、コード画像読み取り装置10は、認識不可の理由および対応方法の両方を通知してもよい。   Further, the content of the user notification is not limited to this example. For example, the code image reading apparatus 10 may notify the user of the reason for the recognition failure instead of the handling method. Alternatively, the code image reading apparatus 10 may notify both of the reason for non-recognition and the handling method.

図7は、図1に示したコード画像読み取り装置10の動作の一例を示している。図7の動作は、ハードウエアのみで実現されてもよく、ハードウエアをソフトウエアにより制御することにより実現されてもよい。例えば、ソフトウエア(プログラム)は、カメラ機能を有する電子機器(例えば、携帯電話)に図7の動作を実行させる。   FIG. 7 shows an example of the operation of the code image reading apparatus 10 shown in FIG. The operation of FIG. 7 may be realized only by hardware, or may be realized by controlling the hardware by software. For example, the software (program) causes an electronic device (for example, a mobile phone) having a camera function to execute the operation of FIG.

処理S100では、撮影部20は、読み取り対象のコード等の被写体を、AFを使用せずに撮影する。処理S110では、コード検出部30は、図8に示すコード検出処理を実施し、コードが撮影されているか否かを検出する。撮影画像内のコードの検出方法は、例えば、特許第4180497号公報に開示されている。また、コード検出部30は、コードが撮影されているときには、撮影されたコードがぼけた画像か否かを判定する。ぼけた画像か否かは、例えば、図8に示すように、画素値の分散に基づいて判定される。なお、画素値の分散に基づく判定は、画素値の標準偏差に基づく判定も含む。したがって、ぼけた画像か否かは、画素値の標準偏差に基づいて判定されてもよい。   In the process S100, the photographing unit 20 photographs a subject such as a code to be read without using AF. In process S110, the code detection unit 30 performs the code detection process shown in FIG. 8 and detects whether or not the code is photographed. A method for detecting a code in a captured image is disclosed in, for example, Japanese Patent No. 4180497. Further, when the code is photographed, the code detection unit 30 determines whether or not the photographed code is a blurred image. Whether or not the image is blurred is determined based on the dispersion of pixel values, for example, as shown in FIG. Note that the determination based on the variance of the pixel values includes determination based on the standard deviation of the pixel values. Accordingly, whether or not the image is blurred may be determined based on the standard deviation of the pixel values.

処理S120では、制御部50は、処理S110の結果(コード検出部30の判定結果)に基づいて、コードが検出されたか否かを判定する。コードが検出されていないとき(処理S120のNo)、コード画像読み取り装置10は、処理S260の認識不可処理を実施して、一連の処理を終了する。一方、コードが検出されたとき(処理S120のYes)、制御部50の動作は、処理S130に移る。   In the process S120, the control unit 50 determines whether or not a code is detected based on the result of the process S110 (determination result of the code detection unit 30). When the code is not detected (No in process S120), the code image reading apparatus 10 performs the recognition impossibility process in process S260 and ends the series of processes. On the other hand, when the code is detected (Yes in process S120), the operation of the control unit 50 proceeds to process S130.

処理S130では、制御部50は、処理S110の結果(コード検出部30の判定結果)に基づいて、コードがぼけた画像か否かを判定する。すなわち、処理S130では、制御部50は、撮影されたコードがコードを認識するための光学分解能の条件を満たしているか否かを判定する。コードがぼけた画像のとき(処理S130のYes)、制御部50の動作は、処理S190に移る。一方、コードがぼけた画像でないとき(処理S130のNo)、制御部50の動作は、処理S140に移る。   In process S130, the control unit 50 determines whether the code is a blurred image based on the result of process S110 (the determination result of the code detection unit 30). That is, in process S130, the control unit 50 determines whether or not the photographed code satisfies an optical resolution condition for recognizing the code. When the code is a blurred image (Yes in process S130), the operation of the control unit 50 proceeds to process S190. On the other hand, when the code is not a blurred image (No in process S130), the operation of the control unit 50 proceeds to process S140.

処理S140では、制御部50は、コードの解像度が解像度条件を満たすか否かを判定する。解像度条件は、コードを認識するための解像度の条件である。例えば、解像度条件は、単位図形(例えば、QRコードのセル)の1辺当たりの画素数N、推定誤差α、最小値Tminを用いて、式(1)で表される。   In step S140, the control unit 50 determines whether or not the code resolution satisfies the resolution condition. The resolution condition is a resolution condition for recognizing a code. For example, the resolution condition is expressed by Expression (1) using the number N of pixels per side of a unit graphic (for example, a QR code cell), the estimation error α, and the minimum value Tmin.

Tmin<N−α ・・・(1)
画素数N、推定誤差αは、例えば、図10に示すように、コードの白/黒パターンの長さ(画素数)のヒストグラムに基づいて算出される。例えば、推定誤差αは、ピークの半値半幅に対応している。また、最小値Tminは、例えば、コードの認識に必要な単位図形の1辺当たりの最少画素数(例えば、3画素)であり、予め設定されている。すなわち、最小値Tminは、図3に示した下限レベルTH20に対応している。例えば、制御部50は、画素数Nが式(1)を満たしているとき、コードの解像度が解像度条件を満たしていると判定する。
Tmin <N−α (1)
For example, as shown in FIG. 10, the number of pixels N and the estimation error α are calculated based on a histogram of the length (number of pixels) of the white / black pattern of the code. For example, the estimation error α corresponds to the half width at half maximum of the peak. The minimum value Tmin is, for example, the minimum number of pixels (for example, 3 pixels) per side of a unit graphic necessary for code recognition, and is set in advance. That is, the minimum value Tmin corresponds to the lower limit level TH20 shown in FIG. For example, when the number N of pixels satisfies the formula (1), the control unit 50 determines that the resolution of the code satisfies the resolution condition.

コードの解像度が解像度条件を満たしているとき(処理S140のYes)、コード画像読み取り装置10は、処理S170(コード読み取り)を実施して、一連の処理を終了する。一方、コードの解像度が解像度条件を満たしていないとき(処理S140のNo)、制御部50の動作は、処理S150に移る。このように、処理S140では、制御部50は、コードの解像度に基づいて、ズーム調整が必要か否かを判定する。   When the resolution of the code satisfies the resolution condition (Yes in process S140), the code image reading apparatus 10 performs the process S170 (code reading) and ends the series of processes. On the other hand, when the code resolution does not satisfy the resolution condition (No in step S140), the operation of the control unit 50 proceeds to step S150. As described above, in step S140, the control unit 50 determines whether or not zoom adjustment is necessary based on the resolution of the code.

処理S150では、制御部50は、ズーム調整が可能か否かを判定する。例えば、制御部50は、式(2)を満たす目標ズーム値Zmがズーム調整部70で調整可能な範囲に存在するか否かを判定する。   In step S150, the control unit 50 determines whether zoom adjustment is possible. For example, the control unit 50 determines whether or not the target zoom value Zm that satisfies Expression (2) is within a range that can be adjusted by the zoom adjustment unit 70.

Tmin/(N−α)<Zm ・・・(2)
制御部50は、式(2)を満たす目標ズーム値Zmがズーム調整部70で調整可能な範囲に存在するとき、ズーム調整可能と判定する。換言すれば、制御部50は、式(2)を満たす目標ズーム値Zmがズーム調整部70で調整可能な範囲に存在しないとき、ズーム調整が可能でないと判定する。
Tmin / (N−α) <Zm (2)
The control unit 50 determines that zoom adjustment is possible when the target zoom value Zm satisfying the expression (2) is within a range adjustable by the zoom adjustment unit 70. In other words, the control unit 50 determines that zoom adjustment is not possible when the target zoom value Zm satisfying the expression (2) is not within the range adjustable by the zoom adjustment unit 70.

ズーム調整が可能でないとき(処理S150のNo)、コード画像読み取り装置10は、処理S180のユーザ通知(近づける指示)を実施して、一連の処理を終了する。一方、ズーム調整が可能なとき(処理S150のYes)、コード画像読み取り装置10の動作は、処理S160に移る。   When zoom adjustment is not possible (No in process S150), the code image reading apparatus 10 performs a user notification (an instruction to approach) in process S180, and ends a series of processes. On the other hand, when zoom adjustment is possible (Yes in process S150), the operation of the code image reading apparatus 10 proceeds to process S160.

処理S160では、コード画像読み取り装置10は、ズーム撮影を実施する。例えば、制御部50は、式(2)を満たす目標ズーム値Zmのうち、ズーム調整部70で調整可能な最小のズーム値を、適正ズーム値として算出する。そして、ズーム調整部70は、制御部50で算出された適正ズーム値に基づいて、ズーム調整を実施する。撮影部20は、ズーム調整部70で調整された適正ズーム値で、読み取り対象のコード等の被写体を撮影する。   In process S160, the code image reading apparatus 10 performs zoom shooting. For example, the control unit 50 calculates, as an appropriate zoom value, the minimum zoom value that can be adjusted by the zoom adjustment unit 70 among the target zoom values Zm that satisfy Expression (2). Then, the zoom adjustment unit 70 performs zoom adjustment based on the appropriate zoom value calculated by the control unit 50. The photographing unit 20 photographs a subject such as a code to be read with the appropriate zoom value adjusted by the zoom adjusting unit 70.

このように、この実施形態では、撮影されたコードの解像度が解像度条件を満たしていないときに、ユーザがズーム調整の倍率(ズーム値)を決定する必要がない。このため、この実施形態では、コード画像読み取り装置10の使い勝手を向上できる。また、コードの解像度が解像度条件を満たしているときには、ズーム調整は実施されない。すなわち、この実施形態では、不必要なズーム調整を実施しないため、コードを認識するまでの時間を短縮できる。   Thus, in this embodiment, when the resolution of the captured code does not satisfy the resolution condition, the user does not need to determine the zoom adjustment magnification (zoom value). For this reason, in this embodiment, the usability of the code image reading apparatus 10 can be improved. When the code resolution satisfies the resolution condition, zoom adjustment is not performed. That is, in this embodiment, unnecessary zoom adjustment is not performed, so that the time until the code is recognized can be shortened.

なお、処理S160のズーム撮影の焦点距離は、例えば、処理S200のAF撮影が実施されたときには、処理S200のAF撮影の焦点距離に基づいて設定される。また、処理S200のAF撮影が実施されていないときには、処理S160のズーム撮影の焦点距離は、例えば、カメラの設計時に設定された焦点距離(処理S100の撮影の焦点距離)である。すなわち、処理S160のズーム撮影の焦点距離は、処理S160の撮影の1つ前に実施された撮影の焦点距離に基づいて設定される。   Note that the focal length of zoom shooting in step S160 is set based on the focal length of AF shooting in step S200, for example, when AF shooting in step S200 is performed. Further, when the AF shooting in the process S200 is not performed, the focal length of the zoom shooting in the processing S160 is, for example, the focal length set when the camera is designed (the focal length of the shooting in the processing S100). That is, the focal length of the zoom shooting in step S160 is set based on the focal length of the shooting performed immediately before the shooting in step S160.

処理S170では、コード処理部90は、コードに格納されているデータを取り出す。例えば、コード画像読み取り装置10は、取り出したデータが示す情報を、表示部100に表示する。これにより、コードの読み取り処理は終了する。   In process S170, the code processing unit 90 retrieves data stored in the code. For example, the code image reading apparatus 10 displays information indicated by the extracted data on the display unit 100. This completes the code reading process.

処理S180では、コード画像読み取り装置10は、コード画像読み取り装置10をコードに近づけるようにするための指示を表示部100に表示する。例えば、通知部80は、コード画像読み取り装置10をコードに近づけるようにするためのユーザ通知DINFを表示部100に出力する。これにより、コード画像読み取り装置10をコードに近づけるようにするための指示(“近づけて下さい”等の指示)が表示部100に表示される。   In process S180, the code image reading apparatus 10 displays an instruction for causing the code image reading apparatus 10 to approach the code on the display unit 100. For example, the notification unit 80 outputs a user notification DINF for causing the code image reading device 10 to approach the code to the display unit 100. As a result, an instruction for causing the code image reading device 10 to approach the code (an instruction such as “Please approach”) is displayed on the display unit 100.

このように、コード画像読み取り装置10は、ズーム調整を実施しても、撮影されるコードの解像度が解像度条件を満たさないとき、適切な対応方法(“近づけて下さい”等の指示)をユーザに通知する。これにより、この実施形態では、コード画像読み取り装置10の利便性を向上できる。   As described above, the code image reading apparatus 10 provides the user with an appropriate response method (instructions such as “keep close”) when the resolution of the photographed code does not satisfy the resolution condition even after performing zoom adjustment. Notice. Thereby, in this embodiment, the convenience of the code image reading apparatus 10 can be improved.

処理S190では、制御部50は、AF調整の開始タイミングが否かを検出する。例えば、制御部50は、図9に示すように、AF調整の開始タイミングを移動状態検出部40の検出結果に基づいて検出する。例えば、制御部50は、コード画像読み取り装置10が移動していないと判定したとき、AF調整の開始タイミングと判定する。なお、制御部50は、コード画像読み取り装置10がカメラの光軸方向に所定時間継続して移動していると判定したとき、AF調整の開始タイミングと判定してもよい。あるいは、制御部50は、コード画像読み取り装置10が光軸方向に移動している期間に、移動方向が反対方向に変化したと判定したとき、AF調整の開始タイミングと判定してもよい。   In step S190, the control unit 50 detects whether or not the AF adjustment start timing is reached. For example, as illustrated in FIG. 9, the control unit 50 detects the AF adjustment start timing based on the detection result of the moving state detection unit 40. For example, when it is determined that the code image reading device 10 is not moved, the control unit 50 determines the AF adjustment start timing. Note that the control unit 50 may determine the AF adjustment start timing when it is determined that the code image reading device 10 is continuously moving in the optical axis direction of the camera for a predetermined time. Alternatively, when it is determined that the moving direction has changed in the opposite direction during the period in which the code image reading device 10 is moving in the optical axis direction, the control unit 50 may determine that the AF adjustment start timing has been reached.

AF調整の開始タイミングが検出されなかったとき(処理S190のNo)、コード画像読み取り装置10は、処理S260の認識不可処理を実施して、一連の処理を終了する。一方、AF調整の開始タイミングが検出されたとき(処理S190のYes)、コード画像読み取り装置10の動作は、処理S200に移る。   When the AF adjustment start timing is not detected (No in process S190), the code image reading apparatus 10 performs the recognition impossibility process in process S260 and ends the series of processes. On the other hand, when the AF adjustment start timing is detected (Yes in process S190), the operation of the code image reading apparatus 10 proceeds to process S200.

処理S200では、コード画像読み取り装置10は、AF撮影を実施する。例えば、AF部60は、制御部50によるAF調整の開始タイミングの検出に応答して、AF調整を実施する。そして、撮影部20は、AF調整で設定された焦点距離で、読み取り対象のコード等の被写体を撮影する。   In process S200, the code image reading apparatus 10 performs AF shooting. For example, the AF unit 60 performs AF adjustment in response to detection of the AF adjustment start timing by the control unit 50. Then, the photographing unit 20 photographs a subject such as a code to be read at a focal length set by AF adjustment.

このように、この実施形態では、撮影されたコードが光学分解能の条件を満たしていないときに、ユーザがカメラの光学特性に合わせて撮影距離を細かく調整する必要がない。また、この実施形態では、ユーザがAF調整を実施するタイミングを決定する必要がない。このため、この実施形態では、コード画像読み取り装置10の使い勝手を向上できる。また、撮影されたコードが光学分解能の条件を満たしているときには、AF調整は実施されない。すなわち、この実施形態では、不必要なAF調整を実施しないため、コードを認識するまでの時間を短縮できる。   Thus, in this embodiment, when the photographed code does not satisfy the optical resolution condition, the user does not need to finely adjust the photographing distance in accordance with the optical characteristics of the camera. Further, in this embodiment, it is not necessary for the user to determine the timing for performing the AF adjustment. For this reason, in this embodiment, the usability of the code image reading apparatus 10 can be improved. Further, when the photographed code satisfies the optical resolution condition, AF adjustment is not performed. That is, in this embodiment, unnecessary AF adjustment is not performed, so that the time until the code is recognized can be shortened.

処理S210、S220は、処理S110、S120と同じである。なお、処理S210−S240では、処理S200のAF撮影で生成された撮影画像が使用される。処理S230は、コードがぼけた画像のとき(処理S230のYes)の分岐先を除いて、処理S130と同じである。例えば、AF撮影後のコードがぼけた画像のとき(処理S230のYes)、制御部50の動作は、処理S240に移る。   Processes S210 and S220 are the same as processes S110 and S120. Note that in steps S210 to S240, a captured image generated by AF shooting in step S200 is used. The process S230 is the same as the process S130 except for the branch destination when the code is a blurred image (Yes in the process S230). For example, when the code after AF shooting is a blurred image (Yes in process S230), the operation of the control unit 50 proceeds to process S240.

処理S240は、判定結果の分岐先を除いて、処理S140と同じである。例えば、AF撮影後のコードの解像度が解像度条件を満たしているとき(処理S240のYes)、コード画像読み取り装置10は、処理S250のユーザ通知(遠ざける指示)を実施して、一連の処理を終了する。一方、AF撮影後のコードの解像度が解像度条件を満たしていないとき(処理S240のNo)、処理S260の認識不可処理を実施して、一連の処理を終了する。   The process S240 is the same as the process S140 except for the branch destination of the determination result. For example, when the resolution of the code after AF shooting satisfies the resolution condition (Yes in process S240), the code image reading apparatus 10 performs a user notification (instruction to move away) in process S250 and ends the series of processes. To do. On the other hand, when the resolution of the code after AF shooting does not satisfy the resolution condition (No in process S240), the recognition impossibility process in process S260 is performed, and the series of processes ends.

ここで、解像度は、図3に示したように、撮影距離が遠くなるにしたがい、低くなる。このため、処理S240で解像度条件を満たしていないときには、コード画像読み取り装置10をコードから遠ざけると、ズーム調整を実施しても解像度条件を満たさない可能性が高くなる。したがって、図7の例では、AF撮影後のコードの解像度が解像度条件を満たしていないとき(処理S240のNo)、処理S260の認識不可処理を実施して、一連の処理を終了する。   Here, as shown in FIG. 3, the resolution becomes lower as the shooting distance becomes longer. For this reason, when the resolution condition is not satisfied in step S240, if the code image reading device 10 is moved away from the code, there is a high possibility that the resolution condition will not be satisfied even if zoom adjustment is performed. Therefore, in the example of FIG. 7, when the resolution of the code after AF shooting does not satisfy the resolution condition (No in processing S240), the recognition impossibility processing in processing S260 is performed, and the series of processing ends.

なお、処理S240の解像度条件は、処理S140で説明した式(1)と異なる条件でもよい。例えば、解像度条件は、式(3)に示すように、ズーム調整部70で調整可能な最大ズーム値Zmaxを考慮した条件でもよい。   Note that the resolution condition of the process S240 may be different from the expression (1) described in the process S140. For example, the resolution condition may be a condition that considers the maximum zoom value Zmax that can be adjusted by the zoom adjustment unit 70 as shown in Expression (3).

Tmin<Zmax・(N−α) ・・・(3)
あるいは、処理S240は、省かれてもよい。すなわち、AF撮影後のコードがぼけた画像のとき(処理S230のYes)、コード画像読み取り装置10は、処理S250のユーザ通知(遠ざける指示)を実施して、一連の処理を終了してもよい。
Tmin <Zmax · (N−α) (3)
Alternatively, the process S240 may be omitted. That is, when the code after AF shooting is a blurred image (Yes in process S230), the code image reading apparatus 10 may perform a user notification (instruction to move away) in process S250 and end the series of processes. .

処理S250では、コード画像読み取り装置10は、コード画像読み取り装置10をコードから遠ざけるようにするための指示を表示部100に表示する。例えば、通知部80は、コード画像読み取り装置10をコードから遠ざけるようにするためのユーザ通知DINFを表示部100に出力する。これにより、コード画像読み取り装置10をコードから遠ざけるようにするための指示(“遠ざけて下さい”等の指示)が表示部100に表示される。   In the process S250, the code image reading device 10 displays an instruction for keeping the code image reading device 10 away from the code on the display unit 100. For example, the notification unit 80 outputs a user notification DINF for keeping the code image reading device 10 away from the code to the display unit 100. As a result, an instruction (an instruction such as “Please keep away”) for moving the code image reading device 10 away from the code is displayed on the display unit 100.

このように、コード画像読み取り装置10は、AF撮影後のコードが光学分解能の条件を満たしていないとき(AF撮影後のコードがぼけた画像のとき)、適切な対応方法(“遠ざけて下さい”等の指示)をユーザに通知する。これにより、この実施形態では、コード画像読み取り装置10の利便性を向上できる。   As described above, the code image reading apparatus 10 can appropriately respond to the code after AF shooting (when the code after AF shooting is a blurred image) (“Please keep away”). Etc.) is notified to the user. Thereby, in this embodiment, the convenience of the code image reading apparatus 10 can be improved.

すなわち、この実施形態では、AF調整やズーム調整を実施してもコードを認識できないと判定したとき、コードを認識できるようにする対応方法をユーザに通知できる(処理S180、S250)。これにより、この実施形態では、コード画像の読み取り操作の効率を向上できる。   That is, in this embodiment, when it is determined that the code cannot be recognized even if AF adjustment or zoom adjustment is performed, the user can be notified of a handling method that enables the code to be recognized (steps S180 and S250). Thereby, in this embodiment, the efficiency of the code image reading operation can be improved.

処理S260では、コード画像読み取り装置10は、例えば、コードの読み取りができないことをユーザに通知する。このように、この実施形態では、コードを認識できるようにする対応方法がないと判定したとき、コード画像読み取り装置10の移動方向を指示せずに、一連の処理を終了する。   In the process S260, the code image reading device 10 notifies the user that the code cannot be read, for example. As described above, in this embodiment, when it is determined that there is no corresponding method for recognizing the code, the series of processing ends without instructing the moving direction of the code image reading device 10.

図7に示した一連の動作では、コードを読み取るまでに実施される撮影の回数は、最大3回(処理S100、S200、S160)である。コードの読み取り処理では、画像撮影に最も時間がかかる。したがって、画像撮影の回数を減らすことにより、コードの読み取り処理全体の処理時間は、効果的に短縮される。すなわち、この実施形態では、コードの読み取り処理全体の処理時間を短くできる。   In the series of operations illustrated in FIG. 7, the maximum number of times of photographing performed before reading the code is three (processing S100, S200, and S160). The code reading process takes the longest time to shoot an image. Therefore, by reducing the number of image shootings, the processing time of the entire code reading process is effectively shortened. That is, in this embodiment, the processing time of the entire code reading process can be shortened.

例えば、ズーム値を1段ずつ変更する方法では、適正ズーム値に到達するまで、画像撮影と解像度条件の判定とが繰り返される。このため、画像撮影の回数が増加する。さらに、適正ズーム値に到達するまでに時間がかかると、ユーザの手が移動して撮影距離がずれるおそれがある。このときには、AF調整を再度実施する必要があり、画像撮影の回数はさらに増加する。このため、ズーム値を1段ずつ変更する方法では、コードの読み取り処理全体の処理時間が長くなる。換言すれば、この実施形態では、ズーム値を1段ずつ変更する方法に比べて、コードの読み取り処理全体の処理時間を短縮できる。   For example, in the method of changing the zoom value step by step, image capturing and resolution condition determination are repeated until the appropriate zoom value is reached. For this reason, the number of times of image shooting increases. Furthermore, if it takes time to reach the appropriate zoom value, the user's hand may move and the shooting distance may shift. At this time, AF adjustment needs to be performed again, and the number of times of image shooting further increases. For this reason, in the method of changing the zoom value step by step, the processing time of the entire code reading process becomes longer. In other words, in this embodiment, the processing time of the entire code reading process can be shortened as compared with the method of changing the zoom value step by step.

なお、コード画像読み取り装置10の動作は、この例に限定されない。例えば、処理S150、S160は、省かれてもよい。この動作では、コードの解像度が解像度条件を満たしていないとき(処理S140のNo)、コード画像読み取り装置10は、処理S180のユーザ通知(近づける指示)を実施して、一連の処理を終了する。例えば、ズーム機能を有さないデジタルカメラが搭載されたコード画像読み取り装置10は、図7の動作から処理S150、S160を省いた動作を実施する。   The operation of the code image reading device 10 is not limited to this example. For example, the processes S150 and S160 may be omitted. In this operation, when the resolution of the code does not satisfy the resolution condition (No in process S140), the code image reading apparatus 10 performs a user notification (an instruction to approach) in process S180, and ends the series of processes. For example, the code image reading apparatus 10 equipped with a digital camera that does not have a zoom function performs an operation in which steps S150 and S160 are omitted from the operation in FIG.

また、処理S140の解像度条件に、図3に示した上限レベルTH22に対応する最大値(例えば、図10に示す最大値Tmax)を含めてもよい。このときには、コード画像読み取り装置10は、コードが表示部100の画面からはみ出すか否かの判定をコードの解像度に基づいて実施できる。例えば、コード画像読み取り装置10は、コードが表示部100の画面からはみ出すと判定したとき、処理S250のユーザ通知(遠ざける指示)を実施して、一連の処理を終了する。   Further, the maximum value (for example, the maximum value Tmax shown in FIG. 10) corresponding to the upper limit level TH22 shown in FIG. 3 may be included in the resolution condition of the process S140. At this time, the code image reading apparatus 10 can determine whether or not the code protrudes from the screen of the display unit 100 based on the resolution of the code. For example, when the code image reading apparatus 10 determines that the code protrudes from the screen of the display unit 100, the code image reading apparatus 10 performs the user notification (instruction to move away) in step S250 and ends the series of processes.

図8は、図1に示したコード検出部30の動作の一例を示している。なお、図8の動作は、例えば、図7に示した処理S110、S210に対応している。図8の動作は、ハードウエアのみで実現されてもよく、ハードウエアをソフトウエアにより制御することにより実現されてもよい。   FIG. 8 shows an example of the operation of the code detection unit 30 shown in FIG. Note that the operation in FIG. 8 corresponds to, for example, the processes S110 and S210 illustrated in FIG. The operation of FIG. 8 may be realized only by hardware, or may be realized by controlling the hardware by software.

処理S300では、コード検出部30は、撮影画像から検査領域を任意に選択する。例えば、コード検出部30は、撮影画像の中央部を検査領域として選択する。なお、コード検出部30は、撮影画像の任意の位置から検査領域を順次選択してもよい。検査領域が順次選択されるときには、例えば、コード(ぼけたコードも含む)が検出されるまで、図8に示した一連の動作が繰り返される。   In process S300, the code detection unit 30 arbitrarily selects an inspection region from the captured image. For example, the code detection unit 30 selects the center portion of the captured image as the inspection region. Note that the code detection unit 30 may sequentially select inspection regions from arbitrary positions in the captured image. When the inspection areas are sequentially selected, for example, the series of operations shown in FIG. 8 is repeated until a code (including a blurred code) is detected.

処理S310では、コード検出部30は、検査領域の水平方向および垂直方向の白黒のエッジ数Heg、Vegを算出する。白黒のエッジ数は、例えば、白黒の境界の数に対応し、画素の諧調が急変する箇所の数を検出することにより算出される。例えば、2次元コードでは、検査領域の水平方向および垂直方向の両方で、多くのエッジが検出される。また、1次元コードでは、例えば、検査領域の水平方向および垂直方向の一方のエッジ数が多くなる。   In process S310, the code detection unit 30 calculates the numbers of black and white edges Heg and Veg in the horizontal and vertical directions of the inspection area. The number of black and white edges is calculated, for example, by detecting the number of points corresponding to the number of black and white boundaries where the gradation of the pixel changes suddenly. For example, in the two-dimensional code, many edges are detected both in the horizontal direction and in the vertical direction of the inspection area. In the one-dimensional code, for example, the number of edges in one of the horizontal direction and the vertical direction of the inspection area increases.

処理S320では、コード検出部30は、水平方向エッジ数Hegおよび垂直方向エッジ数Vegの両方が予め設定された基準値REF1より大きいか否かを判定する。エッジ数Heg、Vegの両方が基準値REF1より大きいとき(処理S320のYes)、コード検出部30の動作は、処理S330に移る。一方、エッジ数Heg、Vegの少なくとも一方が基準値REF1以下のとき(処理S320のNo)、コード検出部30の動作は、処理S400に移る。   In process S320, the code detection unit 30 determines whether both the horizontal edge number Heg and the vertical edge number Veg are larger than a preset reference value REF1. When both the edge numbers Heg and Veg are larger than the reference value REF1 (Yes in process S320), the operation of the code detection unit 30 proceeds to process S330. On the other hand, when at least one of the edge numbers Heg and Veg is equal to or less than the reference value REF1 (No in process S320), the operation of the code detection unit 30 proceeds to process S400.

処理S330では、コード検出部30は、検査領域の黒画素率BRatioを算出する。例えば、2次元コードでは、黒と白の割合が一方に偏らないように生成される。処理S340では、コード検出部30は、黒画素率BRatioが所定の最小値Bminと所定の最大値Bmaxとの間に入っているか否かを判定する。   In process S330, the code detection unit 30 calculates the black pixel rate BRatio of the inspection area. For example, a two-dimensional code is generated so that the ratio of black and white is not biased to one. In process S340, the code detection unit 30 determines whether or not the black pixel rate BRatio is between a predetermined minimum value Bmin and a predetermined maximum value Bmax.

黒画素率BRatioが最小値Bminと最大値Bmaxとの間に入っているとき(処理S340のYes)、コード検出部30の動作は、処理S350に移る。一方、黒画素率BRatioが最小値Bminと最大値Bmaxとの間に入っていないとき(処理S340のNo)、コード検出部30は、処理S390で検査領域はコード以外であると判定し、一連の処理を終了する。すなわち、コード検出部30は、検査領域の黒と白の割合が一方に偏っているとき(処理S340のNo)、コードが検査領域に含まれていないと判定する。   When the black pixel ratio BRatio is between the minimum value Bmin and the maximum value Bmax (Yes in process S340), the operation of the code detection unit 30 proceeds to process S350. On the other hand, when the black pixel ratio BRatio does not fall between the minimum value Bmin and the maximum value Bmax (No in process S340), the code detection unit 30 determines in step S390 that the inspection area is other than the code, and the series Terminate the process. That is, the code detection unit 30 determines that the code is not included in the inspection area when the ratio of black and white in the inspection area is biased to one (No in processing S340).

処理S350では、コード検出部30は、検査領域の画素値の分散SVを算出する。処理S360では、コード検出部30は、画素値の分散SVが予め設定された基準値REF3より大きいか否かを判定する。例えば、ぼけた白黒画像では、画素値の分散SVは、小さくなる。   In process S350, the code detection unit 30 calculates a variance SV of pixel values in the inspection area. In process S360, the code detection unit 30 determines whether or not the variance SV of pixel values is larger than a preset reference value REF3. For example, in a blurred monochrome image, the variance SV of pixel values is small.

画素値の分散SVが基準値REF3より大きいとき(処理S360のYes)、コード検出部30は、処理S370で検査領域は2次元コード(ぼけていない2次元コード)であると判定し、一連の処理を終了する。すなわち、コード検出部30は、画素値の分散SVが基準値REF3より大きいとき(処理S360のYes)、認識可能な2次元コードが撮影画像に含まれていると判定する。   When the variance SV of pixel values is larger than the reference value REF3 (Yes in processing S360), the code detection unit 30 determines in step S370 that the inspection region is a two-dimensional code (a non-blurred two-dimensional code), and a series of The process ends. That is, when the pixel value variance SV is larger than the reference value REF3 (Yes in step S360), the code detection unit 30 determines that a recognizable two-dimensional code is included in the captured image.

一方、画素値の分散SVが基準値REF3以下のとき(処理S360のNo)、コード検出部30は、処理S380で検査領域はぼけた2次元コードであると判定し、一連の処理を終了する。すなわち、コード検出部30は、画素値の分散SVが基準値REF3以下のとき(処理S360のNo)、ぼけた2次元コードが撮影画像に含まれていると判定する。   On the other hand, when the variance SV of pixel values is equal to or less than the reference value REF3 (No in process S360), the code detection unit 30 determines that the inspection area is a blurred two-dimensional code in process S380, and ends a series of processes. . That is, the code detection unit 30 determines that a blurred two-dimensional code is included in the captured image when the pixel value variance SV is equal to or less than the reference value REF3 (No in step S360).

処理S400では、コード検出部30は、水平方向エッジ数Hegおよび垂直方向エッジ数Vegの一方が予め設定された基準値REF2より大きいか否かを判定する。基準値REF2は、基準値REF1と同じ値でもよいし、基準値REF1と異なる値でもよい。   In process S400, the code detection unit 30 determines whether one of the horizontal edge number Heg and the vertical edge number Veg is larger than a preset reference value REF2. The reference value REF2 may be the same value as the reference value REF1, or may be a value different from the reference value REF1.

エッジ数Heg、Vegの一方が基準値REF2より大きいとき(処理S400のYes)、コード検出部30の動作は、処理S410に移る。一方、エッジ数Heg、Vegの両方が基準値REF2以下のとき(処理S400のNo)、コード検出部30は、処理S390で検査領域はコード以外であると判定し、一連の処理を終了する。すなわち、コード検出部30は、検査領域内の白黒の境界の数が少ないとき(処理S400のNo)、コードが検査領域に含まれていないと判定する。   When one of the edge numbers Heg and Veg is larger than the reference value REF2 (Yes in process S400), the operation of the code detection unit 30 proceeds to process S410. On the other hand, when both the edge numbers Heg and Veg are less than or equal to the reference value REF2 (No in process S400), the code detection unit 30 determines in step S390 that the inspection area is other than a code, and ends the series of processes. That is, the code detection unit 30 determines that the code is not included in the inspection area when the number of black and white boundaries in the inspection area is small (No in processing S400).

処理S410では、コード検出部30は、検査領域の水平ライン間の相関Hcおよび垂直ライン間の相関Vcを算出する。以下、水平ライン間の相関Hcおよび垂直ライン間の相関Vcを、水平ライン間相関Hcおよび垂直ライン間相関Vcともそれぞれ称する。1次元コードでは、例えば、水平ライン間相関Hcおよび垂直ライン間相関Vcの一方が大きくなる。   In process S410, the code detection unit 30 calculates the correlation Hc between the horizontal lines and the correlation Vc between the vertical lines in the inspection area. Hereinafter, the correlation Hc between horizontal lines and the correlation Vc between vertical lines are also referred to as a horizontal line correlation Hc and a vertical line correlation Vc, respectively. In the one-dimensional code, for example, one of the horizontal line correlation Hc and the vertical line correlation Vc increases.

処理S420では、コード検出部30は、水平ライン間相関Hcおよび垂直ライン間相関Vcの一方が予め設定された基準値REF4より大きいか否かを判定する。水平ライン間相関Hcおよび垂直ライン間相関Vcの一方が基準値REF4より大きいとき(処理S420のYes)、コード検出部30の動作は、処理S430に移る。   In process S420, the code detection unit 30 determines whether one of the horizontal line correlation Hc and the vertical line correlation Vc is greater than a preset reference value REF4. When one of the horizontal line correlation Hc and the vertical line correlation Vc is larger than the reference value REF4 (Yes in step S420), the operation of the code detection unit 30 proceeds to step S430.

一方、水平ライン間相関Hcおよび垂直ライン間相関Vcの両方が基準値REF4以下のとき(処理S420のNo)、コード検出部30は、処理S460で検査領域はぼけた1次元コードであると判定し、一連の処理を終了する。すなわち、コード検出部30は、水平ライン間相関Hcおよび垂直ライン間相関Vcの両方が基準値REF4以下のとき(処理S420のNo)、ぼけた1次元コードが撮影画像に含まれていると判定する。   On the other hand, when both the horizontal line correlation Hc and the vertical line correlation Vc are less than or equal to the reference value REF4 (No in process S420), the code detection unit 30 determines that the inspection area is a blurred one-dimensional code in process S460. Then, a series of processing ends. That is, when both the horizontal line correlation Hc and the vertical line correlation Vc are equal to or smaller than the reference value REF4 (No in step S420), the code detection unit 30 determines that a blurred one-dimensional code is included in the captured image. To do.

処理S430では、コード検出部30は、検査領域の画素値の分散SVを算出する。処理S440では、コード検出部30は、画素値の分散SVが基準値REF3より大きいか否かを判定する。画素値の分散SVが基準値REF3より大きいとき(処理S440のYes)、コード検出部30は、処理S450で検査領域は1次元コード(ぼけていない1次元コード)であると判定し、一連の処理を終了する。すなわち、コード検出部30は、画素値の分散SVが基準値REF3より大きいとき(処理S440のYes)、認識可能な1次元コードが撮影画像に含まれていると判定する。   In process S430, the code detection unit 30 calculates a variance SV of pixel values in the inspection area. In process S440, the code detection unit 30 determines whether or not the variance SV of pixel values is greater than the reference value REF3. When the pixel value variance SV is larger than the reference value REF3 (Yes in step S440), the code detection unit 30 determines in step S450 that the inspection region is a one-dimensional code (a one-dimensional code that is not blurred). The process ends. That is, when the variance SV of pixel values is larger than the reference value REF3 (Yes in process S440), the code detection unit 30 determines that a recognizable one-dimensional code is included in the captured image.

一方、画素値の分散SVが基準値REF3以下のとき(処理S440のNo)、コード検出部30は、処理S460で検査領域はぼけた1次元コードであると判定し、一連の処理を終了する。すなわち、コード検出部30は、画素値の分散SVが基準値REF3以下のとき(処理S440のNo)、ぼけた1次元コードが撮影画像に含まれていると判定する。   On the other hand, when the variance SV of the pixel values is equal to or less than the reference value REF3 (No in process S440), the code detection unit 30 determines that the inspection area is a blurred one-dimensional code in process S460 and ends the series of processes. . That is, when the variance SV of pixel values is equal to or less than the reference value REF3 (No in processing S440), the code detection unit 30 determines that a blurred one-dimensional code is included in the captured image.

すなわち、撮影画像が認識可能な2次元コードと判定される条件は、処理S320のエッジ数Heg、Vegの条件、処理S340の黒画素率BRatioの条件および処理S360の画素値の分散SVの条件を満たすときである。また、撮影画像がぼけた2次元コードと判定される条件は、処理S320のエッジ数Heg、Vegの条件および処理S340の黒画素率BRatioの条件を満たし、処理S360の画素値の分散SVの条件を満たさないときである。   That is, the conditions for determining a captured image as a recognizable two-dimensional code are the conditions of the number of edges Heg and Veg in the process S320, the condition of the black pixel ratio BRatio in the process S340, and the condition of the variance SV of the pixel values in the process S360. It is time to meet. Further, the condition for determining that the captured image is a blurred two-dimensional code satisfies the conditions of the number of edges Heg and Veg in the process S320 and the condition of the black pixel ratio BRatio in the process S340, and the condition of the variance SV of pixel values in the process S360. Is not satisfied.

そして、撮影画像が認識可能な1次元コードと判定される条件は、処理S400のエッジ数Heg、Vegの条件、処理S420のライン間相関Hc、Vcの条件および処理S440の画素値の分散SVの条件を満たすときである。また、撮影画像がぼけた1次元コードと判定される条件は、処理S400のエッジ数Heg、Vegの条件、処理S420のライン間相関Hc、Vcの条件を満たし、処理S440の画素値の分散SVの条件を満たさないときである。   The conditions for determining a captured image as a recognizable one-dimensional code are the number of edges Heg and Veg in step S400, the inter-line correlation Hc and Vc in step S420, and the pixel value variance SV in step S440. When the condition is met. The conditions for determining that the captured image is a blurred one-dimensional code satisfy the conditions of the number of edges Heg and Veg in the process S400, the interline correlations Hc and Vc in the process S420, and the variance SV of the pixel values in the process S440. This is when the condition is not satisfied.

処理S370−S390、S450、S460では、コード検出部30は、判定結果IINFを制御部50に出力する。これにより、制御部50は、図7に示した処理S120、S130、S220、S230等を実施できる。   In the processes S370 to S390, S450, and S460, the code detection unit 30 outputs the determination result IINF to the control unit 50. Thereby, the control part 50 can implement process S120, S130, S220, S230, etc. which were shown in FIG.

このように、コード検出部30は、撮影距離と焦点距離との差の検出等の複雑な処理を実施せずに、画素値の分散SVに基づいてぼけた画像か否かを判定する。これにより、この実施形態では、ぼけた画像か否かを判定する処理の時間が長くなることを抑制できる。   As described above, the code detection unit 30 determines whether the image is blurred based on the variance SV of pixel values without performing complicated processing such as detection of the difference between the shooting distance and the focal length. Thereby, in this embodiment, it can suppress that the time of the process which determines whether it is a blurred image becomes long.

なお、コード検出部30の動作は、この例に限定されない。例えば、処理S350、S360、S430、S440は、処理S310の前に、実施されてもよい。このときには、画素値の分散SVが基準値REF3より大きいか否かの判定結果は、フラグ等に記憶される。例えば、画素値の分散SVが基準値REF3以下のとき、ぼけた画像であることを示すフラグ等が設定される。   The operation of the code detection unit 30 is not limited to this example. For example, the processes S350, S360, S430, and S440 may be performed before the process S310. At this time, the determination result of whether or not the variance SV of pixel values is larger than the reference value REF3 is stored in a flag or the like. For example, when the variance SV of pixel values is equal to or less than the reference value REF3, a flag indicating that the image is blurred is set.

図9は、AFタイミング検出の一例を示している。コード画像読み取り装置10は、Z軸方向、X軸方向およびY軸方向に分けて、コード画像読み取り装置10の移動を検出する(図9(a))。Z軸方向は、コード画像読み取り装置10のカメラ(より詳細には、撮影レンズ)の光軸に沿う方向(光軸方向)である。なお、図9(a)のコード画像読み取り装置10では、カメラの撮影レンズは、図9(a)のコードCODに対向する側に配置されている。X軸方向およびY軸方向は、Z軸方向に直交する方向である。また、X軸方向およびY軸方向は、例えば、互いに直交している。   FIG. 9 shows an example of AF timing detection. The code image reading device 10 detects the movement of the code image reading device 10 in the Z-axis direction, the X-axis direction, and the Y-axis direction (FIG. 9A). The Z-axis direction is a direction (optical axis direction) along the optical axis of the camera (more specifically, the photographing lens) of the code image reading device 10. In the code image reading device 10 in FIG. 9A, the photographing lens of the camera is disposed on the side facing the code COD in FIG. 9A. The X-axis direction and the Y-axis direction are directions orthogonal to the Z-axis direction. Moreover, the X-axis direction and the Y-axis direction are orthogonal to each other, for example.

例えば、移動状態検出部40は、加速度センサ、角速度センサおよび地磁気センサ等のセンサの出力を用いて、コード画像読み取り装置10のZ軸方向、X軸方向およびY軸方向のそれぞれの移動速度を算出する(図9(b))。図の太線の波形は、コード画像読み取り装置10のZ軸方向、X軸方向およびY軸方向のそれぞれの移動速度の変化の一例を示している。なお、速度“0”より上側の波形は、速度“0”の下側の波形の移動方向と反対側に移動していることを示している。また、範囲DVX、DVY、DVZは、例えば、速度“0”を中心にした所定の範囲である。   For example, the movement state detection unit 40 calculates the respective movement speeds of the code image reading device 10 in the Z-axis direction, the X-axis direction, and the Y-axis direction using outputs of sensors such as an acceleration sensor, an angular velocity sensor, and a geomagnetic sensor. (FIG. 9B). The thick line waveform in the figure shows an example of changes in the moving speed of the code image reading apparatus 10 in the Z-axis direction, the X-axis direction, and the Y-axis direction. The waveform above the speed “0” indicates that the waveform moves to the opposite side of the movement direction of the waveform below the speed “0”. The ranges DVX, DVY, DVZ are, for example, predetermined ranges centered on the speed “0”.

X軸方向およびY軸方向の移動は、例えば、表示部100の画面内にコードCODを納めるための位置合わせをユーザが実施しているときに、発生する。そして、コードCODが表示部100の画面内に納まったときには、X軸方向およびY軸方向の移動速度は、ほぼ“0”になる。例えば、制御部50は、X軸方向の移動速度が予め設定された所定範囲DVX内で推移しているとき、コード画像読み取り装置10のX軸方向の移動はないと判定する。同様に、制御部50は、Y軸方向の移動速度が予め設定された所定範囲DVY内で推移しているとき、コード画像読み取り装置10のY軸方向の移動はないと判定する。   The movement in the X-axis direction and the Y-axis direction occurs, for example, when the user is performing alignment for putting the code COD in the screen of the display unit 100. When the code COD fits within the screen of the display unit 100, the moving speeds in the X-axis direction and the Y-axis direction are substantially “0”. For example, the control unit 50 determines that there is no movement in the X-axis direction of the code image reading device 10 when the moving speed in the X-axis direction is changing within a predetermined range DVX set in advance. Similarly, the control unit 50 determines that there is no movement of the code image reading apparatus 10 in the Y-axis direction when the movement speed in the Y-axis direction is changing within a predetermined range DVY set in advance.

Z軸方向の移動は、例えば、コードCODまでの撮影距離をユーザが調整しているときに、発生する。そして、撮影距離の調整が終了したとき(コードCODを認識できるとユーザが判断したとき)には、Z軸方向の移動速度は、ほぼ“0”になる。例えば、制御部50は、Z軸方向の移動速度が予め設定された所定範囲DVZ内で推移しているとき、コード画像読み取り装置10のZ軸方向の移動はないと判定する。   The movement in the Z-axis direction occurs, for example, when the user is adjusting the shooting distance to the code COD. When the adjustment of the shooting distance is completed (when the user determines that the code COD can be recognized), the moving speed in the Z-axis direction is substantially “0”. For example, the control unit 50 determines that there is no movement of the code image reading device 10 in the Z-axis direction when the movement speed in the Z-axis direction changes within a predetermined range DVZ set in advance.

時刻t10から時刻t20までの期間では、X軸方向およびY軸方向の移動速度の変化が所定範囲DVX、DVYに納まっていない。したがって、制御部50は、コード画像読み取り装置10のX軸方向およびY軸方向の位置合わせの最中であると判定する。   In the period from time t10 to time t20, the change in the moving speed in the X-axis direction and the Y-axis direction is not within the predetermined ranges DVX and DVY. Therefore, the control unit 50 determines that the code image reading apparatus 10 is in the middle of alignment in the X-axis direction and the Y-axis direction.

時刻t20以降では、X軸方向およびY軸方向の移動速度が所定範囲DVX、DVY内で推移している。したがって、制御部50は、コード画像読み取り装置10のX軸方向およびY軸方向の位置合わせが終了していると判定する。すなわち、制御部50は、表示部100の画面内にコードCODが納まっていると判定する。コードCODが表示部100の画面内に納まっているときには、撮影画像内にコードCODが存在する。   After time t20, the movement speeds in the X-axis direction and the Y-axis direction change within the predetermined ranges DVX and DVY. Therefore, the control unit 50 determines that the alignment of the code image reading device 10 in the X-axis direction and the Y-axis direction has been completed. That is, the control unit 50 determines that the code COD is contained in the screen of the display unit 100. When the code COD is within the screen of the display unit 100, the code COD is present in the captured image.

ここで、コードCODの認識条件の1つは、撮影画像内にコードCODが存在することである。したがって、X軸方向およびY軸方向の移動速度が予め設定された所定範囲DVX、DVY内で推移しているとき(時刻t20以降)は、コードCODの認識条件の1つを満たしている。   Here, one of the recognition conditions of the code COD is that the code COD exists in the captured image. Therefore, when the moving speeds in the X-axis direction and the Y-axis direction change within the predetermined ranges DVX and DVY (after time t20), one of the recognition conditions for the code COD is satisfied.

なお、時刻t20から時刻t30までの期間では、Z軸方向の移動速度の変化が所定範囲DVZに納まっていない。したがって、制御部50は、撮影距離の調整中であると判定する。   In the period from time t20 to time t30, the change in the movement speed in the Z-axis direction is not within the predetermined range DVZ. Therefore, the control unit 50 determines that the shooting distance is being adjusted.

時刻t30以降では、X軸方向、Y軸方向およびZ軸方向の移動速度が所定範囲DVX、DVY、DVZ内で推移している。したがって、制御部50は、コード画像読み取り装置10が停止していると判定する。コード画像読み取り装置10が停止しているときには、コードCODを認識できるとユーザが判断している可能性が高いため、制御部50は、AF調整の開始タイミングであると判定する。すなわち、制御部50は、コード画像読み取り装置10が移動していないと判定したとき(図9の“移動なし”の丸印)、AF調整の開始タイミングと判定する。   After time t30, the movement speeds in the X-axis direction, the Y-axis direction, and the Z-axis direction change within the predetermined ranges DVX, DVY, DVZ. Therefore, the control unit 50 determines that the code image reading device 10 is stopped. When the code image reading apparatus 10 is stopped, it is highly likely that the user has determined that the code COD can be recognized, so the control unit 50 determines that it is the AF adjustment start timing. That is, when it is determined that the code image reading apparatus 10 has not moved (the circle “No movement” in FIG. 9), the control unit 50 determines the AF adjustment start timing.

なお、制御部50は、撮影距離の調整期間(時刻t20から時刻t30までの期間)が長いとき、ユーザが適切な撮影距離を判断できずに迷っている可能が高いため、AF調整の開始タイミングを撮影距離の調整期間に検出してもよい。例えば、制御部50は、コード画像読み取り装置10が位置合わせの終了(時刻t20)から所定時間継続してZ軸方向に移動していると判定したとき(図9の“所定時間経過”の丸印)、AF調整の開始タイミングと判定してもよい。あるいは、制御部50は、位置合わせの終了後(時刻t20以降)で、コード画像読み取り装置10のZ軸方向の移動が反対方向に変化したと判定したとき(図9の“移動方向変更”の丸印)、AF調整の開始タイミングと判定してもよい。   Note that when the adjustment period of the shooting distance (the period from time t20 to time t30) is long, the control unit 50 is likely to be at a loss as the user cannot determine an appropriate shooting distance. May be detected during the shooting distance adjustment period. For example, when the control unit 50 determines that the code image reading device 10 continues to move in the Z-axis direction for a predetermined time from the end of alignment (time t20), the circle of “elapsed predetermined time” in FIG. Or the AF adjustment start timing. Alternatively, the control unit 50 determines that the movement of the code image reading apparatus 10 in the Z-axis direction has changed in the opposite direction after the end of alignment (after time t20) (in the “movement direction change” in FIG. 9). Or a start timing of AF adjustment.

すなわち、制御部50は、上述した3つの状態の少なくとも1つを検出可能に形成されていればよい。そして、制御部50は、3つの状態の少なくとも1つを移動状態検出部40の検出結果に基づいて検出することにより、AF調整の開始タイミングを検出する。これにより、この実施形態では、ユーザによる端末(コード画像読み取り装置10)の移動状態に合わせた適切なタイミングで、AF調整を実施できる。3つの状態を第1状態、第2状態および第3状態として、以下に整理して示す。   That is, the control part 50 should just be formed so that at least one of the three states mentioned above can be detected. Then, the control unit 50 detects the AF adjustment start timing by detecting at least one of the three states based on the detection result of the movement state detection unit 40. Thereby, in this embodiment, AF adjustment can be performed at an appropriate timing according to the moving state of the terminal (code image reading device 10) by the user. The three states are organized and shown below as a first state, a second state, and a third state.

第1状態は、コード画像読み取り装置10が停止している状態である。第2状態は、コード画像読み取り装置10がX軸方向およびY軸方向に移動していない状態で、かつ、コード画像読み取り装置10がカメラの光軸方向に所定時間継続して移動している状態である。第3状態は、コード画像読み取り装置10がX軸方向およびY軸方向に移動していない状態で、かつ、コード画像読み取り装置10のZ軸方向の移動が反対方向に変化した状態である。   The first state is a state where the code image reading device 10 is stopped. The second state is a state in which the code image reading device 10 is not moved in the X-axis direction and the Y-axis direction, and the code image reading device 10 is continuously moving in the optical axis direction of the camera for a predetermined time. It is. The third state is a state in which the code image reading device 10 is not moved in the X-axis direction and the Y-axis direction, and the movement of the code image reading device 10 in the Z-axis direction is changed in the opposite direction.

図10は、解像度条件に関する処理の一例を示している。   FIG. 10 shows an example of processing related to the resolution condition.

先ず、制御部50は、検査領域AR(AR10、AR12)のライン毎に、白/黒パターンの長さ(画素数)を検出する(図10(a))。1次元コードCOD20では、制御部50は、例えば、横方向のラインのみに対して、白/黒パターンの長さ検出を実施する。また、2次元コードCOD22では、制御部50は、例えば、縦方向および横方向の両方のラインに対して、白/黒パターンの長さ検出を実施する。   First, the control unit 50 detects the length (number of pixels) of the white / black pattern for each line of the inspection area AR (AR10, AR12) (FIG. 10A). In the one-dimensional code COD20, the control unit 50 performs, for example, white / black pattern length detection only on a horizontal line. In the two-dimensional code COD22, the control unit 50 detects the length of the white / black pattern for both the vertical and horizontal lines, for example.

そして、制御部50は、検出した長さ(画素数)のヒストグラムを作成する(図10(b))。例えば、1次元コードCOD20および2次元コードCOD22では、白/黒パターンの長さは、単位図形(バーコードでは最小バー、QRコードではセル)の幅の整数倍である。したがって、白/黒パターンの長さ(画素数)のヒストグラムでは、等間隔(N、2×N、3×N、4×N)でピークが発生する。   Then, the control unit 50 creates a histogram of the detected length (number of pixels) (FIG. 10B). For example, in the one-dimensional code COD20 and the two-dimensional code COD22, the length of the white / black pattern is an integral multiple of the width of the unit graphic (the smallest bar for the barcode and the cell for the QR code). Therefore, in the histogram of the length (number of pixels) of the white / black pattern, peaks occur at equal intervals (N, 2 × N, 3 × N, 4 × N).

このため、制御部50は、ピークが発生した区間(画素数)N、2×N、3×N、4×Nのうち、最も画素数が少ない区間Nを、単位図形(例えば、QRコードのセル)の1辺当たりの画素数(推定画素数)として算出する。推定画素数Nは、図7で説明した式(1)の画素数Nに対応している。また、制御部50は、推定画素数Nの推定誤差±αを算出する。例えば、制御部50は、区間Nのピークの半値半幅を、推定誤差αとして算出する。   For this reason, the control unit 50 selects a section N having the smallest number of pixels among the sections (number of pixels) N, 2 × N, 3 × N, 4 × N where the peak is generated, as a unit graphic (for example, QR code). (Cell) is calculated as the number of pixels per side (estimated number of pixels). The estimated pixel number N corresponds to the pixel number N in Expression (1) described with reference to FIG. Further, the control unit 50 calculates an estimation error ± α of the estimated number of pixels N. For example, the control unit 50 calculates the half width at half maximum of the peak in the section N as the estimation error α.

なお、制御部50は、ピークが等間隔で発生することを利用して、2つ目以降のピークとの間隔の重み付け平均を推定画素数Nとしてもよい。このときには、推定画素数Nの精度は、向上する。あるいは、制御部50は、他の方法で推定画素数Nを算出してもよい。また、制御部50は、検査領域AR内をFFTしたときの周波数の分布を、白/黒パターンの長さのヒストグラムの代わりに使用してもよい。   Note that the control unit 50 may use the weighted average of the intervals between the second and subsequent peaks as the estimated number of pixels N using the fact that peaks occur at regular intervals. At this time, the accuracy of the estimated number of pixels N is improved. Alternatively, the control unit 50 may calculate the estimated pixel number N by another method. Further, the control unit 50 may use the frequency distribution when the inspection area AR is FFT instead of the white / black pattern length histogram.

次に、制御部50は、推定画素数Nおよび推定誤差αに基づいて、コードCODの解像度が解像度条件を満たしているか否かを検出する(図10(c))。推定画素数Nが最小値Tminより小さいときには、例えば、ソフトウエアの処理限界により、コードCODが認識されない。このため、制御部50は、推定画素数Nが最小値Tminより小さいとき、ズーム調整が必要であると判定する。また、推定画素数Nが最大値Tmaxより大きいときには、例えば、コードCODが表示部100の画面からはみ出す可能性が高くなり、コードCODが認識されない可能性が高くなる。   Next, the control unit 50 detects whether or not the resolution of the code COD satisfies the resolution condition based on the estimated number of pixels N and the estimated error α (FIG. 10C). When the estimated number of pixels N is smaller than the minimum value Tmin, for example, the code COD is not recognized due to software processing limitations. Therefore, the control unit 50 determines that zoom adjustment is necessary when the estimated number of pixels N is smaller than the minimum value Tmin. Further, when the estimated number of pixels N is larger than the maximum value Tmax, for example, there is a high possibility that the code COD protrudes from the screen of the display unit 100, and there is a high possibility that the code COD is not recognized.

推定画素数Nが最大値Tmaxより大きいときにも、コードCODが表示部100の画面からはみ出さない可能性があるため、最大値Tmaxは、解像度条件に含まれなくてもよい。このときの解像度条件は、図7で説明した式(1)で表される。なお、最大値Tmaxを含む解像度条件は、例えば、式(4)で表される。   Even when the estimated number of pixels N is larger than the maximum value Tmax, the code COD may not protrude from the screen of the display unit 100, so the maximum value Tmax may not be included in the resolution condition. The resolution condition at this time is expressed by Expression (1) described with reference to FIG. Note that the resolution condition including the maximum value Tmax is expressed by, for example, Expression (4).

Tmin+α<N<Tmax−α ・・・(4)
推定画素数Nが解像度条件(式(1)あるいは式(4))を満たさないとき、コード画像読み取り装置10は、適正ズーム値でズーム調整することにより、コードCODの解像度を調整する。例えば、制御部50は、ズーム撮影後のコードCODが表示部100の画面からはみ出すことを避けるため、ズーム撮影後のコードCODの推定画素数Nを最小値Tminより僅かに大きくするようなズーム値を、適正ズーム値として算出する。
Tmin + α <N <Tmax−α (4)
When the estimated number of pixels N does not satisfy the resolution condition (Equation (1) or Equation (4)), the code image reading device 10 adjusts the resolution of the code COD by performing zoom adjustment with an appropriate zoom value. For example, in order to prevent the code COD after zoom shooting from protruding from the screen of the display unit 100, the control unit 50 zooms such that the estimated pixel number N of the code COD after zoom shooting is slightly larger than the minimum value Tmin. Is calculated as an appropriate zoom value.

すなわち、制御部50は、例えば、図7で説明した式(2)の目標ズーム値Zmのうちの最小値(=Tmin/(N−α))を、適正ズーム値として算出する。なお、設定可能なズーム値が離散値のとき、制御部50は、最小値(=Tmin/(N−α))より大きい設定可能なズーム値のうち、最小のズーム値(設定可能な値)を適正ズーム値として算出する。また、制御部50は、最小値(=Tmin/(N−α))より大きい設定可能なズーム値が存在しないとき、ズーム調整を実施しても解像度条件が満たされないと判定する。   That is, the control unit 50 calculates, for example, the minimum value (= Tmin / (N−α)) among the target zoom values Zm of the equation (2) described in FIG. 7 as an appropriate zoom value. When the settable zoom value is a discrete value, the control unit 50 sets the minimum zoom value (settable value) among the settable zoom values larger than the minimum value (= Tmin / (N−α)). Is calculated as an appropriate zoom value. In addition, when there is no settable zoom value larger than the minimum value (= Tmin / (N−α)), the control unit 50 determines that the resolution condition is not satisfied even when zoom adjustment is performed.

以上、この実施形態では、コード画像読み取り装置10は、コードCODの認識不可の原因に応じた制御をコードCODの光学分解能および解像度に基づいて実施する制御部50を有している。例えば、制御部50は、コードCODがぼけた画像(光学分解能不足)のとき、AF調整の開始タイミングをコード画像読み取り装置10の移動状態に基づいて検出する。これにより、この実施形態では、AF調整を適切なタイミングで自動的に実施できる。   As described above, in this embodiment, the code image reading apparatus 10 includes the control unit 50 that performs control according to the cause of the unrecognizable code COD based on the optical resolution and resolution of the code COD. For example, when the code COD is a blurred image (insufficient optical resolution), the control unit 50 detects the AF adjustment start timing based on the movement state of the code image reading device 10. Thereby, in this embodiment, AF adjustment can be automatically performed at an appropriate timing.

また、制御部50は、コードCODがぼけた画像でないとき、ズーム調整が必要か否かをコードCODの解像度に基づいて判定する。これにより、この実施形態では、適正ズーム値に設定したズーム撮影を適切なタイミングで自動的に実施できる。さらに、制御部50は、AF調整やズーム調整を実施してもコードCODを認識できないと判定したときに、コードCODを認識できるようにする対応方法をユーザに通知する。これにより、この実施形態では、コード画像読み取り装置10の利便性を向上できる。すなわち、この実施形態では、コード画像の読み取り操作の効率を向上できる。   Further, when the code COD is not a blurred image, the control unit 50 determines whether or not zoom adjustment is necessary based on the resolution of the code COD. Thereby, in this embodiment, zoom photographing set to an appropriate zoom value can be automatically performed at an appropriate timing. Furthermore, when it is determined that the code COD cannot be recognized even after the AF adjustment or the zoom adjustment is performed, the control unit 50 notifies the user of a handling method that enables the code COD to be recognized. Thereby, in this embodiment, the convenience of the code image reading apparatus 10 can be improved. That is, in this embodiment, the efficiency of the code image reading operation can be improved.

以上の実施形態において説明した発明を整理して、付記として開示する。
(付記1)
デジタルカメラが搭載されたコード画像読み取り装置であって、
画像を撮影する撮影部と、
撮影された前記画像の任意の検査領域にコードが含まれているか否かを検出し、前記検査領域内の前記コードがぼけた画像か否かを判定するコード検出部と、
前記コード画像読み取り装置の移動状態を検出する移動状態検出部と、
前記コードが前記ぼけた画像のとき、オートフォーカス調整の開始タイミングを前記移動状態検出部の検出結果に基づいて検出し、前記コードが前記ぼけた画像でないとき、ズーム調整が必要か否かを前記検査領域内の前記コードの解像度に基づいて判定する制御部と、
前記開始タイミングの検出に応答して、前記オートフォーカス調整を実施するオートフォーカス部と、
前記ズーム調整が必要であると前記制御部で判定されたとき、前記ズーム調整を実施するズーム調整部と、
前記コードの認識不可の原因に応じたユーザ通知をユーザに通知する通知部と、
前記コードに格納されているデータを取り出すコード処理部と
を備えていることを特徴とするコード画像読み取り装置。
(付記2)
前記制御部は、前記コードが前記ぼけた画像のとき、第1状態、第2状態および第3状態の少なくとも1つを前記移動状態検出部の前記検出結果に基づいて検出することにより、前記開始タイミングを検出し、
前記第1状態は、前記コード画像読み取り装置が停止している状態であり、
前記第2状態は、前記コード画像読み取り装置が前記デジタルカメラの光軸方向に直交する方向に移動していない状態で、かつ、前記コード画像読み取り装置が前記光軸方向に所定時間継続して移動している状態であり、
前記第3状態は、前記コード画像読み取り装置が前記光軸方向に直交する方向に移動していない状態で、かつ、前記コード画像読み取り装置の前記光軸方向の移動が反対方向に変化した状態であること
を特徴とする付記1記載のコード画像読み取り装置。
(付記3)
前記コード検出部は、前記検査領域の画素値の分散が予め設定された基準値以下のとき、前記コードを前記ぼけた画像と判定すること
を特徴とする付記1または付記2記載のコード画像読み取り装置。
(付記4)
前記通知部は、前記オートフォーカス調整を実施した後の前記コードが前記ぼけた画像のとき、前記コード画像読み取り装置を前記コードから遠ざけるようにするための前記ユーザ通知をユーザに通知すること
を特徴とする付記1ないし付記3のいずれか1項に記載のコード画像読み取り装置。
(付記5)
前記制御部は、前記コードが前記ぼけた画像でないとき、前記コードの最小構成単位の図形の1辺当たりの画素数が予め設定された最小値より小さいか否かを判定し、前記図形の1辺当たりの画素数が前記最小値より小さいとき、前記ズーム調整が必要であると判定すること
を特徴とする付記1ないし付記4のいずれか1項に記載のコード画像読み取り装置。
(付記6)
前記制御部は、前記検査領域における前記図形の1辺当たりの画素数Nを算出する際の分布に基づいて推定誤差αを検出し、前記画素数Nが前記推定誤差αおよび最小値Tminを用いた式(1)を満たさないとき、式(2)を満たす目標ズーム値Zmが前記ズーム調整部で調整可能な範囲に存在するか否かに基づいて、前記コードの認識が可能か否かを判定すること
Tmin<N−α ・・・(1)
Tmin/(N−α)<Zm ・・・(2)
を特徴とする付記5記載のコード画像読み取り装置。
(付記7)
前記通知部は、前記目標ズーム値が前記ズーム調整部で調整可能な範囲に存在しないとき、前記コード画像読み取り装置を前記コードに近づけるようにするための前記ユーザ通知をユーザに通知すること
を特徴とする付記6記載のコード画像読み取り装置。
(付記8)
デジタルカメラが搭載されたコード画像読み取り装置の動作方法であって、
画像を撮影し、
撮影された前記画像の任意の検査領域にコードが含まれているか否かを検出し、前記検査領域内の前記コードがぼけた画像か否かを判定し、
前記コード画像読み取り装置の移動状態を検出し、
前記コードが前記ぼけた画像のとき、オートフォーカス調整の開始タイミングを前記移動状態の検出結果に基づいて検出し、前記コードが前記ぼけた画像でないとき、ズーム調整が必要か否かを前記検査領域内の前記コードの解像度に基づいて判定し、
前記開始タイミングの検出に応答して、前記オートフォーカス調整を実施し、
前記ズーム調整が必要であると判定されたとき、前記ズーム調整を実施し、
前記コードが認識不可のとき、前記コードの認識不可の原因に応じたユーザ通知をユーザに通知し、
認識可能な前記コードが検出されたとき、前記コードに格納されているデータを取り出すこと
を特徴とするコード画像読み取り装置の動作方法。
(付記9)
前記コードが前記ぼけた画像のとき、第1状態、第2状態および第3状態の少なくとも1つを前記移動状態の前記検出結果に基づいて検出することにより、前記開始タイミングを検出し、
前記第1状態は、前記コード画像読み取り装置が停止している状態であり、
前記第2状態は、前記コード画像読み取り装置が前記デジタルカメラの光軸方向に直交する方向に移動していない状態で、かつ、前記コード画像読み取り装置が前記光軸方向に所定時間継続して移動している状態であり、
前記第3状態は、前記コード画像読み取り装置が前記光軸方向に直交する方向に移動していない状態で、かつ、前記コード画像読み取り装置の前記光軸方向の移動が反対方向に変化した状態であること
を特徴とする付記8記載のコード画像読み取り装置の動作方法。
(付記10)
前記検査領域の画素値の分散が予め設定された基準値以下のとき、前記コードを前記ぼけた画像と判定すること
を特徴とする付記8または付記9記載のコード画像読み取り装置の動作方法。
(付記11)
前記オートフォーカス調整を実施した後の前記コードが前記ぼけた画像のとき、前記コード画像読み取り装置を前記コードから遠ざけるようにするための前記ユーザ通知をユーザに通知すること
を特徴とする付記8ないし付記10のいずれか1項に記載のコード画像読み取り装置の動作方法。
(付記12)
前記コードが前記ぼけた画像でないとき、前記コードの最小構成単位の図形の1辺当たりの画素数が予め設定された最小値より小さいか否かを判定し、前記図形の1辺当たりの画素数が前記最小値より小さいとき、前記ズーム調整が必要であると判定すること
を特徴とする付記8ないし付記11のいずれか1項に記載のコード画像読み取り装置の動作方法。
(付記13)
前記検査領域における前記図形の1辺当たりの画素数Nを算出する際の分布に基づいて推定誤差αを検出し、前記画素数Nが前記推定誤差αおよび最小値Tminを用いた式(1)を満たさないとき、式(2)を満たす目標ズーム値Zmが前記ズーム調整部で調整可能な範囲に存在するか否かに基づいて、前記コードの認識が可能か否かを判定すること
Tmin<N−α ・・・(1)
Tmin/(N−α)<Zm ・・・(2)
を特徴とする付記12記載のコード画像読み取り装置の動作方法。
(付記14)
前記目標ズーム値が前記ズーム調整部で調整可能な範囲に存在しないとき、前記コード画像読み取り装置を前記コードに近づけるようにするための前記ユーザ通知をユーザに通知すること
を特徴とする付記13記載のコード画像読み取り装置の動作方法。
(付記15)
デジタルカメラが搭載された電子機器に実行させるコード画像読み取りプログラムであって、
前記電子機器を付記1ないし付記7のいずれか1項に記載のコード画像読み取り装置として動作させるコード画像読み取りプログラム。
(付記16)
デジタルカメラが搭載された電子機器に実行させるコード画像読み取りプログラムであって、
画像を撮影する撮影処理と、
撮影された前記画像の任意の検査領域にコードが含まれているか否かを検出し、前記検査領域内の前記コードがぼけた画像か否かを判定するコード検出処理と、
前記電子機器の移動状態を検出する移動状態検出処理と、
前記コードが前記ぼけた画像のとき、オートフォーカス調整の開始タイミングを前記移動状態の検出結果に基づいて検出し、前記コードが前記ぼけた画像でないとき、ズーム調整が必要か否かを前記検査領域内の前記コードの解像度に基づいて判定する制御処理と、
前記開始タイミングの検出に応答して、前記オートフォーカス調整を実施するオートフォーカス処理と、
前記ズーム調整が必要であると判定されたとき、前記ズーム調整を実施するズーム調整処理と、
前記コードが認識不可のとき、前記コードの認識不可の原因に応じたユーザ通知をユーザに通知する通知処理と、
認識可能な前記コードが検出されたとき、前記コードに格納されているデータを取り出すコード処理と
を前記電子機器に実行させることを特徴とするコード画像読み取りプログラム。
(付記17)
前記コードが前記ぼけた画像のとき、第1状態、第2状態および第3状態の少なくとも1つを前記移動状態の前記検出結果に基づいて検出することにより、前記開始タイミングを検出し、
前記第1状態は、前記電子機器が停止している状態であり、
前記第2状態は、前記電子機器が前記デジタルカメラの光軸方向に直交する方向に移動していない状態で、かつ、前記電子機器が前記光軸方向に所定時間継続して移動している状態であり、
前記第3状態は、前記電子機器が前記光軸方向に直交する方向に移動していない状態で、かつ、前記電子機器の前記光軸方向の移動が反対方向に変化した状態であること
を特徴とする付記16記載のコード画像読み取りプログラム。
(付記18)
前記検査領域の画素値の分散が予め設定された基準値以下のとき、前記コードを前記ぼけた画像と判定すること
を特徴とする付記16または付記17記載のコード画像読み取りプログラム。
(付記19)
前記オートフォーカス調整を実施した後の前記コードが前記ぼけた画像のとき、前記電子機器を前記コードから遠ざけるようにするための前記ユーザ通知をユーザに通知すること
を特徴とする付記16ないし付記18のいずれか1項に記載のコード画像読み取りプログラム。
(付記20)
前記コードが前記ぼけた画像でないとき、前記コードの最小構成単位の図形の1辺当たりの画素数が予め設定された最小値より小さいか否かを判定し、前記図形の1辺当たりの画素数が前記最小値より小さいとき、前記ズーム調整が必要であると判定すること
を特徴とする付記16ないし付記19のいずれか1項に記載のコード画像読み取りプログラム。
(付記21)
前記検査領域における前記図形の1辺当たりの画素数Nを算出する際の分布に基づいて推定誤差αを検出し、前記画素数Nが前記推定誤差αおよび最小値Tminを用いた式(1)を満たさないとき、式(2)を満たす目標ズーム値Zmが前記ズーム調整部で調整可能な範囲に存在するか否かに基づいて、前記コードの認識が可能か否かを判定すること
Tmin<N−α ・・・(1)
Tmin/(N−α)<Zm ・・・(2)
を特徴とする付記20記載のコード画像読み取りプログラム。
(付記22)
前記目標ズーム値が前記ズーム調整部で調整可能な範囲に存在しないとき、前記電子機器を前記コードに近づけるようにするための前記ユーザ通知をユーザに通知すること
を特徴とする付記21記載のコード画像読み取りプログラム。
The invention described in the above embodiments is organized and disclosed as an appendix.
(Appendix 1)
A code image reading device equipped with a digital camera,
A shooting section for shooting images;
A code detection unit that detects whether a code is included in an arbitrary inspection area of the photographed image, and determines whether the code in the inspection area is a blurred image;
A moving state detecting unit for detecting a moving state of the code image reading device;
When the code is the blurred image, the auto focus adjustment start timing is detected based on the detection result of the moving state detection unit, and when the code is not the blurred image, it is determined whether zoom adjustment is necessary or not. A control unit for determining based on the resolution of the code in the inspection area;
An autofocus unit that performs the autofocus adjustment in response to detection of the start timing;
A zoom adjustment unit that performs the zoom adjustment when the control unit determines that the zoom adjustment is necessary;
A notification unit for notifying the user of a user notification according to the cause of the unrecognized code;
A code image reading apparatus, comprising: a code processing unit that extracts data stored in the code.
(Appendix 2)
The control unit detects the start by detecting at least one of a first state, a second state, and a third state based on the detection result of the moving state detection unit when the code is the blurred image. Detect the timing,
The first state is a state where the code image reading device is stopped,
In the second state, the code image reading device is not moved in a direction orthogonal to the optical axis direction of the digital camera, and the code image reading device is continuously moved in the optical axis direction for a predetermined time. Is in a state
The third state is a state in which the code image reading device is not moved in a direction orthogonal to the optical axis direction, and the movement of the code image reading device in the optical axis direction is changed in the opposite direction. The code image reading apparatus according to appendix 1, wherein the code image reading apparatus is provided.
(Appendix 3)
The code image reading unit according to appendix 1 or appendix 2, wherein the code detection unit determines that the code is the blurred image when a variance of pixel values in the inspection area is equal to or less than a preset reference value. apparatus.
(Appendix 4)
The notification unit notifies the user of the user notification for moving the code image reading device away from the code when the code after the autofocus adjustment is the blurred image. The code image reading device according to any one of appendix 1 to appendix 3.
(Appendix 5)
When the code is not the blurred image, the control unit determines whether or not the number of pixels per side of the graphic of the minimum structural unit of the code is smaller than a preset minimum value, and 1 of the graphic The code image reading device according to any one of appendix 1 to appendix 4, wherein when the number of pixels per side is smaller than the minimum value, it is determined that the zoom adjustment is necessary.
(Appendix 6)
The control unit detects an estimation error α based on a distribution when calculating the number N of pixels per side of the graphic in the inspection region, and the number N of pixels uses the estimation error α and the minimum value Tmin. Whether or not the code can be recognized based on whether or not the target zoom value Zm satisfying the formula (2) is within the range adjustable by the zoom adjustment unit when the formula (1) is not satisfied. Judging Tmin <N−α (1)
Tmin / (N−α) <Zm (2)
The code image reading device according to appendix 5, wherein:
(Appendix 7)
The notification unit notifies the user of the user notification for causing the code image reading device to approach the code when the target zoom value does not exist within a range adjustable by the zoom adjustment unit. The code image reading device according to appendix 6.
(Appendix 8)
An operation method of a code image reading apparatus equipped with a digital camera,
Take a picture,
Detecting whether or not a code is included in an arbitrary inspection area of the photographed image, and determining whether or not the code in the inspection area is a blurred image;
Detecting the movement state of the code image reading device,
When the code is the blurred image, the auto focus adjustment start timing is detected based on the detection result of the moving state, and when the code is not the blurred image, it is determined whether zoom adjustment is necessary or not. Based on the resolution of the code in the
In response to the detection of the start timing, the autofocus adjustment is performed,
When it is determined that the zoom adjustment is necessary, the zoom adjustment is performed,
When the code is unrecognizable, notify the user of a user notification according to the cause of the unrecognizable code,
When the recognizable code is detected, the data stored in the code is taken out.
(Appendix 9)
When the code is the blurred image, the start timing is detected by detecting at least one of a first state, a second state, and a third state based on the detection result of the moving state,
The first state is a state where the code image reading device is stopped,
In the second state, the code image reading device is not moved in a direction orthogonal to the optical axis direction of the digital camera, and the code image reading device is continuously moved in the optical axis direction for a predetermined time. Is in a state
The third state is a state in which the code image reading device is not moved in a direction orthogonal to the optical axis direction, and the movement of the code image reading device in the optical axis direction is changed in the opposite direction. The operation method of the code image reading device according to appendix 8, characterized in that it exists.
(Appendix 10)
The code image reading apparatus operating method according to appendix 8 or appendix 9, wherein when the variance of pixel values in the inspection area is equal to or less than a preset reference value, the code is determined as the blurred image.
(Appendix 11)
Supplementary notes 8 to 8, wherein, when the code after the autofocus adjustment is performed is the blurred image, the user notification for moving the code image reading device away from the code is notified to the user. The operation method of the code image reading device according to any one of appendix 10.
(Appendix 12)
When the code is not the blurred image, it is determined whether or not the number of pixels per side of the graphic of the minimum structural unit of the code is smaller than a preset minimum value, and the number of pixels per side of the graphic The operation method of the code image reading device according to any one of appendix 8 to appendix 11, wherein the zoom adjustment is determined to be necessary when is smaller than the minimum value.
(Appendix 13)
Equation (1) in which an estimation error α is detected based on a distribution when calculating the number N of pixels per side of the graphic in the inspection region, and the number N of pixels uses the estimation error α and the minimum value Tmin. If the target zoom value Zm satisfying the expression (2) is within a range that can be adjusted by the zoom adjustment unit, it is determined whether or not the code can be recognized. N-α (1)
Tmin / (N−α) <Zm (2)
An operation method of the code image reading device according to appendix 12.
(Appendix 14)
The user notification for causing the code image reading device to approach the code is notified to the user when the target zoom value is not within a range adjustable by the zoom adjustment unit. Method of the code image reading apparatus of the present invention.
(Appendix 15)
A code image reading program to be executed by an electronic device equipped with a digital camera,
A code image reading program for causing the electronic device to operate as the code image reading device according to any one of appendix 1 to appendix 7.
(Appendix 16)
A code image reading program to be executed by an electronic device equipped with a digital camera,
Shooting process to take images,
A code detection process for detecting whether or not a code is included in an arbitrary inspection area of the photographed image and determining whether or not the code in the inspection area is a blurred image;
A movement state detection process for detecting a movement state of the electronic device;
When the code is the blurred image, the auto focus adjustment start timing is detected based on the detection result of the moving state, and when the code is not the blurred image, it is determined whether zoom adjustment is necessary or not. Control processing to be determined based on the resolution of the code in
In response to detection of the start timing, autofocus processing for performing the autofocus adjustment;
A zoom adjustment process for performing the zoom adjustment when it is determined that the zoom adjustment is necessary;
When the code is unrecognizable, a notification process for notifying the user of a user notification according to the cause of the unrecognized code;
When the recognizable code is detected, a code image reading program for causing the electronic device to execute code processing for extracting data stored in the code.
(Appendix 17)
When the code is the blurred image, the start timing is detected by detecting at least one of a first state, a second state, and a third state based on the detection result of the moving state,
The first state is a state in which the electronic device is stopped,
The second state is a state in which the electronic device is not moved in a direction orthogonal to the optical axis direction of the digital camera, and the electronic device is continuously moved in the optical axis direction for a predetermined time. And
The third state is a state in which the electronic device is not moved in a direction orthogonal to the optical axis direction, and the movement of the electronic device in the optical axis direction is changed in the opposite direction. The code image reading program according to appendix 16.
(Appendix 18)
The code image reading program according to appendix 16 or appendix 17, wherein when the variance of pixel values in the inspection area is equal to or less than a preset reference value, the code is determined to be the blurred image.
(Appendix 19)
Supplementary note 16 to supplementary note 18, wherein when the code after performing the autofocus adjustment is the blurred image, the user notification for keeping the electronic device away from the code is notified to the user. The code image reading program according to any one of the above.
(Appendix 20)
When the code is not the blurred image, it is determined whether or not the number of pixels per side of the graphic of the minimum structural unit of the code is smaller than a preset minimum value, and the number of pixels per side of the graphic The code image reading program according to any one of Supplementary Note 16 to Supplementary Note 19, wherein when the value is smaller than the minimum value, it is determined that the zoom adjustment is necessary.
(Appendix 21)
Equation (1) in which an estimation error α is detected based on a distribution when calculating the number N of pixels per side of the graphic in the inspection region, and the number N of pixels uses the estimation error α and the minimum value Tmin. If the target zoom value Zm satisfying the expression (2) is within a range that can be adjusted by the zoom adjustment unit, it is determined whether or not the code can be recognized. N-α (1)
Tmin / (N−α) <Zm (2)
The code image reading program according to appendix 20, characterized by:
(Appendix 22)
The code according to claim 21, wherein when the target zoom value does not exist within a range adjustable by the zoom adjustment unit, the user notification for causing the electronic device to approach the code is notified to the user. Image reading program.

以上の詳細な説明により、実施形態の特徴点および利点は明らかになるであろう。これは、特許請求の範囲がその精神および権利範囲を逸脱しない範囲で前述のような実施形態の特徴点および利点にまで及ぶことを意図するものである。また、当該技術分野において通常の知識を有する者であれば、あらゆる改良および変更に容易に想到できるはずであり、発明性を有する実施形態の範囲を前述したものに限定する意図はなく、実施形態に開示された範囲に含まれる適当な改良物および均等物に拠ることも可能である。   From the above detailed description, features and advantages of the embodiments will become apparent. This is intended to cover the features and advantages of the embodiments described above without departing from the spirit and scope of the claims. Further, any person having ordinary knowledge in the technical field should be able to easily come up with any improvements and modifications, and there is no intention to limit the scope of the embodiments having the invention to those described above. It is also possible to rely on suitable improvements and equivalents within the scope disclosed in.

10‥コード画像読み取り装置;20‥撮影部;30‥コード検出部;40‥移動状態検出部;50‥制御部;60‥オートフォーカス部;70‥ズーム調整部;80‥通知部;90‥コード処理部;100‥表示部;AR10、AR12‥検査領域;COD、COD20、COD22、CODa、CODb、CODb’、CODc、CODd、CODe‥コード   DESCRIPTION OF SYMBOLS 10 ... Code image reading apparatus; 20 ... Photographing part; 30 ... Code detection part; 40 ... Movement state detection part; 50 ... Control part; 60 ... Auto-focus part; Processing unit: 100, display unit, AR10, AR12, inspection area; COD, COD20, COD22, CODa, CODb, CODb ', CODc, CODd, CODe, code

Claims (8)

デジタルカメラが搭載されたコード画像読み取り装置であって、
画像を撮影する撮影部と、
撮影された前記画像の任意の検査領域にコードが含まれているか否かを検出し、前記検査領域内の前記コードがぼけた画像か否かを判定するコード検出部と、
前記コード画像読み取り装置の移動状態を検出する移動状態検出部と、
前記コードが前記ぼけた画像のとき、オートフォーカス調整の開始タイミングを前記移動状態検出部の検出結果に基づいて検出し、前記コードが前記ぼけた画像でないとき、ズーム調整が必要か否かを前記検査領域内の前記コードの解像度に基づいて判定する制御部と、
前記開始タイミングの検出に応答して、前記オートフォーカス調整を実施するオートフォーカス部と、
前記ズーム調整が必要であると前記制御部で判定されたとき、前記ズーム調整を実施するズーム調整部と、
前記コードの認識不可の原因に応じたユーザ通知をユーザに通知する通知部と、
前記コードに格納されているデータを取り出すコード処理部とを備え、
前記制御部は、前記コードが前記ぼけた画像のとき、第1状態、第2状態および第3状態の少なくとも1つを前記移動状態検出部の前記検出結果に基づいて検出することにより、前記開始タイミングを検出し、
前記第1状態は、前記コード画像読み取り装置が停止している状態であり、
前記第2状態は、前記コード画像読み取り装置が前記デジタルカメラの光軸方向に直交する方向に移動していない状態で、かつ、前記コード画像読み取り装置が前記光軸方向に所定時間継続して移動している状態であり、
前記第3状態は、前記コード画像読み取り装置が前記光軸方向に直交する方向に移動していない状態で、かつ、前記コード画像読み取り装置の前記光軸方向の移動が反対方向に変化した状態であること
特徴とするコード画像読み取り装置。
A code image reading device equipped with a digital camera,
A shooting section for shooting images;
A code detection unit that detects whether a code is included in an arbitrary inspection area of the photographed image, and determines whether the code in the inspection area is a blurred image;
A moving state detecting unit for detecting a moving state of the code image reading device;
When the code is the blurred image, the auto focus adjustment start timing is detected based on the detection result of the moving state detection unit, and when the code is not the blurred image, it is determined whether zoom adjustment is necessary or not. A control unit for determining based on the resolution of the code in the inspection area;
An autofocus unit that performs the autofocus adjustment in response to detection of the start timing;
A zoom adjustment unit that performs the zoom adjustment when the control unit determines that the zoom adjustment is necessary;
A notification unit for notifying the user of a user notification according to the cause of the unrecognized code;
A code processing unit for retrieving data stored in the code ,
The control unit detects the start by detecting at least one of a first state, a second state, and a third state based on the detection result of the moving state detection unit when the code is the blurred image. Detect the timing,
The first state is a state where the code image reading device is stopped,
In the second state, the code image reading device is not moved in a direction orthogonal to the optical axis direction of the digital camera, and the code image reading device is continuously moved in the optical axis direction for a predetermined time. Is in a state
The third state is a state in which the code image reading device is not moved in a direction orthogonal to the optical axis direction, and the movement of the code image reading device in the optical axis direction is changed in the opposite direction. There is
Code image reading apparatus according to claim.
前記コード検出部は、前記検査領域の画素値の分散が予め設定された基準値以下のとき、前記コードを前記ぼけた画像と判定すること
を特徴とする請求項1記載のコード画像読み取り装置。
The code image reading apparatus according to claim 1 , wherein the code detection unit determines that the code is the blurred image when a variance of pixel values in the inspection area is equal to or less than a preset reference value .
前記通知部は、前記オートフォーカス調整を実施した後の前記コードが前記ぼけた画像のとき、前記コード画像読み取り装置を前記コードから遠ざけるようにするための前記ユーザ通知をユーザに通知すること
を特徴とする請求項1または請求項2記載のコード画像読み取り装置。
The notification unit notifies the user of the user notification for moving the code image reading device away from the code when the code after the autofocus adjustment is the blurred image. The code image reading device according to claim 1 or 2.
前記制御部は、前記コードが前記ぼけた画像でないとき、前記コードの最小構成単位の図形の1辺当たりの画素数が予め設定された最小値より小さいか否かを判定し、前記図形の1辺当たりの画素数が前記最小値より小さいとき、前記ズーム調整が必要であると判定すること
を特徴とする請求項1ないし請求項3のいずれか1項に記載のコード画像読み取り装置。
When the code is not the blurred image, the control unit determines whether or not the number of pixels per side of the graphic of the minimum structural unit of the code is smaller than a preset minimum value, and 1 of the graphic 4. The code image reading apparatus according to claim 1 , wherein when the number of pixels per side is smaller than the minimum value, it is determined that the zoom adjustment is necessary . 5.
前記制御部は、前記検査領域における前記図形の1辺当たりの画素数Nを算出する際の分布に基づいて推定誤差αを検出し、前記画素数Nが前記推定誤差αおよび最小値Tminを用いた式(1)を満たさないとき、式(2)を満たす目標ズーム値Zmが前記ズーム調整部で調整可能な範囲に存在するか否かに基づいて、前記コードの認識が可能か否かを判定すること
Tmin<N−α ・・・(1)
Tmin/(N−α)<Zm ・・・(2)
を特徴とする請求項4記載のコード画像読み取り装置。
The control unit detects an estimation error α based on a distribution when calculating the number N of pixels per side of the graphic in the inspection region, and the number N of pixels uses the estimation error α and the minimum value Tmin. Whether or not the code can be recognized based on whether or not the target zoom value Zm satisfying the formula (2) is within the range adjustable by the zoom adjustment unit when the formula (1) is not satisfied. To judge
Tmin <N−α (1)
Tmin / (N−α) <Zm (2)
The code image reading device according to claim 4 .
前記通知部は、前記目標ズーム値が前記ズーム調整部で調整可能な範囲に存在しないとき、前記コード画像読み取り装置を前記コードに近づけるようにするための前記ユーザ通知をユーザに通知すること
を特徴とする請求項5記載のコード画像読み取り装置。
The notifying unit notifies the user of the user notification for causing the code image reading device to approach the code when the target zoom value is not within a range adjustable by the zoom adjusting unit. The code image reading device according to claim 5.
デジタルカメラが搭載されたコード画像読み取り装置の動作方法であって、An operation method of a code image reading apparatus equipped with a digital camera,
画像を撮影し、Take a picture,
撮影された前記画像の任意の検査領域にコードが含まれているか否かを検出し、前記検査領域内の前記コードがぼけた画像か否かを判定し、Detecting whether or not a code is included in an arbitrary inspection area of the photographed image, and determining whether or not the code in the inspection area is a blurred image;
前記コード画像読み取り装置の移動状態を検出し、Detecting the movement state of the code image reading device,
前記コードが前記ぼけた画像のとき、第1状態、第2状態および第3状態の少なくとも1つを前記移動状態の検出結果に基づいて検出することにより、オートフォーカス調整の開始タイミングを検出し、前記コードが前記ぼけた画像でないとき、ズーム調整が必要か否かを前記検査領域内の前記コードの解像度に基づいて判定し、When the code is the blurred image, by detecting at least one of the first state, the second state, and the third state based on the detection result of the moving state, the start timing of the autofocus adjustment is detected, When the code is not the blurred image, determine whether zoom adjustment is necessary based on the resolution of the code in the inspection area;
前記開始タイミングの検出に応答して、前記オートフォーカス調整を実施し、In response to the detection of the start timing, the autofocus adjustment is performed,
前記ズーム調整が必要であると判定されたとき、前記ズーム調整を実施し、When it is determined that the zoom adjustment is necessary, the zoom adjustment is performed,
前記コードが認識不可のとき、前記コードの認識不可の原因に応じたユーザ通知をユーザに通知し、When the code is unrecognizable, notify the user of a user notification according to the cause of the unrecognizable code,
認識可能な前記コードが検出されたとき、前記コードに格納されているデータを取り出し、When the recognizable code is detected, the data stored in the code is extracted,
前記第1状態は、前記コード画像読み取り装置が停止している状態であり、The first state is a state where the code image reading device is stopped,
前記第2状態は、前記コード画像読み取り装置が前記デジタルカメラの光軸方向に直交する方向に移動していない状態で、かつ、前記コード画像読み取り装置が前記光軸方向に所定時間継続して移動している状態であり、In the second state, the code image reading device is not moved in a direction orthogonal to the optical axis direction of the digital camera, and the code image reading device is continuously moved in the optical axis direction for a predetermined time. Is in a state
前記第3状態は、前記コード画像読み取り装置が前記光軸方向に直交する方向に移動していない状態で、かつ、前記コード画像読み取り装置の前記光軸方向の移動が反対方向に変化した状態であることThe third state is a state in which the code image reading device is not moved in a direction orthogonal to the optical axis direction, and the movement of the code image reading device in the optical axis direction is changed in the opposite direction. There is
を特徴とするコード画像読み取り装置の動作方法。A method for operating a code image reading apparatus.
デジタルカメラが搭載された電子機器に実行させるコード画像読み取りプログラムであって、A code image reading program to be executed by an electronic device equipped with a digital camera,
前記電子機器を請求項1ないし請求項6のいずれか1項に記載のコード画像読み取り装置として動作させるコード画像読み取りプログラム。A code image reading program for causing the electronic device to operate as the code image reading apparatus according to claim 1.
JP2012061777A 2012-03-19 2012-03-19 Code image reading apparatus, operation method of code image reading apparatus, and code image reading program Active JP5915296B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012061777A JP5915296B2 (en) 2012-03-19 2012-03-19 Code image reading apparatus, operation method of code image reading apparatus, and code image reading program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012061777A JP5915296B2 (en) 2012-03-19 2012-03-19 Code image reading apparatus, operation method of code image reading apparatus, and code image reading program

Publications (2)

Publication Number Publication Date
JP2013196281A JP2013196281A (en) 2013-09-30
JP5915296B2 true JP5915296B2 (en) 2016-05-11

Family

ID=49395177

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012061777A Active JP5915296B2 (en) 2012-03-19 2012-03-19 Code image reading apparatus, operation method of code image reading apparatus, and code image reading program

Country Status (1)

Country Link
JP (1) JP5915296B2 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6379924B2 (en) * 2014-09-22 2018-08-29 富士ゼロックス株式会社 Image forming apparatus and image processing apparatus
JP6502137B2 (en) * 2015-03-20 2019-04-17 株式会社日立ハイテクノロジーズ Automatic analyzer
JP2020502612A (en) * 2016-09-28 2020-01-23 スリーエム イノベイティブ プロパティズ カンパニー Hierarchical set of optical elements for machine-readable articles
JP6788801B2 (en) * 2017-04-07 2020-11-25 カシオ計算機株式会社 Image confirmation device, image confirmation method, and program
CN113255390A (en) * 2021-04-16 2021-08-13 摩拜(北京)信息技术有限公司 Code scanning method, electronic device and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100588230C (en) * 2003-02-07 2010-02-03 夏普株式会社 Protable cellular phone and protable terminal device
JP2008205774A (en) * 2007-02-20 2008-09-04 Nec Corp System, method and program for guiding photographing work
WO2008143612A1 (en) * 2007-05-17 2008-11-27 Optoelectronics Co., Ltd. Bar code scanner with environmental sensing
JP5044429B2 (en) * 2008-01-30 2012-10-10 京セラ株式会社 Portable electronic device and imaging method
JP5482327B2 (en) * 2010-03-12 2014-05-07 富士通株式会社 Imaging apparatus, imaging method, and imaging program

Also Published As

Publication number Publication date
JP2013196281A (en) 2013-09-30

Similar Documents

Publication Publication Date Title
JP5048468B2 (en) Imaging apparatus and imaging method thereof
US9888163B2 (en) Imaging device
JP5915296B2 (en) Code image reading apparatus, operation method of code image reading apparatus, and code image reading program
JP5088118B2 (en) Focus adjustment device
JP4483930B2 (en) Imaging apparatus, control method thereof, and program
US9060129B2 (en) Imaging device, control method of imaging device, and computer program
JP6671994B2 (en) Imaging device and control method therefor, program, storage medium
JP2003167182A (en) Automatic focusing device
CN103226279A (en) Method and system for an adaptive auto-focus algorithm
US11435550B2 (en) Camera for limiting shifting of focus adjustment optical system
JP6338347B2 (en) Imaging apparatus and control method thereof
US10057478B2 (en) Focus detecting apparatus and method of controlling the same
US20170276902A1 (en) Focus control device, imaging device, and focus control method
JP2019121860A (en) Image processing apparatus and control method therefor
JP5196768B2 (en) Imaging device
JP2007133301A (en) Autofocus camera
CN113475055B (en) Electronic device, camera, and program
JP5564961B2 (en) Imaging device
US9467614B2 (en) Camera module and method for driving the same to achieve fast focus of image being captured
JP4946152B2 (en) Imaging device and its focus adjustment device
KR20110035512A (en) Auto focus method
JP4793459B2 (en) Symbol reader and program
JP2015201709A (en) Imaging apparatus and imaging processing program
JP2014060654A (en) Imaging device, control method therefor, and control program
KR101900429B1 (en) Method and apparatus for determining lens focus

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20141204

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20151015

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20151020

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20151214

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20160321

R150 Certificate of patent or registration of utility model

Ref document number: 5915296

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150