JP6258809B2 - Optical information reader, control method and program for optical information reader - Google Patents

Optical information reader, control method and program for optical information reader Download PDF

Info

Publication number
JP6258809B2
JP6258809B2 JP2014157026A JP2014157026A JP6258809B2 JP 6258809 B2 JP6258809 B2 JP 6258809B2 JP 2014157026 A JP2014157026 A JP 2014157026A JP 2014157026 A JP2014157026 A JP 2014157026A JP 6258809 B2 JP6258809 B2 JP 6258809B2
Authority
JP
Japan
Prior art keywords
distance
unit
decoding
optical information
imaging
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
JP2014157026A
Other languages
Japanese (ja)
Other versions
JP2016033784A (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.)
Keyence Corp
Original Assignee
Keyence Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Keyence Corp filed Critical Keyence Corp
Priority to JP2014157026A priority Critical patent/JP6258809B2/en
Publication of JP2016033784A publication Critical patent/JP2016033784A/en
Application granted granted Critical
Publication of JP6258809B2 publication Critical patent/JP6258809B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Studio Devices (AREA)

Description

本発明は光学的情報読取装置、光学的情報読取装置の制御方法およびプログラムに関する。   The present invention relates to an optical information reader, an optical information reader control method, and a program.

バーコードやQRコード(登録商標)などの2次元コードを読み取る2次元コードリーダ(以下、リーダと称す。)は広く普及している。このようなリーダの一例が特許文献1に記載されている。   Two-dimensional code readers (hereinafter referred to as readers) that read two-dimensional codes such as barcodes and QR codes (registered trademark) are widely used. An example of such a reader is described in Patent Document 1.

特開2011−76519号公報JP 2011-76519 A

ところで、リーダで精度よく2次元コードをデコードするためには、ピンボケがないようにリーダと2次元コードまでの距離を調整する必要がある。多少のピンボケは許容されるものの、ピンボケが大きな画像ではデコード誤りが発生するからである。工場ではラインを搬送されるワーク(製造物)に2次元コードを付与したり、レーザ刻印したりして、それをリーダで読み取って生産管理をしている。リーダはラインに対して設置されるときにワークの2次元コードまでの距離を調整されるが、ラインを搬送されるワークの高さのバラツキやラインに対するワークの位置のバラツキ等によって、リーダと2次元コードまでの距離が適切な距離から外れてしまい、デコード誤りが発生することがある。もちろんリーダは多少のピンボケが発生しても2次元コードをデコードできるが、リーダと2次元コードまでの距離についてどの程度の変動が許容されるかを知った上でリーダを設置することが求められる。つまり、所望の読取成功率を達成可能な距離の範囲(許容深度と称す。)をユーザや設置担当者に提示できれば、工場でのデコードの成功率を向上できるようになろう。これはデコードの失敗によるワークの廃棄を削減する上でも重要であろう。   By the way, in order to accurately decode the two-dimensional code by the reader, it is necessary to adjust the distance between the reader and the two-dimensional code so that there is no blur. This is because although some blurring is allowed, a decoding error occurs in an image with large blurring. In a factory, a two-dimensional code is given to a workpiece (product) conveyed on a line or laser engraving is performed, and this is read by a reader for production management. When the leader is installed with respect to the line, the distance to the two-dimensional code of the workpiece is adjusted. However, due to variations in the height of the workpiece conveyed on the line, variations in the position of the workpiece with respect to the line, etc. The distance to the dimension code may deviate from an appropriate distance, and a decoding error may occur. Of course, the reader can decode the two-dimensional code even if some blur occurs, but it is required to install the reader after knowing how much variation is allowed in the distance between the reader and the two-dimensional code. . That is, if the range of distance that can achieve the desired reading success rate (referred to as allowable depth) can be presented to the user or the person in charge of installation, the success rate of decoding at the factory can be improved. This will also be important in reducing the waste of work due to decoding failures.

そこで、本発明は、許容深度を求めることが可能な光学的情報読取装置を提供することを目的とする。   SUMMARY An advantage of some aspects of the invention is that it provides an optical information reader capable of obtaining an allowable depth.

本発明によれば、たとえば、
フォーカス調整機構を備え、ワークに設けられたコードを撮像する撮像手段と、
前記撮像手段により取得された画像データをデコードするデコード手段と、
前記フォーカス調整機構における調整量を複数通りに変化させたときに、各調整量ごとに前記撮像手段により取得された各画像データについて前記デコード手段によるデコード結果を取得し、前記調整量を換算して得られる前記撮像手段から前記ワークまでの距離と当該デコード結果との対応関係を求め、当該対応関係に基づき前記コードをデコードする上で許容される前記撮像手段から前記ワークまでの距離である許容深度を演算する演算手段と、
を有することを特徴とする光学的情報読取装置が提供される。
According to the present invention, for example,
An imaging unit that includes a focus adjustment mechanism and images a code provided on the workpiece;
Decoding means for decoding image data acquired by the imaging means;
When the adjustment amount in the focus adjustment mechanism is changed in a plurality of ways, the decoding result by the decoding unit is obtained for each image data acquired by the imaging unit for each adjustment amount, and the adjustment amount is converted. An allowable depth that is a distance from the imaging means to the work that is allowed in decoding the code based on the correspondence between the obtained distance from the imaging means to the work and the decoding result Computing means for computing
An optical information reading device is provided.

本発明によれば、許容深度を求めることが可能な光学的情報読取装置が提供される。   According to the present invention, an optical information reading apparatus capable of obtaining an allowable depth is provided.

光学的情報読取装置の一例を示す図The figure which shows an example of an optical information reader 許容深度を説明するための図Diagram for explaining allowable depth 読み取り距離とマッチングレベルとの関係を示す図Diagram showing the relationship between reading distance and matching level レンズ繰り出し量を読み取り距離に変換するための関数などの一例を示す図The figure which shows an example of the function etc. which convert the lens extension amount into the reading distance リーダの一例を示す図Diagram showing an example of a reader リーダを設定するコンピュータの一例を示す図The figure which shows an example of the computer which sets a reader ユーザインタフェースの一例を示す図The figure which shows an example of the user interface 許容深度の取得処理を示すフローチャートFlow chart showing allowable depth acquisition processing

以下に本発明の一実施形態を示す。以下で説明される個別の実施形態は、本発明の上位概念、中位概念および下位概念など種々の概念を理解するために役立つであろう。また、本発明の技術的範囲は、特許請求の範囲によって確定されるのであって、以下の個別の実施形態によって限定されるわけではない。   An embodiment of the present invention is shown below. The individual embodiments described below will help to understand various concepts, such as the superordinate concept, intermediate concept and subordinate concept of the present invention. Further, the technical scope of the present invention is determined by the scope of the claims, and is not limited by the following individual embodiments.

図1はリーダシステム(光学的情報読取装置)の一例を示す図である。ライン1は検査対象物であるワーク2を搬送する搬送ベルトなどである。リーダ3は2次元コードを読み取ってデコードする2次元コードリーダである。なお、リーダ3自体も狭義の光学的情報読取装置である。プログラマブル・ロジック・コントローラ(PLC5)はライン1やリーダ3を制御する制御装置である。コンピュータ4はリーダ3に対して動作条件などを設定したり、リーダ3からデコード結果などを取得して表示したりする情報処理装置である。   FIG. 1 is a diagram showing an example of a reader system (optical information reader). A line 1 is a conveyance belt that conveys a workpiece 2 that is an inspection object. The reader 3 is a two-dimensional code reader that reads and decodes a two-dimensional code. Note that the reader 3 itself is an optical information reading device in a narrow sense. The programmable logic controller (PLC 5) is a control device that controls the line 1 and the reader 3. The computer 4 is an information processing apparatus that sets operating conditions and the like for the reader 3 and acquires and displays a decoding result from the reader 3.

<許容深度(読み取り深度)>
図2(A)、図2(B)は許容深度を説明するための図である。図2(A)はワーク2をリーダ3から遠ざけたり、近づけたりして許容深度DDを見つけることを示す図である。図2(B)はリーダ3をワーク2から遠ざけたり、近づけたりして許容深度DDを見つけることを示す図である。図2(A)、図2(B)においてRDはユーザがリーダ3を設置したときのリーダ3の先端位置P0からワーク2の表面に設けられた2次元コード6までの読み取り距離であり、これを基準距離と呼ぶことにする(読み取り距離は可変であるが、許容深度の取得処理を開始したときの読み取り距離を基準距離と呼ぶ)。ユーザは許容深度DDを把握するために、ワーク2をリーダ3から遠ざけたり、近づけたりしつつ、そのときの読取のしやすさ(マッチングレベルと称す。)を確認し、所望のマッチングレベルを達成可能な遠方側のワーク2の位置Pfと近方側のワーク2の位置Pnとを見つけ、リーダ3の先端位置P0からPnまでの距離と、リーダ3の先端位置P0からPfまでの距離とを許容深度DDとして求める。マッチングレベルはリーダ3またはコンピュータ4が算出して表示するものとする。なお、初期位置(基準位置Pr)においてリーダ3の光学系がワーク2の2次元コード6に合焦しているとは限らない。そのため、基準距離RDに対して遠方側の余裕度(遠方余裕度)Mfと近方側の余裕度(近方余裕度)Mnとが一致しないことがある。よって、基準距離RDのときの2次元コード6の位置を基準位置Prとすると、基準位置Prから近方側の読み取り限界位置Pnまでの距離が近方余裕度Mnである。また、基準位置Prから遠方側の読み取り限界位置Pfまでの距離が遠方余裕度Mfである。図2(B)が示すようにワーク2を固定してリーダ3をワーク2から遠ざけたり、近づけたりしながら各読み取り距離でのマッチングレベルを確認することで許容深度DDを求めてもよい。
<Allowable depth (reading depth)>
2A and 2B are diagrams for explaining the allowable depth. FIG. 2A is a diagram showing that the allowable depth DD is found by moving the work 2 away from or closer to the reader 3. FIG. 2B is a diagram showing that the allowable depth DD is found by moving the reader 3 away from or closer to the work 2. 2A and 2B, RD is a reading distance from the tip position P0 of the reader 3 when the user installs the reader 3 to the two-dimensional code 6 provided on the surface of the workpiece 2. Is referred to as a reference distance (the reading distance is variable, but the reading distance when the permissible depth acquisition process is started is referred to as a reference distance). In order to grasp the permissible depth DD, the user checks the ease of reading (referred to as a matching level) while moving the workpiece 2 away from or closer to the reader 3, and achieves a desired matching level. The possible position Pf of the far side workpiece 2 and the position Pn of the near side workpiece 2 are found, and the distance from the tip position P0 to Pn of the reader 3 and the distance from the tip position P0 to Pf of the reader 3 are determined. Obtained as allowable depth DD. The matching level is calculated and displayed by the reader 3 or the computer 4. Note that the optical system of the reader 3 is not necessarily focused on the two-dimensional code 6 of the workpiece 2 at the initial position (reference position Pr). For this reason, the margin on the far side (far margin) Mf and the margin on the near side (near margin) Mn may not coincide with the reference distance RD. Therefore, if the position of the two-dimensional code 6 at the reference distance RD is the reference position Pr, the distance from the reference position Pr to the reading limit position Pn on the near side is the near margin Mn. The distance from the reference position Pr to the far-side reading limit position Pf is the far margin Mf. As shown in FIG. 2B, the allowable depth DD may be obtained by confirming the matching level at each reading distance while fixing the work 2 and moving the reader 3 away from or close to the work 2.

ところで、マッチングレベルとはリーダ3が2次元コード6の読み取りに成功したときにリーダ3にとって2次元コード6がどれだけ読み取りやすかったかを示すパラメータである。2次元コード6の1回の読み取りあたりの読み取り結果は成功と失敗との2つしかない。よって、デコードに成功したか失敗しただけに着目してもどの程度の余裕をもってデコードに成功したのかはわからない。そのため、当業界ではマッチングレベルという尺度が使用されている。マッチングレベルの算出方法自体はすでに当業界においてよく知られているため、ここではその詳細については省略する。   Incidentally, the matching level is a parameter indicating how easy the reader 3 can read the two-dimensional code 6 when the reader 3 successfully reads the two-dimensional code 6. There are only two reading results for each reading of the two-dimensional code 6: success and failure. Therefore, even if attention is paid only to whether the decoding succeeds or fails, it is not known how much time the decoding succeeds. Therefore, a measure called matching level is used in the industry. Since the matching level calculation method itself is already well known in the art, its details are omitted here.

図3はリーダ・ワーク間の読み取り距離とマッチングレベルとの関係を示すグラフと、許容深度と、近方余裕度および遠方余裕度を表示するユーザインタフェース(UI)の一例を示している。図3では基準距離RDが170mmである例である。図3においてUMLはユーザが設定した所定の閾値条件である。ここでのUMLは許容できる下限のマッチングレベルである。この例では、UMLを満たす近方側の限界距離は130mmであり、遠方側の距離は220mmである。よって、許容深度は130mmないし220mmmとなる。また、基準距離RDが170mmであり、かつ、近方側の限界距離は130mmであるため、近方余裕度は40mmである。基準距離RDが170mmであり、かつ、遠方側の限界距離は220mmであるため、遠方余裕度は50mmである。   FIG. 3 shows an example of a graph showing the relationship between the reading distance between the reader / work and the matching level, and an example of a user interface (UI) that displays the allowable depth, the near margin, and the far margin. FIG. 3 shows an example in which the reference distance RD is 170 mm. In FIG. 3, UML is a predetermined threshold condition set by the user. The UML here is an allowable lower limit matching level. In this example, the near limit distance that satisfies UML is 130 mm, and the far distance is 220 mm. Therefore, the allowable depth is 130 mm to 220 mm. Moreover, since the reference distance RD is 170 mm and the limit distance on the near side is 130 mm, the near margin is 40 mm. Since the reference distance RD is 170 mm and the far-side limit distance is 220 mm, the far margin is 50 mm.

このように許容深度等をユーザに提示できれば、リーダ3とワーク2の2次元コード6までの距離をどの程度の範囲にとどめればよいかを具体的に理解できるようになる。しかし、図2(A)や図2(B)で示した手法ではユーザがワーク2を上下させたり、リーダ3を上下させたりする必要がある。とりわけ、リーダ3にはケーブル等が接続されており、手動でリーダ3を移動させることは簡単ではない。さらに、多数の位置についてデコード結果を取得する必要があり、膨大な作業となってしまうだろう。その一方で、リーダ3の光学系にフォーカス調整機構(AF機構)を採用することも可能である。AF機構は被写体に対して合焦するように光学系を駆動する機構である。そこで、本実施形態では、AF機構を駆動して合焦位置を調整し、調整量をリーダ3とワーク2までの距離に換算し、換算距離とデコード結果との対応関係を求め、この対応関係に基づき許容深度を演算する光学的情報読取装置を提供する。これにより、ユーザはリーダ3やワーク2を移動させることなく、許容深度を把握できるようになる。   If the permissible depth or the like can be presented to the user in this way, it becomes possible to specifically understand the range in which the distance from the reader 3 to the two-dimensional code 6 of the work 2 should be kept. However, in the method shown in FIGS. 2A and 2B, the user needs to move the workpiece 2 up and down and the reader 3 up and down. In particular, a cable or the like is connected to the reader 3, and it is not easy to move the reader 3 manually. Furthermore, decoding results need to be obtained for a large number of positions, which would be a huge work. On the other hand, it is also possible to employ a focus adjustment mechanism (AF mechanism) in the optical system of the reader 3. The AF mechanism is a mechanism for driving the optical system so as to focus on the subject. Therefore, in the present embodiment, the AF mechanism is driven to adjust the in-focus position, the adjustment amount is converted into the distance between the reader 3 and the work 2, and the correspondence between the converted distance and the decoding result is obtained. An optical information reader that calculates the allowable depth based on the above is provided. As a result, the user can grasp the allowable depth without moving the reader 3 or the work 2.

<AF調整量を読み取り距離に換算する方法>
AF機構は、一般に、光学系の一部または全部のレンズを繰り出したり、液体レンズの屈折率を変化させたりして、ピント合わせ(合焦)を実行する。ここでは説明の便宜上、レンズを繰り出すものとして説明する。そこで、予めレンズの繰り出し量(AF調整量)と読み取り距離との関係を示すデータを作成しておけば、このデータに基づいて繰り出し量を読み取り距離に換算することが可能となる。なお、読み取り距離はリーダ3の先端位置P0からワーク2の2次元コード6までの距離である。
<Method of converting AF adjustment amount into reading distance>
The AF mechanism generally performs focusing (focusing) by extending a part or all of the lenses of the optical system or changing the refractive index of the liquid lens. Here, for convenience of explanation, it is assumed that the lens is extended. Therefore, if data indicating the relationship between the lens feed amount (AF adjustment amount) and the read distance is created in advance, the feed amount can be converted into the read distance based on this data. The reading distance is the distance from the tip position P0 of the reader 3 to the two-dimensional code 6 of the workpiece 2.

図4はレンズ繰り出し量と読み取り距離との対応関係の一例を示す図である。このような関係はリーダ3について実験を行ったり、シミューレションを実行したりすることで得られる。これをテーブルや関数として記憶装置に記憶しておくことで、レンズ繰り出し量を読み取り距離に換算することができる。たとえば、12個のレンズ繰り出し量のそれぞれについて読み取り距離を測定することで、テーブルや関数が作成される。最小二乗法などの数学的な近似手法によって近似関数が生成されてもよい。また、測定値に対して補間処理を行うことで2つの測定値の間にある値を求めてもよい。なお、レンズ繰り出し量としては、たとえば、レンズの位置を調整するモータの回転数(回転量)を採用できる。液体式レンズであれば、これに代えて印加電圧(AF調整量)と読み取り距離との関係(テーブルや関数など)を予め求めて記憶部に記憶し、この関係を参照することで印加電圧を読み取り距離に換算できる。このようにAF調整量を読み取り距離に換算するためのデータ等はリーダ3の工場出荷時に生成されるため、ユーザがこれを用意する手間を省ける。   FIG. 4 is a diagram illustrating an example of a correspondence relationship between the lens extension amount and the reading distance. Such a relationship can be obtained by conducting an experiment on the reader 3 or executing a simulation. By storing this in a storage device as a table or function, the lens extension amount can be converted into a reading distance. For example, a table or a function is created by measuring the reading distance for each of the 12 lens feed amounts. The approximation function may be generated by a mathematical approximation method such as a least square method. Moreover, you may obtain | require the value which exists between two measured values by performing an interpolation process with respect to a measured value. As the lens extension amount, for example, the rotation speed (rotation amount) of a motor that adjusts the position of the lens can be adopted. In the case of a liquid type lens, instead of this, the relationship (table, function, etc.) between the applied voltage (AF adjustment amount) and the reading distance is obtained in advance and stored in the storage unit, and the applied voltage is determined by referring to this relationship. Can be converted into reading distance. As described above, the data for converting the AF adjustment amount into the reading distance is generated when the reader 3 is shipped from the factory, so that the user can save time and effort.

<制御ユニット>
図5はリーダ3の電子的な構成を示すブロック図である。リーダ3のカメラ部(撮像手段)は、撮像素子10、光学系9、AF機構11、照明部12などを有している。撮像素子10は光学系9を通して結像した2次元コードの画像を電気的な信号に変換するCCDやCMOS等のイメージセンサである。AF機構11は光学系9のうち合焦用のレンズの位置や屈折率を調整する機構である。照明部12は1つ以上の発光素子を有し、2次元コードを照明するユニットである。デコード部13は撮像素子10によって取得された2次元コードの画像データ32をデコードしてデコード結果31を記憶部30に書き込むユニットである。通信部14はPLC5やコンピュータ4と通信するユニットである。表示部15は液晶表示装置や発光ダイオードなどであり、情報を視覚的に出力するユニットである。表示部15は、たとえば、2次元コードのデコード結果31である文字情報、読み取り成功率(複数回読み取り処理を実行したときに成功の割合)、マッチングレベル(読み取りのしやすさを示す読取余裕度)、PPC(2次元コードを構成する1つのセルが画像データにおいていくつの画素に相当するかを示す値)、許容深度、近方余裕度、遠方余裕度などを表示してもよい。入力部16はスイッチなどの入力操作を受け付けるユニットである。制御ユニット20はリーダ3の各部を統括的に制御するユニットである。制御ユニット20は様々な機能を搭載しているが、これらは論理回路により実現されてもよいし、ソフトウエアを実行することによって実現されてもよい。オートフォーカス制御部(AF制御部)21はAF機構11を制御するユニットである。撮像制御部22は照明部12の照明光の光量を制御したり、撮像素子10の露光時間(シャッタースピード)を制御したりするユニットである。
<Control unit>
FIG. 5 is a block diagram showing an electronic configuration of the reader 3. The camera unit (imaging means) of the reader 3 includes an image sensor 10, an optical system 9, an AF mechanism 11, an illumination unit 12, and the like. The image sensor 10 is an image sensor such as a CCD or CMOS that converts an image of a two-dimensional code formed through the optical system 9 into an electrical signal. The AF mechanism 11 is a mechanism for adjusting the position and refractive index of the focusing lens in the optical system 9. The illumination unit 12 has one or more light emitting elements and is a unit that illuminates a two-dimensional code. The decoding unit 13 is a unit that decodes the image data 32 of the two-dimensional code acquired by the image sensor 10 and writes the decoding result 31 in the storage unit 30. The communication unit 14 is a unit that communicates with the PLC 5 and the computer 4. The display unit 15 is a liquid crystal display device, a light emitting diode, or the like, and is a unit that visually outputs information. The display unit 15 includes, for example, character information that is the decoding result 31 of the two-dimensional code, a reading success rate (success rate when a plurality of reading processes are executed), and a matching level (read margin indicating ease of reading). ), PPC (a value indicating how many pixels a single cell constituting the two-dimensional code corresponds to), allowable depth, near margin, far margin, and the like may be displayed. The input unit 16 is a unit that receives an input operation such as a switch. The control unit 20 is a unit that comprehensively controls each unit of the reader 3. The control unit 20 has various functions, but these may be realized by a logic circuit or may be realized by executing software. The autofocus control unit (AF control unit) 21 is a unit that controls the AF mechanism 11. The imaging control unit 22 is a unit that controls the amount of illumination light of the illumination unit 12 and controls the exposure time (shutter speed) of the imaging device 10.

演算部23は様々な演算処理を実行する。たとえば、演算部23はAF制御部21を通じて、AF機構11における調整量を複数通りに変化させる。たとえば、演算部23は許容深度の取得処理を開始すると、AF制御部21を通じて、ワーク2に対して近方側に光学系の焦点が変更されるようAF機構11の調整量を変化させてデコード部13に近方側についてのデコード結果を取得させる。たとえば、AF機構11は最も近方側の位置までレンズを移動させた後、そこから基準位置にかけて一定のステップでレンズの繰り出し量を変化させる。撮像素子10は各ステップごとに画像データを取得してデコード部13に供給する。これが完了すると、AF制御部21は、ワーク2に対して遠方側に光学系の焦点が変更されるようAF機構11のレンズ繰り出し量を変化させる。撮像素子10は各ステップごとに画像データを取得してデコード部13に供給する。なお、AF機構11は、最も近方側のレンズ繰り出し量から遠方側のレンズ繰り出し量まで連続的に変化させてもよい。その一方で、演算部23は、各調整量ごとに撮像素子10により取得された各画像データ32をデコード部13にデコードさせ、デコード結果31を取得する。さらに、演算部23は撮像素子10からワーク2までの読み取り距離とデコード結果31との対応関係を求める。撮像素子10からワーク2までの読み取り距離は、AF機構11の調整量を換算して得られる。演算部23はこの対応関係に基づきコードをデコードする上で許容される撮像素子10からワーク2までの読み取り距離である許容深度を演算する。また、演算部23は上述した近方余裕度や遠方余裕度を算出し、表示部15に表示させてもよい。予め設定部24はデコード結果31に対する閾値条件を設定する。閾値条件は許容深度の基準となる。この閾値条件は図3で説明したUMLである。たとえば、演算部23は、AF制御部21に最も近方側のレンズ繰り出し量から遠方側のレンズ繰り出し量まで連続的にレンズ繰り出し量を変化させ、そのうちマッチングレベルがUML以上となるレンズ繰り出し量を読み取り距離に換算し、読み取り距離とマッチングレベルとを対応付けて記録してもよい。つまり、最も近方側のレンズ繰り出し量からあるレンズ繰り出し量まではそのマッチングレベルがUML未満となるため、記録が省略される。また、読み取り距離が基準距離を超えてさらに遠方側の読み取り距離に変更されると、マッチングレベルがUML未満となったときに、レンズ繰り出し量の調整は停止され、許容深度の取得処理も停止されてもよい。   The calculation unit 23 executes various calculation processes. For example, the calculation unit 23 changes the adjustment amount in the AF mechanism 11 through the AF control unit 21 in a plurality of ways. For example, when the calculation unit 23 starts the permissible depth acquisition process, the AF control unit 21 changes the adjustment amount of the AF mechanism 11 so that the focal point of the optical system is changed to the near side with respect to the workpiece 2 and decodes. The unit 13 is caused to acquire the decoding result for the near side. For example, the AF mechanism 11 moves the lens to the closest position, and then changes the lens feed amount from the reference position to the reference position. The image sensor 10 acquires image data at each step and supplies the image data to the decoding unit 13. When this is completed, the AF control unit 21 changes the lens extension amount of the AF mechanism 11 so that the focal point of the optical system is changed to the far side with respect to the workpiece 2. The image sensor 10 acquires image data at each step and supplies the image data to the decoding unit 13. Note that the AF mechanism 11 may continuously change from the closest lens extension amount to the far side lens extension amount. On the other hand, the calculation unit 23 causes the decoding unit 13 to decode each image data 32 acquired by the imaging device 10 for each adjustment amount, and acquires a decoding result 31. Further, the calculation unit 23 obtains a correspondence relationship between the reading distance from the image sensor 10 to the work 2 and the decoding result 31. The reading distance from the image sensor 10 to the workpiece 2 is obtained by converting the adjustment amount of the AF mechanism 11. The computing unit 23 computes an allowable depth that is a reading distance from the image sensor 10 to the work 2 that is allowed for decoding the code based on this correspondence. Further, the calculation unit 23 may calculate the above-described near margin or far margin and display the calculated margin on the display unit 15. The setting unit 24 sets a threshold condition for the decoding result 31 in advance. The threshold condition is a criterion for the allowable depth. This threshold condition is the UML described with reference to FIG. For example, the calculation unit 23 causes the AF control unit 21 to continuously change the lens extension amount from the closest lens extension amount to the far side lens extension amount, of which the lens extension amount at which the matching level is greater than or equal to UML. It may be converted into a reading distance, and the reading distance and the matching level may be recorded in association with each other. That is, since the matching level is less than UML from the closest lens extension amount to a certain lens extension amount, recording is omitted. In addition, when the reading distance exceeds the reference distance and is changed to a reading distance on the far side, when the matching level becomes less than UML, the adjustment of the lens extension amount is stopped and the acquisition process of the allowable depth is also stopped. May be.

読取条件制御部25は、露光時間や照明光量などの撮像条件やデコード部13における画像処理条件(フィルタの係数など)を制御するユニットである。ライン1を搬送されるワーク2に対する外光の影響などで適切な撮像条件や画像処理条件は変化する。よって、読取条件制御部25は、より適切な読取条件を探索して、AF制御部21や撮像制御部22、デコード部13に設定する。なお、読取条件制御部25は演算部23が許容深度の取得処理を実行している間は読取条件を変更せずに固定する。読取条件はマッチングレベルに影響を及ぼすため、読取条件が変動してしまうと正確な許容深度が得られなくなってしまうからである。そのため、演算部23は、読取条件制御部25で読取条件が確定した後で許容深度の取得処理を開始する。記憶部30は、メモリなどの記憶装置であり、デコード部13によって取得されたデコード結果31、撮像素子10によって取得された画像データ32、コンピュータ4などの設定装置によってリーダ3に設定されたデータや入力部16を通じて設定されたデータである設定データ33などを記憶する。   The reading condition control unit 25 is a unit that controls imaging conditions such as exposure time and illumination light amount, and image processing conditions (such as filter coefficients) in the decoding unit 13. Appropriate imaging conditions and image processing conditions change due to the influence of external light on the workpiece 2 conveyed on the line 1. Therefore, the reading condition control unit 25 searches for a more appropriate reading condition and sets it in the AF control unit 21, the imaging control unit 22, and the decoding unit 13. The reading condition control unit 25 fixes the reading condition without changing it while the calculation unit 23 is executing the processing for obtaining the allowable depth. This is because the reading condition affects the matching level, and if the reading condition fluctuates, an accurate allowable depth cannot be obtained. Therefore, the calculation unit 23 starts an allowable depth acquisition process after the reading condition is determined by the reading condition control unit 25. The storage unit 30 is a storage device such as a memory. The decoding result 31 acquired by the decoding unit 13, the image data 32 acquired by the image sensor 10, the data set in the reader 3 by the setting device such as the computer 4, The setting data 33, which is data set through the input unit 16, is stored.

図6はコンピュータ4の機能を示すブロック図である。リーダ3を小型化すると、リーダ3の表示部15や入力部16だけではリーダ3のすべての機能を設定することが難しくなる。そこで、一部またはすべての設定データ33についてはコンピュータ4で作成してリーダ3に転送してもよい。CPU40は記憶部50に記憶されているプログラムに基づきコンピュータ4が備えている各部を制御するユニットである。演算部41の一機能であるUI制御部43はリーダ3の撮像条件などを設定するためのユーザインタフェースやリーダ3が出力するデコード結果31、画像データ32などを表示するためのユーザインタフェースを生成し、表示部61に表示させる。UI制御部43は許容深度や近方余裕度、遠方余裕度、リーダ3からワーク2までの距離(読み取り距離)、読み取り距離とデコード結果との対応関係を示すグラフ(図3など)などを表示部61に表示してもよい。なお、入力部62によってグラフの一部が指定されると、UI制御部43は指定された部分に対応した読み取り距離を表示部61に表示させてもよい。たとえば、ユーザは、入力部62の一部であるポインティングデバイスによってポインタを移動させ、グラフ上の所望の位置にポインタを重ね合わせてもよい。UI制御部43や演算部41はポインタの座標を取得し、その座標からグラフ上での対応する読み取り距離を算出してもよい。演算部41はリーダ3の演算部23の代わりに上述した各種の演算処理を実行するユニットである。リーダ3の演算部23の演算性能が低く、コンピュータ4の演算部41の演算性能が高い場合には、コンピュータ4の演算部41がほとんどの演算処理を実行してもよい。設定部42は撮像条件やUMLなどの制御パラメータをリーダ3に設定するユニットである。通信部63はリーダ3の通信部14と有線または無線で接続し、デコード結果31や画像データ32を受信したり、設定部42で生成された設定データ33を送信したりする。記憶部50は、メモリやハードディスクドライブ(HDD)、ソリッドステートドライブ(SSD)などである。   FIG. 6 is a block diagram showing functions of the computer 4. If the size of the reader 3 is reduced, it becomes difficult to set all the functions of the reader 3 with only the display unit 15 and the input unit 16 of the reader 3. Therefore, some or all of the setting data 33 may be created by the computer 4 and transferred to the reader 3. The CPU 40 is a unit that controls each unit included in the computer 4 based on a program stored in the storage unit 50. The UI control unit 43, which is a function of the calculation unit 41, generates a user interface for setting the imaging conditions of the reader 3 and the user interface for displaying the decoding result 31, the image data 32, and the like output from the reader 3. To be displayed on the display unit 61. The UI control unit 43 displays an allowable depth, a near margin, a far margin, a distance from the reader 3 to the workpiece 2 (reading distance), a graph (such as FIG. 3) showing a correspondence relationship between the reading distance and the decoding result. You may display on the part 61. FIG. When a part of the graph is designated by the input unit 62, the UI control unit 43 may display the reading distance corresponding to the designated part on the display unit 61. For example, the user may move the pointer with a pointing device that is a part of the input unit 62 and superimpose the pointer on a desired position on the graph. The UI control unit 43 and the calculation unit 41 may acquire the coordinates of the pointer and calculate the corresponding reading distance on the graph from the coordinates. The calculation unit 41 is a unit that executes the various calculation processes described above instead of the calculation unit 23 of the reader 3. When the calculation performance of the calculation unit 23 of the reader 3 is low and the calculation performance of the calculation unit 41 of the computer 4 is high, the calculation unit 41 of the computer 4 may execute most calculation processes. The setting unit 42 is a unit that sets control parameters such as imaging conditions and UML in the reader 3. The communication unit 63 is connected to the communication unit 14 of the reader 3 by wire or wireless, and receives the decoding result 31 and the image data 32 and transmits the setting data 33 generated by the setting unit 42. The storage unit 50 is a memory, a hard disk drive (HDD), a solid state drive (SSD), or the like.

<ユーザインタフェースの一例>
図7はデコード結果と読み取り距離との対応関係であるグラフを表示するユーザインタフェース70a、70bの一例を示す図である。ユーザインタフェース70aでは、ポインタ71はまだグラフの一部を指定してはいない。UI制御部43は入力部62のポインティングデバイスの操作に連動してポインタ71の表示位置を更新する。UI制御部43はポインタ71の座標がグラフの座標と一致すると、その座標に対応した読み取り距離を求め、読み取り距離をポップアップ表示する。図7ではポップアップ部72に読み取り距離とその読み取り距離で取得された画像データとが含まれているが、少なくとも読み取り距離が含まれていればよい。また画像データを表示することでユーザは2次元コードの画像を視覚的に把握可能となり、マッチングレベルと画像との関係も理解できるようになろう。2次元コードの画像を確認することはユーザにとってUMLを変更するのに役立つであろう。
<Example of user interface>
FIG. 7 is a diagram illustrating an example of user interfaces 70a and 70b for displaying a graph indicating a correspondence relationship between a decoding result and a reading distance. In the user interface 70a, the pointer 71 has not yet designated a part of the graph. The UI control unit 43 updates the display position of the pointer 71 in conjunction with the operation of the pointing device of the input unit 62. When the coordinates of the pointer 71 coincide with the coordinates of the graph, the UI control unit 43 obtains a reading distance corresponding to the coordinates, and pops up the reading distance. In FIG. 7, the pop-up unit 72 includes the reading distance and image data acquired at the reading distance, but it is sufficient that at least the reading distance is included. Also, by displaying the image data, the user can visually grasp the image of the two-dimensional code and understand the relationship between the matching level and the image. Confirming the image of the two-dimensional code will help the user to change the UML.

<フローチャート>
リーダ3には運転モードと設定モードとが存在する。運転モードは、実際にライン1を搬送される複数のワーク2について2次元コードの読み取りを実行するモードである。設定モードは、リーダ3の読取条件を設定し、許容深度などをユーザに提示するモードである。
<Flowchart>
The reader 3 has an operation mode and a setting mode. The operation mode is a mode in which reading of a two-dimensional code is performed on a plurality of workpieces 2 that are actually conveyed on the line 1. The setting mode is a mode in which the reading conditions of the reader 3 are set and the allowable depth and the like are presented to the user.

図8は許容深度の取得処理を示すフローチャートである。図8を用いて取得処理の各ステップについて説明する。ユーザはリーダ3がワーク2に設けられた2次元コードを読み取れるように、リーダ3とワーク2の距離(読み取り距離)を調整する。通常、リーダ3は支持部材に固定されており、ワーク2からの距離を調整可能となっている。ユーザは表示部15に表示されるマッチングレベルを確認し、マッチングレベルが最大となるようにリーダ3とワーク2の距離を調整する。この状態での読み取り距離が基準距離となる。基準距離が確定すると、ユーザは入力部16を操作して、制御ユニット20に許容深度の取得処理を開始させる。   FIG. 8 is a flowchart showing an allowable depth acquisition process. Each step of the acquisition process will be described with reference to FIG. The user adjusts the distance (reading distance) between the reader 3 and the work 2 so that the reader 3 can read the two-dimensional code provided on the work 2. Usually, the leader 3 is fixed to a support member, and the distance from the workpiece 2 can be adjusted. The user confirms the matching level displayed on the display unit 15 and adjusts the distance between the reader 3 and the work 2 so that the matching level is maximized. The reading distance in this state becomes the reference distance. When the reference distance is determined, the user operates the input unit 16 to cause the control unit 20 to start an allowable depth acquisition process.

S800で設定部24は入力部16またはコンピュータ4を通じて入力された値に基づき閾値UMLを設定する。設定部24は表示部15にUMLの設定を促すメッセージ等を表示してもよい。   In S800, the setting unit 24 sets the threshold value UML based on the value input through the input unit 16 or the computer 4. The setting unit 24 may display a message or the like for prompting the setting of the UML on the display unit 15.

S801で読取条件制御部25は撮像素子10により取得された画像データ等に基づき読取条件を確定させ、撮像条件を撮像制御部22に設定し、画像処理条件をデコード部13に設定する。読取条件制御部25はデコード結果が最良となるように、AF調整量、照明光量、露光時間、画像処理条件などを探索して設定する。   In step S <b> 801, the reading condition control unit 25 determines the reading condition based on the image data acquired by the image sensor 10, sets the imaging condition in the imaging control unit 22, and sets the image processing condition in the decoding unit 13. The reading condition control unit 25 searches and sets the AF adjustment amount, illumination light quantity, exposure time, image processing conditions, etc. so that the decoding result is the best.

S802で演算部23はAF制御部21を通じて取得したAF機構11のレンズ繰り出し量を読み取り距離に変換することで基準距離を求める。   In S <b> 802, the calculation unit 23 obtains a reference distance by converting the lens extension amount of the AF mechanism 11 acquired through the AF control unit 21 into a reading distance.

S803でAF制御部21はAF機構11を制御し、光学系の焦点位置が近方側に移動するようレンズの繰り出し量を1段階だけ調整する。ここでは基準距離から徐々に読み取り距離を削減して行くものとする。S804で撮像制御部22は撮像素子10に撮像を実行させて画像データを取得し、デコード部13に画像データについてデコード処理を実行させる。デコード部13は画像データについてデコード処理を実行してデコード結果を取得する。S805で演算部23はデコード部13が出力するデコード結果に基づき2次元コードのデコードに成功したかどうかを判定する。2次元コードでは1回あたりの読み取り結果は成功か失敗の2つの結果しかない。そこで、たとえば、演算部23は、ひとつの位置(読み取り距離)についてN回の読み取りを実行し、成功回数をカウントし、その平均成功回数(読み取り成功率)を求め、読み取り成功率が0%を超えていれば読み取り成功と判定し、読み取り成功率が0%であれば読み取り失敗と判定してもよい。読み取り成功であれば、S807に進み、演算部23はデコード結果に基づきマッチングレベルを求めるとともに、レンズの繰り出し量から読み取り距離を求め、これらを記憶部30に記憶する。一方で、読み取り失敗であれば、S806に進み、演算部23はデコード結果に基づきマッチングレベルを求め、マッチングレベルが閾値以上であるかどうかを判定する。マッチングレベルが閾値以上であれば、読み取り距離はまだ近方側の限界距離には達していない。そこで、S803に戻り、レンズ繰り出し量を近方側に1段階調整する。その後、読み取り距離が近方側の限界距離に達するまで、S803ないしS807の処理を繰り返し実行する。一方で、マッチングレベルが閾値未満になると、近方側の限界距離が確定し、つまり近方余裕度(基準距離と近方側の限界距離との差分)も確定する。そのため、S808に進む。   In step S <b> 803, the AF control unit 21 controls the AF mechanism 11 to adjust the lens extension amount by one step so that the focal position of the optical system moves to the near side. Here, the reading distance is gradually reduced from the reference distance. In step S804, the imaging control unit 22 causes the imaging device 10 to perform imaging to acquire image data, and causes the decoding unit 13 to perform decoding processing on the image data. The decoding unit 13 performs a decoding process on the image data and acquires a decoding result. In step S <b> 805, the calculation unit 23 determines whether the two-dimensional code has been successfully decoded based on the decoding result output from the decoding unit 13. In a two-dimensional code, there are only two results of success or failure as a result of reading each time. Therefore, for example, the calculation unit 23 performs N readings for one position (reading distance), counts the number of successes, obtains the average number of successes (reading success rate), and the reading success rate is 0%. If it exceeds, it may be determined that the reading has succeeded, and if the reading success rate is 0%, it may be determined that the reading has failed. If the reading is successful, the process advances to step S807, and the calculation unit 23 obtains a matching level based on the decoding result, obtains a reading distance from the lens feed amount, and stores them in the storage unit 30. On the other hand, if the reading is unsuccessful, the process proceeds to S806, where the calculation unit 23 obtains a matching level based on the decoding result, and determines whether the matching level is equal to or higher than a threshold value. If the matching level is equal to or greater than the threshold, the reading distance has not yet reached the near limit distance. Therefore, the process returns to S803, and the lens feed amount is adjusted by one step to the near side. Thereafter, the processing of S803 to S807 is repeatedly executed until the reading distance reaches the near limit distance. On the other hand, when the matching level is less than the threshold value, the near limit distance is determined, that is, the near margin (difference between the reference distance and the near limit distance) is also determined. Therefore, it progresses to S808.

S808でAF制御部21は読み取り距離が基準距離に復帰するようAF機構11を制御し、AF機構11のレンズ繰り出し量を調整する。   In step S808, the AF control unit 21 controls the AF mechanism 11 so that the reading distance returns to the reference distance, and adjusts the lens extension amount of the AF mechanism 11.

S809でAF制御部21はAF機構11を制御し、光学系の焦点位置が遠方側に移動するようレンズの繰り出し量を1段階だけ調整する。ここでは基準距離から徐々に読み取り距離を増加して行くものとする。S810で撮像制御部22は撮像素子10に撮像を実行させて画像データを取得し、デコード部13に画像データについてデコード処理を実行させる。デコード部13は画像データについてデコード処理を実行してデコード結果を取得する。S811で演算部23はデコード部13が出力するデコード結果に基づき2次元コードのデコードに成功したかどうかを判定する。読み取り成功であれば、S813に進み、演算部23はデコード結果に基づきマッチングレベルを求めるとともに、レンズの繰り出し量から読み取り距離を求め、これらを記憶部30に記憶する。一方で、読み取り失敗であれば、S812に進み、演算部23はデコード結果に基づきマッチングレベルを求め、マッチングレベルが閾値以上であるかどうかを判定する。マッチングレベルが閾値以上であれば、読み取り距離はまだ遠方側の限界距離には達していない。そこで、S809に戻り、レンズ繰り出し量を遠方側に1段階調整する。その後、読み取り距離が遠方側の限界距離に達するまで、S809ないしS813の処理を繰り返し実行する。一方で、マッチングレベルが閾値未満になると、遠方側の限界距離が確定し、つまり遠方余裕度(基準距離と遠方側の限界距離との差分)も確定する。そのため、S814に進む。   In step S809, the AF control unit 21 controls the AF mechanism 11, and adjusts the lens feed amount by one step so that the focal position of the optical system moves to the far side. Here, the reading distance is gradually increased from the reference distance. In step S810, the imaging control unit 22 causes the imaging element 10 to perform imaging to acquire image data, and causes the decoding unit 13 to execute decoding processing on the image data. The decoding unit 13 performs a decoding process on the image data and acquires a decoding result. In S811, the calculation unit 23 determines whether the two-dimensional code has been successfully decoded based on the decoding result output from the decoding unit 13. If the reading is successful, the process proceeds to S813, where the calculation unit 23 obtains a matching level based on the decoding result, obtains a reading distance from the lens feed amount, and stores them in the storage unit 30. On the other hand, if the reading is unsuccessful, the process proceeds to S812, where the calculation unit 23 obtains a matching level based on the decoding result, and determines whether the matching level is equal to or higher than a threshold value. If the matching level is greater than or equal to the threshold value, the reading distance has not yet reached the far limit distance. Therefore, the process returns to S809, and the lens feed amount is adjusted one step to the far side. Thereafter, the processes of S809 to S813 are repeatedly executed until the reading distance reaches the far limit distance. On the other hand, when the matching level becomes less than the threshold value, the far side limit distance is determined, that is, the far margin (the difference between the reference distance and the far side limit distance) is also determined. Therefore, it progresses to S814.

S814で演算部23は近方側の限界距離と遠方側の限界距離とから許容深度を決定し、表示部15に表示する。これによりユーザは許容深度を把握できるようになる。なお、演算部23は許容深度とともに、または、許容深度に代えて、近方余裕度と遠方余裕度とのうち両方または一方を表示部15に表示させてもよい。また、演算部23は記憶部30に記憶したマッチングレベルと読み取り距離との対応関係を示すグラフを作成し、表示部15に表示してもよい。なお、これらの表示処理は上述したようにコンピュータ4で実行されてもよい。   In S <b> 814, the calculation unit 23 determines an allowable depth from the near limit distance and the far limit distance, and displays the allowable depth on the display unit 15. As a result, the user can grasp the allowable depth. The calculation unit 23 may cause the display unit 15 to display both or one of the near margin and the far margin together with the allowable depth or instead of the allowable depth. In addition, the calculation unit 23 may create a graph indicating the correspondence between the matching level stored in the storage unit 30 and the reading distance and display the graph on the display unit 15. Note that these display processes may be executed by the computer 4 as described above.

<まとめ>
リーダ3は、光学系の合焦位置を調整するAF機構11と、ワーク2に設けられた2次元コード6を撮像する撮像素子10と、撮像素子10により取得された画像データをデコードするデコード部13とを有している。演算部23は、AF機構11における調整量を複数通りに変化させたときに、各調整量ごとに撮像素子10により取得された各画像データについてデコード部13によるデコード結果を取得し、調整量を換算して得られる読み取り距離とデコード結果との対応関係を求め、当該対応関係に基づき許容深度を演算する。これにより許容深度を求めることが可能な光学的情報読取装置が提供される。なお、コンピュータ4の演算部41が演算部23の演算処理の一部またはすべてを実行してもよい。
<Summary>
The reader 3 includes an AF mechanism 11 that adjusts the in-focus position of the optical system, an image sensor 10 that images the two-dimensional code 6 provided on the work 2, and a decoding unit that decodes image data acquired by the image sensor 10. 13. When the adjustment amount in the AF mechanism 11 is changed in a plurality of ways, the calculation unit 23 acquires the decoding result by the decoding unit 13 for each image data acquired by the imaging device 10 for each adjustment amount, and calculates the adjustment amount. A correspondence relationship between the read distance obtained by conversion and the decoding result is obtained, and an allowable depth is calculated based on the correspondence relationship. Thus, an optical information reading apparatus capable of obtaining the allowable depth is provided. Note that the calculation unit 41 of the computer 4 may execute part or all of the calculation processing of the calculation unit 23.

表示部15、61は演算部23、41により演算された許容深度を表示する許容深度表示手段として機能してもよい。これによりユーザは許容深度を視覚的に把握できるようになる。   The display units 15 and 61 may function as an allowable depth display unit that displays the allowable depth calculated by the calculation units 23 and 41. As a result, the user can visually grasp the allowable depth.

図3や図8を用いて説明したように、演算部23は、撮像素子10からワークまでの距離とデコード結果との対応関係に基づき、マッチングレベルが閾値条件(例:UML)を満たしている読み取り距離のうち、ワーク2に対して最も近い距離(近方限界距離)と、ワーク2に対して最も遠い距離(遠方限界距離)とを演算し、ワーク2に対して最も近い距離からワークに対して最も遠い距離までを許容深度として出力してもよい。これにより、閾値条件を満たすことが可能な近方側の読み取り距離と、遠方側の読み取り距離を明確に把握できるようになる。つまり、ユーザは許容深度を把握できるため、ワーク2の高低のバラツキなどを考慮し、読み取り距離を効率よく再調整することが可能となろう。つまり、ワーク2の高低のバラツキが最大となったとしても2次元コードの読み取りに成功するように、リーダ3の読み取り距離を調整できるようになる。これにより、2次元コードが読み取れないことによるワーク2の廃棄率を低下させることが可能となる。ワーク2が製品として合格レベルにあっても2次元コードが正しく印刷、貼付または刻印されていなければ、製品管理ができないためそのワーク2は廃棄される。これは、ワーク2の読み取り距離の設定が不十分であることが原因で読み取りの失敗が発生しても、そのワーク2は廃棄されてしまうことを意味する。ワーク2の不要な廃棄はワーク2の製造コストの上昇を招くため、このような読み取り失敗は削減されなければならない。とくにワーク2がエンジンブロックなどの高価な部品であればなおさらである。本実施形態では、リーダ3の許容深度をユーザに提示できるだけ、ユーザは読み取り距離を正しく設定しやすくなり、ワーク2の不要な廃棄を削減できるようになろう。   As described with reference to FIGS. 3 and 8, the calculation unit 23 satisfies the threshold level condition (eg, UML) based on the correspondence between the distance from the image sensor 10 to the work and the decoding result. Of the reading distances, the distance closest to the work 2 (near limit distance) and the distance farthest from the work 2 (far limit distance) are calculated, and the work is measured from the distance closest to the work 2 to the work. On the other hand, the farthest distance may be output as the allowable depth. This makes it possible to clearly grasp the reading distance on the near side that can satisfy the threshold condition and the reading distance on the far side. That is, since the user can grasp the allowable depth, it will be possible to efficiently readjust the reading distance in consideration of variations in the workpiece 2. That is, the reading distance of the reader 3 can be adjusted so that the reading of the two-dimensional code is successful even if the variation in height of the workpiece 2 becomes maximum. Thereby, it becomes possible to reduce the discard rate of the workpiece | work 2 by not being able to read a two-dimensional code. Even if the workpiece 2 is at an acceptable level as a product, if the two-dimensional code is not correctly printed, affixed or stamped, the product management cannot be performed and the workpiece 2 is discarded. This means that even if a reading failure occurs due to insufficient setting of the reading distance of the work 2, the work 2 is discarded. Since unnecessary disposal of the work 2 leads to an increase in manufacturing cost of the work 2, such reading failure must be reduced. This is especially true if the workpiece 2 is an expensive part such as an engine block. In the present embodiment, as long as the permissible depth of the reader 3 can be presented to the user, the user can easily set the reading distance correctly, and unnecessary disposal of the workpiece 2 can be reduced.

ユーザは設定部24、42を通じて閾値条件であるUMLを設定してもよい。ワーク2やライン1の設置環境に応じて適切なUMLが異なることが予想される。そこで、ユーザは自己の経験に基づいて適切なUMLを設定してもよい。   The user may set UML that is a threshold condition through the setting units 24 and 42. It is expected that the appropriate UML varies depending on the installation environment of the workpiece 2 and the line 1. Therefore, the user may set an appropriate UML based on his / her own experience.

図2を用いて説明したように、演算部23、41は、ワーク2から撮像素子10までの実際の読み取り距離である基準距離RDとワーク2に対して最も近い読み取り距離との差分である近方余裕度Mnを演算してもよい。さらに、演算部23、41および表示部15、61は近方余裕度を表示する近方余裕度表示手段として機能してもよい。これによりユーザは近方余裕度Mnを明確に把握できるようになろう。   As described with reference to FIG. 2, the calculation units 23 and 41 are close to each other, which is the difference between the reference distance RD that is the actual reading distance from the work 2 to the image sensor 10 and the reading distance closest to the work 2. The direction margin Mn may be calculated. Further, the calculation units 23 and 41 and the display units 15 and 61 may function as a near margin display means for displaying the near margin. As a result, the user will be able to clearly grasp the proximity margin Mn.

図2を用いて説明したように、演算部23、41は、ワーク2から撮像素子10までの実際の読み取り距離である基準距離RDとワーク2に対して最も遠い読み取り距離との差分である遠方余裕度Mfを演算してもよい。また、演算部23、41および表示部15、61は遠方余裕度を表示する遠方余裕度表示手段として機能してもよい。これによりユーザは遠方余裕度Mfを明確に把握できるようになろう。   As described with reference to FIG. 2, the calculation units 23 and 41 are far distances that are differences between the reference distance RD that is the actual reading distance from the workpiece 2 to the image sensor 10 and the reading distance that is farthest from the workpiece 2. The margin Mf may be calculated. The calculation units 23 and 41 and the display units 15 and 61 may function as a far margin display unit that displays a far margin. Accordingly, the user can clearly grasp the far margin Mf.

AF制御部21がAF機構11のフォーカスの調整量を段階的に変化させ、撮像素子10は各フォーカスの調整量に対してそれぞれワーク2に設けられた2次元コードを撮像して画像データを出力してもよい。これにより、ユーザは手動で読み取り距離を多数回にわたって調整し、そのたびに撮像を実行する煩わしさから解放されよう。   The AF control unit 21 changes the focus adjustment amount of the AF mechanism 11 stepwise, and the image sensor 10 captures a two-dimensional code provided on the work 2 for each focus adjustment amount and outputs image data. May be. As a result, the user manually adjusts the reading distance many times and is relieved from the trouble of performing imaging every time.

読取条件制御部25は撮像素子10の撮像条件とデコード部13における画像処理条件とを含む読取条件を制御してもよい。演算部23は、読取条件が確定した後で許容深度の取得処理を開始する。このように読取条件が適切に調整された上で許容深度の取得処理を実行することで、より正確な許容深度が求められるようになろう。同様に、演算部23が許容深度の取得処理を実行している間は読取条件制御部25が読取条件を変更せずに固定してもよい。読取条件を一定とすることで、より正確な許容深度が求められるようになろう。   The reading condition control unit 25 may control reading conditions including the imaging conditions of the image sensor 10 and the image processing conditions in the decoding unit 13. The calculation unit 23 starts an allowable depth acquisition process after the reading condition is determined. As described above, by executing the process for obtaining the allowable depth after appropriately adjusting the reading conditions, a more accurate allowable depth will be obtained. Similarly, the reading condition control unit 25 may fix the reading condition without changing it while the calculation unit 23 executes the processing for obtaining the allowable depth. By making the reading conditions constant, a more accurate allowable depth will be required.

図8を用いて説明したように、許容深度の取得処理が開始されると、AF制御部21は、ワークに対して近方側に撮像素子10の光学系の焦点が変更されるようAF機構11の調整量を変化させてデコード部13に近方側についてデコード結果を取得させ、デコード部13が近方側についてのデコード結果の取得を完了すると、ワークに対して遠方側に撮像素子10の光学系の焦点が変更されるようAF機構11の調整量を変化させ、デコード部13に遠方側についてデコード結果を取得させてもよい。これにより、近方側から遠方側にかけて効率よくデコード結果を取得できるようになろう。   As described with reference to FIG. 8, when the allowable depth acquisition process is started, the AF control unit 21 changes the focus of the optical system of the image sensor 10 to the near side with respect to the workpiece. 11, the decoding unit 13 is caused to acquire the decoding result for the near side, and when the decoding unit 13 completes the acquisition of the decoding result for the near side, the image sensor 10 The adjustment amount of the AF mechanism 11 may be changed so that the focal point of the optical system is changed, and the decoding unit 13 may acquire the decoding result for the far side. As a result, decoding results can be obtained efficiently from the near side to the far side.

図3や図7を用いて説明したように、演算部23、41および表示部15、61は読み取り距離とデコード結果との対応関係を示すグラフを表示するグラフ表示手段として機能してもよい。これにより、読み取り距離とデコード結果との関係がどのような特性であるかをユーザが把握できるようになる。   As described with reference to FIGS. 3 and 7, the calculation units 23 and 41 and the display units 15 and 61 may function as a graph display unit that displays a graph indicating a correspondence relationship between the reading distance and the decoding result. As a result, the user can grasp the characteristics of the relationship between the reading distance and the decoding result.

図7を用いて説明したように、対応関係を示すグラフの一部を指定する指定手段として入力部62やポインタ71が機能してもよい。UI制御部43や表示部61は、ポインタ71により指定された部分に対応した撮像素子10からワークまでの距離を表示する距離表示手段として機能してもよい。これによりユーザはグラフにおいて所望のマッチングレベルに対応した読み取り距離を簡易な操作によって表示させることが可能となる。   As described with reference to FIG. 7, the input unit 62 and the pointer 71 may function as designation means for designating a part of the graph indicating the correspondence. The UI control unit 43 and the display unit 61 may function as a distance display unit that displays the distance from the image sensor 10 corresponding to the portion designated by the pointer 71 to the workpiece. Thereby, the user can display the reading distance corresponding to the desired matching level in the graph by a simple operation.

デコード結果は、たとえば、2次元コード6についての読取成功率、読み取りやすさの指標である読取余裕度、または、2次元コード6を構成する1つのセルが撮像素子10によって得られた画像データにおいていくつの画素に相当するかを示すPPCであってもよい。ユーザによって必要となるデコード結果の指標はさまざまである。よって、ユーザによって必要となるデコード結果の指標を求めて、表示してもよい。   The decoding result is, for example, the reading success rate for the two-dimensional code 6, the reading margin that is an index of readability, or the image data obtained by the image sensor 10 with one cell constituting the two-dimensional code 6. It may be a PPC indicating how many pixels it corresponds to. There are various indicators of decoding results required by the user. Therefore, an index of the decoding result required by the user may be obtained and displayed.

本実施例においては、撮像手段により取得された画像データの読取成功率から許容深度を計算しているのではない。画像データをデコードした結果であるデコード結果を基に、許容深度を求めている。図3に示した例では、取得した画像データ自体の輝度、コントラスト比などを縦軸にとっているのではなく、画像データをデコードしたマッチングレベルを縦軸にとっている。コードリーダでは、画像の鮮鋭さよりも画像をデコードした結果であるデコード結果がユーザにとって重要な指標である。そのため、デコード結果を基に読取距離と許容深度を算出している。仮に、画像データから読取距離や許容深度を算出すると、デコード結果が良くない距離であっても、許容深度内にあると演算される場合もある。画像データが鮮鋭な距離と、デコード結果が優れている距離とは、必ずしも一致しないためである。   In this embodiment, the allowable depth is not calculated from the reading success rate of the image data acquired by the imaging means. The permissible depth is obtained based on the decoding result that is the result of decoding the image data. In the example shown in FIG. 3, the vertical axis represents the matching level obtained by decoding the image data, rather than the luminance, contrast ratio, and the like of the acquired image data itself. In the code reader, the decoding result, which is the result of decoding the image, is more important for the user than the sharpness of the image. Therefore, the reading distance and the allowable depth are calculated based on the decoding result. If the reading distance and the allowable depth are calculated from the image data, even if the decoding result is not good, it may be calculated that it is within the allowable depth. This is because the distance at which the image data is sharp and the distance at which the decoding result is excellent do not always match.

1…ライン、2…ワーク、3…リーダ、4…コンピュータ、5…プログラマブルロジックコントローラ(PLC)   DESCRIPTION OF SYMBOLS 1 ... Line, 2 ... Work, 3 ... Reader, 4 ... Computer, 5 ... Programmable logic controller (PLC)

Claims (17)

フォーカス調整機構を備え、ワークに設けられたコードを撮像する撮像手段と、
前記撮像手段により取得された画像データをデコードするデコード手段と、
前記フォーカス調整機構における調整量を複数通りに変化させたときに、各調整量ごとに前記撮像手段により取得された各画像データについて前記デコード手段によるデコード結果を取得し、前記調整量を換算して得られる前記撮像手段から前記ワークまでの距離と当該デコード結果との対応関係を求め、当該対応関係に基づき前記コードをデコードする上で許容される前記撮像手段から前記ワークまでの距離である許容深度を演算する演算手段と、
を有することを特徴とする光学的情報読取装置。
An imaging unit that includes a focus adjustment mechanism and images a code provided on the workpiece;
Decoding means for decoding image data acquired by the imaging means;
When the adjustment amount in the focus adjustment mechanism is changed in a plurality of ways, the decoding result by the decoding unit is obtained for each image data acquired by the imaging unit for each adjustment amount, and the adjustment amount is converted. An allowable depth that is a distance from the imaging means to the work that is allowed in decoding the code based on the correspondence between the obtained distance from the imaging means to the work and the decoding result Computing means for computing
An optical information reading apparatus comprising:
前記演算手段により演算された許容深度を表示する許容深度表示手段をさらに有することを特徴する請求項1に記載の光学的情報読取装置。   The optical information reading apparatus according to claim 1, further comprising an allowable depth display unit that displays the allowable depth calculated by the calculation unit. 前記演算手段は、前記撮像手段から前記ワークまでの距離と前記デコード結果との対応関係に基づき、前記デコード結果が所定の閾値条件を満たしている距離であって前記ワークに対して最も近い距離と、前記ワークに対して最も遠い距離とを演算し、前記ワークに対して最も近い距離から前記ワークに対して最も遠い距離までを前記許容深度として出力することを特徴とする請求項1または2に記載の光学的情報読取装置。   The computing means is based on a correspondence relationship between a distance from the imaging means to the work and the decoding result, and is a distance that the decoding result satisfies a predetermined threshold condition and is the closest distance to the work. The distance farthest from the work is calculated, and the distance from the distance closest to the work to the distance farthest from the work is output as the allowable depth. The optical information reading device described. 前記閾値条件を設定する設定手段をさらに有することを特徴とする請求項3に記載の光学的情報読取装置。   The optical information reading apparatus according to claim 3, further comprising setting means for setting the threshold condition. 前記演算手段は、前記ワークから前記撮像手段までの実際の距離である基準距離と前記ワークに対して最も近い距離との差分である近方余裕度を演算することを特徴とする請求項3または4に記載の光学的情報読取装置。   The calculation means calculates a proximity margin that is a difference between a reference distance that is an actual distance from the work to the imaging means and a distance that is closest to the work. 5. The optical information reading device according to 4. 前記近方余裕度を表示する近方余裕度表示手段をさらに有することを特徴する請求項5に記載の光学的情報読取装置。   6. The optical information reading apparatus according to claim 5, further comprising a near margin display means for displaying the near margin. 前記演算手段は、前記ワークから前記撮像手段までの実際の距離である基準距離と前記ワークに対して最も遠い距離との差分である遠方余裕度を演算することを特徴とする請求項3ないし6のいずれか1項に記載の光学的情報読取装置。   7. The calculation unit according to claim 3, wherein the calculation unit calculates a far margin that is a difference between a reference distance that is an actual distance from the workpiece to the imaging unit and a distance farthest from the workpiece. The optical information reader according to any one of the above. 前記遠方余裕度を表示する遠方余裕度表示手段をさらに有することを特徴する請求項7に記載の光学的情報読取装置。   8. The optical information reading apparatus according to claim 7, further comprising a far margin display means for displaying the far margin. 前記フォーカス調整機構を制御するオートフォーカス制御部をさらに有し、
前記オートフォーカス制御部が前記フォーカス調整機構のフォーカスの調整量を変化させ、
前記撮像手段は各フォーカスの調整量に対してそれぞれ前記ワークに設けられたコードを撮像して画像データを出力することを特徴とする請求項1ないし8のいずれか1項に記載の光学的情報読取装置。
An autofocus control unit for controlling the focus adjustment mechanism;
The autofocus control unit changes the focus adjustment amount of the focus adjustment mechanism,
9. The optical information according to claim 1, wherein the imaging unit images a code provided on the workpiece for each focus adjustment amount and outputs image data. 10. Reader.
前記撮像手段の撮像条件と前記デコード手段における画像処理条件とを含む読取条件を制御する読取条件制御手段をさらに有し、
前記演算手段は、前記読取条件が確定した後で前記許容深度の取得処理を開始することを特徴とする請求項1ないし9のいずれか1項に記載の光学的情報読取装置。
A reading condition control means for controlling a reading condition including an imaging condition of the imaging means and an image processing condition in the decoding means;
10. The optical information reading apparatus according to claim 1, wherein the calculation unit starts the permissible depth acquisition process after the reading condition is determined. 11.
前記演算手段が前記許容深度の取得処理を実行している間は前記読取条件制御手段が前記読取条件を変更せずに固定することを特徴とする請求項10に記載の光学的情報読取装置。   The optical information reading apparatus according to claim 10, wherein the reading condition control unit fixes the reading condition without changing while the calculation unit performs the processing for obtaining the allowable depth. 前記許容深度の取得処理が開始されると、前記オートフォーカス制御部は、前記ワークに対して近方側に前記撮像手段の光学系の焦点が変更されるよう前記フォーカス調整機構の調整量を変化させて前記デコード手段に前記近方側についてデコード結果を取得させ、前記デコード手段が前記近方側についてのデコード結果の取得を完了すると、前記ワークに対して遠方側に前記撮像手段の光学系の焦点が変更されるよう前記フォーカス調整機構の調整量を変化させ、前記デコード手段に前記遠方側についてデコード結果を取得させることを特徴とする請求項9に記載の光学的情報読取装置。   When the permissible depth acquisition process is started, the autofocus control unit changes the adjustment amount of the focus adjustment mechanism so that the focus of the optical system of the imaging unit is changed closer to the workpiece. The decoding means acquires the decoding result for the near side, and when the decoding means completes the acquisition of the decoding result for the near side, the optical system of the imaging means is located far from the workpiece. The optical information reading apparatus according to claim 9, wherein an adjustment amount of the focus adjustment mechanism is changed so that a focus is changed, and the decoding unit is caused to acquire a decoding result for the far side. 前記撮像手段から前記ワークまでの距離と当該デコード結果との対応関係を示すグラフを表示するグラフ表示手段をさらに有することを特徴とする請求項1ないし12のいずれか1項に記載の光学的情報読取装置。   13. The optical information according to claim 1, further comprising a graph display unit that displays a graph indicating a correspondence relationship between a distance from the imaging unit to the workpiece and the decoding result. Reader. 前記対応関係を示すグラフの一部を指定する指定手段と、
前記指定手段により指定された部分に対応した前記撮像手段から前記ワークまでの距離を表示する距離表示手段と
をさらに有することを特徴とする請求項13に記載の光学的情報読取装置。
Designation means for designating a part of the graph indicating the correspondence;
The optical information reading apparatus according to claim 13, further comprising a distance display unit that displays a distance from the imaging unit to the workpiece corresponding to a portion designated by the designation unit.
前記デコード結果は、前記コードについての読取成功率、読み取りやすさの指標である読取余裕度、または、前記コードを構成する1つのセルが前記画像データにおいていくつの画素に相当するかを示すPPCであることを特徴とする請求項1ないし14のいずれか1項に記載の光学的情報読取装置。   The decoding result is a PPC indicating a reading success rate for the code, a reading margin that is an index of readability, or a number of pixels corresponding to one cell constituting the code in the image data. The optical information reading device according to claim 1, wherein the optical information reading device is provided. フォーカス調整機構を備え、ワークに設けられたコードを撮像する撮像手段と、前記撮像手段により取得された画像データをデコードするデコード手段とを有する光学的情報読取装置の制御方法であって、
前記フォーカス調整機構における調整量を複数通りに変化させながら各調整量ごとに前記撮像手段により取得された各画像データについて前記デコード手段によるデコード結果を取得し、前記調整量を換算して得られる前記撮像手段から前記ワークまでの距離と当該デコード結果との対応関係を求め、当該対応関係に基づき前記コードをデコードする上で許容される前記撮像手段から前記ワークまでの距離である許容深度を演算することを特徴とする制御方法。
A control method for an optical information reading apparatus, comprising: a focus adjustment mechanism, and an imaging means for imaging a code provided on a work; and a decoding means for decoding image data acquired by the imaging means,
Obtaining the decoding result by the decoding means for each image data obtained by the imaging means for each adjustment amount while changing the adjustment amount in the focus adjustment mechanism in a plurality of ways, and obtaining the adjustment amount A correspondence relationship between the distance from the imaging means to the workpiece and the decoding result is obtained, and an allowable depth that is a distance from the imaging means to the workpiece that is allowed to decode the code is calculated based on the correspondence relationship. A control method characterized by that.
フォーカス調整機構を備え、ワークに設けられたコードを撮像する撮像手段と、前記撮像手段により取得された画像データをデコードするデコード手段とを有する光学的情報読取装置で実行されるプログラムであって、当該光学的情報読取装置に、
前記フォーカス調整機構における調整量を複数通りに変化させながら各調整量ごとに前記撮像手段により取得された各画像データについて前記デコード手段によるデコード結果を取得させ、前記調整量を換算して得られる前記撮像手段から前記ワークまでの距離と当該デコード結果との対応関係を求めさせ、当該対応関係に基づき前記コードをデコードする上で許容される前記撮像手段から前記ワークまでの距離である許容深度を演算させることを特徴とするプログラム。
A program that is executed by an optical information reading device that includes a focus adjustment mechanism and includes an imaging unit that images a code provided on a workpiece, and a decoding unit that decodes image data acquired by the imaging unit, In the optical information reader,
Obtaining a decoding result by the decoding unit for each image data acquired by the imaging unit for each adjustment amount while changing the adjustment amount in the focus adjustment mechanism in a plurality of ways, and obtaining the conversion amount The correspondence between the distance from the imaging means to the workpiece and the decoding result is obtained, and the allowable depth that is the distance from the imaging means to the workpiece that is allowed to decode the code based on the correspondence is calculated. A program characterized by letting
JP2014157026A 2014-07-31 2014-07-31 Optical information reader, control method and program for optical information reader Active JP6258809B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014157026A JP6258809B2 (en) 2014-07-31 2014-07-31 Optical information reader, control method and program for optical information reader

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2014157026A JP6258809B2 (en) 2014-07-31 2014-07-31 Optical information reader, control method and program for optical information reader

Publications (2)

Publication Number Publication Date
JP2016033784A JP2016033784A (en) 2016-03-10
JP6258809B2 true JP6258809B2 (en) 2018-01-10

Family

ID=55452636

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2014157026A Active JP6258809B2 (en) 2014-07-31 2014-07-31 Optical information reader, control method and program for optical information reader

Country Status (1)

Country Link
JP (1) JP6258809B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102020109928B3 (en) 2020-04-09 2020-12-31 Sick Ag Camera and method for capturing image data
CN113111673B (en) * 2021-04-09 2024-07-09 北京复兴华创技术有限公司 Quick two-dimension code decoding method and device for production line

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0627893B2 (en) * 1983-05-10 1994-04-13 ミノルタカメラ株式会社 Automatic focus adjustment device
JP5303420B2 (en) * 2009-10-01 2013-10-02 株式会社キーエンス Imaging condition setting device and imaging condition setting method for optical information reader

Also Published As

Publication number Publication date
JP2016033784A (en) 2016-03-10

Similar Documents

Publication Publication Date Title
EP2996065B1 (en) Variable depth of field barcode scanner
EP3040906B1 (en) Visual feedback for code readers
CN102737211B (en) Code reading apparatus and computer program product
CN111711759B (en) Focusing method, device, storage medium and electronic equipment
US8608075B2 (en) Code reading apparatus and computer program product
CN105044879A (en) Automatic focusing system using multiple lenses and method thereof
JP2010286740A (en) Optical information reading apparatus
JP5865299B2 (en) Focus adjustment device, camera system, and focus adjustment method
JP6258809B2 (en) Optical information reader, control method and program for optical information reader
CN102937701B (en) Camera shooting module motor tester
US10598891B2 (en) Control apparatus, image capturing apparatus, control method, and non-transitory computer-readable storage medium
JP2023126966A (en) Illumination control for imaging systems with multiple image sensors
JP2017129613A (en) Focus adjustment device and focus adjustment method
JP2022105618A (en) Dot peen mark image acquisition
JP7478834B2 (en) An intelligent method for focus tracking in machine vision applications.
JP6381434B2 (en) FOCUS CONTROL DEVICE, OPTICAL DEVICE, AND FOCUS CONTROL METHOD
JP2015212746A (en) Zoom tracking controller, zoom tracking control program, optical device, and imaging apparatus
US10371923B2 (en) Lens control apparatus and lens control method
US9591199B2 (en) Image pickup system
US20190098202A1 (en) Control apparatus, image capturing apparatus, and control method
JP6358888B2 (en) Optical information reading apparatus, optical information reading method and program
CN104780314A (en) Terminal
US20160150150A1 (en) Focus detection apparatus and control method for the same
CN113615159A (en) Image sensor with a plurality of pixels
JP2013118006A (en) Code reading device and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20170301

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20171207

R150 Certificate of patent or registration of utility model

Ref document number: 6258809

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250