JP7087984B2 - Imaging system and setting device - Google Patents

Imaging system and setting device Download PDF

Info

Publication number
JP7087984B2
JP7087984B2 JP2018238023A JP2018238023A JP7087984B2 JP 7087984 B2 JP7087984 B2 JP 7087984B2 JP 2018238023 A JP2018238023 A JP 2018238023A JP 2018238023 A JP2018238023 A JP 2018238023A JP 7087984 B2 JP7087984 B2 JP 7087984B2
Authority
JP
Japan
Prior art keywords
focus
focal position
processing
search
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2018238023A
Other languages
Japanese (ja)
Other versions
JP2020101600A (en
Inventor
俊帆 畑
信隆 今西
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Omron Corp
Original Assignee
Omron Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Omron Corp filed Critical Omron Corp
Priority to JP2018238023A priority Critical patent/JP7087984B2/en
Publication of JP2020101600A publication Critical patent/JP2020101600A/en
Application granted granted Critical
Publication of JP7087984B2 publication Critical patent/JP7087984B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本技術は、撮像システムおよび設定装置に関する。 The present technology relates to an imaging system and a setting device.

一般にカメラの分野では、合焦状態を判定し、被写体に合焦するように光学系のフォーカスレンズを移動させるオートフォーカス処理が知られている。たとえば特開2018-84701号公報(特許文献1)には、オートフォーカス処理を実行する際にフォーカスレンズを移動させる範囲を制限範囲に制限する焦点調節装置が開示されている。 Generally, in the field of a camera, an autofocus process is known in which a focus state is determined and an optical focus lens is moved so as to focus on a subject. For example, Japanese Patent Application Laid-Open No. 2018-8471 (Patent Document 1) discloses a focus adjusting device that limits the range in which the focus lens is moved when the autofocus process is executed to a limited range.

特開2018-84701号公報Japanese Unexamined Patent Publication No. 2018-8471

特許文献1に開示されているように、フォーカスレンズを移動させる範囲などのオートフォーカス処理の条件(以下、「AF処理条件」という)を変更した場合、オートフォーカス処理の実行に要する時間(以下、「AF処理時間」という)が変化する。AF処理時間は、被写体の画像を得るまでの時間に大きく影響する。特に、多数の製品を順次撮像し、画像に基づいて検査するシステムでは、検査時間をなるべく短くする必要がある。そのため、AF処理時間を考慮しながら、AF処理条件を適宜設定することが望まれる。しかしながら、作業者は、AF処理条件とAF処理時間との関係を詳細に把握していない。そのため、作業者は、AF処理条件を変更したときにAF処理時間がどの程度変わるのかを理解できない。 As disclosed in Patent Document 1, when the conditions for autofocus processing (hereinafter referred to as "AF processing conditions") such as the range in which the focus lens is moved are changed, the time required to execute the autofocus processing (hereinafter referred to as "AF processing conditions") is changed. "AF processing time") changes. The AF processing time greatly affects the time required to obtain an image of the subject. In particular, in a system in which a large number of products are sequentially imaged and inspected based on the images, it is necessary to shorten the inspection time as much as possible. Therefore, it is desirable to appropriately set the AF processing conditions while considering the AF processing time. However, the worker does not grasp the relationship between the AF processing condition and the AF processing time in detail. Therefore, the operator cannot understand how much the AF processing time changes when the AF processing conditions are changed.

本発明は、上記の問題を鑑みてなされたものであり、その目的は、オートフォーカス処理の実行に要する時間を考慮しながら、オートフォーカス処理の条件を適宜設定可能な撮像システムおよび設定装置を提供することである。 The present invention has been made in view of the above problems, and an object of the present invention is to provide an imaging system and a setting device capable of appropriately setting the conditions of the autofocus processing while considering the time required to execute the autofocus processing. It is to be.

本開示の一例によれば、撮像システムは、焦点位置が所定範囲で可変である撮像装置と、オートフォーカス処理手段と、設定手段とを備える。オートフォーカス処理手段は、焦点位置を変化させたときの、撮像装置によって生成される画像から算出される合焦度の変化に基づいて、対象物に合焦する合焦位置を探索するオートフォーカス処理を実行する。設定手段は、表示装置に表示された設定画面への入力情報に従って、オートフォーカス処理の処理条件を設定する。設定手段は、処理条件に従って実行されるオートフォーカス処理に要する処理時間を設定画面に表示させることにより、入力情報の入力を支援する。 According to one example of the present disclosure, the imaging system includes an imaging device whose focal position is variable within a predetermined range, autofocus processing means, and setting means. The autofocus processing means searches for an in-focus position that focuses on an object based on a change in the in-focus degree calculated from an image generated by an image pickup device when the focus position is changed. To execute. The setting means sets the processing conditions for the autofocus process according to the input information on the setting screen displayed on the display device. The setting means supports the input of input information by displaying the processing time required for the autofocus processing executed according to the processing conditions on the setting screen.

この開示によれば、オートフォーカス処理に要する処理時間が設定画面に表示される。これにより、作業者は、オートフォーカス処理に要する処理時間を考慮しながら、処理条件を適宜設定できる。 According to this disclosure, the processing time required for the autofocus processing is displayed on the setting screen. As a result, the operator can appropriately set the processing conditions while considering the processing time required for the autofocus processing.

上述の開示において、処理条件は、撮像装置の露光時間、所定範囲のうちの合焦位置の探索範囲、焦点位置の変化幅、焦点位置の探索方向、および合焦度の算出対象となる画像領域の少なくとも1つを含む。 In the above disclosure, the processing conditions are the exposure time of the image pickup apparatus, the search range of the in-focus position within a predetermined range, the change width of the focal position, the search direction of the focal position, and the image area for which the focus degree is calculated. Includes at least one of.

オートフォーカス処理に要する処理時間は、露光時間、探索範囲、焦点位置の変化幅、探索方向、および合焦度の算出対象となる画像領域に依存して変動する。そのため、この開示によれば、オートフォーカス処理に要する処理時間を考慮しながら、これらの条件の少なくとも1つを設定できる。 The processing time required for the autofocus processing varies depending on the exposure time, the search range, the change width of the focal position, the search direction, and the image area for which the focus degree is calculated. Therefore, according to this disclosure, at least one of these conditions can be set while considering the processing time required for the autofocus processing.

上述の開示において、オートフォーカス処理は、第1探索処理と第2探索処理とを含む。第1探索処理は、焦点位置を第1変化幅ずつ変化させながら、合焦度が閾値を超える第1焦点位置を探索する処理である。第2探索処理は、第1焦点位置から第1変化幅よりも小さい第2変化幅ずつ焦点位置を変化させながら、合焦度が極大を示す第2焦点位置を合焦位置として探索する処理である。処理条件は、第1変化幅を含む。 In the above disclosure, the autofocus process includes a first search process and a second search process. The first search process is a process of searching for a first focal position whose in-focus degree exceeds a threshold value while changing the focal position by the first change width. The second search process is a process of searching for the second focal position, which shows the maximum in-focus degree, as the in-focus position while changing the focal position from the first focal position by the second change width smaller than the first change width. be. The processing conditions include the first change width.

この開示によれば、オートフォーカス処理に要する処理時間を考慮しながら、第1探索処理における第1変化幅を適宜設定できる。 According to this disclosure, the first change width in the first search process can be appropriately set while considering the processing time required for the autofocus process.

上述の開示において、設定手段は、焦点位置と合焦度との関係を示す図形を設定画面に表示させ、閾値を入力情報として受けると、図形において合焦度が閾値を連続して超える焦点位置の幅に基づいて第1変化幅を設定する。 In the above disclosure, the setting means displays a figure showing the relationship between the focal position and the degree of focus on the setting screen, and when the threshold is received as input information, the focus position in the figure continuously exceeds the threshold. The first change width is set based on the width of.

この開示によれば、作業者は、焦点位置と合焦度との関係を示す図形と閾値との関係を確認しながら、第1変化幅を適宜設定できる。 According to this disclosure, the operator can appropriately set the first change width while confirming the relationship between the threshold value and the figure showing the relationship between the focal position and the degree of focus.

上述の開示において、第1探索処理は、連続して合焦度が閾値を超える焦点位置の集合が複数探索された場合に、当該複数の集合のうち、焦点位置の探索方向の上流側から指定番号目の集合に属する焦点位置を第1焦点位置として選択する処理を含む。処理条件は、探索方向および指定番号を含む。 In the above disclosure, in the first search process, when a plurality of sets of focal positions whose focal degree exceeds the threshold value are continuously searched, the first search process is designated from the upstream side of the plurality of sets in the search direction of the focal position. The process of selecting the focal position belonging to the set of numbers as the first focal position is included. The processing conditions include the search direction and the designated number.

この開示によれば、オートフォーカス処理に要する処理時間を考慮しながら、第1探索処理における探索方向および指定番号を適宜設定できる。 According to this disclosure, the search direction and the designated number in the first search process can be appropriately set while considering the processing time required for the autofocus process.

上述の開示において、設定手段は、焦点位置と合焦度との関係を示す図形を設定画面に表示させる。図形は、合焦度が閾値を超える焦点位置の複数の区域を有する。設定手段は、複数の区域のうち指定された区域に基づいて指定番号を設定する。 In the above disclosure, the setting means displays a figure showing the relationship between the focal position and the degree of focus on the setting screen. The figure has multiple areas of focal position where the degree of focus exceeds the threshold. The setting means sets a designated number based on a designated area among a plurality of areas.

この開示によれば、連続して合焦度が閾値を超える焦点位置の集合が複数探索された場合であっても、作業者は、図形を確認しながら、検査対象箇所に応じた指定番号を設定できる。 According to this disclosure, even when a plurality of sets of focal positions whose in-focus degree exceeds the threshold value are continuously searched, the operator can select a designated number according to the inspection target location while checking the figure. Can be set.

上述の開示において、焦点位置と合焦度との関係は、焦点位置を所定範囲内で第2変化幅ずつ変化させるスキャン処理によって取得される。撮像システムは、スキャン処理に要したスキャン時間に基づいて処理時間を算出するための算出手段をさらに備える。 In the above disclosure, the relationship between the focal position and the degree of focus is acquired by a scanning process in which the focal position is changed by a second change width within a predetermined range. The imaging system further includes a calculation means for calculating the processing time based on the scanning time required for the scanning processing.

この開示によれば、スキャン処理に要するスキャン時間に基づいて処理時間が算出される。これにより、実状に即した処理時間を設定画面に表示させることができる。 According to this disclosure, the processing time is calculated based on the scanning time required for the scanning processing. As a result, the processing time according to the actual situation can be displayed on the setting screen.

上述の開示において、処理条件は、合焦度の算出対象となる画像領域を含む。設定手段は、撮像装置によって撮像されたサンプル画像を設定画面に表示させ、サンプル画像上の指定領域を示す領域情報を入力情報として受け、領域情報に基づいて、合焦度の算出対象となる画像領域を設定する。 In the above disclosure, the processing condition includes an image area for which the degree of focus is calculated. The setting means displays the sample image captured by the image pickup device on the setting screen, receives the area information indicating the designated area on the sample image as input information, and based on the area information, the image to be calculated the focus degree. Set the area.

この開示によれば、作業者は、サンプル画像を確認しながら、検査対象箇所に応じて、合焦度の算出対象となる画像領域を適宜設定できる。 According to this disclosure, the operator can appropriately set the image area for which the in-focus degree is calculated according to the inspection target portion while checking the sample image.

本開示の一例によれば、上記の撮像システムで用いられる設定装置は、上記の設定手段を備える。この開示によっても、作業者は、オートフォーカス処理に要する処理時間を考慮しながら、処理条件を適宜設定できる。 According to an example of the present disclosure, the setting device used in the above-mentioned imaging system includes the above-mentioned setting means. Also with this disclosure, the operator can appropriately set the processing conditions while considering the processing time required for the autofocus processing.

本発明によれば、オートフォーカス処理の実行に要する時間を考慮しながら、オートフォーカス処理の条件を適宜設定できる。 According to the present invention, the conditions of the autofocus processing can be appropriately set while considering the time required to execute the autofocus processing.

実施の形態に係る撮像システムの1つの適用例を示す模式図である。It is a schematic diagram which shows one application example of the image pickup system which concerns on embodiment. 撮像システムに備えられる撮像装置の内部構成の一例を示す図である。It is a figure which shows an example of the internal structure of the image pickup apparatus provided in the image pickup system. 合焦位置の探索方法を説明するための模式図である。It is a schematic diagram for demonstrating the search method of the in-focus position. 焦点位置が可変のレンズモジュールの構成の一例を示す図である。It is a figure which shows an example of the structure of the lens module which the focal position is variable. 焦点位置が可変のレンズモジュールの構成の別の例を示す図である。It is a figure which shows another example of the structure of the lens module which the focal position is variable. 実施の形態に係る画像処理装置のハードウェア構成の一例を示すブロック図である。It is a block diagram which shows an example of the hardware composition of the image processing apparatus which concerns on embodiment. 設定装置のハードウェア構成を表わすブロック図である。It is a block diagram which shows the hardware composition of a setting apparatus. 第2の探索方法における1段階目の探索処理を説明する図である。It is a figure explaining the search process of the 1st stage in the 2nd search method. 第2の探索方法における2段階目の探索処理の一例を説明する図である。It is a figure explaining an example of the search process of the 2nd stage in the 2nd search method. 第2の探索方法における2段階目の探索処理の他の例を説明する図である。It is a figure explaining another example of the search process of the 2nd stage in the 2nd search method. 2段階目の探索処理の起点の決定方法を説明する図である。It is a figure explaining the method of determining the starting point of the search process of the 2nd stage. 第4の探索方法の1段階目の探索処理で探索された複数の焦点位置の一例を示す図である。It is a figure which shows an example of the plurality of focal positions searched by the search process of the 1st stage of the 4th search method. 撮像装置によるワークWの撮像を模式的に示した図である。It is a figure which shows the image of the work W by the image pickup apparatus schematically. 複数のピークを含む合焦度波形の一例を示す図である。It is a figure which shows an example of the focusing degree waveform including a plurality of peaks. 第4の探索方法における探索方向と指定番号との設定方法を説明する図である。It is a figure explaining the setting method of the search direction and the designated number in the 4th search method. ワークWの像を含む画像の一例を示す図である。It is a figure which shows an example of the image which includes the image of a work W. 第1および第3の探索方法に対応する設定画面の一例を示す図である。It is a figure which shows an example of the setting screen corresponding to the 1st and 3rd search methods. 第2および第4の探索方法に対応する設定画面の一例を示す図である。It is a figure which shows an example of the setting screen corresponding to the 2nd and 4th search methods. 焦点位置の変化幅Δf1の設定方法を説明する図である。It is a figure explaining the setting method of the change width Δf1 of a focal position. 変化幅Δf1と最小変化幅Δf0との関係を示す図である。It is a figure which shows the relationship between the change width Δf1 and the minimum change width Δf0.

以下、図面を参照しつつ、本発明に従う実施の形態について説明する。以下の説明では、同一の部品および構成要素には同一の符号を付してある。それらの名称および機能も同じである。したがって、これらについての詳細な説明は繰り返さない。 Hereinafter, embodiments according to the present invention will be described with reference to the drawings. In the following description, the same parts and components are designated by the same reference numerals. Their names and functions are the same. Therefore, the detailed description of these will not be repeated.

§1 適用例
まず、図1および図2を参照して、本発明が適用される場面の一例について説明する。図1は、実施の形態に係る撮像システムの1つの適用例を示す模式図である。図2は、撮像システムに備えられる撮像装置の内部構成の一例を示す図である。
§1 Application example First, an example of a situation in which the present invention is applied will be described with reference to FIGS. 1 and 2. FIG. 1 is a schematic diagram showing one application example of the imaging system according to the embodiment. FIG. 2 is a diagram showing an example of the internal configuration of an image pickup apparatus provided in an image pickup system.

図1に示すように、本実施の形態に係る撮像システム1は、たとえば外観検査システムとして実現される。撮像システム1は、たとえば工業製品の生産ラインなどにおいて、ステージ90上に載置されたワークWの検査対象箇所を撮像し、得られた画像を用いて検査対象箇所の外観検査を行なう。外観検査では、検査対象箇所の傷、汚れ、異物の有無、寸法などが検査される。 As shown in FIG. 1, the imaging system 1 according to the present embodiment is realized as, for example, a visual inspection system. The image pickup system 1 takes an image of an inspection target portion of the work W placed on the stage 90 in, for example, a production line of an industrial product, and performs an appearance inspection of the inspection target portion using the obtained image. In the visual inspection, scratches, stains, the presence or absence of foreign matter, dimensions, etc. of the inspection target part are inspected.

ステージ90上に載置されたワークWの外観検査が完了すると、次のワーク(図示せず)がステージ90上に搬送される。ワークWの撮像の際、ワークWは、ステージ90上の所定位置に所定姿勢で静止してもよい。あるいは、ワークWがステージ90上を移動しながら、ワークWが撮像されてもよい。 When the visual inspection of the work W placed on the stage 90 is completed, the next work (not shown) is conveyed onto the stage 90. When the work W is imaged, the work W may be stationary in a predetermined posture at a predetermined position on the stage 90. Alternatively, the work W may be imaged while the work W moves on the stage 90.

図1に示すように、撮像システム1は、基本的な構成要素として、撮像装置10と、画像処理装置20と、設定装置40とを備える。この実施の形態では、撮像システム1は、さらに、PLC(Programmable Logic Controller)30を備える。 As shown in FIG. 1, the image pickup system 1 includes an image pickup device 10, an image processing device 20, and a setting device 40 as basic components. In this embodiment, the imaging system 1 further includes a PLC (Programmable Logic Controller) 30.

撮像装置10は、画像処理装置20に接続される。撮像装置10は、画像処理装置20からの指令に従って、撮像視野に存在する被写体(ワークW)を撮像して、ワークWの像を含む画像データを生成する。撮像装置10と画像処理装置20とは一体化されていてもよい。 The image pickup device 10 is connected to the image processing device 20. The image pickup apparatus 10 images a subject (work W) existing in the imaging field of view according to a command from the image processing apparatus 20, and generates image data including an image of the work W. The image pickup device 10 and the image processing device 20 may be integrated.

図2に示されるように、撮像装置10は、照明部11と、レンズモジュール12と、撮像素子13と、撮像素子制御部14と、レンズ制御部16と、レジスタ15,17と、通信インターフェース(I/F)部18とを含む。 As shown in FIG. 2, the image pickup device 10 includes an illumination unit 11, a lens module 12, an image pickup element 13, an image pickup element control unit 14, a lens control unit 16, and registers 15 and 17, and a communication interface ( I / F) Part 18 is included.

照明部11は、ワークWに対して光を照射する。照明部11から照射された光は、ワークWの表面で反射し、レンズモジュール12に入射する。照明部11は省略されてもよい。 The lighting unit 11 irradiates the work W with light. The light emitted from the illumination unit 11 is reflected on the surface of the work W and is incident on the lens module 12. The illumination unit 11 may be omitted.

レンズモジュール12は、ワークWからの光を撮像素子13の撮像面13a上に結像させるための光学系である。レンズモジュール12の焦点位置は、所定の可動範囲内で可変である。焦点位置とは、光軸に平行な入射光線が光軸と交わる点の位置である。 The lens module 12 is an optical system for forming an image of light from the work W on the image pickup surface 13a of the image pickup element 13. The focal position of the lens module 12 is variable within a predetermined movable range. The focal position is the position of the point where the incident light ray parallel to the optical axis intersects the optical axis.

レンズモジュール12は、レンズ12aと、レンズ群12bと、レンズ12cと、可動部12dと、フォーカス調節部12eとを有する。レンズ12aは、レンズモジュール12の焦点位置を変化させるためのレンズである。フォーカス調節部12eは、レンズ12aを制御して、レンズモジュール12の焦点位置を変化させる。 The lens module 12 includes a lens 12a, a lens group 12b, a lens 12c, a movable portion 12d, and a focus adjusting portion 12e. The lens 12a is a lens for changing the focal position of the lens module 12. The focus adjusting unit 12e controls the lens 12a to change the focal position of the lens module 12.

レンズ群12bは、焦点距離を変更するためのレンズ群である。焦点距離が変更されることにより、ズーム倍率が制御される。レンズ群12bは、可動部12dに設置され、光軸方向に沿って可動する。レンズ12cは、撮像装置10内の予め定められた位置に固定されるレンズである。 The lens group 12b is a lens group for changing the focal length. The zoom magnification is controlled by changing the focal length. The lens group 12b is installed in the movable portion 12d and moves along the optical axis direction. The lens 12c is a lens fixed at a predetermined position in the image pickup apparatus 10.

撮像素子13は、例えばCMOS(Complementary Metal Oxide Semiconductor)イメージセンサなどの光電変換素子であり、レンズモジュール12を介してワークWからの光を受けることによって画像信号を生成する。 The image pickup device 13 is a photoelectric conversion element such as a CMOS (Complementary Metal Oxide Semiconductor) image sensor, and generates an image signal by receiving light from the work W via the lens module 12.

撮像素子制御部14は、撮像素子13からの画像信号に基づいて画像データを生成する。このとき、撮像素子制御部14は、レジスタ15が記憶する命令に従って、シャッターを露光時間だけ開閉し、画像データ(以下、単に「画像」という)を生成する。 The image sensor control unit 14 generates image data based on the image signal from the image sensor 13. At this time, the image sensor control unit 14 opens and closes the shutter for the exposure time according to the command stored in the register 15, and generates image data (hereinafter, simply referred to as “image”).

レンズ制御部16は、レジスタ17が記憶する命令に従って、撮像装置10のフォーカスを調節する。具体的には、レンズ制御部16は、レンズモジュール12の焦点位置が命令に応じた位置になるように、フォーカス調節部12eを制御する。フォーカス調節部12eは、レンズ制御部16の制御により、レンズモジュール12の焦点位置を調節する。 The lens control unit 16 adjusts the focus of the image pickup apparatus 10 according to the command stored in the register 17. Specifically, the lens control unit 16 controls the focus adjustment unit 12e so that the focus position of the lens module 12 becomes a position in response to a command. The focus adjusting unit 12e adjusts the focal position of the lens module 12 under the control of the lens control unit 16.

レンズ制御部16は、ワークWのうち撮像視野内に含まれる領域の大きさが略一定になるように、可動部12dを制御して、レンズ群12bの位置を調節してもよい。言い換えると、レンズ制御部16は、ワークWのうち撮像視野内に含まれる領域の大きさが予め定められた範囲内になるように、可動部12dを制御することができる。レンズ制御部16は、撮像位置とワークWとの距離に応じてレンズ群12bの位置を調節すればよい。なお、この実施の形態では、ズームの調節は必須ではない。 The lens control unit 16 may control the movable unit 12d to adjust the position of the lens group 12b so that the size of the region included in the imaging field of view of the work W is substantially constant. In other words, the lens control unit 16 can control the movable unit 12d so that the size of the region included in the imaging field of view of the work W is within a predetermined range. The lens control unit 16 may adjust the position of the lens group 12b according to the distance between the image pickup position and the work W. In this embodiment, the zoom adjustment is not essential.

通信I/F部18は、画像処理装置20との間でデータを送受信する。通信I/F部18は、撮像指示を画像処理装置20から受信する。通信I/F部18は、撮像素子制御部14によって生成された画像を画像処理装置20に送信する。 The communication I / F unit 18 transmits / receives data to / from the image processing device 20. The communication I / F unit 18 receives an image pickup instruction from the image processing device 20. The communication I / F unit 18 transmits the image generated by the image sensor control unit 14 to the image processing device 20.

図1に戻って、PLC30は、画像処理装置20に接続され、画像処理装置20を制御する。例えばPLC30は、ワークWがステージ90上に載置されたタイミングで、画像処理装置20に対して検査指令を出力する。 Returning to FIG. 1, the PLC 30 is connected to the image processing device 20 and controls the image processing device 20. For example, the PLC 30 outputs an inspection command to the image processing device 20 at the timing when the work W is placed on the stage 90.

画像処理装置20は、撮像装置10から画像を取得し、取得した画像に対する画像処理を行なう。画像処理装置20は、指令生成部21と、合焦度算出部22と、探索部23と、検査部24と、記憶部230と、通信部25とを含む。 The image processing device 20 acquires an image from the image pickup device 10 and performs image processing on the acquired image. The image processing device 20 includes a command generation unit 21, a focus calculation unit 22, a search unit 23, an inspection unit 24, a storage unit 230, and a communication unit 25.

指令生成部21は、PLC30からの検査指令を受けて、撮像装置10に撮像指令(撮像トリガ)を生成する。このとき、指令生成部21は、記憶部230が記憶する処理条件データで示されるAF処理条件に従って撮像するように撮像指令を生成する。具体的には、指令生成部21は、AF処理条件に従って、探索範囲において焦点位置を変化幅ずつ変化させ、各焦点位置の画像を撮像装置10から受けるように、撮像指令を生成する。すなわち、指令生成部21は、探索範囲の起点に対応する焦点位置を指定した撮像指令を生成した後、変化幅ずつ変化させた焦点位置を指定した撮像指令を順次生成する。 The command generation unit 21 receives an inspection command from the PLC 30 and generates an image pickup command (imaging trigger) in the image pickup apparatus 10. At this time, the command generation unit 21 generates an image pickup command so as to take an image according to the AF processing condition indicated by the processing condition data stored in the storage unit 230. Specifically, the command generation unit 21 changes the focal position in the search range by the change width according to the AF processing conditions, and generates an imaging command so as to receive an image of each focal position from the imaging device 10. That is, the command generation unit 21 generates an imaging command that specifies the focal position corresponding to the starting point of the search range, and then sequentially generates an imaging command that specifies the focal position that is changed by the change width.

なお、指令生成部21は、探索範囲の起点に対応する焦点位置を指定した撮像指令を生成する前に、レンズモジュール12の焦点位置を探索範囲の起点に移動させる移動指令を生成してもよい。移動指令を受けた撮像装置10では、レンズ制御部16は、移動指令に従って、レンズモジュール12の焦点位置を探索範囲の起点に移動させる。移動指令は、例えば、(1)ワークWの品種の切り替え時、(2)ワークWの検査画像の撮像終了時、(3)ワークWの検査終了時、(4)ステージ90上の所定位置に次のワークWが搬送された時(ワーク検出時)に生成される。ただし、移動指令は、(1)および(2)のタイミングで生成されることが好ましい。もしくは、移動指令は、(1)および(3)のタイミングで生成されることが好ましい。これにより、次のワークWをステージ90上の所定位置に搬送する処理と並行して、レンズモジュール12の焦点位置を探索範囲の起点に移動させることができ、複数のワークWに対する検査時間を短縮できる。 The command generation unit 21 may generate a movement command for moving the focal position of the lens module 12 to the starting point of the search range before generating an imaging command specifying the focal position corresponding to the starting point of the search range. .. In the image pickup apparatus 10 that has received the movement command, the lens control unit 16 moves the focal position of the lens module 12 to the starting point of the search range in accordance with the movement command. The move command is, for example, (1) at the time of switching the product type of the work W, (2) at the end of imaging the inspection image of the work W, (3) at the end of the inspection of the work W, and (4) at a predetermined position on the stage 90. It is generated when the next work W is conveyed (when the work is detected). However, it is preferable that the movement command is generated at the timings (1) and (2). Alternatively, it is preferable that the movement command is generated at the timings (1) and (3). As a result, the focal position of the lens module 12 can be moved to the starting point of the search range in parallel with the process of transporting the next work W to a predetermined position on the stage 90, and the inspection time for a plurality of work Ws is shortened. can.

合焦度算出部22は、撮像装置10から受けた画像に対して、合焦度を算出する。合焦度とは、対象物に対して焦点がどの程度合っているかを表す度合いであり、公知の種々の方法を用いる算出される。たとえば、合焦度算出部22は、画像に対してハイパスフィルタを適用することにより高周波成分を抽出し、抽出された高周波成分の積算値を合焦度として算出する。このような合焦度は、画像の明暗差に依存した値を示す。 The in-focus degree calculation unit 22 calculates the in-focus degree with respect to the image received from the image pickup apparatus 10. The degree of focus is a degree indicating how much the object is in focus, and is calculated by using various known methods. For example, the in-focus degree calculation unit 22 extracts a high-frequency component by applying a high-pass filter to the image, and calculates the integrated value of the extracted high-frequency component as the in-focus degree. Such a degree of focus indicates a value depending on the difference in brightness of the image.

探索部23は、ワークWの検査対象箇所に合焦する焦点位置である合焦位置を探索する。具体的には、探索部23は、探索範囲内の各焦点位置に対応する画像の合焦度を合焦度算出部22から取得する。探索部23は、取得した合焦度がピークとなる焦点位置を合焦位置として決定する。「合焦する」とは、ワークWの検査対象箇所の像が撮像素子13の撮像面13a(図2参照)に結像することを意味する。探索部23は、レンズモジュール12の焦点位置が合焦位置であるときの画像を検査画像として特定する。 The search unit 23 searches for a focusing position, which is a focal position for focusing on the inspection target portion of the work W. Specifically, the search unit 23 acquires the in-focus degree of the image corresponding to each focal position in the search range from the in-focus degree calculation unit 22. The search unit 23 determines the focal position at which the acquired in-focus degree peaks as the in-focus position. “Focusing” means that an image of an inspection target portion of the work W is formed on the image pickup surface 13a (see FIG. 2) of the image pickup element 13. The search unit 23 specifies an image when the focal position of the lens module 12 is the in-focus position as an inspection image.

指令生成部21、合焦度算出部22および探索部23は、撮像装置10のレンズ制御部16と協働して、焦点位置を変化させたときの、撮像装置10によって生成される画像から算出される合焦度の変化に基づいて、対象物に合焦する合焦位置を探索するオートフォーカス処理を実行する。指令生成部21、合焦度算出部22および探索部23は、記憶部230が記憶する処理条件データ232に従った処理を実行する。 The command generation unit 21, the in-focus degree calculation unit 22, and the search unit 23 cooperate with the lens control unit 16 of the image pickup device 10 to calculate from the image generated by the image pickup device 10 when the focal position is changed. Based on the change in the degree of focusing, the autofocus process for searching the focusing position to focus on the object is executed. The command generation unit 21, the focus degree calculation unit 22, and the search unit 23 execute processing according to the processing condition data 232 stored in the storage unit 230.

検査部24は、検査画像に基づいてワークWを検査し、検査結果を出力する。具体的には、検査部24は、検査画像に対して予め登録された画像処理を施すことにより、ワークWを検査する。検査部24は、公知の技術を用いて検査を行なえばよい。 The inspection unit 24 inspects the work W based on the inspection image and outputs the inspection result. Specifically, the inspection unit 24 inspects the work W by performing image processing registered in advance on the inspection image. The inspection unit 24 may perform the inspection using a known technique.

記憶部230は、各種のデータ、プログラム等を記憶する。具体的には、記憶部230は、処理条件データ232を記憶する。処理条件データ232は、レンズモジュール12の焦点位置を変化させたときの、撮像装置10によって生成される画像から算出される合焦度の変化に基づいて、ワークWに合焦する合焦位置を探索するオートフォーカス処理の条件(AF処理条件)を示す。処理条件データ232は、設定装置40によって生成される。 The storage unit 230 stores various data, programs, and the like. Specifically, the storage unit 230 stores the processing condition data 232. The processing condition data 232 determines the in-focus position to be in focus on the work W based on the change in the in-focus degree calculated from the image generated by the image pickup apparatus 10 when the focal position of the lens module 12 is changed. The conditions for autofocus processing to be searched (AF processing conditions) are shown. The processing condition data 232 is generated by the setting device 40.

通信部25は、撮像装置10、設定装置40およびPLC30との間でデータの送受信を行なう。例えば、通信部25は、検査部24による検査結果をPLC30に送信する。 The communication unit 25 transmits / receives data to / from the image pickup device 10, the setting device 40, and the PLC 30. For example, the communication unit 25 transmits the inspection result by the inspection unit 24 to the PLC 30.

設定装置40は、設定画面への入力情報に従って、AF処理条件を設定する。図1に示されるように、設定装置40は、入力装置41と、表示装置42と、条件設定部43と、時間算出部44と、通信部45とを備える。 The setting device 40 sets AF processing conditions according to the input information on the setting screen. As shown in FIG. 1, the setting device 40 includes an input device 41, a display device 42, a condition setting unit 43, a time calculation unit 44, and a communication unit 45.

入力装置41は、キーボードやマウスなどで構成され、作業者からの入力情報を受け付ける。表示装置42は、ディスプレイ、各種インジケータなどで構成され、各種情報を表示する。 The input device 41 is composed of a keyboard, a mouse, or the like, and receives input information from an operator. The display device 42 is composed of a display, various indicators, and the like, and displays various information.

条件設定部43は、AF処理条件を設定するための設定画面を表示装置42に表示させ、設定画面への入力情報に従ってAF処理条件を設定する。 The condition setting unit 43 displays a setting screen for setting the AF processing condition on the display device 42, and sets the AF processing condition according to the input information on the setting screen.

時間算出部44は、AF処理条件に従って実行されるオートフォーカス処理に要する時間(AF処理時間)を算出する。時間算出部44は、AF処理条件とAF処理時間との関係を示す相関情報を予め記憶しておき、当該相関情報に基づいてAF処理時間を算出すればよい。条件設定部43は、時間算出部44によって算出されたAF処理時間を設定画面に表示させることにより、設定画面への入力情報の入力を支援する。 The time calculation unit 44 calculates the time (AF processing time) required for the autofocus processing executed according to the AF processing conditions. The time calculation unit 44 may store the correlation information indicating the relationship between the AF processing conditions and the AF processing time in advance, and calculate the AF processing time based on the correlation information. The condition setting unit 43 supports the input of input information to the setting screen by displaying the AF processing time calculated by the time calculation unit 44 on the setting screen.

通信部45は、画像処理装置20との間でデータの送受信を行なう。例えば、通信部45は、条件設定部43によって設定されたAF処理条件を示す処理条件データ232を画像処理装置20に送信する。 The communication unit 45 transmits / receives data to / from the image processing device 20. For example, the communication unit 45 transmits the processing condition data 232 indicating the AF processing conditions set by the condition setting unit 43 to the image processing device 20.

このように、条件設定部43は、AF処理時間を設定画面に表示させることにより、入力情報の入力を支援する。これにより、作業者は、AF処理時間を考慮しながら、AF処理条件を適宜設定できる。 In this way, the condition setting unit 43 supports the input of input information by displaying the AF processing time on the setting screen. As a result, the operator can appropriately set the AF processing conditions while considering the AF processing time.

§2 具体例
<A.レンズモジュールの構成例>
図3は、合焦位置の探索方法を説明するための模式図である。説明を簡単にするため、図3には、レンズモジュール12のうちの1枚のレンズのみを示している。
§2 Specific example <A. Lens module configuration example>
FIG. 3 is a schematic diagram for explaining a method of searching for a focus position. For simplicity of explanation, FIG. 3 shows only one lens of the lens module 12.

図3に示すように、レンズモジュール12の主点Oから対象面(ワークWにおける検査対象箇所の表面)までの距離をaとし、レンズモジュール12の主点Oから撮像面13aまでの距離をbとし、レンズモジュール12の主点Oからレンズモジュール12の焦点位置(後側焦点位置)Fまでの距離(焦点距離)をfとする。ワークWの検査対象箇所の像が撮像面13aの位置で結ばれる場合に、以下の式(1)が成立する。
1/a+1/b=1/f・・・(1)
すなわち、式(1)が成り立つときに、ワークWの検査対象箇所の表面に合焦した画像を撮像することができる。
As shown in FIG. 3, the distance from the principal point O of the lens module 12 to the target surface (the surface of the inspection target portion in the work W) is a, and the distance from the principal point O of the lens module 12 to the imaging surface 13a is b. Let f be the distance (focal length) from the principal point O of the lens module 12 to the focal position (rear focal length) F of the lens module 12. When the image of the inspection target portion of the work W is connected at the position of the image pickup surface 13a, the following equation (1) is established.
1 / a + 1 / b = 1 / f ... (1)
That is, when the equation (1) holds, an image focused on the surface of the inspection target portion of the work W can be captured.

ワークWの検査対象箇所の高さの個体差に応じて、撮像面13aと検査対象箇所との距離が変化し得る。撮像面13aと検査対象箇所との距離が変化した場合であっても検査対象箇所に合焦した画像を得るために、レンズモジュール12の焦点位置Fが調節される。レンズモジュール12の焦点位置Fを調節する方法には、以下の方法(A)および方法(B)がある。 The distance between the image pickup surface 13a and the inspection target portion may change according to the individual difference in the height of the inspection target portion of the work W. Even when the distance between the image pickup surface 13a and the inspection target portion changes, the focal position F of the lens module 12 is adjusted in order to obtain an image focused on the inspection target portion. There are the following methods (A) and (B) as methods for adjusting the focal position F of the lens module 12.

方法(A)は、レンズモジュール12を構成する少なくとも1つのレンズ(例えばレンズ12a)を光軸方向に平行移動させる方法である。方法(A)によれば、レンズモジュール12の主点Oが光軸方向に移動するとともに、焦点位置Fが変化する。その結果、距離bが変化する。式(1)を満たす距離bに対応する焦点位置Fが合焦位置として探索される。 The method (A) is a method of translating at least one lens (for example, the lens 12a) constituting the lens module 12 in the optical axis direction. According to the method (A), the principal point O of the lens module 12 moves in the optical axis direction, and the focal position F changes. As a result, the distance b changes. The focal position F corresponding to the distance b satisfying the equation (1) is searched for as the in-focus position.

方法(B)は、レンズモジュール12を構成する少なくとも1つのレンズ(例えばレンズ12a)の屈折方向を変化させる方法である。方法(B)によれば、レンズモジュール12の焦点距離fが変化することに伴い、焦点位置Fが変化する。式(1)を満たす焦点距離fに対応する焦点位置Fが合焦位置として探索される。 The method (B) is a method of changing the refraction direction of at least one lens (for example, the lens 12a) constituting the lens module 12. According to the method (B), the focal position F changes as the focal length f of the lens module 12 changes. The focal length F corresponding to the focal length f satisfying the equation (1) is searched for as the in-focus position.

レンズモジュール12の焦点位置Fを変化させるためのレンズ12aの構成は特に限定されない。以下に、レンズ12aの構成の例を説明する。 The configuration of the lens 12a for changing the focal position F of the lens module 12 is not particularly limited. An example of the configuration of the lens 12a will be described below.

図4は、焦点位置が可変のレンズモジュール12の構成の一例を示す図である。なお、図4に示す例では、レンズモジュール12を構成するレンズ12aを平行移動させる。ただし、レンズモジュール12を構成する少なくとも1つのレンズ(レンズ12a、レンズ群12bおよびレンズ12cのうちの少なくとも1つのレンズ)を平行移動させてもよい。 FIG. 4 is a diagram showing an example of the configuration of the lens module 12 having a variable focal position. In the example shown in FIG. 4, the lens 12a constituting the lens module 12 is translated. However, at least one lens (at least one lens of the lens 12a, the lens group 12b, and the lens 12c) constituting the lens module 12 may be translated.

図4に示す構成のレンズ12aを用いることにより、上記の方法(A)に従って、レンズモジュール12の焦点位置Fが変化する。すなわち、図4に示した構成では、フォーカス調節部12eは、レンズ12aを光軸方向に沿って移動させる。レンズ12aの位置を移動させることによって、レンズモジュール12の焦点位置Fが変化する。焦点位置Fが取り得る可動範囲Raは、レンズ12aの可動範囲Rbに対応する。 By using the lens 12a having the configuration shown in FIG. 4, the focal position F of the lens module 12 changes according to the above method (A). That is, in the configuration shown in FIG. 4, the focus adjusting unit 12e moves the lens 12a along the optical axis direction. By moving the position of the lens 12a, the focal position F of the lens module 12 changes. The movable range Ra that the focal position F can take corresponds to the movable range Rb of the lens 12a.

レンズ制御部16は、レンズ12aの移動量を制御することにより、レンズモジュール12の焦点位置Fを変化させる。レンズ12aは、図示しないモータの駆動量に応じて移動する。モータの最小駆動量は、モータの性能等によって予め定められる。そのため、レンズモジュール12の焦点位置Fの最小変化幅Δf0は、モータの最小駆動量に応じて定められる。 The lens control unit 16 changes the focal position F of the lens module 12 by controlling the amount of movement of the lens 12a. The lens 12a moves according to the driving amount of a motor (not shown). The minimum drive amount of the motor is predetermined by the performance of the motor and the like. Therefore, the minimum change width Δf0 of the focal position F of the lens module 12 is determined according to the minimum drive amount of the motor.

図4では、1枚のレンズ12aの例が示されている。通常では、フォーカス調節用のレンズは複数枚の組レンズで構成されることが多い。しかしながら、組レンズにおいても、組レンズを構成する少なくとも1枚のレンズの移動量を制御することにより、レンズモジュール12の焦点位置Fを変化させることができる。 FIG. 4 shows an example of one lens 12a. Usually, the lens for focus adjustment is often composed of a plurality of sets of lenses. However, also in the assembled lens, the focal position F of the lens module 12 can be changed by controlling the amount of movement of at least one lens constituting the assembled lens.

図5は、焦点位置が可変のレンズモジュール12の構成の別の例を示す図である。図5に示す構成のレンズ12aを用いることにより、上記の方法(B)に従って、レンズモジュール12の焦点位置Fが変化する。 FIG. 5 is a diagram showing another example of the configuration of the lens module 12 having a variable focal position. By using the lens 12a having the configuration shown in FIG. 5, the focal position F of the lens module 12 changes according to the above method (B).

図5に示すレンズ12aは液体レンズである。レンズ12aは、透光性容器80と、電極83a,83b,84a,84bと、絶縁体85a,85bと、絶縁層86a,86bとを含む。 The lens 12a shown in FIG. 5 is a liquid lens. The lens 12a includes a translucent container 80, electrodes 83a, 83b, 84a, 84b, insulators 85a, 85b, and insulating layers 86a, 86b.

透光性容器80内の密閉空間には、水などの導電性液体81と、油などの絶縁性液体82とが充填される。導電性液体81と絶縁性液体82とは混合せず、互いに屈折率が異なる。 The closed space in the translucent container 80 is filled with a conductive liquid 81 such as water and an insulating liquid 82 such as oil. The conductive liquid 81 and the insulating liquid 82 do not mix and have different refractive indexes from each other.

電極83a,83bは、絶縁体85a,85bと透光性容器80との間にそれぞれ固定され、導電性液体81中に位置する。 The electrodes 83a and 83b are fixed between the insulators 85a and 85b and the translucent container 80, respectively, and are located in the conductive liquid 81.

電極84a,84bは、導電性液体81と絶縁性液体82との界面の端部付近に配置される。電極84aと導電性液体81および絶縁性液体82との間には絶縁層86aが介在する。電極84bと導電性液体81および絶縁性液体82との間には絶縁層86bが介在する。電極84aと電極84bとは、レンズ12aの光軸に対して対称な位置に配置される。 The electrodes 84a and 84b are arranged near the end of the interface between the conductive liquid 81 and the insulating liquid 82. An insulating layer 86a is interposed between the electrode 84a and the conductive liquid 81 and the insulating liquid 82. An insulating layer 86b is interposed between the electrode 84b and the conductive liquid 81 and the insulating liquid 82. The electrodes 84a and 84b are arranged at positions symmetrical with respect to the optical axis of the lens 12a.

図5に示す構成において、フォーカス調節部12eは、電圧源12e1と、電圧源12e2とを含む。電圧源12e1は、電極84aと電極83aとの間に電圧Vaを印加する。電圧源12e2は、電極84bと電極83bとの間に電圧Vbを印加する。 In the configuration shown in FIG. 5, the focus adjusting unit 12e includes a voltage source 12e1 and a voltage source 12e2. The voltage source 12e1 applies a voltage Va between the electrode 84a and the electrode 83a. The voltage source 12e2 applies a voltage Vb between the electrode 84b and the electrode 83b.

電極84aと電極83aとの間に電圧Vaを印加すると、導電性液体81は、電極84aに引っ張られる。同様に、電極84bと電極83bとの間に電圧Vbを印加すると、導電性液体81は、電極84bに引っ張られる。これにより、導電性液体81と絶縁性液体82との界面の曲率が変化する。導電性液体81と絶縁性液体82との屈折率が異なるため、導電性液体81と絶縁性液体82との界面の曲率が変化することにより、レンズモジュール12の焦点位置Fが変化する。 When a voltage Va is applied between the electrode 84a and the electrode 83a, the conductive liquid 81 is pulled by the electrode 84a. Similarly, when a voltage Vb is applied between the electrode 84b and the electrode 83b, the conductive liquid 81 is pulled by the electrode 84b. As a result, the curvature of the interface between the conductive liquid 81 and the insulating liquid 82 changes. Since the refractive indexes of the conductive liquid 81 and the insulating liquid 82 are different, the focal position F of the lens module 12 changes due to the change in the curvature of the interface between the conductive liquid 81 and the insulating liquid 82.

導電性液体81と絶縁性液体82との界面の曲率は、電圧Va,Vbの大きさに依存する。そのため、レンズ制御部16は、電圧Va,Vbの大きさを制御することにより、レンズモジュール12の焦点位置Fを変化させる。焦点位置Fが取り得る可動範囲Raは、電圧Va,Vbが取り得る電圧範囲によって定まる。 The curvature of the interface between the conductive liquid 81 and the insulating liquid 82 depends on the magnitudes of the voltages Va and Vb. Therefore, the lens control unit 16 changes the focal position F of the lens module 12 by controlling the magnitudes of the voltages Va and Vb. The movable range Ra that the focal position F can take is determined by the voltage range that the voltages Va and Vb can take.

レンズモジュール12の焦点位置Fの最小変化幅Δf0は、電圧Va,Vbの最小変化幅に応じて定められる。 The minimum change width Δf0 of the focal position F of the lens module 12 is determined according to the minimum change width of the voltages Va and Vb.

通常は、電圧Vaと電圧Vbとは同値に制御される。これにより、導電性液体81と絶縁性液体82との界面は、光軸に対して対称に変化する。ただし、電圧Vaと電圧Vbとが異なる値に制御されてもよい。これにより、導電性液体81と絶縁性液体82との界面が光軸に対して非対称となり、撮像装置10の撮像視野の向きを変更することができる。 Normally, the voltage Va and the voltage Vb are controlled to the same value. As a result, the interface between the conductive liquid 81 and the insulating liquid 82 changes symmetrically with respect to the optical axis. However, the voltage Va and the voltage Vb may be controlled to different values. As a result, the interface between the conductive liquid 81 and the insulating liquid 82 becomes asymmetric with respect to the optical axis, and the direction of the image pickup field of view of the image pickup apparatus 10 can be changed.

さらに液体レンズと固体レンズとを組み合わせてもよい。この場合、上記の方法(A)および方法(B)の両方を用いてレンズモジュール12の焦点位置Fを変化させる。 Further, a liquid lens and a solid lens may be combined. In this case, the focal position F of the lens module 12 is changed by using both the above method (A) and the method (B).

<B.画像処理装置のハードウェア構成>
図6は、実施の形態に係る画像処理装置のハードウェア構成の一例を示すブロック図である。図6に示す例の画像処理装置20は、演算処理部であるCPU(Central Processing Unit)210と、図1に示す記憶部230としてのメインメモリ234およびハードディスク236と、カメラインターフェース216と、入力インターフェース218と、表示コントローラ220と、PLCインターフェース222と、通信インターフェース224と、データリーダ/ライタ226とを含む。これらの各部は、バス228を介して、互いにデータ通信可能に接続される。
<B. Image processing device hardware configuration>
FIG. 6 is a block diagram showing an example of the hardware configuration of the image processing apparatus according to the embodiment. The image processing device 20 of the example shown in FIG. 6 includes a CPU (Central Processing Unit) 210 which is an arithmetic processing unit, a main memory 234 and a hard disk 236 as a storage unit 230 shown in FIG. 1, a camera interface 216, and an input interface. It includes a display controller 220, a PLC interface 222, a communication interface 224, and a data reader / writer 226. Each of these parts is connected to each other via bus 228 so as to be capable of data communication.

CPU210は、ハードディスク236に格納されたプログラム(コード)をメインメモリ234に展開して、これらを所定順序で実行することで、各種の演算を実施する。図1に示す指令生成部21、合焦度算出部22、探索部23および検査部24は、CPU210が制御プログラム238を実行することにより実現される。 The CPU 210 expands the programs (codes) stored in the hard disk 236 to the main memory 234 and executes them in a predetermined order to perform various operations. The command generation unit 21, the focus calculation unit 22, the search unit 23, and the inspection unit 24 shown in FIG. 1 are realized by the CPU 210 executing the control program 238.

メインメモリ234は、典型的には、DRAM(Dynamic Random Access Memory)などの揮発性の記憶装置であり、ハードディスク236から読み出されたプログラムに加えて、撮像装置10によって取得された画像データ、ワークデータなどを保持する。さらに、ハードディスク236には、各種設定値などが格納されてもよい。図1に示す記憶部230は、メインメモリ234およびハードディスク236によって構成される。なお、ハードディスク236に加えて、あるいは、ハードディスク236に代えて、フラッシュメモリなどの半導体記憶装置を採用してもよい。 The main memory 234 is typically a volatile storage device such as a DRAM (Dynamic Random Access Memory), and in addition to a program read from the hard disk 236, image data and work acquired by the image pickup device 10 Holds data etc. Further, various setting values and the like may be stored in the hard disk 236. The storage unit 230 shown in FIG. 1 is composed of a main memory 234 and a hard disk 236. In addition to the hard disk 236, or instead of the hard disk 236, a semiconductor storage device such as a flash memory may be adopted.

カメラインターフェース216は、CPU210と撮像装置10との間のデータ伝送を仲介する。すなわち、カメラインターフェース216は、ワークWを撮像して画像データを生成するための撮像装置10と接続される。より具体的には、カメラインターフェース216は、撮像装置10からの画像データを一時的に蓄積するための画像バッファ216aを含む。そして、カメラインターフェース216は、画像バッファ216aに所定コマ数の画像データが蓄積されると、その蓄積されたデータをメインメモリ234へ転送する。また、カメラインターフェース216は、CPU210が発生した内部コマンドに従って、撮像装置10に対して撮像指令を送る。 The camera interface 216 mediates data transmission between the CPU 210 and the image pickup device 10. That is, the camera interface 216 is connected to an image pickup device 10 for capturing an image of the work W and generating image data. More specifically, the camera interface 216 includes an image buffer 216a for temporarily storing image data from the image pickup apparatus 10. Then, when the image data of a predetermined number of frames is accumulated in the image buffer 216a, the camera interface 216 transfers the accumulated data to the main memory 234. Further, the camera interface 216 sends an image pickup command to the image pickup apparatus 10 according to an internal command generated by the CPU 210.

入力インターフェース218は、CPU210と入力装置240との間のデータ伝送を仲介する。表示コントローラ220は、表示装置250と接続され、CPU210における処理の結果などをユーザに通知する。 The input interface 218 mediates data transmission between the CPU 210 and the input device 240. The display controller 220 is connected to the display device 250 and notifies the user of the result of processing in the CPU 210 and the like.

PLCインターフェース222は、CPU210とPLC30との間のデータ伝送を仲介する。より具体的には、PLCインターフェース222は、PLC30からの制御指令をCPU210へ伝送する。 The PLC interface 222 mediates data transmission between the CPU 210 and the PLC 30. More specifically, the PLC interface 222 transmits a control command from the PLC 30 to the CPU 210.

通信インターフェース224は、CPU210と設定装置40との間のデータ伝送を仲介する。通信インターフェース224は、典型的には、イーサネット(登録商標)やUSB(Universal Serial Bus)などからなる。なお、後述するように、メモリカード206に格納されたプログラムを画像処理装置20にインストールする形態に代えて、通信インターフェース224を介して、配信サーバなどからダウンロードしたプログラムを画像処理装置20にインストールしてもよい。 The communication interface 224 mediates data transmission between the CPU 210 and the setting device 40. The communication interface 224 typically comprises Ethernet (registered trademark), USB (Universal Serial Bus), or the like. As will be described later, instead of installing the program stored in the memory card 206 in the image processing device 20, the program downloaded from the distribution server or the like is installed in the image processing device 20 via the communication interface 224. You may.

図1に示す通信部25は、カメラインターフェース216、PLCインターフェース222および通信インターフェース224によって実現される。 The communication unit 25 shown in FIG. 1 is realized by a camera interface 216, a PLC interface 222, and a communication interface 224.

データリーダ/ライタ226は、CPU210と記録媒体であるメモリカード206との間のデータ伝送を仲介する。すなわち、メモリカード206には、画像処理装置20で実行されるプログラムなどが格納された状態で流通し、データリーダ/ライタ226は、このメモリカード206からプログラムを読出す。また、データリーダ/ライタ226は、CPU210の内部指令に応答して、撮像装置10によって取得された画像データおよび/または画像処理装置20における処理結果などをメモリカード206へ書込む。なお、メモリカード206は、SD(Secure Digital)などの汎用的な半導体記憶デバイスや、フレキシブルディスク(Flexible Disk)などの磁気記憶媒体や、CD-ROM(Compact Disk Read Only Memory)などの光学記憶媒体等からなる。 The data reader / writer 226 mediates data transmission between the CPU 210 and the memory card 206, which is a recording medium. That is, the memory card 206 is distributed in a state in which a program or the like executed by the image processing device 20 is stored, and the data reader / writer 226 reads the program from the memory card 206. Further, the data reader / writer 226 writes the image data acquired by the image pickup apparatus 10 and / or the processing result in the image processing apparatus 20 to the memory card 206 in response to the internal command of the CPU 210. The memory card 206 is a general-purpose semiconductor storage device such as SD (Secure Digital), a magnetic storage medium such as a flexible disk, or an optical storage medium such as a CD-ROM (Compact Disk Read Only Memory). Etc.

<C.設定装置のハードウェア構成>
図7は、設定装置のハードウェア構成を表わすブロック図である。図7を参照して、設定装置40は、主たる構成要素として、プログラムを実行するCPU(プロセッサ)401と、データを不揮発的に格納するROM(Read Only Memory)402と、CPU401によるプログラムの実行により生成されたデータ、又は入力装置41を介して入力されたデータを揮発的に格納するRAM403と、データを不揮発的に格納するHDD(Hard Disk Drive)404と、作業者の入力情報を受ける入力装置41と、表示装置42と、駆動装置408と、通信IF409とを含む。各構成要素は、相互にデータバス410によって接続されている。駆動装置408には、記録媒体430が装着される。
<C. Hardware configuration of setting device>
FIG. 7 is a block diagram showing the hardware configuration of the setting device. With reference to FIG. 7, the setting device 40 has, as main components, a CPU (processor) 401 for executing a program, a ROM (Read Only Memory) 402 for storing data non-volatilely, and an execution of a program by the CPU 401. A RAM 403 that volatilely stores the generated data or data input via the input device 41, an HDD (Hard Disk Drive) 404 that stores the data non-volatilely, and an input device that receives the input information of the operator. 41, a display device 42, a drive device 408, and a communication IF 409 are included. The components are connected to each other by the data bus 410. The recording medium 430 is mounted on the drive device 408.

設定装置40における処理は、各ハードウェアおよびCPU401により実行されるプログラム(設定プログラム420を含む)によって実現される。このようなプログラムは、HDD404に予め記憶されている。もしくは、プログラムは、記録媒体430に格納されて、プログラムプロダクトとして流通していてもよい。あるいは、プログラムは、いわゆるインターネットに接続されている情報提供事業者によってダウンロード可能なプログラムプロダクトとして提供されてもよい。このようなプログラムは、駆動装置408その他の読取装置により記録媒体430から読み取られて、あるいは、通信IF409を介してダウンロードされた後、HDD404に一旦格納される。そのプログラムは、CPU401によってHDD404から読み出され、RAM403に実行可能なプログラムの形式で格納される。CPU401は、そのプログラムを実行する。 The processing in the setting device 40 is realized by each hardware and a program (including the setting program 420) executed by the CPU 401. Such a program is stored in the HDD 404 in advance. Alternatively, the program may be stored in the recording medium 430 and distributed as a program product. Alternatively, the program may be provided as a program product that can be downloaded by an information provider connected to the so-called Internet. Such a program is read from the recording medium 430 by the drive device 408 or other reading device, or downloaded via the communication IF 409, and then temporarily stored in the HDD 404. The program is read from the HDD 404 by the CPU 401 and stored in the RAM 403 in the form of an executable program. The CPU 401 executes the program.

図1に示す条件設定部43および時間算出部44は、CPU401が設定プログラム420を実行することにより実現される。 The condition setting unit 43 and the time calculation unit 44 shown in FIG. 1 are realized by the CPU 401 executing the setting program 420.

記録媒体430としては、DVD-ROM、CD-ROM、FD(Flexible Disk)、ハードディスクに限られず、磁気テープ、カセットテープ、光ディスク(MO(Magnetic Optical Disc)/MD(Mini Disc)/DVD(Digital Versatile Disc))、IC(Integrated Circuit)カード(メモリカードを含む)、光カード、マスクROM、EPROM(Electronically Programmable Read-Only Memory)、EEPROM(Electronically Erasable Programmable Read-Only Memory)、フラッシュROMなどの半導体メモリ等の固定的にプログラムを担持する媒体でもよい。記録媒体430は、プログラム等をコンピュータが読取可能な一時的でない媒体である。 The recording medium 430 is not limited to DVD-ROM, CD-ROM, FD (Flexible Disk), and hard disk, but also magnetic tape, cassette tape, optical disc (MO (Magnetic Optical Disc) / MD (Mini Disc) / DVD (Digital Versatile). Semiconductor memory such as Disc)), IC (Integrated Circuit) card (including memory card), optical card, mask ROM, EPROM (Electronically Programmable Read-Only Memory), EEPROM (Electronically Erasable Programmable Read-Only Memory), flash ROM, etc. It may be a medium that carries the program in a fixed manner such as. The recording medium 430 is a non-temporary medium in which a computer can read a program or the like.

<D.合焦位置の探索方法>
合焦位置は、例えば以下の第1~第4の探索方法のいずれかを用いて探索される。
<D. How to search for the in-focus position>
The in-focus position is searched using, for example, one of the following first to fourth search methods.

<D-1.第1の探索方法>
第1の探索方法は、レンズモジュール12の焦点位置を設定された探索範囲内で変化させながら、合焦度が極大となる焦点位置を見つけた時点で探索を終了し、合焦度が極大となる焦点位置を合焦位置として決定する方法である。第1の探索方法では、レンズモジュール12の焦点位置は、予め定められた最小変化幅Δf0ずつ変化する。
<D-1. First search method>
In the first search method, while changing the focal position of the lens module 12 within the set search range, the search ends when the focal position at which the in-focus degree is maximized is found, and the in-focus degree is maximized. This is a method of determining the focal position as the in-focus position. In the first search method, the focal position of the lens module 12 changes by a predetermined minimum change width Δf0.

具体的には、指令生成部21は、レンズモジュール12の焦点位置が探索範囲の一端から他端に向けて最小変化幅Δf0ずつ変化するように、順次撮像指令を生成する。探索部23は、先の焦点位置での合焦度と次の焦点位置での合焦度との差を順次演算し、この差が正からゼロまたは負に変化した時点の焦点位置を合焦位置として決定する合焦位置決定処理を実行する。 Specifically, the command generation unit 21 sequentially generates an imaging command so that the focal position of the lens module 12 changes by the minimum change width Δf0 from one end to the other end of the search range. The search unit 23 sequentially calculates the difference between the in-focus degree at the previous focal position and the in-focus degree at the next focal position, and focuses the focal position at the time when this difference changes from positive to zero or negative. The in-focus position determination process for determining the position is executed.

なお、ノイズによる誤動作を避けるために、探索部23は、予め定められた条件を満たす場合に合焦位置決定処理を実行することが好ましい。予め定められた条件は、例えば、合焦度がノイズレベルに応じて定められた基準値を超えているという条件、もしくは、先の焦点位置での合焦度と次の焦点位置での合焦度との差が複数回連続して増大しているという条件である。または、探索部23は、合焦位置決定処理において、連続する3つ以上の焦点位置の合焦度を用いて、合焦度が極大となる合焦位置を探索してもよい。 In order to avoid malfunction due to noise, it is preferable that the search unit 23 executes the focusing position determination process when a predetermined condition is satisfied. The predetermined conditions are, for example, the condition that the degree of focus exceeds the reference value set according to the noise level, or the degree of focus at the previous focal position and the focus at the next focal position. The condition is that the difference from the degree is increasing multiple times in a row. Alternatively, the search unit 23 may search for the in-focus position where the in-focus degree is maximized by using the in-focus degree of three or more consecutive focal positions in the in-focus position determination process.

<D-2.第2の探索方法>
図8~図11を参照して、第2の探索方法について説明する。第2の探索方法は、2段階の探索処理を含む。図8は、第2の探索方法における1段階目の探索処理を説明する図である。図9は、第2の探索方法における2段階目の探索処理の一例を説明する図である。図10は、第2の探索方法における2段階目の探索処理の他の例を説明する図である。図11は、2段階目の探索処理の起点の決定方法を説明する図である。
<D-2. Second search method>
A second search method will be described with reference to FIGS. 8 to 11. The second search method includes a two-step search process. FIG. 8 is a diagram illustrating a first-stage search process in the second search method. FIG. 9 is a diagram illustrating an example of a second-stage search process in the second search method. FIG. 10 is a diagram illustrating another example of the second-stage search process in the second search method. FIG. 11 is a diagram illustrating a method of determining the starting point of the second stage search process.

図8に示されるように、1段階目の探索処理は、レンズモジュール12の焦点位置を探索範囲の一端F0から他端Fnに向けて変化幅Δf1ずつ変化させながら、合焦度が予め定められた閾値Thを超える焦点位置F1を探索する処理である。変化幅Δf1は、最小変化幅Δf0のN倍(Nは2以上の整数)である。1段階目の探索処理は、合焦度が閾値Thを超える焦点位置F1を見つけた時点で終了する。 As shown in FIG. 8, in the first-stage search process, the degree of focus is predetermined while changing the focal position of the lens module 12 from one end F0 to the other end Fn of the search range by a change width Δf1. This is a process of searching for a focal position F1 that exceeds the threshold value Th. The change width Δf1 is N times the minimum change width Δf0 (N is an integer of 2 or more). The search process of the first stage ends when the focal position F1 whose in-focus degree exceeds the threshold value Th is found.

合焦度が閾値を超える焦点位置F1が探索されると、2段階目の探索処理が実行される。2段階目の探索処理は、1段階目の探索処理で探索された焦点位置F1の近傍において焦点位置を最小変化幅Δf0ずつ変化させながら、合焦度が極大となる焦点位置を合焦位置として探索する処理である。 When the focal position F1 whose in-focus degree exceeds the threshold value is searched, the second stage search process is executed. In the second stage search process, the focus position is changed by the minimum change width Δf0 in the vicinity of the focus position F1 searched in the first stage search process, and the focus position where the degree of focus is maximized is set as the focus position. It is a process to search.

例えば図9に示されるように、焦点位置F1を起点として最小変化幅Δf0ずつ焦点位置を変化させながら、合焦度が極大となる合焦位置が探索される。具体的には、まず、焦点位置F1における合焦度と、焦点位置F1から方向D1に最小変化幅Δf0だけ変化させた焦点位置F2における合焦度とが比較される。焦点位置F1における合焦度よりも焦点位置F2における合焦度が大きい場合、方向D1に沿って焦点位置を変化させながら、合焦度が極大となる合焦位置が探索される。焦点位置F1における合焦度よりも焦点位置F2における合焦度が小さい場合、方向D1と反対の方向D2に沿って焦点位置を変化させながら、合焦度が極大となる合焦位置が探索される。 For example, as shown in FIG. 9, the focusing position where the degree of focusing is maximized is searched while changing the focusing position by the minimum change width Δf0 starting from the focal position F1. Specifically, first, the in-focus degree at the focal position F1 is compared with the in-focus degree at the focal position F2 in which the minimum change width Δf0 is changed from the focal position F1 to the direction D1. When the in-focus degree in the focal position F2 is larger than the in-focus degree in the focal position F1, the in-focus position where the in-focus degree is maximized is searched while changing the focal position along the direction D1. When the in-focus degree in the focal position F2 is smaller than the in-focus degree in the focal position F1, the in-focus position where the in-focus degree is maximized is searched while changing the focal position along the direction D2 opposite to the direction D1. To.

検査対象となるワークWの品種が同じであれば、焦点位置の変化に対する合焦度の変化を示す波形(以下、「合焦度波形」という)は、ワークWの個体差に応じて僅かに変動するものの、概ね同じ形状を有する。そのため、サンプルとなる基準ワークに対応する合焦度波形を予め取得しておき、当該合焦度波形におけるピークの形状を考慮して、2段階目の探索処理の起点となる焦点位置が決定されてもよい。具体的には、なるべくピークの頂点に近い焦点位置が2段階目の探索処理の起点として決定される。これにより、2段階目の探索処理に要する時間を短縮できる。 If the work W to be inspected is of the same type, the waveform showing the change in focus with respect to the change in focal position (hereinafter referred to as "focus waveform") is slightly different depending on the individual difference of the work W. Although it varies, it has almost the same shape. Therefore, the focus waveform corresponding to the reference work as a sample is acquired in advance, and the focal position that is the starting point of the second stage search process is determined in consideration of the shape of the peak in the focus waveform. You may. Specifically, the focal position as close to the peak peak as possible is determined as the starting point of the second stage search process. As a result, the time required for the second stage search process can be shortened.

例えば図10に示されるように、焦点位置F1からの距離がWd/2であり、合焦度が閾値Thを超える焦点位置F3が特定される。Wdは、基準ワークの合焦度波形において、連続して合焦度が閾値Thを超える範囲の幅を示す。具体的には、焦点位置F1から方向D1にWd/2だけ変化させた位置の合焦度が閾値Thを超えるか否かが判定される。合焦度が閾値Thを超える場合には、焦点位置F1から方向D1にWd/2だけ変化させた焦点位置が焦点位置F3として特定される。合焦度が閾値Th以下である場合には、焦点位置F1から方向D1の反対の方向D2にWd/2だけ変化させた焦点位置が焦点位置F3として特定される。 For example, as shown in FIG. 10, a focal position F3 whose distance from the focal position F1 is Wd / 2 and whose degree of focus exceeds the threshold value Th is specified. Wd indicates the width of the range in which the in-focus degree continuously exceeds the threshold value Th in the in-focus degree waveform of the reference work. Specifically, it is determined whether or not the in-focus degree of the position changed from the focal position F1 to the direction D1 by Wd / 2 exceeds the threshold value Th. When the degree of focusing exceeds the threshold value Th, the focal position changed from the focal position F1 to the direction D1 by Wd / 2 is specified as the focal position F3. When the degree of focusing is equal to or less than the threshold value Th, the focal position changed from the focal position F1 to the opposite direction D2 of the direction D1 by Wd / 2 is specified as the focal position F3.

次に図11に示されるように、焦点位置F1における合焦度から閾値Thを差し引いた値Saと、焦点位置F3における合焦度から閾値Thを差し引いた値Sbとが算出される。そして、焦点位置F1と焦点位置F3との間に位置し、焦点位置F1からの距離と焦点位置F3からの距離との比がSb:Saとなる焦点位置F4が、2段階目の探索処理の起点として決定される。 Next, as shown in FIG. 11, a value Sa obtained by subtracting the threshold value Th from the in-focus degree at the focal position F1 and a value Sb obtained by subtracting the threshold value Th from the in-focus degree at the focal position F3 are calculated. Then, the focal position F4, which is located between the focal position F1 and the focal position F3 and whose ratio of the distance from the focal position F1 to the distance from the focal position F3 is Sb: Sa, is the second stage search process. Determined as the starting point.

<D-3.第3の探索方法>
第3の探索方法は、2段階の探索処理を含む。1段階目の探索処理は、レンズモジュール12の焦点位置を探索範囲の一端から他端に向けて変化幅Δf1ずつ変化させて探索範囲全域の合焦度を取得し、合焦度が最大となる焦点位置を探索する処理である。
<D-3. Third search method>
The third search method includes a two-step search process. In the first-stage search process, the focal position of the lens module 12 is changed by a change width Δf1 from one end to the other end of the search range to acquire the focus degree of the entire search range, and the focus degree is maximized. This is the process of searching for the focal position.

2段階目の探索処理は、第2の探索方法の2段階目の探索処理と同様に、1段階目の探索処理で探索された焦点位置の近傍において焦点位置を最小変化幅Δf0ずつ変化させながら、合焦度が極大となる焦点位置を合焦位置として探索する処理である。 In the second-stage search process, similarly to the second-stage search process of the second search method, the focal position is changed by the minimum change width Δf0 in the vicinity of the focal position searched in the first-stage search process. This is a process of searching for the focal position where the degree of focusing is maximized as the focusing position.

<D-4.第4の探索方法>
第4の探索方法は、2段階の探索処理を含む。1段階目の探索処理は、レンズモジュール12の焦点位置を探索範囲の一端から他端に向けて変化幅Δf1ずつ変化させて探索範囲の全域の合焦度を取得し、合焦度が予め定められた閾値Thを超える焦点位置を探索する処理である。ただし、合焦度が閾値Thを超える焦点位置が複数探索される場合がある。この場合、1段階目の探索処理は、合焦度が閾値Thを超える複数の焦点位置から1つの焦点位置を選択する処理を含む。
<D-4. Fourth search method>
The fourth search method includes a two-step search process. In the first-stage search process, the focal position of the lens module 12 is changed by a change width Δf1 from one end to the other end of the search range to acquire the focus degree of the entire search range, and the focus degree is predetermined. This is a process of searching for a focal position that exceeds the determined threshold Th. However, there are cases where a plurality of focal positions whose in-focus degree exceeds the threshold value Th are searched. In this case, the first-stage search process includes a process of selecting one focal position from a plurality of focal positions whose in-focus degree exceeds the threshold value Th.

図12は、合焦度が閾値Thを超える複数の焦点位置の一例を示す図である。図12に示す例では、合焦度波形が3つのピークP1~P3を含み、1段階目の探索処理において、ピークP1~P3にそれぞれ対応する焦点位置群G1~G3が探索される。焦点位置群G1~G3の各々は、連続して合焦度が閾値Thを超える焦点位置の集合である。 FIG. 12 is a diagram showing an example of a plurality of focal positions whose in-focus degree exceeds the threshold value Th. In the example shown in FIG. 12, the focus waveform includes three peaks P1 to P3, and in the first-stage search process, the focal position groups G1 to G3 corresponding to the peaks P1 to P3 are searched. Each of the focal position groups G1 to G3 is a set of focal positions whose in-focus degree continuously exceeds the threshold value Th.

1段階目の探索処理において、探索方向Dの上流側から指定番号目の焦点位置群(例えば1番目の焦点位置群G1)に属する焦点位置の中から、合焦度が最も大きい焦点位置が選択される。 In the first-stage search process, the focal position having the highest focusing degree is selected from the focal positions belonging to the focal position group of the designated number (for example, the first focal position group G1) from the upstream side of the search direction D. Will be done.

2段階目の探索処理は、第2の探索方法の2段階目の探索処理と同様に、1段階目の探索処理で探索された焦点位置の近傍において焦点位置を最小変化幅Δf0ずつ変化させながら、合焦度が極大となる焦点位置を合焦位置として探索する処理である。 In the second-stage search process, similarly to the second-stage search process of the second search method, the focal position is changed by the minimum change width Δf0 in the vicinity of the focal position searched in the first-stage search process. This is a process of searching for the focal position where the degree of focusing is maximized as the focusing position.

<E.オートフォーカス処理の条件>
設定装置40の条件設定部43によって設定されるAF処理条件は、以下のE-1~E-5に記されるパラメータのうちの少なくとも1つを含む。これらのパラメータの値によって、AF処理時間が変動する。
<E. Conditions for autofocus processing>
The AF processing condition set by the condition setting unit 43 of the setting device 40 includes at least one of the parameters described in the following E-1 to E-5. The AF processing time varies depending on the values of these parameters.

<E-1.露光時間>
露光時間は、画像におけるワークWの検査対象箇所の明度が検査に適した範囲内になるように適宜設定される。露光時間が短いほど、AF処理時間が短くなる。
<E-1. Exposure time>
The exposure time is appropriately set so that the brightness of the inspection target portion of the work W in the image is within a range suitable for inspection. The shorter the exposure time, the shorter the AF processing time.

<E-2.探索範囲>
探索範囲は、レンズモジュール12の焦点位置が取り得る可動範囲Ra(図4および図5参照)のうち、合焦位置が探索される範囲である。
<E-2. Search range>
The search range is a range in which the in-focus position is searched in the movable range Ra (see FIGS. 4 and 5) that the focal position of the lens module 12 can take.

図13は、撮像装置によるワークWの撮像を模式的に示した図である。図13に示す例のワークWは、透明体(ガラスなど)である。透明体のワークWであるため、ワークWのおもて面および裏面のいずれにも合焦可能である。さらに、ワークWの背景であるステージ90に合焦する可能性もある。このような場合、可動範囲Raの全域で焦点位置を変化させると、合焦度波形に複数のピークが含まれる。 FIG. 13 is a diagram schematically showing the imaging of the work W by the imaging device. The work W of the example shown in FIG. 13 is a transparent body (glass or the like). Since it is a transparent work W, it can be focused on both the front surface and the back surface of the work W. Further, there is a possibility of focusing on the stage 90 which is the background of the work W. In such a case, when the focal position is changed over the entire range of movement Ra, the focus waveform includes a plurality of peaks.

図14は、複数のピークを含む合焦度波形の一例を示す図である。図14には、複数のピークP1~P3を含む合焦度波形が示される。ピークP1がワークWの検査対象箇所に対応する場合において、ピークP2またはピークP3に対応する焦点位置が合焦位置として探索されると、正しく検査することができない。 FIG. 14 is a diagram showing an example of a focus waveform including a plurality of peaks. FIG. 14 shows a focus waveform including a plurality of peaks P1 to P3. When the peak P1 corresponds to the inspection target portion of the work W, if the focal position corresponding to the peak P2 or the peak P3 is searched for as the in-focus position, the inspection cannot be performed correctly.

このような問題を解決するために、可動範囲Raのうちの検査対象箇所に応じた範囲Rcが探索範囲として設定される。探索範囲が小さいほど、AF処理時間が短くなる。 In order to solve such a problem, the range Rc corresponding to the inspection target portion in the movable range Ra is set as the search range. The smaller the search range, the shorter the AF processing time.

<E-3.焦点位置の変化幅>
上記の第2~第4の探索方法では、1段階目の探索処理において、焦点位置を変化幅Δf1ずつ変化させる。変化幅Δf1を大きくすることにより、撮像装置10における撮像回数が減るため、AF処理時間が短くなる。ただし、変化幅Δf1を大きくしすぎると、検査対象箇所に対応するピークが見逃される可能性がある。そのため、検査対象箇所に対応するピークの幅に応じて、変化幅Δf1が設定される。
<E-3. Focus position change width>
In the above-mentioned second to fourth search methods, the focal position is changed by the change width Δf1 in the first stage search process. By increasing the change width Δf1, the number of times of imaging in the image pickup apparatus 10 is reduced, so that the AF processing time is shortened. However, if the change width Δf1 is made too large, the peak corresponding to the inspection target portion may be overlooked. Therefore, the change width Δf1 is set according to the width of the peak corresponding to the inspection target location.

<E-4.合焦位置の探索方向>
上記の第1の探索方法では、合焦度が極大となる焦点位置が探索された時点で、合焦位置の探索が終了する。探索範囲の両端のうち検査対象箇所に合焦する焦点位置に近い側の一端を起点とし、他端を終点とする探索方向に沿って合焦位置を探索することにより、AF処理時間が短くなる。そのため、検査対象箇所に応じて探索方向が設定される。
<E-4. Search direction for focus position>
In the above-mentioned first search method, the search for the in-focus position ends when the focal position where the in-focus degree becomes maximum is searched. The AF processing time is shortened by searching for the in-focus position along the search direction with one end of the search range on the side close to the focal position that focuses on the inspection target point as the starting point and the other end as the ending point. .. Therefore, the search direction is set according to the inspection target location.

上記の第2の探索方法においても、合焦度が閾値Thを超える焦点位置が探索された時点で、1段階目の探索処理が終了する。探索範囲の両端のうち検査対象箇所に合焦する焦点位置に近い側の一端を起点とし、他端を終点とする探索方向に沿って合焦位置を探索することにより、1段階目の探索処理に要する時間が短くなる。そのため、検査対象箇所に応じて、1段階目の探索処理における探索方向が設定される。 Also in the second search method described above, the first-stage search process ends when the focal position whose in-focus degree exceeds the threshold value Th is searched. The first-stage search process is performed by searching for the in-focus position along the search direction with one end of the search range on the side close to the focal position that focuses on the inspection target point as the starting point and the other end as the ending point. The time required for this is shortened. Therefore, the search direction in the first stage search process is set according to the inspection target location.

上記の第3および第4の探索方法では、1段階目の探索処理において、探索範囲の全域が探索される。ただし、2段階目の探索処理では、1段階目の探索処理で探索された焦点位置の近傍において合焦位置が探索される。すなわち、1段階目の探索処理の終了後に、2段階目の探索処理の開始位置(つまり、1段階目の探索処理で探索された焦点位置)まで焦点位置を戻す移行処理が必要となる。探索範囲の両端のうち検査対象箇所に合焦する焦点位置に近い側の一端を終点とし、他端を起点とする探索方向に従って1段階目の探索処理が実行されることにより、移行処理に要する時間が短くなる。そのため、検査対象箇所に応じて、1段階目の探索処理における探索方向が設定される。 In the above-mentioned third and fourth search methods, the entire search range is searched in the first-stage search process. However, in the second-stage search process, the in-focus position is searched in the vicinity of the focal position searched in the first-stage search process. That is, after the end of the first-stage search process, a transition process for returning the focal position to the start position of the second-stage search process (that is, the focal position searched by the first-stage search process) is required. The transition process is required because the first step of the search process is executed according to the search direction starting from the other end of the search range, with one end on the side close to the focal point that focuses on the inspection target point as the end point. The time is shortened. Therefore, the search direction in the first stage search process is set according to the inspection target location.

第4の探索方法では、上述したように、1段階目の探索処理において、探索方向の上流側から指定番号目の焦点位置群に属する焦点位置の中から、合焦度が最も大きい焦点位置が選択される。そのため、探索方向と合わせて、指定番号も設定される。 In the fourth search method, as described above, in the first-stage search process, the focal position having the highest degree of focus is selected from the focal positions belonging to the focal position group of the designated number from the upstream side in the search direction. Be selected. Therefore, the designated number is set together with the search direction.

図15は、第4の探索方法における探索方向と指定番号との設定方法を説明する図である。図15に示す例では、図12と同様の合焦度波形が示される。探索方向として、探索範囲の一端F0を起点とし、他端Fnを終点とする方向D1と、一端F0を終点とし、他端Fnを起点とする方向D2とが設定可能である。ピークP1が検査対象箇所に対応するピークである場合、ピークP1に近い一端F0を終点とする方向D2を探索方向として設定することが好ましい。これにより、移行処理に要する時間が短くなる。方向D2を探索方向として設定された場合、ピークP1は、3番目の焦点位置群として探索される。そのため、指定番号「3」が設定される。 FIG. 15 is a diagram illustrating a method of setting a search direction and a designated number in the fourth search method. In the example shown in FIG. 15, a focus waveform similar to that in FIG. 12 is shown. As the search direction, a direction D1 whose starting point is one end F0 of the search range and whose end point is the other end Fn, and a direction D2 whose end point is one end F0 and whose starting point is the other end Fn can be set. When the peak P1 is a peak corresponding to the inspection target location, it is preferable to set the direction D2 having one end F0 near the peak P1 as the search direction. This shortens the time required for the migration process. When the direction D2 is set as the search direction, the peak P1 is searched as the third focal position group. Therefore, the designated number "3" is set.

<E-5.合焦度の算出対象となる画像領域>
図16は、ワークWの像を含む画像の一例を示す図である。図16に示す例では、画像50の中にワークWの周囲の背景の像も含まれる。この場合、背景部分に合焦した画像が取得される可能性がある。そのため、画像50のうちのワークWの像を含む部分領域A1を、合焦度の算出対象となる画像領域(以下、「合焦度算出領域」という)として設定することが好ましい。これにより、背景部分に合焦した画像が取得される可能性を低減できる。
<E-5. Image area for which the degree of focus is calculated>
FIG. 16 is a diagram showing an example of an image including an image of the work W. In the example shown in FIG. 16, the image 50 also includes an image of the background around the work W. In this case, an image focused on the background portion may be acquired. Therefore, it is preferable to set the partial region A1 including the image of the work W in the image 50 as an image region (hereinafter, referred to as “focus degree calculation region”) for which the focus degree is calculated. This makes it possible to reduce the possibility of acquiring an image in focus on the background portion.

合焦度は、合焦度算出領域の明暗差に依存した値を示す。そのため、印刷されたテキスト部分では合焦度が高くなる。テキスト部分と検査対象箇所との高さが同じである場合には、テキスト部分を含む部分領域A2を合焦度算出領域として設定することにより、検査対象箇所に合焦した画像を得やすくなる。 The in-focus degree indicates a value depending on the difference in brightness in the in-focus degree calculation area. Therefore, the degree of focusing is high in the printed text portion. When the height of the text portion and the inspection target portion are the same, by setting the partial region A2 including the text portion as the in-focus degree calculation region, it becomes easy to obtain an image in focus on the inspection target portion.

合焦度算出領域が設定された場合、合焦度算出部22は、当該合焦度算出領域に基づいて合焦度を算出する。合焦度算出領域のサイズに応じて、合焦度の算出に要する時間が変動する。すなわち、合焦度算出領域のサイズが小さい程、合焦度の算出に要する時間が短くなり、AF処理時間が短くなる。 When the in-focus degree calculation area is set, the in-focus degree calculation unit 22 calculates the in-focus degree based on the in-focus degree calculation area. The time required to calculate the in-focus degree varies depending on the size of the in-focus degree calculation area. That is, the smaller the size of the in-focus degree calculation area, the shorter the time required for calculating the in-focus degree, and the shorter the AF processing time.

<F.処理条件の設定方法>
次に、条件設定部43によるAF処理条件の設定方法について説明する。条件設定部43は、表示装置42に表示された設定画面への入力情報に従って、AF処理条件を設定する。条件設定部43は、時間算出部44によって算出されたAF処理時間を設定画面に表示させることにより、入力情報の入力を支援する。
<F. How to set processing conditions>
Next, a method of setting the AF processing condition by the condition setting unit 43 will be described. The condition setting unit 43 sets AF processing conditions according to the input information on the setting screen displayed on the display device 42. The condition setting unit 43 supports the input of input information by displaying the AF processing time calculated by the time calculation unit 44 on the setting screen.

上述したように、検査対象となるワークWの品種が同じであれば、合焦度波形は、ワークWの個体差に応じて僅かに変動するものの、概ね同じ形状を有する。そのため、作業者は、予めサンプルとなる基準ワークW0をステージ90上に設置しておく。そして、条件設定部43は、基準ワークW0に対応する合焦度波形を取得し、当該合焦度波形を表示させることにより、入力情報の入力を支援する。 As described above, if the work W to be inspected is of the same type, the focus waveform has substantially the same shape, although it slightly varies depending on the individual difference of the work W. Therefore, the worker installs the reference work W0 as a sample on the stage 90 in advance. Then, the condition setting unit 43 supports the input of the input information by acquiring the in-focus degree waveform corresponding to the reference work W0 and displaying the in-focus degree waveform.

<F-1.第1および第3の探索方法に対応する設定画面例>
図17は、第1および第3の探索方法に対応する設定画面の一例を示す図である。図17に示す例の設定画面60は、条件設定部43によって表示装置42に表示される。設定画面60は、波形読み取りボタン61と、波形表示領域62と、ピーク選択欄64と、画像表示領域65と、つまみ68,69と、露光時間入力欄71と、変化幅入力欄72と、時間表示欄73と、OKボタン74と、キャンセルボタン75とを含む。
<F-1. Example of setting screen corresponding to the first and third search methods>
FIG. 17 is a diagram showing an example of a setting screen corresponding to the first and third search methods. The setting screen 60 of the example shown in FIG. 17 is displayed on the display device 42 by the condition setting unit 43. The setting screen 60 includes a waveform reading button 61, a waveform display area 62, a peak selection field 64, an image display area 65, knobs 68 and 69, an exposure time input field 71, a change width input field 72, and a time. A display field 73, an OK button 74, and a cancel button 75 are included.

波形読み取りボタン61は、基準ワークW0に対応する合焦度波形を読み取る処理(以下、「スキャン処理」という」を実行するためのボタンである。 The waveform reading button 61 is a button for executing a process of reading a focus waveform corresponding to the reference work W0 (hereinafter, referred to as “scan process””.

波形読み取りボタン61が押下されると、条件設定部43は、スキャン処理の実行指示(以下、「スキャン指示」という)を画像処理装置20に出力する。このとき、条件設定部43は、画像表示領域65に表示される枠線67で囲まれる画像領域(合焦度算出領域)のサイズおよび位置姿勢を示す領域情報と、露光時間入力欄71に入力されている露光時間を示す露光時間情報とをスキャン指示に付加する。なお、起動時には、枠線67は、画像全体を囲むように表示され、露光時間入力欄にはデフォルト値が入力されている。 When the waveform reading button 61 is pressed, the condition setting unit 43 outputs a scan process execution instruction (hereinafter referred to as “scan instruction”) to the image processing device 20. At this time, the condition setting unit 43 inputs the area information indicating the size and position / orientation of the image area (focus degree calculation area) surrounded by the frame line 67 displayed in the image display area 65 and the exposure time input field 71. The exposure time information indicating the exposure time is added to the scan instruction. At the time of startup, the frame line 67 is displayed so as to surround the entire image, and a default value is input in the exposure time input field.

スキャン指示を受けた画像処理装置20において、指令生成部21は、可動範囲Raの全域において焦点位置を最小変化幅Δf0ずつ変化させ、各焦点位置の画像を撮像装置10から受けるように、撮像指令を生成する。すなわち、指令生成部21は、可動範囲Raの一端に対応する焦点位置を指定した撮像指令を生成した後、最小変化幅Δf0ずつ変化させた焦点位置を指定した撮像指令を順次生成する。このとき、指令生成部21は、露光時間情報で示される露光時間だけ撮像するように撮像指令を生成する。これにより、画像処理装置20は、可動範囲Raの全域の各焦点位置の画像を撮像装置10から取得する。画像処理装置20の合焦度算出部22は、各焦点位置の画像について、領域情報で示される合焦度算出領域の合焦度を算出する。画像処理装置20は、可動範囲Raの全域における最小変化幅Δf0間隔に複数の焦点位置の各々について、当該焦点位置と合焦度とを対応付けたスキャン結果を設定装置40に出力する。 In the image processing device 20 that has received the scan instruction, the command generation unit 21 changes the focal position by the minimum change width Δf0 over the entire range of Ra, and orders the image to receive an image of each focal position from the image pickup device 10. To generate. That is, the command generation unit 21 sequentially generates an imaging command that specifies the focal position corresponding to one end of the movable range Ra, and then sequentially generates an imaging command that specifies the focal position that is changed by the minimum change width Δf0. At this time, the command generation unit 21 generates an image pickup command so as to take an image only for the exposure time indicated by the exposure time information. As a result, the image processing device 20 acquires an image of each focal position in the entire range of the movable range Ra from the image pickup device 10. The in-focus degree calculation unit 22 of the image processing device 20 calculates the in-focus degree of the in-focus degree calculation region indicated by the area information for the image of each focal position. The image processing device 20 outputs to the setting device 40 a scan result in which the focal position and the degree of focus are associated with each of the plurality of focal positions at the minimum change width Δf0 interval in the entire range of the movable range Ra.

波形表示領域62は、基準ワークW0に対応する合焦度波形63が表示される。合焦度波形63は、折れ線グラフで表される。条件設定部43は、画像処理装置20から受けたスキャン結果に基づいて合焦度波形63を生成し、生成した合焦度波形63を波形表示領域62に表示させる。 In the waveform display area 62, the focus waveform 63 corresponding to the reference work W0 is displayed. The focus waveform 63 is represented by a line graph. The condition setting unit 43 generates an in-focus degree waveform 63 based on the scan result received from the image processing device 20, and displays the generated in-focus degree waveform 63 in the waveform display area 62.

ピーク選択欄64は、基準ワークW0の検査対象箇所に対応するピークを選択するための入力欄である。条件設定部43は、合焦度波形63のピークとなる焦点位置(以下、「ピーク位置」という)を抽出する。例えば、条件設定部43は、合焦度が基準値を超え、かつ、合焦度が極大となる焦点位置をピーク位置として抽出する。条件設定部43は、抽出したピーク位置を示す記号を波形表示領域62に表示する。図17に示す例では、3つのピーク位置にそれぞれ対応する3つの記号「(1)」、「(2)」および「(3)」が表示される。ピーク選択欄64には、抽出された3つのピーク位置のうち選択した1つのピーク位置に対応する記号が入力される。 The peak selection field 64 is an input field for selecting a peak corresponding to the inspection target portion of the reference work W0. The condition setting unit 43 extracts a focal position (hereinafter, referred to as “peak position”) that is the peak of the focus waveform 63. For example, the condition setting unit 43 extracts the focal position where the degree of focus exceeds the reference value and the degree of focus is maximum as the peak position. The condition setting unit 43 displays a symbol indicating the extracted peak position in the waveform display area 62. In the example shown in FIG. 17, three symbols "(1)", "(2)" and "(3)" corresponding to the three peak positions are displayed. In the peak selection field 64, a symbol corresponding to one selected peak position among the three extracted peak positions is input.

ピーク選択欄64にピーク位置が入力されると、条件設定部43は、撮像指示を画像処理装置20に出力する。このとき、条件設定部43は、ピーク選択欄64に入力されたピーク位置を撮像指示に付加する。 When the peak position is input to the peak selection field 64, the condition setting unit 43 outputs an image pickup instruction to the image processing device 20. At this time, the condition setting unit 43 adds the peak position input to the peak selection field 64 to the imaging instruction.

撮像指示を受けた画像処理装置20において、指令生成部21は、焦点位置をピーク位置に調節して撮像する撮像指令を生成する。撮像装置10は、基準ワークW0を撮像することにより得られる画像(以下、「サンプル画像」という)を画像処理装置20に出力する。これにより、画像処理装置20は、焦点位置がピーク位置に調節されたときのサンプル画像を撮像装置10から取得する。画像処理装置20は、当該画像を設定装置40に出力する。 In the image processing device 20 that has received the image pickup instruction, the command generation unit 21 adjusts the focal position to the peak position and generates an image pickup command for image pickup. The image pickup apparatus 10 outputs an image (hereinafter referred to as “sample image”) obtained by imaging the reference work W0 to the image processing apparatus 20. As a result, the image processing device 20 acquires a sample image when the focal position is adjusted to the peak position from the image pickup device 10. The image processing device 20 outputs the image to the setting device 40.

画像表示領域65は、撮像装置10の撮像によって得られたサンプル画像66を表示するための領域である。条件設定部43は、ピーク選択欄64へのピーク位置の入力に応じて画像処理装置20から受けたサンプル画像66を画像表示領域65に表示させる。これにより、作業者は、画像表示領域65に表示されるサンプル画像66を確認することにより、基準ワークW0の検査対象箇所に合焦するときの焦点位置をピーク位置としてピーク選択欄64に入力できる。 The image display area 65 is an area for displaying the sample image 66 obtained by the image pickup of the image pickup apparatus 10. The condition setting unit 43 displays the sample image 66 received from the image processing device 20 in the image display area 65 in response to the input of the peak position to the peak selection field 64. As a result, the operator can input the focal position when focusing on the inspection target portion of the reference work W0 as the peak position in the peak selection field 64 by checking the sample image 66 displayed in the image display area 65. ..

画像表示領域65には、合焦度算出領域を設定するための枠線67が表示される。作業者は、枠線67のサイズおよび位置姿勢を変更することにより、合焦度算出領域のサイズおよび位置姿勢を設定する。なお、枠線67のサイズおよび位置姿勢が変更されると、条件設定部43は、合焦度算出領域の変更を反映させるために波形読み取りボタン61を押下する必要がある旨のメッセージを設定画面60に表示する。 In the image display area 65, a frame line 67 for setting the focus degree calculation area is displayed. The operator sets the size and position / posture of the in-focus degree calculation area by changing the size and position / posture of the frame line 67. When the size and position / orientation of the frame line 67 are changed, the condition setting unit 43 sets a message to the effect that the waveform reading button 61 needs to be pressed in order to reflect the change in the in-focus degree calculation area. Display at 60.

例えば、作業者は、基準ワークW0における検査対象箇所と同じ高さであり、かつ、コントラストの高い部分を含む領域を囲むように枠線67のサイズおよび位置姿勢を変更する。図17に示す例では、表面に印刷されたテキストを囲むように枠線67のサイズおよび位置姿勢が変更されている。なお、コントラストの高い部分としては、表面に印刷されたテキストの他にも、エッジ部分、ネジなどの部品が取り付けられた部分などが含まれる。 For example, the operator changes the size and position / posture of the frame line 67 so as to surround the area including the inspection target portion in the reference work W0 and having a high contrast portion. In the example shown in FIG. 17, the size and position / orientation of the border 67 are changed so as to surround the text printed on the surface. In addition to the text printed on the surface, the high-contrast portion includes an edge portion, a portion to which parts such as screws are attached, and the like.

図17に示す例では、矩形の枠線67が示されるが、枠線67の形状(つまり合焦度算出領域の形状)はこれに限定されない。例えば、合焦度算出領域は、円形あるいは領域を形成することが可能な任意の自由な形状であってもよい。また、合焦度算出領域は、1つにまとまった領域であると限定される必要はなく、分散して存在する複数の領域であってもよい。 In the example shown in FIG. 17, a rectangular frame line 67 is shown, but the shape of the frame line 67 (that is, the shape of the in-focus degree calculation region) is not limited to this. For example, the focus calculation region may be circular or any free shape capable of forming the region. Further, the focus calculation region does not have to be limited to a single region, and may be a plurality of regions that exist in a dispersed manner.

つまみ68,69は、合焦位置の探索範囲を設定するためのつまみである。波形表示領域62には、探索範囲の一端となる焦点位置に対応する点線68aと、探索範囲の他端となる焦点位置に対応する点線69aとが表示される。作業者は、つまみ68を移動させることにより、点線68aの位置(つまり探索範囲の一端)を変更することができる。さらに、作業者は、つまみ69を移動させることにより、点線69aの位置(つまり探索範囲の他端)を変更することができる。条件設定部43は、点線68aから点線69aまでの範囲を探索範囲として設定する。 The knobs 68 and 69 are knobs for setting the search range of the in-focus position. In the waveform display area 62, a dotted line 68a corresponding to a focal position at one end of the search range and a dotted line 69a corresponding to the focal position at the other end of the search range are displayed. The operator can change the position of the dotted line 68a (that is, one end of the search range) by moving the knob 68. Further, the operator can change the position of the dotted line 69a (that is, the other end of the search range) by moving the knob 69. The condition setting unit 43 sets the range from the dotted line 68a to the dotted line 69a as the search range.

ラジオボタン70a,70bは、焦点位置の探索方向を設定するためのボタンである。ラジオボタン70aが押下されると、条件設定部43は、点線68aの焦点位置から点線69aの焦点位置に向かう方向を探索方向として設定する。ラジオボタン70bが操作されると、条件設定部43は、点線69aの焦点位置から点線68aの焦点位置に向かう方向を探索方向として設定する。 The radio buttons 70a and 70b are buttons for setting the search direction of the focal position. When the radio button 70a is pressed, the condition setting unit 43 sets the direction from the focal position of the dotted line 68a toward the focal position of the dotted line 69a as the search direction. When the radio button 70b is operated, the condition setting unit 43 sets the direction from the focal position of the dotted line 69a to the focal position of the dotted line 68a as the search direction.

露光時間入力欄71は、露光時間を設定するための入力欄である。作業者は、画像表示領域65に表示されたサンプル画像66を確認しながら、サンプル画像66の明度が検査に適した範囲内になるように露光時間を入力する。起動時には、露光時間入力欄71にはデフォルト値が入力されている。露光時間が変更されると、条件設定部43は、露光時間の変更を反映させるために波形読み取りボタン61を押下する必要がある旨のメッセージを設定画面60に表示する。 The exposure time input field 71 is an input field for setting the exposure time. While checking the sample image 66 displayed in the image display area 65, the operator inputs the exposure time so that the brightness of the sample image 66 is within a range suitable for inspection. At startup, a default value is input in the exposure time input field 71. When the exposure time is changed, the condition setting unit 43 displays a message on the setting screen 60 that the waveform reading button 61 needs to be pressed in order to reflect the change in the exposure time.

変化幅入力欄72は、第3の探索方法の1段階目の探索処理における焦点位置の変化幅Δf1を入力するための欄である。条件設定部43は、変化幅入力欄72に入力された値に基づいて変化幅Δf1を設定する。変化幅入力欄72には、例えば、最小変化幅Δf0に対する倍数Nが入力される。この場合、条件設定部43は、最小変化幅Δf0のN倍を変化幅Δf1として設定する。なお、第1の探索方法に従って合焦位置が探索される場合には、変化幅入力欄72は設定画面60から省略される。 The change width input field 72 is a field for inputting the change width Δf1 of the focal position in the first stage search process of the third search method. The condition setting unit 43 sets the change width Δf1 based on the value input in the change width input field 72. In the change width input field 72, for example, a multiple N with respect to the minimum change width Δf0 is input. In this case, the condition setting unit 43 sets N times the minimum change width Δf0 as the change width Δf1. When the in-focus position is searched according to the first search method, the change width input field 72 is omitted from the setting screen 60.

時間表示欄73は、現時点で設定されているAF処理条件に対応するAF処理時間を表示するための欄である。時間表示欄73に表示されるAF処理時間は、時間算出部44によって算出される。枠線67、つまみ68,69、ラジオボタン70a,70b、露光時間入力欄71、および変化幅入力欄72に対する入力を受け付けるたびに、時間表示欄73のAF処理時間が更新される。 The time display column 73 is a column for displaying the AF processing time corresponding to the AF processing condition currently set. The AF processing time displayed in the time display field 73 is calculated by the time calculation unit 44. The AF processing time in the time display field 73 is updated each time an input is received for the frame line 67, the knobs 68, 69, the radio buttons 70a, 70b, the exposure time input field 71, and the change width input field 72.

OKボタン74は、現時点で設定されているAF処理条件を画像処理装置20に登録するためのボタンである。OKボタン74が押下されると、条件設定部43は、設定画面60への入力情報に基づいて、AF処理条件を示す処理条件データ232を生成する。処理条件データ232は、露光時間、探索範囲、1段階目の探索処理における変化幅Δf1(第3の探索方法に限る)、探索方向、および合焦度算出領域のサイズおよび位置姿勢を示す。条件設定部43は、生成した処理条件データ232を画像処理装置20に出力する。画像処理装置20は、設定装置40から受けた処理条件データ232を記憶部230に格納する。 The OK button 74 is a button for registering the AF processing conditions currently set in the image processing device 20. When the OK button 74 is pressed, the condition setting unit 43 generates the processing condition data 232 indicating the AF processing condition based on the input information on the setting screen 60. The processing condition data 232 indicates the exposure time, the search range, the change width Δf1 (limited to the third search method) in the first-stage search process, the search direction, and the size and position / orientation of the focus calculation region. The condition setting unit 43 outputs the generated processing condition data 232 to the image processing device 20. The image processing device 20 stores the processing condition data 232 received from the setting device 40 in the storage unit 230.

キャンセルボタン75は、AF処理条件の設定処理を中止するためのボタンである。キャンセルボタン75が操作されると、条件設定部43は、設定画面60を閉じ、AF処理条件の設定処理を中止する。 The cancel button 75 is a button for canceling the AF processing condition setting process. When the cancel button 75 is operated, the condition setting unit 43 closes the setting screen 60 and cancels the AF processing condition setting process.

<F-2.第2および第4の探索方法に対応する設定画面例>
図18は、第2および第4の探索方法に対応する設定画面の一例を示す図である。図18に示す例の設定画面60aは、図17に示す例の設定画面60と比較して、変化幅入力欄72の代わりにつまみ76を含む点でのみ相違する。
<F-2. Setting screen example corresponding to the second and fourth search methods>
FIG. 18 is a diagram showing an example of a setting screen corresponding to the second and fourth search methods. The setting screen 60a of the example shown in FIG. 18 is different from the setting screen 60 of the example shown in FIG. 17 only in that the knob 76 is included instead of the change width input field 72.

つまみ76は、第2および第4の探索方法における閾値Thを設定するためのつまみである。波形表示領域62には、閾値Thを示す直線76aが表示される。作業者は、つまみ76を上下させることにより、直線76aの位置(すなわち閾値Th)を変えることができる。 The knob 76 is a knob for setting the threshold value Th in the second and fourth search methods. A straight line 76a indicating the threshold value Th is displayed in the waveform display area 62. The operator can change the position of the straight line 76a (that is, the threshold value Th) by moving the knob 76 up and down.

条件設定部43は、直線76aの位置に応じて閾値Thを設定するとともに、1段階目の探索処理における焦点位置の変化幅Δf1を設定する。 The condition setting unit 43 sets the threshold value Th according to the position of the straight line 76a, and sets the change width Δf1 of the focal position in the first stage search process.

図19は、焦点位置の変化幅Δf1の設定方法を説明する図である。図19に示されるように、条件設定部43は、合焦度波形63において、連続して合焦度が閾値Thを超える焦点位置の区域を特定する。図19に示す例では、合焦度波形63は、合焦度が閾値Thを超える焦点位置の3つの区域R1~R3を有する。区域R1~R3は、ピークP1~P3にそれぞれ対応する。条件設定部43は、区域R1~R3の幅d1~d3をそれぞれ算出する。条件設定部43は、算出された全ての幅d1~d3のうち最小の幅(例えば幅d2)または当該最小の幅よりも所定値だけ小さい幅を変化幅Δf1として設定する。これにより、変化幅Δf1ずつ焦点位置を変化させることにより、区域R1~R3の各々において、少なくとも1つの焦点位置で合焦度が閾値Thを超える。その結果、1段階目の探索処理において、ピークP1~P3を見逃すことを防止できる。 FIG. 19 is a diagram illustrating a method of setting the change width Δf1 of the focal position. As shown in FIG. 19, the condition setting unit 43 continuously identifies an area of the focal position where the in-focus degree exceeds the threshold value Th in the in-focus degree waveform 63. In the example shown in FIG. 19, the focus waveform 63 has three areas R1 to R3 of focal positions where the focus exceeds the threshold Th. Areas R1 to R3 correspond to peaks P1 to P3, respectively. The condition setting unit 43 calculates the widths d1 to d3 of the areas R1 to R3, respectively. The condition setting unit 43 sets the minimum width (for example, the width d2) of all the calculated widths d1 to d3 or the width smaller than the minimum width by a predetermined value as the change width Δf1. As a result, by changing the focal position by the change width Δf1, the in-focus degree exceeds the threshold value Th at at least one focal position in each of the areas R1 to R3. As a result, it is possible to prevent the peaks P1 to P3 from being overlooked in the first stage search process.

第4の探索方法では、上述したように、2段階目の探索処理において、探索方向Dの上流側から指定番号目の焦点位置群に属する焦点位置の中から、合焦度が最も大きい焦点位置が選択される(図12参照)。第4の探索方法に従って合焦位置が探索される場合には、条件設定部43は、ラジオボタン70a,70bに対する押下と、ピーク選択欄64への入力とに従って、探索方向を設定するとともに指定番号も設定すればよい。 In the fourth search method, as described above, in the second stage search process, the focal position having the highest degree of focus is among the focal positions belonging to the focal position group of the designated number from the upstream side of the search direction D. Is selected (see FIG. 12). When the in-focus position is searched according to the fourth search method, the condition setting unit 43 sets the search direction and the designated number according to the pressing of the radio buttons 70a and 70b and the input to the peak selection field 64. Can also be set.

例えば、図18に示す例では、点線68aの焦点位置から点線69aの焦点位置に向かう方向を探索方向を選択するラジオボタン70aが押下され、かつ、点線68aに最も近いピーク位置に対応する記号「(1)」がピーク選択欄64に入力されている。言い換えると、図19に示す区域R1~R3のうち区域R1が指定されている。そのため、条件設定部43は、指定番号「1」を設定する。 For example, in the example shown in FIG. 18, the radio button 70a for selecting the search direction from the focal position of the dotted line 68a toward the focal position of the dotted line 69a is pressed, and the symbol "corresponding to the peak position closest to the dotted line 68a". (1) ”is entered in the peak selection field 64. In other words, of the areas R1 to R3 shown in FIG. 19, the area R1 is designated. Therefore, the condition setting unit 43 sets the designated number “1”.

OKボタン74が押下されると、条件設定部43は、入力情報に基づいて、露光時間、探索範囲、1段階目の探索処理における変化幅Δf1、探索方向、閾値Th、指定番号および合焦度算出領域のサイズおよび位置姿勢を示す処理条件データ232を生成する。 When the OK button 74 is pressed, the condition setting unit 43 sets the exposure time, the search range, the change width Δf1 in the first stage search process, the search direction, the threshold value Th, the designated number, and the focus degree based on the input information. The processing condition data 232 indicating the size and position / orientation of the calculation area is generated.

<G.処理時間の算出方法>
次に、時間算出部44によるAF処理時間の算出方法について説明する。
<G. Processing time calculation method>
Next, a method of calculating the AF processing time by the time calculation unit 44 will be described.

<G-1.第1の探索方法に従ったAF処理時間の算出方法>
合焦位置の探索は、1つの焦点位置における撮像処理、撮像により得られた画像から合焦度を算出する合焦度算出処理および次の焦点位置にレンズモジュール12を調節する調節処理を繰り返すことにより実行される。そのため、時間算出部44は、以下の式(2)に従って算出された時間TをAF処理時間として決定する。式(2)において、撮像時間は、1回の撮像処理に要する時間である。画像処理時間は、1回の合焦度算出処理に要する時間である。調節時間は、1回の調節処理に要する時間である。
<G-1. AF processing time calculation method according to the first search method>
The search for the in-focus position is performed by repeating an imaging process at one focal position, an in-focus degree calculation process for calculating the in-focus degree from an image obtained by imaging, and an adjustment process for adjusting the lens module 12 to the next focal position. Is executed by. Therefore, the time calculation unit 44 determines the time T calculated according to the following equation (2) as the AF processing time. In the formula (2), the imaging time is the time required for one imaging process. The image processing time is the time required for one focusing degree calculation process. The adjustment time is the time required for one adjustment process.

Figure 0007087984000001
Figure 0007087984000001

撮像時間は、露光時間と、撮像装置10から画像処理装置20に画像を転送する時間(以下、「画像転送時間」という)との和である。画像転送時間は、予め実験等により確認される。時間算出部44は、予め確認された画像転送時間を記憶しておき、当該画像転送時間に露光時間入力欄71に入力された露光時間を加算することにより、撮像時間を算出する。 The image pickup time is the sum of the exposure time and the time for transferring an image from the image pickup device 10 to the image processing device 20 (hereinafter referred to as "image transfer time"). The image transfer time is confirmed in advance by an experiment or the like. The time calculation unit 44 stores the image transfer time confirmed in advance, and calculates the imaging time by adding the exposure time input in the exposure time input field 71 to the image transfer time.

画像処理時間は、合焦度算出領域に含まれる画素数に比例する。基準画素数を有する画像領域から合焦度を算出するのに要する時間(以下、「基準算出時間」)は、予め実験等により確認される。時間算出部44は、予め確認された基準算出時間を記憶しておき、基準画素数に対する合焦度算出領域に含まれる画素数の比率を当該基準算出時間に乗じることにより、画像処理時間を算出する。 The image processing time is proportional to the number of pixels included in the focus calculation area. The time required to calculate the in-focus degree from the image region having the reference pixel number (hereinafter, “reference calculation time”) is confirmed in advance by an experiment or the like. The time calculation unit 44 stores the reference calculation time confirmed in advance, and calculates the image processing time by multiplying the reference calculation time by the ratio of the number of pixels included in the in-focus degree calculation area to the reference pixel number. do.

調節時間は、焦点位置の変化幅に比例する。最小変化幅Δf0だけ焦点位置を変化させるのに要する時間(以下、「基準移動時間」という)は、予め実験等により確認される。時間算出部44は、予め確認された基準移動時間を調節時間とする。 The adjustment time is proportional to the change width of the focal position. The time required to change the focal position by the minimum change width Δf0 (hereinafter referred to as “reference movement time”) is confirmed in advance by an experiment or the like. The time calculation unit 44 sets the reference movement time confirmed in advance as the adjustment time.

焦点位置を変化させる回数nは、探索範囲に依存する。時間算出部44は、設定画面中の点線68aから点線69aまでの距離を最小変化幅Δf0で除算することにより、回数nを算出する。 The number of times n to change the focal position depends on the search range. The time calculation unit 44 calculates the number of times n by dividing the distance from the dotted line 68a to the dotted line 69a in the setting screen by the minimum change width Δf0.

時間算出部44は、上記のようにして算出した撮像時間、画像処理時間、調節時間および回数nを上記の式(1)に代入することにより時間Tを算出し、算出した時間TをAF処理時間として決定する。 The time calculation unit 44 calculates the time T by substituting the imaging time, the image processing time, the adjustment time, and the number of times n calculated as described above into the above equation (1), and the calculated time T is AF processed. Determined as time.

<G-2.第2の探索方法に従った処理時間の算出方法>
第2の探索方法では、1段階目の探索処理と2段階目の探索処理とが行なわれる。そのため、時間算出部44は、1段階目の探索処理に要する時間と、2段階目の探索処理に要する時間との和をAF処理時間として算出する。
<G-2. Calculation method of processing time according to the second search method>
In the second search method, the first-stage search process and the second-stage search process are performed. Therefore, the time calculation unit 44 calculates the sum of the time required for the first-stage search process and the time required for the second-stage search process as the AF processing time.

時間算出部44は、上記の式(1)を用いて、1段階目の探索処理に要する時間および2段階目の探索処理に要する時間の各々を算出すればよい。 The time calculation unit 44 may calculate each of the time required for the first-stage search process and the time required for the second-stage search process using the above equation (1).

1段階目の探索処理に要する時間は、以下のようにして算出される。1段階目の探索処理では、変化幅Δf1ずつ焦点位置が変化する。 The time required for the first stage search process is calculated as follows. In the first stage search process, the focal position changes by the change width Δf1.

図20は、変化幅Δf1と最小変化幅Δf0との関係を示す図である。変化幅Δf1は、最小変化幅Δf0のN倍(Nは正の整数)である。図20に示す例では、Nは3である。時間算出部44は、基準移動時間にNを乗じることにより調節時間を算出する。 FIG. 20 is a diagram showing the relationship between the change width Δf1 and the minimum change width Δf0. The change width Δf1 is N times the minimum change width Δf0 (N is a positive integer). In the example shown in FIG. 20, N is 3. The time calculation unit 44 calculates the adjustment time by multiplying the reference movement time by N.

また、時間算出部44は、合焦度波形63に基づいて、探索範囲の起点となる焦点位置から合焦度が閾値Thを最初に超える焦点位置までの距離を変化幅Δf1で除算した値を回数nとして算出する。時間算出部44は、ラジオボタン70aが押下された場合、波形表示領域62に表示される点線68aに対応する位置を探索範囲の起点として特定する。時間算出部44は、ラジオボタン70bが押下された場合、波形表示領域62に表示される点線69aに対応する位置を探索範囲の起点として特定する。さらに、時間算出部44は、合焦度波形63において、探索範囲の起点から探索方向に変化幅Δf1ずつ変化させたときに合焦度が最初に閾値Thを超える焦点位置(以下、「1段階目の探索位置」という)を特定する。時間算出部44は、特定したこれらの焦点位置に基づいて、回数nを算出する。 Further, the time calculation unit 44 divides the distance from the focal position, which is the starting point of the search range, to the focal position where the in-focus degree first exceeds the threshold Th by the change width Δf1 based on the in-focus degree waveform 63. Calculated as the number of times n. When the radio button 70a is pressed, the time calculation unit 44 specifies the position corresponding to the dotted line 68a displayed in the waveform display area 62 as the starting point of the search range. When the radio button 70b is pressed, the time calculation unit 44 specifies the position corresponding to the dotted line 69a displayed in the waveform display area 62 as the starting point of the search range. Further, in the focusing degree waveform 63, the time calculation unit 44 sets the focal position where the focusing degree first exceeds the threshold value Th when the change width Δf1 is changed in the search direction from the starting point of the search range (hereinafter, “1 step”). The search position of the eye ") is specified. The time calculation unit 44 calculates the number of times n based on these specified focal positions.

1段階目の探索処理における撮像時間および画像処理時間は、<G-1.第1の探索方法に従った処理時間の算出方法>で説明した方法により算出される。 The imaging time and image processing time in the first stage search processing are <G-1. Calculation method of processing time according to the first search method> Calculated by the method described in.

時間算出部44は、上記のようにして算出した撮像時間、画像処理時間、調節時間および回数nを上記の式(2)に代入することにより時間Tを算出し、算出した時間Tを1段階目の探索処理に要する時間として決定する。 The time calculation unit 44 calculates the time T by substituting the imaging time, the image processing time, the adjustment time, and the number of times n calculated as described above into the above equation (2), and the calculated time T is set in one step. It is determined as the time required for the eye search process.

2段階目の探索処理に要する時間は、以下のようにして算出される。すなわち、時間算出部44は、1段階目の探索位置からピーク選択欄64に入力されたピーク位置までの距離を最小変化幅Δf0で除算した値を回数nとして算出する。 The time required for the second stage search process is calculated as follows. That is, the time calculation unit 44 calculates the value obtained by dividing the distance from the search position in the first stage to the peak position input in the peak selection field 64 by the minimum change width Δf0 as the number of times n.

2段階目の探索処理における撮像時間、画像処理時間および調節時間は、<G-1.第1の探索方法に従った処理時間の算出方法>で説明した方法により算出される。 The imaging time, image processing time, and adjustment time in the second stage search processing are <G-1. Calculation method of processing time according to the first search method> Calculated by the method described in.

時間算出部44は、上記のようにして算出した撮像時間、画像処理時間、調節時間および回数nを上記の式(2)に代入することにより時間Tを算出し、算出した時間Tを2段階目の探索処理に要する時間として決定する。 The time calculation unit 44 calculates the time T by substituting the imaging time, the image processing time, the adjustment time, and the number of times n calculated as described above into the above equation (2), and the calculated time T is set in two steps. It is determined as the time required for the eye search process.

<G-3.第3の探索方法に従った処理時間の算出方法>
第3の探索方法でも、1段階目の探索処理と2段階目の探索処理とが行なわれる。さらに、第3の探索方法では、1段階目の探索処理から2段階目の探索処理に移行するまでの間に、焦点位置を移動させる移行処理が必要となる。そのため、時間算出部44は、1段階目の探索処理に要する時間と2段階目の探索処理に要する時間と移行処理に要する時間との和をAF処理時間として算出する。
<G-3. Calculation method of processing time according to the third search method>
Also in the third search method, the first-stage search process and the second-stage search process are performed. Further, in the third search method, a transition process for moving the focal position is required between the transition from the first-stage search process to the second-stage search process. Therefore, the time calculation unit 44 calculates the sum of the time required for the first stage search processing, the time required for the second stage search processing, and the time required for the transition processing as the AF processing time.

時間算出部44は、上記の式(2)を用いて、1段階目の探索処理に要する時間および2段階目の探索処理に要する時間の各々を算出すればよい。 The time calculation unit 44 may calculate each of the time required for the first-stage search process and the time required for the second-stage search process using the above equation (2).

1段階目の探索処理に要する時間は、以下のようにして算出される。1段階目の探索処理では、変化幅Δf1ずつ焦点位置が変化する。変化幅Δf1は、最小変化幅Δf0のN倍である。時間算出部44は、基準移動時間にNを乗じることにより調節時間を算出する。 The time required for the first stage search process is calculated as follows. In the first stage search process, the focal position changes by the change width Δf1. The change width Δf1 is N times the minimum change width Δf0. The time calculation unit 44 calculates the adjustment time by multiplying the reference movement time by N.

また、時間算出部44は、点線68aに対応する焦点位置から点線69aに対応する焦点位置までの距離(つまり、探索範囲の幅)を変化幅Δf1で除算した値を回数nとして算出する。 Further, the time calculation unit 44 calculates the value obtained by dividing the distance (that is, the width of the search range) from the focal position corresponding to the dotted line 68a to the focal position corresponding to the dotted line 69a by the change width Δf1 as the number of times n.

1段階目の探索処理における撮像時間および画像処理時間は、<G-1.第1の探索方法に従った処理時間の算出方法>で説明した方法により算出される。 The imaging time and image processing time in the first stage search processing are <G-1. Calculation method of processing time according to the first search method> Calculated by the method described in.

時間算出部44は、上記のようにして算出した撮像時間、画像処理時間、調節時間および回数nを上記の式(2)に代入することにより時間Tを算出し、算出した時間Tを1段階目の探索処理に要する時間として決定する。 The time calculation unit 44 calculates the time T by substituting the imaging time, the image processing time, the adjustment time, and the number of times n calculated as described above into the above equation (2), and the calculated time T is set in one step. It is determined as the time required for the eye search process.

2段階目の探索処理に要する時間は、以下のようにして算出される。すなわち、時間算出部44は、合焦度波形63において、探索範囲の起点から探索方向に変化幅Δf1ずつ変化させたときに合焦度が最大となる焦点位置(1段階目の探索位置)を特定する。時間算出部44は、1段階目の探索位置からピーク選択欄64に入力されたピーク位置までの距離を最小変化幅Δf0で除算した値を回数nとして算出する。 The time required for the second stage search process is calculated as follows. That is, the time calculation unit 44 sets the focal position (first stage search position) at which the focus degree is maximum when the change width Δf1 is changed in the search direction from the starting point of the search range in the focus degree waveform 63. Identify. The time calculation unit 44 calculates the value obtained by dividing the distance from the search position in the first stage to the peak position input in the peak selection field 64 by the minimum change width Δf0 as the number of times n.

2段階目の探索処理における撮像時間、画像処理時間および調節時間は、<G-1.第1の探索方法に従った処理時間の算出方法>で説明した方法により算出される。 The imaging time, image processing time, and adjustment time in the second stage search processing are <G-1. Calculation method of processing time according to the first search method> Calculated by the method described in.

時間算出部44は、上記のようにして算出した撮像時間、画像処理時間、調節時間および回数nを上記の式(2)に代入することにより時間Tを算出し、算出した時間Tを2段階目の探索処理に要する時間として決定する。 The time calculation unit 44 calculates the time T by substituting the imaging time, the image processing time, the adjustment time, and the number of times n calculated as described above into the above equation (2), and the calculated time T is set in two steps. It is determined as the time required for the eye search process.

移行処理に要する時間は、以下のようにして算出される。すなわち、時間算出部44は、探索範囲の終点から1段階目の探索位置までの距離を最小変化幅Δf0で除算した値Kを算出する。時間算出部44は、基準移動時間にKを乗じることにより、移行処理に要する時間を算出する。 The time required for the migration process is calculated as follows. That is, the time calculation unit 44 calculates the value K obtained by dividing the distance from the end point of the search range to the search position of the first stage by the minimum change width Δf0. The time calculation unit 44 calculates the time required for the transition process by multiplying the reference travel time by K.

<G-4.第4の探索方法に従った処理時間の算出方法>
第4の探索方法では、1段階目の探索処理と2段階目の探索処理とが行なわれる。第4の探索方法でも、1段階目の探索処理から2段階目の探索処理に移行するまでの間に、焦点位置を移動させる移行処理が必要となる。そのため、時間算出部44は、1段階目の探索処理に要する時間と2段階目の探索処理に要する時間と移行処理に要する時間との和をAF処理時間として算出する。
<G-4. Calculation method of processing time according to the fourth search method>
In the fourth search method, the first-stage search process and the second-stage search process are performed. Also in the fourth search method, a transition process for moving the focal position is required between the transition from the first-stage search process to the second-stage search process. Therefore, the time calculation unit 44 calculates the sum of the time required for the first stage search processing, the time required for the second stage search processing, and the time required for the transition processing as the AF processing time.

時間算出部44は、<G-3.第3の探索方法に従った処理時間の算出方法>に説明した方法と同じ方法により、1段階目の探索処理に要する時間を算出する。なお、第4の探索方法では、1段階目の探索処理は、探索方向の上流側から指定番号目の焦点位置群に属する焦点位置の中から、合焦度が最も大きい焦点位置を選択する処理を含む。しかしながら、当該選択する処理は、CPU401による比較的簡易な演算処理である。そのため、当該選択する処理に要する時間は、無視される。 The time calculation unit 44 is <G-3. Calculation method of processing time according to the third search method> The time required for the first stage search processing is calculated by the same method as described in. In the fourth search method, the first-stage search process is a process of selecting the focal position having the highest degree of focus from the focal positions belonging to the focal position group of the designated number from the upstream side in the search direction. including. However, the selected process is a relatively simple arithmetic process by the CPU 401. Therefore, the time required for the selected process is ignored.

2段階目の探索処理に要する時間は、以下のようにして算出される。すなわち、時間算出部44は、合焦度波形63において、探索範囲の起点から探索方向に変化幅Δf1ずつ焦点位置を変化させたときに、ピーク選択欄64に入力されたピーク位置に最も近くなる焦点位置(1段階目の探索位置)を特定する。1段階目の探索位置は、ピーク位置と同一であってもよい。時間算出部44は、1段階目の探索位置からピーク選択欄64に入力されたピーク位置までの距離を最小変化幅Δf0で除算した値を回数nとして算出する。 The time required for the second stage search process is calculated as follows. That is, when the focus position is changed by the change width Δf1 from the starting point of the search range to the search direction in the focus waveform 63, the time calculation unit 44 becomes closest to the peak position input to the peak selection field 64. Specify the focal position (search position of the first stage). The search position in the first stage may be the same as the peak position. The time calculation unit 44 calculates the value obtained by dividing the distance from the search position in the first stage to the peak position input in the peak selection field 64 by the minimum change width Δf0 as the number of times n.

2段階目の探索処理における撮像時間、算出時間および調節時間は、<G-1.第1の探索方法に従った処理時間の算出方法>で説明した方法により算出される。 The imaging time, calculation time, and adjustment time in the second stage search process are <G-1. Calculation method of processing time according to the first search method> Calculated by the method described in.

時間算出部44は、上記のようにして算出した撮像時間、画像処理時間、調節時間および回数nを上記の式(2)に代入することにより時間Tを算出し、算出した時間Tを2段階目の探索処理に要する時間として決定する。 The time calculation unit 44 calculates the time T by substituting the imaging time, the image processing time, the adjustment time, and the number of times n calculated as described above into the above equation (2), and the calculated time T is set in two steps. It is determined as the time required for the eye search process.

移行処理に要する時間は、以下のようにして算出される。すなわち、時間算出部44は、探索範囲の終点から1段階目の探索位置までの距離を最小変化幅Δf0で除算した値Kを算出する。時間算出部44は、基準移動時間にKを乗じることにより、移行処理に要する時間を算出する。 The time required for the migration process is calculated as follows. That is, the time calculation unit 44 calculates the value K obtained by dividing the distance from the end point of the search range to the search position of the first stage by the minimum change width Δf0. The time calculation unit 44 calculates the time required for the transition process by multiplying the reference travel time by K.

<H.AF処理条件に従ったオートフォーカス処理の実行>
画像処理装置20および撮像装置10は、以下のようにして、AF処理条件に従ってオートフォーカス処理を実行する。
<H. Execution of autofocus processing according to AF processing conditions>
The image processing device 20 and the image pickup device 10 execute the autofocus process according to the AF processing conditions as follows.

画像処理装置20の指令生成部21は、AF処理条件データで示される露光時間で撮像する撮像指令を生成する。 The command generation unit 21 of the image processing device 20 generates an image pickup command for imaging at the exposure time indicated by the AF processing condition data.

さらに、指令生成部21は、AF処理条件データで示される探索範囲、探索方向および変化幅Δf1に基づいて、各撮像指令における焦点位置を決定する。例えば、第2~第4の探索方法の場合、1段階目の探索処理において、指令生成部21は、探索範囲および探索方向に基づいて、起点となる焦点位置を指定した撮像指令を生成する。その後、指令生成部21は、直近の撮像指令に応じて取得した画像の合焦度が算出された後、前回指定した焦点位置から変化幅Δf1だけ探索方向に移動させた焦点位置を指定した撮像指令を生成する。 Further, the command generation unit 21 determines the focal position in each imaging command based on the search range, the search direction, and the change width Δf1 indicated by the AF processing condition data. For example, in the case of the second to fourth search methods, in the first stage search process, the command generation unit 21 generates an imaging command that specifies a focal position as a starting point based on the search range and the search direction. After that, the command generation unit 21 calculates the in-focus degree of the image acquired in response to the latest imaging command, and then performs imaging by designating the focal position moved in the search direction by the change width Δf1 from the previously specified focal position. Generate a command.

2段階目の探索処理において、指令生成部21は、1段階目の探索処理で探索された焦点位置から最小変化幅Δf0だけ移動させた焦点位置を指定した撮像指令を生成する。探索部23は、1段階目の探索処理で探索された焦点位置の合焦度と、1段階目の探索処理で探索された焦点位置から最小変化幅Δf0だけ移動させた焦点位置の合焦度との比較により探索方向を決定する。その後、指令生成部21は、前回指定した焦点位置から最小変化幅Δf0だけ探索方向に移動させた焦点位置を指定した撮像指令を生成する。 In the second-stage search process, the command generation unit 21 generates an imaging command that specifies the focal position moved by the minimum change width Δf0 from the focal position searched in the first-stage search process. The search unit 23 has the in-focus degree of the focal position searched in the first-stage search process and the in-focus degree of the focal position moved by the minimum change width Δf0 from the focal position searched in the first-stage search process. The search direction is determined by comparison with. After that, the command generation unit 21 generates an imaging command specifying the focal position moved in the search direction by the minimum change width Δf0 from the previously designated focal position.

第1の探索方法の場合、指令生成部21は、探索範囲および探索方向に基づいて、起点となる焦点位置を指定した撮像指令を生成する。その後、指令生成部21は、前回指定した焦点位置から最小変化幅Δf0だけ探索方向に移動させた焦点位置を指定した撮像指令を生成する。 In the case of the first search method, the command generation unit 21 generates an imaging command that specifies a focal position as a starting point based on the search range and the search direction. After that, the command generation unit 21 generates an imaging command specifying the focal position moved in the search direction by the minimum change width Δf0 from the previously designated focal position.

画像処理装置20の合焦度算出部22は、AF処理条件データで示される合焦度算出領域から合焦度を算出する。 The in-focus degree calculation unit 22 of the image processing apparatus 20 calculates the in-focus degree from the in-focus degree calculation area indicated by the AF processing condition data.

第4の探索方法の1段階目の探索処理において、画像処理装置20の探索部23は、合焦度算出部22によって算出された合焦度と、AF処理条件データで示される探索方向および指定番号とに基づいて、1つの焦点位置を探索する。 In the search process of the first stage of the fourth search method, the search unit 23 of the image processing device 20 has the in-focus degree calculated by the in-focus degree calculation unit 22 and the search direction and designation indicated by the AF processing condition data. Search for one focal position based on the number.

<I.変形例>
<I-1.変形例1>
上記の説明では、時間算出部44は、基準ワークW0に対応する合焦度波形63に基づいて、第2~第4の探索方法における2段階目の探索処理に要する時間を算出するものとした。しかしながら、2段階目の探索処理では、ワークWの状態において、焦点位置を変化させる回数nが変動する。そのため、予め実験等により、2段階目の探索処理において焦点位置を変化させる平均回数が確認されてもよい。時間算出部44は、当該平均回数を予め記憶しておき、当該平均回数を上記の式(1)のnに代入することにより、これらの探索処理に要する時間を算出すればよい。
<I. Modification example>
<I-1. Modification 1>
In the above description, the time calculation unit 44 calculates the time required for the second stage search process in the second to fourth search methods based on the focus waveform 63 corresponding to the reference work W0. .. However, in the second stage search process, the number of times n for changing the focal position varies in the state of the work W. Therefore, the average number of times the focal position is changed in the second stage search process may be confirmed in advance by an experiment or the like. The time calculation unit 44 may calculate the time required for these search processes by storing the average number of times in advance and substituting the average number of times into n in the above equation (1).

もしくは、1段階目の探索処理に要する時間に比べて、2段階目の探索処理に要する時間がわずかである場合には、時間算出部44は、2段階目の探索処理に要する時間を固定時間としてAF処理時間を算出してもよい。固定時間は、予め実験等により確認される。 Alternatively, when the time required for the second-stage search process is shorter than the time required for the first-stage search process, the time calculation unit 44 sets the time required for the second-stage search process as a fixed time. The AF processing time may be calculated as. The fixed time is confirmed in advance by experiments or the like.

<I-2.変形例2>
画像処理装置20は、条件設定部43および時間算出部44を含んでもよい。この場合、画像処理装置20は、AF処理条件を設定する設定装置としても動作する。画像処理装置20に含まれる条件設定部43は、画像処理装置20に接続される表示装置250(図6参照)に設定画面60,60aを表示すればよい。
<I-2. Modification 2>
The image processing device 20 may include a condition setting unit 43 and a time calculation unit 44. In this case, the image processing device 20 also operates as a setting device for setting AF processing conditions. The condition setting unit 43 included in the image processing device 20 may display the setting screens 60 and 60a on the display device 250 (see FIG. 6) connected to the image processing device 20.

<I-3.変形例3>
時間算出部44は、波形読み取りボタン61の押下に応じて実行されるスキャン処理に要したスキャン時間に基づいて、AF処理時間を算出してもよい。
<I-3. Modification 3>
The time calculation unit 44 may calculate the AF processing time based on the scanning time required for the scanning processing executed in response to the pressing of the waveform reading button 61.

画像処理時間は、画像に応じて変動し得る。すなわち、画像処理時間は、ワークWの品種に応じて変動し得る。そのため、時間算出部44は、サンプルとなる基準ワークW0を用いたスキャン時間から画像処理時間を算出することが好ましい。 The image processing time can vary depending on the image. That is, the image processing time may vary depending on the type of work W. Therefore, it is preferable that the time calculation unit 44 calculates the image processing time from the scan time using the reference work W0 as a sample.

具体的には、時間算出部44は、画像処理装置20にスキャン指示を出力してから、画像処理装置20からスキャン結果を受けるまでのスキャン時間を記録しておく。スキャン時間は、以下の式(3)のように表される。 Specifically, the time calculation unit 44 records the scan time from the output of the scan instruction to the image processing device 20 to the reception of the scan result from the image processing device 20. The scan time is expressed by the following equation (3).

Figure 0007087984000002
Figure 0007087984000002

式(3)において、nmaxは、可動範囲Raの幅を最小変化幅Δf0で除算した値である。そのため、時間算出部44は、スキャン時間をnmaxで除算することにより、1つの焦点位置における撮像時間と画像処理時間と調節時間との総和(=スキャン時間/nmax)を算出する。 In the equation (3), n max is a value obtained by dividing the width of the movable range Ra by the minimum change width Δf0. Therefore, the time calculation unit 44 calculates the sum (= scan time / n max ) of the imaging time, the image processing time, and the adjustment time at one focal position by dividing the scan time by n max .

式(3)の撮像時間は、上述したように露光時間と画像転送時間との和である。式(3)の調節時間は、最小変化幅Δf0だけ焦点位置を移動させるのに要する最小移動時間と同じである。画像転送時間および最小移動時間については、画像の状態に依存せず、予め実験等により確認される。そのため、時間算出部44は、スキャン時間/nmaxから、設定画面60,60aで設定された露光時間と予め確認された画像転送時間および最小移動時間とを差し引くことにより、1つの焦点位置に対応する画像から合焦度を算出するのに要する画像処理時間を算出する。 The image pickup time of the formula (3) is the sum of the exposure time and the image transfer time as described above. The adjustment time of the equation (3) is the same as the minimum movement time required to move the focal position by the minimum change width Δf0. The image transfer time and the minimum movement time do not depend on the state of the image and are confirmed in advance by experiments or the like. Therefore, the time calculation unit 44 corresponds to one focal position by subtracting the exposure time set on the setting screens 60 and 60a, the image transfer time confirmed in advance, and the minimum movement time from the scan time / n max . The image processing time required to calculate the degree of focus is calculated from the image to be used.

時間算出部44は、このようにして算出した画像処理時間を上記の式(2)に代入することにより、AF処理時間を算出すればよい。これにより、AF処理時間の算出精度が向上する。 The time calculation unit 44 may calculate the AF processing time by substituting the image processing time calculated in this way into the above equation (2). This improves the calculation accuracy of the AF processing time.

もしくは、画像処理装置20は、撮像装置10から画像を受けてから合焦度算出部22から合焦度が算出されるまでの時間を計測し、計測した時間を画像処理時間として設定装置40に出力してもよい。設定装置40は、計測された画像処理時間を式(2)に代入することにより、AF処理時間を算出すればよい。これによっても、AF処理時間の算出精度が向上する。 Alternatively, the image processing device 20 measures the time from receiving the image from the image pickup device 10 until the focusing degree is calculated from the focusing degree calculation unit 22, and the measured time is set as the image processing time in the setting device 40. It may be output. The setting device 40 may calculate the AF processing time by substituting the measured image processing time into the equation (2). This also improves the calculation accuracy of the AF processing time.

さらに、レンズ制御部16は、スキャン処理において、最小変化幅Δf0だけ焦点位置を変化させるのに要する時間を計測してもよい。計測された時間は、画像処理装置20を介して設定装置40に出力される。設定装置40は、計測された時間を調節時間として式(2)に代入することにより、AF処理時間を算出すればよい。これにより、AF処理時間の算出精度がさらに向上する。 Further, the lens control unit 16 may measure the time required to change the focal position by the minimum change width Δf0 in the scan process. The measured time is output to the setting device 40 via the image processing device 20. The setting device 40 may calculate the AF processing time by substituting the measured time as the adjustment time into the equation (2). As a result, the calculation accuracy of the AF processing time is further improved.

さらに、画像処理装置20は、スキャン処理において、撮像指令を撮像装置10に出力してから、撮像装置10から画像を受けるまでの時間を計測してもよい。設定装置40は、計測された時間を撮像時間として式(2)に代入することにより、AF処理時間を算出すればよい。これにより、AF処理時間の算出精度がさらに向上する。 Further, the image processing device 20 may measure the time from the output of the image pickup command to the image pickup device 10 to the reception of the image from the image pickup device 10 in the scan process. The setting device 40 may calculate the AF processing time by substituting the measured time as the imaging time into the equation (2). As a result, the calculation accuracy of the AF processing time is further improved.

<I-4.変形例4>
上記の式(2)では、撮像時間と、画像処理時間と、調節時間との和に基づいて、AF処理時間が算出されるものとした。これは、ある焦点位置の撮像指令に応じて取得した画像に対する合焦度の算出が終了してから、次の焦点位置の撮像指令が出力されることを前提としている。しかしながら、画像処理装置の指令生成部21は、ある焦点位置の撮像指令に対応する画像を取得すると、次の焦点位置の撮像指令を出力してもよい。この場合、ある焦点位置の画像に対する合焦度算出処理と次の焦点位置への調節処理とが並行して実行される。
<I-4. Modification 4>
In the above formula (2), the AF processing time is calculated based on the sum of the imaging time, the image processing time, and the adjustment time. This is based on the premise that the imaging command for the next focal position is output after the calculation of the in-focus degree for the image acquired in response to the imaging command for a certain focal position is completed. However, when the command generation unit 21 of the image processing device acquires an image corresponding to an image pickup command at a certain focal position, the command generation unit 21 may output an image pickup command at the next focus position. In this case, the focus calculation process for the image at a certain focal position and the adjustment process for the next focal position are executed in parallel.

合焦度算出処理に要する時間(画像処理時間)が調節処理に要する時間(調節時間)よりも長い場合には、時間算出部44は、上記の式(2)の代わりに以下の式(4)を用いてAF処理時間を算出すればよい。 When the time required for the in-focus degree calculation process (image processing time) is longer than the time required for the adjustment process (adjustment time), the time calculation unit 44 uses the following equation (4) instead of the above equation (2). ) May be used to calculate the AF processing time.

Figure 0007087984000003
Figure 0007087984000003

合焦度算出処理に要する時間(画像処理時間)が調節処理に要する時間(調節時間)よりも短い場合には、時間算出部44は、上記の式(2)の代わりに以下の式(5)を用いてAF処理時間を算出すればよい。 When the time required for the in-focus degree calculation process (image processing time) is shorter than the time required for the adjustment process (adjustment time), the time calculation unit 44 uses the following equation (5) instead of the above equation (2). ) May be used to calculate the AF processing time.

Figure 0007087984000004
Figure 0007087984000004

画像処理時間と調節時間とのどちらが長いかは、予め実験等により確認される。時間算出部44は、確認結果に応じて、式(4)または式(5)のいずれかを用いればよい。 Which of the image processing time and the adjustment time is longer is confirmed in advance by an experiment or the like. The time calculation unit 44 may use either the formula (4) or the formula (5) depending on the confirmation result.

<I-5.変形例5>
上記の説明では、折れ線グラフである合焦度波形63が設定画面60,60aに表示される。しかしながら、設定画面60,60aには、折れ線グラフである合焦度波形63に限らず、可動範囲Raにおける各焦点位置と合焦度との関係を示す図形が表示されればよい。図形には、折れ線グラフ以外の各種グラフが含まれる。あるいは、図形において、合焦度の大小が、色度、彩度および明度の少なくとも1つによって表されてもよい。
<I-5. Modification 5>
In the above description, the focus waveform 63, which is a line graph, is displayed on the setting screens 60 and 60a. However, the setting screens 60 and 60a are not limited to the focus waveform 63 which is a line graph, and a figure showing the relationship between each focal position and the focus degree in the movable range Ra may be displayed. The figure includes various graphs other than the line graph. Alternatively, in the figure, the magnitude of the focus may be represented by at least one of chromaticity, saturation and lightness.

<J.作用・効果>
以上のように、撮像システム1は、焦点位置が所定の可動範囲Raで可変である撮像装置10と、指令生成部21と、合焦度算出部22と、探索部23と、条件設定部43とを備える。指令生成部21、合焦度算出部22および探索部23は、焦点位置を変化させたときの、撮像装置10によって生成される画像から算出される合焦度の変化に基づいて、ワークWの検査対象箇所に合焦する合焦位置を探索するオートフォーカス処理を実行する。条件設定部43は、表示装置42に表示された設定画面60,60aへの入力情報に従って、AF処理条件を設定する。条件設定部43は、AF処理条件に従って実行されるAF処理時間を設定画面60,60aに表示させることにより、入力情報の入力を支援する。これにより、作業者は、AF処理時間を考慮しながら、AF処理条件を適宜設定できる。
<J. Action / effect>
As described above, the image pickup system 1 includes an image pickup device 10 whose focal position is variable in a predetermined movable range Ra, a command generation unit 21, a focus degree calculation unit 22, a search unit 23, and a condition setting unit 43. And prepare. The command generation unit 21, the in-focus degree calculation unit 22, and the search unit 23 of the work W are based on the change in the in-focus degree calculated from the image generated by the image pickup apparatus 10 when the focal position is changed. Executes autofocus processing to search for the in-focus position to focus on the inspection target location. The condition setting unit 43 sets AF processing conditions according to the input information on the setting screens 60 and 60a displayed on the display device 42. The condition setting unit 43 supports the input of input information by displaying the AF processing time executed according to the AF processing conditions on the setting screens 60 and 60a. As a result, the operator can appropriately set the AF processing conditions while considering the AF processing time.

第2および第4の探索方法に従うオートフォーカス処理は、1段階目の探索処理と2段階目の探索処理とを含む。1段階目の探索処理は、焦点位置を変化幅Δf1ずつ変化させながら、合焦度が閾値Thを超える第1焦点位置を探索する処理である。2段階目の探索処理は、第1焦点位置から最小変化幅Δf0ずつ焦点位置を変化させながら、合焦度が極大を示す第2焦点位置を合焦位置として探索する処理である。 The autofocus process according to the second and fourth search methods includes a first-stage search process and a second-stage search process. The first-stage search process is a process of searching for a first focal position whose in-focus degree exceeds the threshold value Th while changing the focal position by a change width Δf1. The second-stage search process is a process of searching for the second focal position, which shows the maximum focusing degree, as the focusing position while changing the focal position by the minimum change width Δf0 from the first focal position.

このとき、条件設定部43は、設定画面の入力情報に従って変化幅Δf1を設定する。具体的には、条件設定部43は、焦点位置と合焦度との関係を示す図形(例えば合焦度波形63)を設定画面60,60aに表示させる。条件設定部43は、閾値Thを入力情報として受けると、合焦度波形63において合焦度が閾値Thを連続して超える焦点位置の幅に基づいて変化幅Δf1を設定する。これにより,作業者は、合焦度波形63と閾値との関係を確認しながら、変化幅Δf1を適宜設定できる。 At this time, the condition setting unit 43 sets the change width Δf1 according to the input information on the setting screen. Specifically, the condition setting unit 43 displays a figure (for example, the in-focus degree waveform 63) showing the relationship between the focal position and the in-focus degree on the setting screens 60 and 60a. When the condition setting unit 43 receives the threshold value Th as input information, the condition setting unit 43 sets the change width Δf1 based on the width of the focal position where the focus degree continuously exceeds the threshold value Th in the focus degree waveform 63. As a result, the operator can appropriately set the change width Δf1 while confirming the relationship between the focus waveform 63 and the threshold value.

第4の探索方法における1段階目の探索処理は、連続して合焦度が閾値Thを超える焦点位置の集合が複数探索された場合に、当該複数の集合のうち、探索方向の上流側から指定番号目の集合に属する焦点位置を第1焦点位置として選択する処理を含む。 In the first-stage search process in the fourth search method, when a plurality of sets of focal positions whose in-focus degree exceeds the threshold Th are continuously searched, the upstream side of the plurality of sets in the search direction is used. It includes a process of selecting a focal position belonging to the set of designated numbers as the first focal position.

このとき、条件設定部43は、設定画面の入力情報に従って探索方向および指定番号を設定する。具体的には、条件設定部43は、焦点位置と合焦度との関係を示す図形(例えば合焦度波形63)を設定画面60,60aに表示させる。合焦度波形63は、合焦度が閾値Thを超える焦点位置の複数の区域R1~R3を有する。条件設定部43は、複数の区域R1~R3のうち指定された区域に基づいて指定番号を設定する。これにより,作業者は、合焦度波形63を確認しながら、指定番号を適宜設定できる。 At this time, the condition setting unit 43 sets the search direction and the designated number according to the input information on the setting screen. Specifically, the condition setting unit 43 displays a figure (for example, the in-focus degree waveform 63) showing the relationship between the focal position and the in-focus degree on the setting screens 60 and 60a. The focus waveform 63 has a plurality of areas R1 to R3 at focal positions where the focus exceeds the threshold Th. The condition setting unit 43 sets a designated number based on a designated area among a plurality of areas R1 to R3. As a result, the operator can appropriately set the designated number while checking the focus waveform 63.

合焦度波形63は、焦点位置を可動範囲Ra内で最小変化幅Δf0ずつ変化させるスキャン処理によって取得される。変形例3において、時間算出部44は、スキャン処理に要したスキャン時間に基づいてAF処理時間を算出する。これにより、実状に即したAF処理時間を設定画面60,60aに表示させることができる。 The focus waveform 63 is acquired by a scan process in which the focal position is changed by the minimum change width Δf0 within the movable range Ra. In the modification 3, the time calculation unit 44 calculates the AF processing time based on the scanning time required for the scanning processing. As a result, the AF processing time according to the actual situation can be displayed on the setting screens 60 and 60a.

条件設定部43は、撮像装置10によって撮像されたサンプル画像66を設定画面60,60aに表示させ、サンプル画像66上の枠線67で囲まれた領域を示す領域情報を入力情報として受ける。条件設定部43は、領域情報に基づいて、合焦度算出領域のサイズおよび位置姿勢を設定する。これにより、作業者は、サンプル画像66を確認しながら、検査対象箇所に応じて、合焦度算出領域を適宜設定できる。 The condition setting unit 43 displays the sample image 66 captured by the image pickup apparatus 10 on the setting screens 60 and 60a, and receives the area information indicating the area surrounded by the frame line 67 on the sample image 66 as input information. The condition setting unit 43 sets the size and position / posture of the in-focus degree calculation area based on the area information. As a result, the operator can appropriately set the in-focus degree calculation area according to the inspection target portion while checking the sample image 66.

§3 付記
以上のように、実施の形態は以下のような開示を含む。
§3 Addendum As described above, the embodiments include the following disclosures.

(構成1)
焦点位置が所定範囲で可変である撮像装置(10)と、
前記焦点位置を変化させたときの、前記撮像装置(10)によって生成される画像から算出される合焦度の変化に基づいて、対象物に合焦する合焦位置を探索するオートフォーカス処理を実行するためのオートフォーカス処理手段(21,22,23)と、
表示装置(42,250)に表示された設定画面への入力情報に従って、前記オートフォーカス処理の処理条件を設定するための設定手段(43)とを備え、
前記設定手段(43)は、前記処理条件に従って実行される前記オートフォーカス処理に要する処理時間を前記設定画面に表示させることにより、前記入力情報の入力を支援する、撮像システム(1)。
(Structure 1)
An image pickup device (10) whose focal position is variable within a predetermined range, and
An autofocus process for searching for an in-focus position to focus on an object based on a change in the in-focus degree calculated from an image generated by the image pickup device (10) when the focus position is changed. Autofocus processing means (21, 22, 23) for execution, and
It is provided with a setting means (43) for setting the processing conditions of the autofocus processing according to the input information on the setting screen displayed on the display device (42, 250).
The setting means (43) supports the input of the input information by displaying the processing time required for the autofocus processing executed according to the processing conditions on the setting screen (1).

(構成2)
前記処理条件は、前記撮像装置(10)の露光時間、前記所定範囲のうちの前記合焦位置の探索範囲、前記焦点位置の変化幅、前記焦点位置の探索方向、および前記合焦度の算出対象となる画像領域の少なくとも1つを含む、構成1に記載の撮像システム(1)。
(Structure 2)
The processing conditions include the exposure time of the image pickup apparatus (10), the search range of the focus position in the predetermined range, the change width of the focus position, the search direction of the focus position, and the calculation of the focus degree. The imaging system (1) according to configuration 1, which comprises at least one of the target image regions.

(構成3)
前記オートフォーカス処理は、
前記焦点位置を第1変化幅ずつ変化させながら、前記合焦度が閾値を超える第1焦点位置を探索する第1探索処理と、
前記第1焦点位置から前記第1変化幅よりも小さい第2変化幅ずつ前記焦点位置を変化させながら、前記合焦度が極大を示す第2焦点位置を前記合焦位置として探索する第2探索処理とを含み、
前記処理条件は、前記第1変化幅を含む、構成2に記載の撮像システム(1)。
(Structure 3)
The autofocus process is
The first search process for searching for the first focal position whose in-focus degree exceeds the threshold value while changing the focal position by the first change width.
A second search for searching for the second focal position showing the maximum in-focus degree as the in-focus position while changing the focal position by a second change width smaller than the first change width from the first focal position. Including processing
The imaging system (1) according to configuration 2, wherein the processing conditions include the first change width.

(構成4)
前記設定手段(43)は、
前記焦点位置と前記合焦度との関係を示す図形を前記設定画面に表示させ、
前記閾値を前記入力情報として受けると、前記図形において前記合焦度が前記閾値を連続して超える前記焦点位置の幅に基づいて前記第1変化幅を設定する、構成3に記載の撮像システム(1)。
(Structure 4)
The setting means (43) is
A figure showing the relationship between the focal position and the degree of focus is displayed on the setting screen.
The imaging system according to configuration 3, wherein when the threshold value is received as the input information, the first change width is set based on the width of the focal position where the focus degree continuously exceeds the threshold value in the figure. 1).

(構成5)
前記第1探索処理は、連続して合焦度が前記閾値を超える焦点位置の集合が複数探索された場合に、当該複数の集合のうち、前記焦点位置の探索方向の上流側から指定番号目の集合に属する焦点位置を第1焦点位置として選択する処理を含み、
前記処理条件は、前記探索方向および前記指定番号を含む、構成3に記載の撮像システム(1)。
(Structure 5)
In the first search process, when a plurality of sets of focal positions whose in-focus degree exceeds the threshold value are continuously searched, the designated number from the upstream side in the search direction of the focal position among the plurality of sets. Including the process of selecting the focal position belonging to the set of the first focal position as the first focal position.
The imaging system (1) according to configuration 3, wherein the processing conditions include the search direction and the designated number.

(構成6)
前記設定手段(43)は、前記焦点位置と前記合焦度との関係を示す図形を前記設定画面に表示させ、
前記図形は、前記合焦度が前記閾値を超える前記焦点位置の複数の区域を有し、
前記設定手段(43)は、前記複数の区域のうち指定された区域に基づいて前記指定番号を設定する、構成5に記載の撮像システム(1)。
(Structure 6)
The setting means (43) displays a figure showing the relationship between the focal position and the degree of focus on the setting screen.
The figure has a plurality of areas of the focal position where the degree of focus exceeds the threshold.
The imaging system (1) according to configuration 5, wherein the setting means (43) sets the designated number based on a designated area among the plurality of areas.

(構成7)
前記関係は、前記焦点位置を前記所定範囲内で前記第2変化幅ずつ変化させるスキャン処理によって取得され、
前記撮像システム(1)は、前記スキャン処理に要したスキャン時間に基づいて前記処理時間を算出するための算出手段(44)をさらに備える、構成4または6に記載の撮像システム(1)。
(Structure 7)
The relationship is acquired by a scan process in which the focal position is changed by the second change width within the predetermined range.
The imaging system (1) according to configuration 4 or 6, further comprising a calculation means (44) for calculating the processing time based on the scanning time required for the scanning processing.

(構成8)
前記処理条件は、前記合焦度の算出対象となる画像領域を含み、
前記設定手段(43)は、
前記撮像装置(10)によって撮像されたサンプル画像を前記設定画面に表示させ、
前記サンプル画像上の指定領域を示す領域情報を前記入力情報として受け、
前記領域情報に基づいて、前記合焦度の算出対象となる画像領域を設定する、構成2に記載の撮像システム(1)。
(Structure 8)
The processing condition includes an image area for which the degree of focus is calculated.
The setting means (43) is
The sample image captured by the image pickup device (10) is displayed on the setting screen.
The area information indicating the designated area on the sample image is received as the input information, and the area information is received.
The imaging system (1) according to configuration 2, which sets an image region to be calculated for the degree of focus based on the region information.

(構成9)
構成1から8のいずれかに記載の撮像システム(1)で用いられる設定装置(40)であって、
前記設定手段(43)を備える、設定装置(40)。
(Structure 9)
The setting device (40) used in the imaging system (1) according to any one of configurations 1 to 8.
A setting device (40) including the setting means (43).

本発明の実施の形態について説明したが、今回開示された実施の形態はすべての点で例示であって制限的なものではないと考えられるべきである。本発明の範囲は特許請求の範囲によって示され、特許請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。 Although embodiments of the present invention have been described, it should be considered that the embodiments disclosed this time are exemplary in all respects and not restrictive. The scope of the present invention is indicated by the scope of claims and is intended to include all modifications within the meaning and scope equivalent to the scope of claims.

1 撮像システム、10 撮像装置、11 照明部、12 レンズモジュール、12a,12c レンズ、12b レンズ群、12d 可動部、12e フォーカス調節部、12e1,12e2 電圧源、13 撮像素子、13a 撮像面、14 撮像素子制御部、15,17 レジスタ、16 レンズ制御部、18 通信I/F部、20 画像処理装置、21 指令生成部、22 合焦度算出部、23 探索部、24 検査部、25,45 通信部、30 PLC、40 設定装置、41,240 入力装置、42,250 表示装置、43 条件設定部、44 時間算出部、50 画像、60,60a 設定画面、61 波形読み取りボタン、62 波形表示領域、63 合焦度波形、64 ピーク選択欄、65 画像表示領域、66 サンプル画像、67 枠線、68,69,76 つまみ、70a,70b ラジオボタン、71 露光時間入力欄、72 変化幅入力欄、73 時間表示欄、74 OKボタン、75 キャンセルボタン、80 透光性容器、81 導電性液体、82 絶縁性液体、83a,83b,84a,84b 電極、85a,85b 絶縁体、86a,86b 絶縁層、90 ステージ、206 メモリカード、210,401 CPU、216 カメラインターフェース、216a 画像バッファ、218 入力インターフェース、220 表示コントローラ、222 合焦度インターフェース、224 通信インターフェース、226 データリーダ/ライタ、228 バス、230 記憶部、232 処理条件データ、234 メインメモリ、236 ハードディスク、238 制御プログラム、402 ROM、403 RAM、404 HDD、408 駆動装置、409 通信IF、410 データバス、420 設定プログラム、430 記録媒体、W ワーク、W0 基準ワーク。 1 Imaging system, 10 Imaging device, 11 Lighting unit, 12 Lens module, 12a, 12c lens, 12b lens group, 12d movable unit, 12e focus adjustment unit, 12e1, 12e2 voltage source, 13 imaging element, 13a imaging surface, 14 imaging Element control unit, 15, 17 registers, 16 lens control unit, 18 communication I / F unit, 20 image processing unit, 21 command generation unit, 22 focus calculation unit, 23 search unit, 24 inspection unit, 25, 45 communication Unit, 30 PLC, 40 setting device, 41,240 input device, 42,250 display device, 43 condition setting unit, 44 time calculation unit, 50 images, 60, 60a setting screen, 61 waveform reading button, 62 waveform display area, 63 Focus waveform, 64 Peak selection field, 65 Image display area, 66 Sample image, 67 Border, 68, 69, 76 knobs, 70a, 70b radio buttons, 71 Exposure time input field, 72 Change width input field, 73 Time display field, 74 OK button, 75 cancel button, 80 translucent container, 81 conductive liquid, 82 insulating liquid, 83a, 83b, 84a, 84b electrodes, 85a, 85b insulator, 86a, 86b insulating layer, 90 Stage, 206 memory card, 210,401 CPU, 216 camera interface, 216a image buffer, 218 input interface, 220 display controller, 222 focus interface, 224 communication interface, 226 data reader / writer, 228 bus, 230 storage, 232 processing condition data, 234 main memory, 236 hard disk, 238 control program, 402 ROM, 403 RAM, 404 HDD, 408 drive unit, 409 communication IF, 410 data bus, 420 setting program, 430 recording medium, W work, W0 standard work.

Claims (9)

焦点位置が所定範囲で可変である撮像装置と、
前記焦点位置を変化させたときの、前記撮像装置によって生成される画像から算出される合焦度の変化に基づいて、対象物に合焦する合焦位置を探索するオートフォーカス処理を実行するためのオートフォーカス処理手段と、
表示装置に表示された設定画面への入力情報に従って、前記オートフォーカス処理の処理条件を設定するための設定手段とを備え、
前記設定手段は、前記オートフォーカス処理の処理条件と前記オートフォーカス処理の処理時間との関係を示す相関情報に基づいて、設定した前記処理条件に従って実行される前記オートフォーカス処理に要する処理時間を算出し、算出した処理時間を前記設定画面に表示させることにより、前記入力情報の入力を支援する、撮像システム。
An image pickup device whose focal position is variable within a predetermined range, and
To execute an autofocus process that searches for the in-focus position to focus on the object based on the change in the in-focus degree calculated from the image generated by the image pickup device when the focus position is changed. Autofocus processing means and
It is provided with a setting means for setting the processing conditions of the autofocus processing according to the input information on the setting screen displayed on the display device.
The setting means calculates the processing time required for the autofocus processing executed according to the set processing conditions based on the correlation information indicating the relationship between the processing conditions of the autofocus processing and the processing time of the autofocus processing. An imaging system that supports the input of the input information by displaying the calculated processing time on the setting screen.
前記処理条件は、前記撮像装置の露光時間、前記所定範囲のうちの前記合焦位置の探索範囲、前記焦点位置の変化幅、前記焦点位置の探索方向、および前記合焦度の算出対象となる画像領域の少なくとも1つを含む、請求項1に記載の撮像システム。 The processing conditions are subject to calculation of the exposure time of the image pickup apparatus, the search range of the focus position within the predetermined range, the change width of the focus position, the search direction of the focus position, and the focus degree. The imaging system according to claim 1, wherein the imaging system comprises at least one of the image areas. 焦点位置が所定範囲で可変である撮像装置と、
前記焦点位置を変化させたときの、前記撮像装置によって生成される画像から算出される合焦度の変化に基づいて、対象物に合焦する合焦位置を探索するオートフォーカス処理を実行するためのオートフォーカス処理手段と、
表示装置に表示された設定画面への入力情報に従って、前記オートフォーカス処理の処理条件を設定するための設定手段とを備え、
前記設定手段は、前記処理条件に従って実行される前記オートフォーカス処理に要する処理時間を前記設定画面に表示させることにより、前記入力情報の入力を支援し、
前記オートフォーカス処理は、
前記焦点位置を第1変化幅ずつ変化させながら、前記合焦度が閾値を超える第1焦点位置を探索する第1探索処理と、
前記第1焦点位置から前記第1変化幅よりも小さい第2変化幅ずつ前記焦点位置を変化させながら、前記合焦度が極大を示す第2焦点位置を前記合焦位置として探索する第2探索処理とを含み、
前記処理条件は、前記第1変化幅を含む、撮像システム。
An image pickup device whose focal position is variable within a predetermined range, and
To execute an autofocus process that searches for the in-focus position to focus on the object based on the change in the in-focus degree calculated from the image generated by the image pickup device when the focus position is changed. Autofocus processing means and
It is provided with a setting means for setting the processing conditions of the autofocus processing according to the input information on the setting screen displayed on the display device.
The setting means supports the input of the input information by displaying the processing time required for the autofocus processing executed according to the processing conditions on the setting screen.
The autofocus process is
The first search process for searching for the first focal position whose in-focus degree exceeds the threshold value while changing the focal position by the first change width.
A second search for searching for the second focal position showing the maximum in-focus degree as the in-focus position while changing the focal position by a second change width smaller than the first change width from the first focal position. Including processing
The processing condition includes the first change width, and the imaging system.
前記設定手段は、
前記焦点位置と前記合焦度との関係を示す図形を前記設定画面に表示させ、
前記閾値を前記入力情報として受けると、前記図形において前記合焦度が前記閾値を連続して超える前記焦点位置の幅に基づいて前記第1変化幅を設定する、請求項3に記載の撮像システム。
The setting means is
A figure showing the relationship between the focal position and the degree of focus is displayed on the setting screen.
The imaging system according to claim 3, wherein when the threshold value is received as the input information, the first change width is set based on the width of the focal position where the focus degree continuously exceeds the threshold value in the figure. ..
前記第1探索処理は、連続して合焦度が前記閾値を超える焦点位置の集合が複数探索された場合に、当該複数の集合のうち、前記焦点位置の探索方向の上流側から指定番号目の集合に属する焦点位置を第1焦点位置として選択する処理を含み、
前記処理条件は、前記探索方向および前記指定番号を含む、請求項3に記載の撮像システム。
In the first search process, when a plurality of sets of focal positions whose in-focus degree exceeds the threshold value are continuously searched, the designated number from the upstream side in the search direction of the focal position among the plurality of sets. Including the process of selecting the focal position belonging to the set of the first focal position as the first focal position.
The imaging system according to claim 3, wherein the processing conditions include the search direction and the designated number.
前記設定手段は、前記焦点位置と前記合焦度との関係を示す図形を前記設定画面に表示させ、
前記図形は、前記合焦度が前記閾値を超える前記焦点位置の複数の区域を有し、
前記設定手段は、前記複数の区域のうち指定された区域に基づいて前記指定番号を設定する、請求項5に記載の撮像システム。
The setting means displays a figure showing the relationship between the focal position and the degree of focus on the setting screen.
The figure has a plurality of areas of the focal position where the degree of focus exceeds the threshold.
The imaging system according to claim 5, wherein the setting means sets the designated number based on a designated area among the plurality of areas.
前記関係は、前記焦点位置を前記所定範囲内で前記第2変化幅ずつ変化させるスキャン処理によって取得され、
前記撮像システムは、前記スキャン処理に要したスキャン時間に基づいて前記処理時間を算出するための算出手段をさらに備える、請求項4または6に記載の撮像システム。
The relationship is acquired by a scan process in which the focal position is changed by the second change width within the predetermined range.
The imaging system according to claim 4 or 6, further comprising a calculation means for calculating the processing time based on the scanning time required for the scanning processing.
前記処理条件は、前記合焦度の算出対象となる画像領域を含み、
前記設定手段は、
前記撮像装置によって撮像されたサンプル画像を前記設定画面に表示させ、
前記サンプル画像上の指定領域を示す領域情報を前記入力情報として受け、
前記領域情報に基づいて、前記合焦度の算出対象となる画像領域を設定する、請求項2に記載の撮像システム。
The processing condition includes an image area for which the degree of focus is calculated.
The setting means is
The sample image captured by the image pickup device is displayed on the setting screen.
The area information indicating the designated area on the sample image is received as the input information, and the area information is received.
The imaging system according to claim 2, wherein an image region for which the degree of focus is calculated is set based on the region information.
請求項1から8のいずれか1項に記載の撮像システムで用いられる設定装置であって、
前記設定手段を備える、設定装置。
A setting device used in the imaging system according to any one of claims 1 to 8.
A setting device including the setting means.
JP2018238023A 2018-12-20 2018-12-20 Imaging system and setting device Active JP7087984B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2018238023A JP7087984B2 (en) 2018-12-20 2018-12-20 Imaging system and setting device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2018238023A JP7087984B2 (en) 2018-12-20 2018-12-20 Imaging system and setting device

Publications (2)

Publication Number Publication Date
JP2020101600A JP2020101600A (en) 2020-07-02
JP7087984B2 true JP7087984B2 (en) 2022-06-21

Family

ID=71139416

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2018238023A Active JP7087984B2 (en) 2018-12-20 2018-12-20 Imaging system and setting device

Country Status (1)

Country Link
JP (1) JP7087984B2 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010237701A (en) 2005-01-28 2010-10-21 Casio Computer Co Ltd Image capture device and program
JP2012123174A (en) 2010-12-08 2012-06-28 Canon Inc Image pickup apparatus, control method thereof, and program
JP2018005021A (en) 2016-07-05 2018-01-11 武蔵オプティカルシステム株式会社 Autofocus module and video camera

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010237701A (en) 2005-01-28 2010-10-21 Casio Computer Co Ltd Image capture device and program
JP2012123174A (en) 2010-12-08 2012-06-28 Canon Inc Image pickup apparatus, control method thereof, and program
JP2018005021A (en) 2016-07-05 2018-01-11 武蔵オプティカルシステム株式会社 Autofocus module and video camera

Also Published As

Publication number Publication date
JP2020101600A (en) 2020-07-02

Similar Documents

Publication Publication Date Title
JP5868183B2 (en) Imaging apparatus and imaging method
WO2018228479A1 (en) Automatic focusing method and apparatus, storage medium and electronic device
JP5895270B2 (en) Imaging device
JP6137847B2 (en) IMAGING DEVICE AND IMAGING DEVICE CONTROL METHOD
JP6906947B2 (en) Image processing equipment, imaging equipment, image processing methods and computer programs
JP5374119B2 (en) Distance information acquisition device, imaging device, and program
WO2020110712A1 (en) Inspection system, inspection method, and program
US9482855B2 (en) Microscope system
JP2007003656A (en) Apparatus for determining focal position of imaging lens and method thereof
US9900493B2 (en) Focus detecting apparatus, and method of prediction for the same
JP2015121773A (en) Imaging device
US10827114B2 (en) Imaging system and setting device
KR20170101532A (en) Method for image fusion, Computer program for the same, and Recording medium storing computer program for the same
JP6326631B2 (en) Imaging device
JP7087984B2 (en) Imaging system and setting device
JP5900049B2 (en) Depth of field expansion system and depth of field expansion method
JP7047725B2 (en) Inspection system, inspection method and program
JP6312410B2 (en) Alignment apparatus, microscope system, alignment method, and alignment program
JP6623419B2 (en) Display control device, imaging device, smartphone, display control method, and program
JP7287533B2 (en) Inspection system, inspection method and program
JP2015210396A (en) Aligment device, microscope system, alignment method and alignment program
JP6089232B2 (en) Imaging device
JP2020086216A (en) Imaging control device, imaging apparatus and imaging control program
JP2016212813A (en) Image processor, image processing method and program
WO2021065065A1 (en) Imaging device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20201214

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20211027

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20211116

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20211217

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20220523

R150 Certificate of patent or registration of utility model

Ref document number: 7087984

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150