JP2017224923A - Autofocus device and autofocus program - Google Patents

Autofocus device and autofocus program Download PDF

Info

Publication number
JP2017224923A
JP2017224923A JP2016117797A JP2016117797A JP2017224923A JP 2017224923 A JP2017224923 A JP 2017224923A JP 2016117797 A JP2016117797 A JP 2016117797A JP 2016117797 A JP2016117797 A JP 2016117797A JP 2017224923 A JP2017224923 A JP 2017224923A
Authority
JP
Japan
Prior art keywords
evaluation value
region
focus
data
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2016117797A
Other languages
Japanese (ja)
Other versions
JP6685550B2 (en
Inventor
邦彦 佐藤
Kunihiko Sato
邦彦 佐藤
光一朗 石神
Koichiro Ishigami
光一朗 石神
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.)
HST VISION CORP
Original Assignee
HST VISION 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 HST VISION CORP filed Critical HST VISION CORP
Priority to JP2016117797A priority Critical patent/JP6685550B2/en
Publication of JP2017224923A publication Critical patent/JP2017224923A/en
Application granted granted Critical
Publication of JP6685550B2 publication Critical patent/JP6685550B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Automatic Focus Adjustment (AREA)
  • Studio Devices (AREA)
  • Focusing (AREA)

Abstract

PROBLEM TO BE SOLVED: To realize a proper autofocus at a small load irrespective of a number of a target of focus or a fluctuation of a position.SOLUTION: An autofocus device of an imaging system comprises an evaluation value calculation part and a focusing position determination part. The evaluation value calculation part calculates an evaluation value for determining a focusing position in each image data obtained by imaging a subject at a focal position. The focusing position determination part determines the focusing position on the basis of the evaluation value of a plurality of focal positions. The evaluation value calculation part generates evaluation data contributed by a positive weight to a first score component and contributed by a negative weight to a second score component by using the first score component calculated for a first region which has the size including a target and the second score component calculated to a second region which has the size including a peripheral part of the target in each local area of image data, and calculates the evaluation value on the basis of the evaluation data in the plurality of local regions.SELECTED DRAWING: Figure 3

Description

本発明は、コントラスト方式で合焦位置を検出するオートフォーカス装置及びオートフォーカス用プログラムに関する。   The present invention relates to an autofocus device and an autofocus program for detecting a focus position by a contrast method.

従来、オートフォーカス装置は、光学系のレンズ焦点位置を段階的に変化させつつ被写体を撮像し、各段階での被写体の撮影画像に基づいてコントラスト情報等の評価値を取得する。そして、最適な評価値(例えば、最大となる評価値)を得られる段階のレンズ焦点位置を、合焦位置として検出する。オートフォーカス装置は、環境や被写体に応じてより最適な合焦位置を検出するために、様々な改良がなされている。   2. Description of the Related Art Conventionally, an autofocus device captures an object while changing the lens focal position of an optical system in stages, and acquires an evaluation value such as contrast information based on a photographed image of the object at each stage. Then, the lens focus position at the stage where an optimum evaluation value (for example, the maximum evaluation value) can be obtained is detected as the in-focus position. Various improvements have been made to the autofocus device in order to detect a more optimal focus position according to the environment and subject.

例えば、特許文献1のオートフォーカスカメラは、被写体までの距離情報に依存して撮影レンズのピント位置を制御する演算制御部を有する。そして、演算制御部は、距離情報および距離以外の背景情報に基づいてピント位置を決定する。   For example, the autofocus camera of Patent Document 1 has an arithmetic control unit that controls the focus position of the photographing lens depending on distance information to the subject. Then, the calculation control unit determines the focus position based on the distance information and background information other than the distance.

また、特許文献2のオートフォーカス装置は、撮影視野の中央部と全体の2つのAFエリアについてAF評価値を発生するAF評価値発生部を設ける。更に、これらのAFエリアのAF評価値から割り出されるフォーカスレンズの合焦位置がほぼ等しい場合、中央部AFエリアと全体AFエリアのAF評価値の差からフォーカスレンズの合焦位置を割り出すCPUを設ける。   In addition, the autofocus device disclosed in Patent Document 2 includes an AF evaluation value generation unit that generates AF evaluation values for the central portion of the photographing field and the entire two AF areas. Further, when the focus lens in-focus positions calculated from the AF evaluation values of these AF areas are substantially equal, a CPU for determining the focus lens in-focus position from the difference between the AF evaluation values of the central AF area and the entire AF area is provided. Provide.

特開2000−321483号公報JP 2000-321483 A 特開2004−309722号公報JP 2004-309722 A

しかしながら、従来のオートフォーカス装置は、フォーカスのターゲットが小面積であって周囲のコントラストが大きい被写体等の場合には、周囲にフォーカスを合わせたときのコントラスト情報(評価値)が最大となって、フォーカスが周囲に引かれ易いという問題がある。この場合、周囲にピントを合わせた合焦位置で本撮影が行われて、ターゲットがぼけた画像が生成されてしまう。例えば、電子部品等を検査するマシンビジョンシステムでは、電極等の突起状部材を有する電子部品を突起部の先端側から撮影して突起部の位置を判定することがある。このとき、突起部の先端がフォーカスのターゲットとなるが、周囲よりも突出しているため、先端側から見ると、小面積で周囲のコントラストが大きくなっていてフォーカスを合わせ難くなっている。   However, in a conventional autofocus device, when the focus target is a small area and the subject has a large surrounding contrast, the contrast information (evaluation value) when the surrounding is focused is maximized. There is a problem that the focus is easily drawn to the surroundings. In this case, the actual shooting is performed at the in-focus position where the surrounding is in focus, and an image in which the target is blurred is generated. For example, in a machine vision system that inspects an electronic component or the like, an electronic component having a protruding member such as an electrode may be photographed from the tip side of the protruding portion to determine the position of the protruding portion. At this time, the tip of the projection becomes the focus target, but it protrudes from the periphery, so that when viewed from the tip, the surrounding contrast is small and the surrounding contrast is large, making it difficult to focus.

これに対して、ターゲット近辺のみに関心領域(ROI:Region Of Interest)を設定し、周囲を参照しないように覆うことによって、当然ながらターゲットにピントを合わせた合焦位置で撮影することが可能である。しかしながら、一般的にフォーカスをオートで制御したいような撮影条件においては、画角内でのターゲットの位置は正確には未知であることが多く、撮像するタイミング間でも変動が起こり得る。また、ターゲットは、サイズが小さいほど、位置の変動によって、予め固定した関心領域から外れる確率が高くなる。   On the other hand, by setting a region of interest (ROI) only in the vicinity of the target and covering it so as not to refer to the surroundings, it is naturally possible to shoot at a focus position where the target is in focus. is there. However, in general, under shooting conditions where it is desired to automatically control the focus, the position of the target within the angle of view is often unknown accurately, and fluctuations may occur between the timings of imaging. In addition, the smaller the size of the target, the higher the probability that the target will deviate from the fixed region of interest due to the position variation.

また、そのような状況を避けるため、パターンマッチング等によって適応的にターゲット位置を識別して、その位置へ専用の画角や関心領域を追従させて撮影を行う技術も提案されているが、このようなパターンマッチング及び追従処理は、構成や処理が複雑化し、負荷が高くなってしまう。さらには、ターゲットが複数あり、それらの位置関係が未知の場合には、ターゲットに合わせた領域でのコントラスト情報の検出がより困難となる。   In addition, in order to avoid such a situation, a technique for adaptively identifying a target position by pattern matching or the like and tracking a dedicated field angle or region of interest to the position has been proposed. Such pattern matching and tracking processing complicates the configuration and processing, and increases the load. Furthermore, when there are a plurality of targets and their positional relationship is unknown, it becomes more difficult to detect contrast information in a region matched to the target.

更に、例えば、製造装置に用いられるフォーカス機構等は、フォーカスの対象とする被写体の物理条件がある程度限定されている代わりに、検出の精度や速度に対して非常に高い性能が求められる場合がある。しかしながら、上記したような従来のフォーカス装置では、フォーカスのターゲットを小面積に限定した場合に、ターゲットの検出の精度や速度の性能が低下するおそれがある。   Furthermore, for example, a focus mechanism or the like used in a manufacturing apparatus may be required to have very high performance with respect to detection accuracy and speed instead of the physical conditions of a subject to be focused being limited to some extent. . However, in the conventional focusing apparatus as described above, when the focus target is limited to a small area, there is a possibility that the accuracy and speed performance of target detection may be reduced.

本発明は上記した課題を解決すべくなされたものであり、フォーカスのターゲットの数や位置の変動に拘らず、小さい負荷で、適切なオートフォーカスを実現することを目的とするものである。   The present invention has been made to solve the above-described problems, and an object of the present invention is to realize appropriate autofocus with a small load regardless of the number and position of focus targets.

本発明のオートフォーカス装置は、上記した目的を達成するため、被写体の画像のコントラストに応じて前記被写体に対する焦点制御状態を決定するオートフォーカス装置であって、複数の焦点位置のそれぞれにおいて前記被写体を撮像して得られる複数の画像のそれぞれについて、合焦位置の判定に用いられる評価値を算出する評価値算出部と、前記複数の焦点位置のそれぞれに対して算出された複数の前記評価値に基づいて、合焦位置を判定する合焦位置判定部と、を備え、前記評価値算出部は、前記各画像に含まれる複数の局所領域のそれぞれについて、前記被写体のフォーカスのターゲットを含む大きさの第1領域に対して算出される第1のスコア成分と、前記第1領域の周囲で前記ターゲットの周辺部分の少なくとも一部以上を含む大きさの第2領域に対して算出される第2のスコア成分とを用いて、前記第1のスコア成分に正の重みで寄与し、前記第2のスコア成分に負の重みで寄与するように計算した評価データを生成し、前記各画像内の前記複数の局所領域のそれぞれについて生成された複数の前記評価データに基づいて前記評価値を算出することを特徴とする。   In order to achieve the above object, an autofocus device according to the present invention is an autofocus device that determines a focus control state for the subject in accordance with a contrast of an image of the subject, wherein the subject is detected at each of a plurality of focus positions. For each of a plurality of images obtained by imaging, an evaluation value calculation unit that calculates an evaluation value used for determination of an in-focus position, and a plurality of the evaluation values calculated for each of the plurality of focus positions A focus position determination unit that determines a focus position, and the evaluation value calculation unit includes a focus target for each of the plurality of local regions included in each image. Including a first score component calculated for the first region of the target and at least a part of a peripheral portion of the target around the first region. Using a second score component calculated for a second region of size, so as to contribute to the first score component with a positive weight and to contribute to the second score component with a negative weight The evaluation data calculated in the above is generated, and the evaluation value is calculated based on the plurality of evaluation data generated for each of the plurality of local regions in each image.

例えば、前記評価値算出部は、前記各画像内の前記各局所領域の画素データに対して、前記正の重みに対応する正の係数を前記第1領域に与えると共に前記負の重みに対応する負の係数を前記第2領域に与える空間的加重フィルタを用いた畳み込み演算を行い、前記畳み込み演算の結果に基づいて前記評価データを生成するとよい。   For example, the evaluation value calculation unit provides a positive coefficient corresponding to the positive weight to the first region and corresponds to the negative weight for the pixel data of each local region in each image. It is preferable to perform a convolution operation using a spatial weighting filter that gives a negative coefficient to the second region, and to generate the evaluation data based on a result of the convolution operation.

また、前記評価値算出部は、前記各画像内の前記各局所領域の画素データに対して所定のバンドパス特性を持つ空間的周波数フィルタを用いた周波数フィルタ処理を行い、前記周波数フィルタ処理後のデータに基づいて振幅成分の大小を表す値へ換算する換算処理を行い、前記換算処理の結果に基づいて前記第1のスコア成分及び前記第2のスコア成分を算出するとよい。あるいは、前記評価値算出部は、前記加重フィルタと前記周波数フィルタとを予め結合させた結合空間フィルタを用いて前記畳み込み演算を行ってもよい。   Further, the evaluation value calculation unit performs a frequency filter process using a spatial frequency filter having a predetermined bandpass characteristic on the pixel data of each local region in each image, and after the frequency filter process A conversion process for converting the amplitude component into a value representing the magnitude of the amplitude component may be performed based on the data, and the first score component and the second score component may be calculated based on the result of the conversion process. Alternatively, the evaluation value calculation unit may perform the convolution operation using a combined spatial filter in which the weighting filter and the frequency filter are combined in advance.

更に、例えば、前記評価値算出部は、前記各画像内の画素データとして、各画素位置に結像される前記被写体の輝度に線形又は非線形な関係を持つ階調に相当する情報を用いて、前記階調が前記各画像内の前記複数の局所領域毎に分布したコントラストに相当する指標を算出する。   Further, for example, the evaluation value calculation unit uses, as pixel data in each image, information corresponding to a gradation having a linear or nonlinear relationship with the luminance of the subject imaged at each pixel position, An index corresponding to a contrast in which the gradation is distributed for each of the plurality of local regions in each image is calculated.

なお、前記評価値算出部は、前記各画像について、前記複数の評価データの中から最大値を前記評価値とするとよく、前記合焦位置判定部は、前記複数の焦点位置のそれぞれに対する前記複数の評価値の中から最大値が得られる焦点位置を合焦位置として判定するとよい。   The evaluation value calculation unit may set a maximum value of the plurality of evaluation data as the evaluation value for each image, and the focus position determination unit may determine the plurality of focus positions with respect to each of the plurality of focus positions. The focus position where the maximum value can be obtained from the evaluation values is preferably determined as the focus position.

これらのような構成によれば、オートフォーカス装置は、フォーカスのターゲットとこのターゲットの周辺部分とで合焦する焦点位置が異なる被写体の場合でも、ターゲットにピントを合わせた合焦位置を検出することができる。そのため、例えば、電極等の突起状部材を有する電子部品のように、周辺部分よりも小面積のターゲットを有する被写体を突起部の先端側から本撮影する場合でも、突起部の先端にピントを合わせた合焦位置を検出することができる。あるいは、凹部を有する部品を凹みの正面から本撮影する場合でも、凹部の深部にピントを合わせた合焦位置を検出することができる。また、オートフォーカス装置は、撮影するタイミングに応じてターゲットの位置が変動する場合でも、複雑な処理や構成を備えることなく、迅速且つ確実にターゲットの合焦位置を検出することができる。そのため、このオートフォーカス装置をマシンビジョンシステム等に採用する場合には、撮影及び検査の処理速度の向上や、処理負担の軽減、更には、設備コストの抑制を実現することができる。   According to such a configuration, the autofocus device detects the in-focus position where the target is in focus even when the focus target and the peripheral portion of the target have different focus positions. Can do. For this reason, for example, when shooting a subject having a target with a smaller area than the peripheral part, such as an electronic component having a protruding member such as an electrode, from the tip side of the protrusion, the tip of the protrusion is focused. The in-focus position can be detected. Alternatively, even when an image of a component having a recess is taken from the front of the recess, it is possible to detect the in-focus position where the deep portion of the recess is in focus. In addition, the autofocus device can quickly and surely detect the in-focus position of the target without providing complicated processing and configuration even when the position of the target fluctuates according to the shooting timing. Therefore, when this autofocus device is employed in a machine vision system or the like, it is possible to improve the processing speed of photographing and inspection, reduce the processing load, and further reduce the equipment cost.

更に、前記評価値算出部は、前記周波数フィルタ処理後のデータに対して画素サイズ縮小処理を行い、前記縮小処理後のデータに基づいて前記第1のスコア成分及び前記第2のスコア成分を算出するとよい。   Further, the evaluation value calculation unit performs a pixel size reduction process on the data after the frequency filter process, and calculates the first score component and the second score component based on the data after the reduction process Good.

このような構成によれば、オートフォーカス装置は、オートフォーカス動作における処理速度を向上すると共に、処理負担を軽減することが可能となる。   According to such a configuration, the autofocus device can improve the processing speed in the autofocus operation and reduce the processing load.

更に、前記評価値算出部は、前記第1領域と前記第2領域との間に、重みが0である不感帯としての第3領域を持つ前記加重フィルタを用いてもよい。   Further, the evaluation value calculation unit may use the weighting filter having a third region as a dead zone having a weight of 0 between the first region and the second region.

このような構成によれば、例えば、撮影側から見て突起部のターゲットの先端が微小面積を有し、先端から基端にかけて面積が増加している被写体を撮影する場合や、撮影側から見て凹部のターゲットの深部が微小面積を有し、深部から凹部縁側にかけて面積が増加している被写体を撮影する場合でも、ターゲットの先端や深部以外での合焦を回避して、確実にターゲットの合焦位置を検出することができる。   According to such a configuration, for example, when shooting a subject in which the tip of the target of the projection has a minute area when viewed from the shooting side and the area increases from the tip to the base end, Even when shooting a subject whose deep part of the concave target has a very small area and the area increases from the deep part to the edge of the concave part, focusing on other than the tip or deep part of the target is avoided to ensure that the target is The in-focus position can be detected.

更に、オートフォーカス装置は、前記焦点位置に対して適正な分布範囲または極性の情報を取得する適正分布取得部を備え、前記合焦位置判定部は、前記複数の焦点位置に対する前記複数の評価値の中から局所的ピーク位置を1つ以上算出し、前記適正分布に最も適する前記局所的ピーク位置が得られた前記焦点位置を合焦位置として判定してもよい。   The autofocus device further includes an appropriate distribution acquisition unit that acquires information on an appropriate distribution range or polarity with respect to the focus position, and the focus position determination unit includes the plurality of evaluation values for the plurality of focus positions. One or more local peak positions may be calculated from the above, and the focal position at which the local peak position most suitable for the appropriate distribution is obtained may be determined as the in-focus position.

このような構成によれば、被写体において焦点位置の異なる2つ以上の突起部や凹部が存在する場合でも、最適なターゲットを選択してフォーカスを合わせることが可能となる。   According to such a configuration, even when there are two or more protrusions or recesses having different focal positions in the subject, it is possible to select an optimum target and focus.

更に、オートフォーカス装置は、前記第1領域の大きさ及び前記第2領域の大きさの少なくとも一方を変更することができる領域設定部を備えてもよいし、前記第1のスコア成分に寄与させる前記正の重み及び前記第2のスコア成分に寄与させる前記負の重みの少なくとも一方を変更することができる寄与率設定部を備えてもよい。   Furthermore, the autofocus device may include an area setting unit that can change at least one of the size of the first area and the size of the second area, and contributes to the first score component. A contribution rate setting unit that can change at least one of the positive weight and the negative weight that contributes to the second score component may be provided.

これらのような構成によれば、オートフォーカス装置は、被写体においてピントを合わせるべきターゲットについて、被写体(例えば、マシンビジョンシステム等での検査製品)毎に、詳細な設定を行うことが可能となる。   According to such a configuration, the autofocus device can perform detailed setting for each subject (for example, an inspection product in a machine vision system or the like) for a target to be focused on the subject.

また、本発明のオートフォーカス用プログラムは、上記の何れかのオートフォーカス装置としてコンピュータを機能させるためのプログラムであって、上記のオートフォーカス装置に備わる評価値算出部及び合焦位置判定部や、適正分布取得部、領域設定部及び寄与率設定部と同様の機能の各処理ステップを有して構成される。   Further, the autofocus program of the present invention is a program for causing a computer to function as any of the above autofocus devices, the evaluation value calculation unit and the in-focus position determination unit provided in the autofocus device, Each processing step has the same function as the appropriate distribution acquisition unit, region setting unit, and contribution rate setting unit.

本発明によれば、フォーカスのターゲットの数や位置の変動に拘らず、小さい負荷で、適切なオートフォーカスを実現することができる。   According to the present invention, it is possible to realize appropriate autofocus with a small load regardless of the number of focus targets and the variation in position.

本発明の一実施形態に係るオートフォーカス装置を備えた撮像システムを示すブロック図である。1 is a block diagram illustrating an imaging system including an autofocus device according to an embodiment of the present invention. 本発明の一実施形態に係るオートフォーカス装置を備えた撮像システムで撮影した被写体の撮影画像の例を示す概要図である。It is a schematic diagram showing an example of a photographed image of a subject photographed by an imaging system including an autofocus device according to an embodiment of the present invention. 本発明の一実施形態に係るオートフォーカス装置におけるオートフォーカス動作を示すフローチャートである。It is a flowchart which shows the autofocus operation | movement in the autofocus apparatus based on one Embodiment of this invention. 本発明の他の実施形態に係るオートフォーカス装置の加重フィルタ生成部で生成される加重フィルタの例を示すグラフである。It is a graph which shows the example of the weighting filter produced | generated by the weighting filter production | generation part of the autofocus apparatus which concerns on other embodiment of this invention. 本発明の一実施形態に係るオートフォーカス装置を備えた撮像システムで撮影した被写体の画像データの例を示す概要図である。It is a schematic diagram which shows the example of the image data of the object image | photographed with the imaging system provided with the auto-focus apparatus which concerns on one Embodiment of this invention. 本発明の一実施形態に係るオートフォーカス装置を備えた撮像システムで撮影した被写体の画像データの一部の例を示すグラフである。It is a graph which shows the example of a part of image data of the subject image | photographed with the imaging system provided with the autofocus apparatus which concerns on one Embodiment of this invention. 本発明の一実施形態に係るオートフォーカス装置を備えた撮像システムで撮影した被写体の画像データに基づく空間フィルタリング処理後のデータの一部の例を示すグラフである。It is a graph which shows the example of a part of data after the spatial filtering process based on the image data of the object image | photographed with the imaging system provided with the autofocus apparatus which concerns on one Embodiment of this invention. オートフォーカス装置を備えた撮像システムで撮影した被写体の画像データに基づく振幅成分への換算処理後のデータの一部の例を示すグラフである。It is a graph which shows the example of a part of data after the conversion process to the amplitude component based on the image data of the object image | photographed with the imaging system provided with the autofocus apparatus. 本発明の一実施形態に係るオートフォーカス装置を備えた撮像システムで撮影した被写体の画像データに基づく重み付け処理後のデータの一部の例を示すグラフである。It is a graph which shows the example of a part of data after the weighting process based on the image data of the object image | photographed with the imaging system provided with the auto-focus apparatus which concerns on one Embodiment of this invention.

以下、図面を参照しつつ、本発明の実施形態について説明する。本発明のオートフォーカス装置は、独立した装置でもよいが、カメラ、スマートフォン、タブレット端末等のように撮像部を備えていて撮像制御や画像処理が可能な様々な機器の一部として備わるオートフォーカス装置でもよく、マシンビジョンシステム等の撮像システムにおいて撮像部に接続されていて撮像制御や画像処理が可能な管理装置等の様々な機器の一部として備わるオートフォーカス装置でもよい。即ち、本発明のオートフォーカス装置は、撮像画像に基づくオートフォーカス機能を有する様々な装置やコンピュータの一部として備わるものであればよい。同様にして、本発明のオートフォーカス用プログラムも、撮像画像に基づくオートフォーカス機能を有する様々な装置やコンピュータの一部として備わるものであればよい。本実施形態では、本発明に係るオートフォーカス装置を備えた撮像システム1について説明する。   Hereinafter, embodiments of the present invention will be described with reference to the drawings. Although the autofocus device of the present invention may be an independent device, the autofocus device includes an imaging unit such as a camera, a smartphone, and a tablet terminal, and is provided as part of various devices capable of imaging control and image processing. Alternatively, it may be an autofocus device provided as a part of various devices such as a management device that is connected to an imaging unit and can perform imaging control and image processing in an imaging system such as a machine vision system. That is, the autofocus device of the present invention may be provided as a part of various devices or computers having an autofocus function based on a captured image. Similarly, the autofocus program of the present invention may be provided as a part of various devices or computers having an autofocus function based on a captured image. In the present embodiment, an imaging system 1 including an autofocus device according to the present invention will be described.

図1に示すように、撮像システム1は、光学系10と、光学系駆動部11と、撮像部12と、撮像駆動部13と、A/D変換部14と、画像処理部15と、領域設定部16と、加重フィルタ生成部17と、評価値算出部18と、合焦位置判定部19とを備える。また、撮像システム1は、CPU等からなる制御部30と、ROMやRAM等からなる記憶部31と、画像データを記録する記録媒体32と、操作部33と、表示部34とを備える。図1では、撮像システム1の各部間でやり取りされる被写体像や画像データ等を点線で示し、制御信号や駆動信号等を実線で示す。   As shown in FIG. 1, the imaging system 1 includes an optical system 10, an optical system driving unit 11, an imaging unit 12, an imaging driving unit 13, an A / D conversion unit 14, an image processing unit 15, and an area. A setting unit 16, a weighting filter generation unit 17, an evaluation value calculation unit 18, and an in-focus position determination unit 19 are provided. In addition, the imaging system 1 includes a control unit 30 including a CPU, a storage unit 31 including a ROM and a RAM, a recording medium 32 that records image data, an operation unit 33, and a display unit 34. In FIG. 1, subject images, image data, and the like exchanged between the units of the imaging system 1 are indicated by dotted lines, and control signals, drive signals, and the like are indicated by solid lines.

撮像システム1は、例えば、光学系10、光学系駆動部11、撮像部12、撮像駆動部13及びA/D変換部14からなるカメラ(撮像装置)と、他の各部を含むパーソナルコンピュータ(管理装置)とを通信可能に接続して構成される。あるいは、撮像システム1は、各部を1つのカメラに備えて構成されてもよい。撮像システム1のオートフォーカス装置は、少なくとも、領域設定部16、加重フィルタ生成部17、評価値算出部18及び合焦位置判定部19を備えて構成され、入力画像データに基づいて光学系10の光学駆動部12を制御する。   The imaging system 1 includes, for example, a camera (imaging device) including an optical system 10, an optical system drive unit 11, an imaging unit 12, an imaging drive unit 13, and an A / D conversion unit 14, and a personal computer (management) including other units. Device) in a communicable manner. Alternatively, the imaging system 1 may be configured by including each unit in one camera. The autofocus device of the imaging system 1 is configured to include at least an area setting unit 16, a weighting filter generation unit 17, an evaluation value calculation unit 18, and a focus position determination unit 19, and the optical system 10 includes an optical system 10 based on input image data. The optical drive unit 12 is controlled.

撮像システム1は、バス30aを介して各部に接続された制御部30が各部を制御することで動作するように構成される。記憶部31は、例えば、撮影制御、オートフォーカス制御、画像処理制御等に必要なプログラムやデータ、その他の撮像システム1の機能を制御するためのプログラムやデータを記憶している。そして、制御部30は、記憶部31に記憶された各プロクラム等に従って演算処理を実行して、制御部30に接続された各部を制御する。   The imaging system 1 is configured such that the control unit 30 connected to each unit via the bus 30a operates by controlling each unit. The storage unit 31 stores, for example, programs and data necessary for shooting control, autofocus control, image processing control, and other programs and data for controlling other functions of the imaging system 1. The control unit 30 executes arithmetic processing according to each program stored in the storage unit 31 to control each unit connected to the control unit 30.

例えば、画像処理部15は、記憶部31に記憶されて制御部30に実行されるプログラム(即ち、画像処理プログラム)で構成されてよい。また、領域設定部16、加重フィルタ生成部17、評価値算出部18及び合焦位置判定部19、並びに後述する寄与率設定部20及び適正分布取得部21は、記憶部31に記憶されて制御部30に実行されるプログラム(即ち、撮像システム1やカメラに適用されるオートフォーカス用プログラム)で構成されてよい。この場合、領域設定部16、加重フィルタ生成部17、評価値算出部18及び合焦位置判定部19、並びに後述する寄与率設定部20及び適正分布取得部21は、オートフォーカス用プログラムの各処理ステップとして動作する。例えば、オートフォーカス用プログラムは、撮像システム1やカメラの撮影モードが被写体の突出した先端や凹部の深部にピントを合わせるピンフォーカスモード等に選択された場合に動作するように組み込まれる。   For example, the image processing unit 15 may be configured by a program (that is, an image processing program) stored in the storage unit 31 and executed by the control unit 30. In addition, the region setting unit 16, the weighting filter generation unit 17, the evaluation value calculation unit 18, the in-focus position determination unit 19, a contribution rate setting unit 20 and an appropriate distribution acquisition unit 21 to be described later are stored and controlled in the storage unit 31. The program may be configured to be executed by the unit 30 (that is, an autofocus program applied to the imaging system 1 or the camera). In this case, the area setting unit 16, the weighting filter generation unit 17, the evaluation value calculation unit 18, the in-focus position determination unit 19, the contribution rate setting unit 20, and the appropriate distribution acquisition unit 21 described later are each processed by the autofocus program. Operates as a step. For example, the autofocus program is incorporated so as to operate when the shooting mode of the imaging system 1 or the camera is selected as a pin focus mode for focusing on the protruding tip of the subject or the deep part of the recess.

光学系10は、被写体像を取り込んで撮像部12に入射する光入射機構である。光学系10は、図示しないが、ズームレンズ、フォーカスレンズ、シャッタ機構や絞り機構を、所定の光軸上に配置して備える。光学系10は、光学系駆動部11からの駆動信号に応じてフォーカスレンズが光軸方向に変位するように構成される。   The optical system 10 is a light incident mechanism that captures a subject image and enters the imaging unit 12. Although not shown, the optical system 10 includes a zoom lens, a focus lens, a shutter mechanism, and a diaphragm mechanism arranged on a predetermined optical axis. The optical system 10 is configured such that the focus lens is displaced in the optical axis direction in accordance with a drive signal from the optical system drive unit 11.

光学系駆動部11は、制御部30からの制御信号に基づいて、光学系10のフォーカスレンズの位置を変動させる駆動信号を光学系10へと出力する。例えば、光学系駆動部11は、コントラスト方式(山登り方式)のオートフォーカス動作時には、フォーカスレンズの位置(焦点位置)を段階的に変動させる駆動信号を順次出力する。また、光学系駆動部11は、オートフォーカス動作等で合焦位置(合焦するレンズ位置)が決定した場合には、決定したレンズ位置にフォーカスレンズを変動させる駆動信号を出力する。   The optical system drive unit 11 outputs a drive signal for changing the position of the focus lens of the optical system 10 to the optical system 10 based on a control signal from the control unit 30. For example, the optical system drive unit 11 sequentially outputs a drive signal that fluctuates the position of the focus lens (focal position) step by step during a contrast method (mountain climbing method) autofocus operation. Further, when the in-focus position (lens position to be in focus) is determined by an autofocus operation or the like, the optical system drive unit 11 outputs a drive signal for changing the focus lens to the determined lens position.

撮像部12は、図示しないが、撮影画像の1画面を形成する撮像面及び水平転送路を備え、撮像面が、各画素に対応する複数の感光部及び複数の垂直転送路を備える。各感光部は、入射光を受光した際に、光を受光光量に応じた電気信号に光電変換する光センサである。例えば、撮像部12は、電荷結合素子(Charge Coupled Device:CCD)や金属酸化膜型半導体(Metal Oxide Semiconductor:MOS)等のイメージセンサで構成される。撮像部12は、光学系10を介してその撮像面に結像される被写体像を、撮像駆動部13からの駆動信号に基づいて光電変換し、これにより得られた各画素の信号電荷をアナログ電気信号の撮像画像に変換してA/D変換部14へと出力する。   Although not shown, the imaging unit 12 includes an imaging surface and a horizontal transfer path that form one screen of a captured image, and the imaging surface includes a plurality of photosensitive units and a plurality of vertical transfer paths corresponding to each pixel. Each photosensitive unit is an optical sensor that photoelectrically converts light into an electrical signal corresponding to the amount of received light when receiving incident light. For example, the imaging unit 12 includes an image sensor such as a charge coupled device (CCD), a metal oxide semiconductor (Metal Oxide Semiconductor: MOS), or the like. The imaging unit 12 photoelectrically converts a subject image formed on the imaging surface via the optical system 10 based on a drive signal from the imaging drive unit 13 and analogizes the signal charge of each pixel obtained thereby. An electrical signal is converted into a captured image and output to the A / D converter 14.

撮像駆動部13は、制御部30からの制御信号に基づいて撮像部12を駆動する。例えば、撮像駆動部13は、各感光部から電荷を読み出すための電荷読出パルス、水平転送路や垂直転送路での電荷の転送を行うための転送パルス等の駆動信号を撮像部12へと出力する。   The imaging drive unit 13 drives the imaging unit 12 based on a control signal from the control unit 30. For example, the imaging drive unit 13 outputs to the imaging unit 12 drive signals such as a charge readout pulse for reading out charges from each photosensitive unit and a transfer pulse for transferring charges in the horizontal transfer path and the vertical transfer path. To do.

A/D変換部14は、撮像部12で生成されたアナログ電気信号の撮像画像を、ディジタル画像信号の撮像画像へと変換する。   The A / D converter 14 converts the captured image of the analog electrical signal generated by the imaging unit 12 into a captured image of a digital image signal.

画像処理部15は、A/D変換部14で得られたディジタル画像信号の撮像画像に画像処理を施す。例えば、画像処理部15は、記録媒体32等で記録可能なフォーマットの画像データを生成して、記録媒体32に記録する。また、画像処理部15は、表示部34等で表示可能なフォーマットの画像データを生成して、表示部34に表示させる。更に、画像処理部15は、オートフォーカス動作時には、光学系10のフォーカスレンズを各段階に変動させる度に画像データを生成し、即ち、複数の焦点位置のそれぞれの画像データを生成する。   The image processing unit 15 performs image processing on the captured image of the digital image signal obtained by the A / D conversion unit 14. For example, the image processing unit 15 generates image data in a format that can be recorded on the recording medium 32 or the like, and records the image data on the recording medium 32. Further, the image processing unit 15 generates image data in a format that can be displayed on the display unit 34 and the like, and causes the display unit 34 to display the image data. Further, the image processing unit 15 generates image data every time the focus lens of the optical system 10 is changed at each stage during the autofocus operation, that is, generates image data of each of a plurality of focal positions.

領域設定部16は、被写体40を撮影する際のフォーカスのターゲット41に相当する領域を設定する機能を有する(図2参照)。領域設定部16は、図2に示すように、被写体40の画像データの全画像領域43の中で、ターゲット41を含む大きさの主対象範囲44と、主対象範囲44の周囲でターゲット41の周辺部分42を少なくとも一部以上含む大きさの周辺範囲45とを設定する。領域設定部16は、被写体40の画像データとして予め定めた基準データに基づいて、あるいは、複数の被写体40が撮影される際に最初に撮影した画像データに基づいて、主対象範囲44や周辺範囲45を設定してもよい。領域設定部16は、主対象範囲44及び周辺範囲45を、基準データに基づいて自動的に設定してもよいが、操作部33を介したユーザーの手動操作に応じて設定してもよい。例えば、領域設定部16は、ユーザーの手動操作のために、画像データの全画像領域43を表示部34に表示し、全画像領域43上の範囲選択を操作部33を介して受け付け、選択された範囲を主対象範囲44や周辺範囲45として設定する。このように、領域設定部16は、主対象範囲44及び周辺範囲45の大きさの少なくとも一方を変更可能に構成され、これにより、下記の局所領域の第1領域46の大きさ及び第2領域47の大きさの少なくとも一方を変更可能となっている。   The area setting unit 16 has a function of setting an area corresponding to the focus target 41 when photographing the subject 40 (see FIG. 2). As shown in FIG. 2, the region setting unit 16 includes a main target range 44 having a size including the target 41 in the entire image region 43 of the image data of the subject 40, and the target 41 around the main target range 44. A peripheral range 45 having a size including at least a part of the peripheral portion 42 is set. The area setting unit 16 determines the main target range 44 and the peripheral range based on reference data predetermined as the image data of the subject 40 or based on image data first taken when a plurality of subjects 40 are taken. 45 may be set. The area setting unit 16 may automatically set the main target range 44 and the peripheral range 45 based on the reference data, but may set the main target range 44 and the peripheral range 45 according to a user's manual operation via the operation unit 33. For example, the region setting unit 16 displays the entire image region 43 of the image data on the display unit 34 for manual operation by the user, and accepts and selects a range on the entire image region 43 via the operation unit 33. Are set as the main target range 44 and the peripheral range 45. As described above, the region setting unit 16 is configured to be able to change at least one of the sizes of the main target range 44 and the peripheral range 45, and thereby, the size of the first region 46 and the second region of the following local region At least one of the 47 sizes can be changed.

ターゲット41は、全画像領域43の中の一部であり、例えば、周辺部分42よりも小面積である。主対象範囲44は、ターゲット41が既知である前提で、ターゲット41を含む画像サイズ(主対象サイズ)であり、例えば、8×8画素以上の矩形で設定される。周辺範囲45は、ターゲット41の合焦時にぼけているターゲット41の周辺部分42(背景)を包含する領域のサイズ(周辺サイズ)であり、ターゲット41の周囲に対称的に位置するような矩形で設定される。なお、周辺範囲45は、画像データの全画像領域43に複数のターゲット41がある場合には、主対象範囲44に対応するターゲット41に隣接する他のターゲットを含まないように設定される。被写体が複数のターゲット41を含む場合でも、周辺範囲45が隣接する他のターゲットを含まずに設定されることにより、確実にターゲット41の合焦位置を検出できるようになる。   The target 41 is a part of the entire image region 43, and has a smaller area than the peripheral portion 42, for example. The main target range 44 is an image size (main target size) including the target 41 on the assumption that the target 41 is known, and is set, for example, as a rectangle of 8 × 8 pixels or more. The peripheral range 45 is a size (peripheral size) of a region including the peripheral portion 42 (background) of the target 41 that is blurred when the target 41 is in focus, and is a rectangle that is symmetrically positioned around the target 41. Is set. The peripheral range 45 is set so as not to include other targets adjacent to the target 41 corresponding to the main target range 44 when there are a plurality of targets 41 in the entire image region 43 of the image data. Even when the subject includes a plurality of targets 41, the in-focus position of the target 41 can be reliably detected by setting the peripheral range 45 without including other adjacent targets.

加重フィルタ生成部17は、領域設定部16で設定された主対象範囲44及び周辺範囲45に対応する空間的加重フィルタ(カーネル)を生成する。加重フィルタ生成部17は、加重フィルタにおいて、主対象範囲44に相当する領域には主対象重み係数として正の値(正の重みに対応する正の係数)を設定し、周辺範囲45に相当する領域には周辺重み係数として負の値(負の重みに対応する負の係数)を設定する。なお、主対象範囲44や周辺範囲45に設定される重み係数は、加重フィルタ生成部17が自動的に設定してもよいが、操作部33を介したユーザーの手動操作によって調整可能としてよい。例えば、撮像システム1が、主対象範囲44に対して設定された主対象重み係数、及び周辺範囲45に対して設定された周辺重み係数の少なくとも一方を変更することができる寄与率設定部20を備えてもよい。寄与率設定部20は、例えば、主対象重み係数や周辺重み係数を設定するための寄与率設定画面を表示部34に表示して、主対象重み係数や周辺重み係数のユーザーによる設定入力を寄与率設定画面上で操作部33を介して受け付けるとよい。   The weighting filter generation unit 17 generates a spatial weighting filter (kernel) corresponding to the main target range 44 and the peripheral range 45 set by the region setting unit 16. In the weighting filter, the weighting filter generation unit 17 sets a positive value (a positive coefficient corresponding to a positive weight) as a main target weighting factor in an area corresponding to the main target range 44, and corresponds to the peripheral range 45. A negative value (a negative coefficient corresponding to a negative weight) is set as a peripheral weighting coefficient in the region. The weighting factors set in the main target range 44 and the peripheral range 45 may be automatically set by the weighting filter generation unit 17, but may be adjustable by a user's manual operation via the operation unit 33. For example, the imaging system 1 includes a contribution rate setting unit 20 that can change at least one of the main target weighting factor set for the main target range 44 and the peripheral weighting factor set for the peripheral range 45. You may prepare. For example, the contribution rate setting unit 20 displays a contribution rate setting screen for setting the main target weighting factor and the peripheral weighting factor on the display unit 34, and contributes the setting input by the user of the main target weighting factor and the peripheral weighting factor. It may be accepted via the operation unit 33 on the rate setting screen.

主対象重み係数は、オートフォーカス動作時に焦点のみが異なる画像間の相対比較を行う際に、ターゲット41に合焦した画像のコントラストを明瞭にするための重み係数であり、絶対値は必ずしも限定しないが、ここでは、主対象範囲44のサンプリング点の合計が1.0となるように正規化した値とする。周辺重み係数は、ターゲット41の周辺部分42に合焦した画像のコントラストを抑制するための重み係数であり、即ち、周辺範囲45は、画像データのコントラストから得られるスコア(評価値)にペナルティを与える領域である。周辺重み係数は、負の値であれば必ずしも限定せずにペナルティ効果を考慮して選択すればよいが、ここではサイズによって適用後のレベルが変動しないような値に設定するため、例えば、周辺範囲45のサンプリング点合計が−2.0となるように正規化する。   The main target weighting factor is a weighting factor for clarifying the contrast of the image focused on the target 41 when performing a relative comparison between images having different focal points during the autofocus operation, and the absolute value is not necessarily limited. However, here, the normalized value is set so that the sum of the sampling points in the main target range 44 is 1.0. The peripheral weighting factor is a weighting factor for suppressing the contrast of the image focused on the peripheral portion 42 of the target 41. That is, the peripheral range 45 penalizes the score (evaluation value) obtained from the contrast of the image data. It is an area to give. The peripheral weighting factor is not necessarily limited as long as it is a negative value, and may be selected in consideration of the penalty effect, but here it is set to a value that does not change the level after application depending on the size. Normalization is performed so that the sum of the sampling points in the range 45 is −2.0.

上記の加重フィルタは、各焦点位置の画像データ(全画像領域43)において画素位置の異なる複数の局所領域のデータ(以下、単に局所領域と称する)のそれぞれに対する畳み込み演算に用いられる。局所領域は、主対象範囲44及び周辺範囲45を含む大きさであり、即ち、主対象範囲44に対応する第1領域46と周辺範囲45に対応する第2領域47とを含む。例えば、全画像領域43に亘って画素位置毎にスキャンすることで複数の局所領域が得られる。この畳み込み演算の結果に基づいて、各局所領域の評価データが算出される。各局所領域の評価データは、詳細は後述するが、鮮鋭度と相関が高いスコア成分(鮮鋭度の指標となるスコア成分)に基づいて算出される。加重フィルタを用いた畳み込み演算を行うことにより、第1領域46の第1のスコア成分を算出するときには第1のスコア成分に正の重みが寄与することになり、また、第2領域47の第2のスコア成分を算出するときには第2のスコア成分に負の重みが寄与することになる。   The weighting filter is used for a convolution operation on each of a plurality of local area data (hereinafter simply referred to as local areas) having different pixel positions in the image data (all image areas 43) at each focal position. The local region has a size including the main target range 44 and the peripheral range 45, that is, includes a first region 46 corresponding to the main target range 44 and a second region 47 corresponding to the peripheral range 45. For example, a plurality of local regions can be obtained by scanning the entire image region 43 for each pixel position. Based on the result of this convolution operation, evaluation data for each local region is calculated. The evaluation data of each local area is calculated based on a score component (score component serving as an index of sharpness) having a high correlation with the sharpness, details of which will be described later. By performing a convolution operation using a weighting filter, a positive weight contributes to the first score component when the first score component of the first region 46 is calculated. When calculating the score component of 2, a negative weight contributes to the second score component.

評価値算出部18は、オートフォーカス動作時に撮像された各焦点位置の画像データに基づいて、最適な合焦位置を評価するための評価値を算出する。即ち、評価値算出部18は、各焦点位置での評価値を算出する。オートフォーカス動作時の評価値の算出について、図3のフローチャートを参照して説明する。   The evaluation value calculation unit 18 calculates an evaluation value for evaluating the optimum in-focus position based on the image data of each focal position imaged during the autofocus operation. That is, the evaluation value calculation unit 18 calculates an evaluation value at each focal position. Calculation of the evaluation value during the autofocus operation will be described with reference to the flowchart of FIG.

オートフォーカス動作時を開始する前に、上記の加重フィルタ生成部17によって加重フィルタを生成しておく(ステップS1)。加重フィルタ生成部17は、2次元の主対象範囲44及び周辺範囲45に対応する加重フィルタを生成するが、理解を容易にするため、1次元(左右方向)の加重フィルタを図4のグラフに示す。図4において、縦軸は重み係数のレベルを定めるフィルタ係数Fを示し、横軸は左右方向の画素位置座標iを示していて、横軸の原点は主対象範囲44の中心を示す。図4に示すように、加重フィルタは、主対象範囲44に主対象重み係数を設定すると共に、周辺範囲45に周辺重み係数を設定して構成される。   Before starting the autofocus operation, a weighting filter is generated by the weighting filter generation unit 17 (step S1). The weighting filter generation unit 17 generates a weighting filter corresponding to the two-dimensional main target range 44 and the peripheral range 45, but in order to facilitate understanding, the one-dimensional (left-right direction) weighting filter is represented in the graph of FIG. Show. In FIG. 4, the vertical axis indicates the filter coefficient F that determines the level of the weighting coefficient, the horizontal axis indicates the pixel position coordinate i in the horizontal direction, and the origin of the horizontal axis indicates the center of the main target range 44. As shown in FIG. 4, the weighting filter is configured by setting a main target weighting factor in the main target range 44 and setting a peripheral weighting factor in the peripheral range 45.

評価値算出部18は、例えば、図5に示すような全画像領域43を構成する2次元の画像データを入力するが(ステップS2)、理解を容易にするため、線Bに沿った1次元(左右方向)の画像データを図6のグラフに示す。図5において、ターゲット41は被写体40から撮影側(カメラ側)に突出している。図6(a)はターゲット41の周辺部分42に合焦した状態(周辺合焦状態)のデータを示し、図6(b)はターゲット41に合焦した状態(ターゲット合焦状態)のデータを示す。以下、図7、図8及び図9でも、理解を容易にするため、図6と同様にして1次元(左右方向)のデータを示す。   The evaluation value calculation unit 18 inputs, for example, two-dimensional image data constituting the entire image region 43 as shown in FIG. 5 (step S2), but in order to facilitate understanding, the evaluation value calculation unit 18 performs one-dimensional along the line B. The image data in the (left-right direction) is shown in the graph of FIG. In FIG. 5, the target 41 protrudes from the subject 40 to the photographing side (camera side). 6A shows data in a state in which the peripheral portion 42 of the target 41 is focused (peripheral focused state), and FIG. 6B shows data in a state in which the target 41 is focused (target focused state). Show. Hereinafter, in order to facilitate understanding, one-dimensional (left-right direction) data is also shown in FIGS.

評価値算出部18は、各焦点位置の画像データの評価値を算出するために、画像データに含まれる複数の局所領域のそれぞれについて評価データを生成し、これらの複数の評価データに基づいて各焦点位置の評価値を算出する。評価データの生成及び評価値の算出の詳細は後述する。なお、この局所領域には、主対象範囲44に対応する同じ大きさの第1領域46と、周辺範囲45に対応する同じ大きさの第2領域47との少なくとも2つの領域が含まれる。評価値算出部18は、各焦点位置の画像データとして、例えば、各画素位置に結像される被写体40の輝度に線形又は非線形な関係を有する階調に相当する情報を用いて、この階調が全画像領域43内の複数の局所領域毎に分布したコントラストに相当する指標を算出して、その算出結果の画素データを用いる。ここで用いられる画素データは、例えば、輝度に線形に比例するモノクロ信号(グレースケール)でよい。あるいは、三原色RGBからなる画像データから抽出したG成分のみのデータや、ガンマ特性等の被線形に符号化されたデータを用いてもよい。   The evaluation value calculation unit 18 generates evaluation data for each of a plurality of local regions included in the image data in order to calculate the evaluation value of the image data at each focal position, and each evaluation data is calculated based on the plurality of evaluation data. An evaluation value of the focal position is calculated. Details of generation of evaluation data and calculation of evaluation values will be described later. The local region includes at least two regions, a first region 46 having the same size corresponding to the main target range 44 and a second region 47 having the same size corresponding to the peripheral range 45. The evaluation value calculation unit 18 uses, as the image data at each focal position, for example, information corresponding to a gradation having a linear or nonlinear relationship with the luminance of the subject 40 imaged at each pixel position. Calculates an index corresponding to the contrast distributed for each of the plurality of local areas in the entire image area 43, and uses the pixel data of the calculation result. The pixel data used here may be, for example, a monochrome signal (grayscale) that is linearly proportional to the luminance. Alternatively, only the G component data extracted from the image data composed of the three primary colors RGB, or linearly encoded data such as gamma characteristics may be used.

評価値算出部18は、評価データ生成のために、先ず、各画像データの各局所領域の画素データに対して所定のバンドパス特性を有する空間的周波数フィルタを用いて周波数フィルタ処理を行い(ステップS3)、エッジ部を中心に局所的な明暗の相対変化のみをデータとして算出する。そして、周波数フィルタ処理後のデータに基づいて、複数の局所領域のそれぞれについて、鮮鋭度と相関が高いスコア成分(鮮鋭度の指標となるスコア成分)を算出する。例えば、各局所領域のデータを、振幅成分でコントラストの大小を表す数値に換算する換算処理を行う。これにより、各局所領域の第1領域46に対する第1のスコア成分と第2領域47に対する第2のスコア成分とが算出される。   In order to generate evaluation data, the evaluation value calculation unit 18 first performs frequency filter processing on the pixel data of each local region of each image data using a spatial frequency filter having a predetermined bandpass characteristic (step S1). S3) Only local relative light and dark changes centering on the edge portion are calculated as data. Then, based on the data after the frequency filter processing, a score component (score component serving as a sharpness index) having a high correlation with the sharpness is calculated for each of the plurality of local regions. For example, a conversion process is performed for converting the data of each local region into a numerical value representing the magnitude of contrast with an amplitude component. As a result, the first score component for the first region 46 and the second score component for the second region 47 of each local region are calculated.

このような空間フィルタリング処理では、例えば、ローカットフィルタによって、鮮鋭度と相関の低い明暗差を除き、ハイカットフィルタによって、フォーカス判定に関連の低いノイズ成分の影響を抑える。あるいは、この空間フィルタリング処理では、図6に示すデータに対して、最小限の簡易な処理として平均を除いて振幅のみを抽出する計算を行うことによって、図7に示すデータが得られる。なお、周波数フィルタ処理は、画像データから局所的なコントラストを検出するための手法の一つであり、局所的なコントラストを検出することができれば、周波数フィルタ処理以外の手法を適用してもよい。   In such a spatial filtering process, for example, a low-cut filter removes contrast differences having low correlation with sharpness, and a high-cut filter suppresses the influence of low noise components related to focus determination. Alternatively, in this spatial filtering process, the data shown in FIG. 7 can be obtained by performing a calculation for extracting only the amplitude, excluding the average, as a minimum simple process for the data shown in FIG. Note that the frequency filter process is one of the techniques for detecting local contrast from image data, and any technique other than the frequency filter process may be applied as long as the local contrast can be detected.

ここで一般的には、振幅成分でコントラストの大小を表す数値に換算するために、例えば、二乗平均や最大値と最小値との差等によって算出することができる。また、図8のように絶対値したデータの平均を用いる処理は、各値をY(iは、データ数n以下の整数)、各値の平均値をYmeanとすると、次の数式(1)によって行うことができる。

Figure 2017224923
Here, in general, in order to convert the amplitude component into a numerical value indicating the magnitude of the contrast, for example, it can be calculated by a mean square or a difference between the maximum value and the minimum value. The average processing using the absolute value data as in Figure 8, each value Y i (i is an integer number of data n), when the average value of each value and Y mean, the following equation ( 1).
Figure 2017224923

しかしながら、このように単純に平均化したデータでは、図8(a)の周辺合焦状態は、図8(b)のターゲット合焦状態に比べて、全体的に絶対値が高いため、このままでは、図8(a)の周辺合焦状態の方がコントラストが高いと判断されてしまうことがある。   However, with the data simply averaged in this way, the peripheral in-focus state in FIG. 8A has a higher absolute value as a whole than the target in-focus state in FIG. In some cases, it is determined that the contrast is higher in the peripheral in-focus state in FIG.

従って、評価値算出部18は、コントラストを表す数値への換算処理の前に、追加的に加重フィルタ処理を行う(ステップS5)。ここでは、周波数フィルタ後の振幅成分Aに対して(例えば、上記のように絶対値化されたレベル|Y−Ymean|に対して)、上記の加重フィルタを適用する畳み込み演算を行い、次の数式(2)で表すことができる。

Figure 2017224923
Accordingly, the evaluation value calculation unit 18 additionally performs a weighting filter process before the conversion process into a numerical value representing contrast (step S5). Here, a convolution operation that applies the above weighting filter is performed on the amplitude component A i after the frequency filter (for example, on the level | Y i −Y mean | absolute value as described above). , Can be expressed by the following formula (2).
Figure 2017224923

このとき、同一の局所領域において、加重フィルタの主対象範囲44に対して第1領域46内にターゲット41に相当するデータ(ターゲットデータ)があると共に周辺範囲45に対して第2領域47内に周辺部分42に相当するデータ(周辺部データ)がある場合には、畳み込み演算によって全体的にデータのレベルが下げられるがターゲットデータのピークは維持される(図9(b)参照)。一方、同一の局所領域において、加重フィルタの主対象範囲44に対して第1領域46内にターゲット41に相当するデータ(ターゲットデータ)がない場合には、畳み込み演算によって全体的にデータのレベルが下げられ、即ち、ターゲット41の周辺部分42に合焦した画像に対する全体的なレベルは抑制される(図9(a)参照)。   At this time, in the same local region, there is data (target data) corresponding to the target 41 in the first region 46 with respect to the main target range 44 of the weighting filter, and within the second region 47 with respect to the peripheral range 45. When there is data corresponding to the peripheral portion 42 (peripheral portion data), the level of the data is lowered as a whole by the convolution operation, but the peak of the target data is maintained (see FIG. 9B). On the other hand, in the same local region, when there is no data (target data) corresponding to the target 41 in the first region 46 with respect to the main target range 44 of the weighting filter, the overall data level is determined by the convolution operation. That is, the overall level of the image focused on the peripheral portion 42 of the target 41 is suppressed (see FIG. 9A).

従って、このような畳み込み演算後のデータに対して上記の換算処理を行うと(ステップS6)、各局所領域の第1領域46に対して算出される第1のスコア成分に対しては、加重フィルタの主対象範囲44に設定された主対象重み係数が寄与していて、各局所領域の第2領域47に対して算出される第2のスコア成分に対しては、加重フィルタの周辺範囲45に設定された周辺重み係数が寄与するように計算(統合)した評価データが得られる。   Therefore, when the above conversion processing is performed on the data after such a convolution operation (step S6), the first score component calculated for the first region 46 of each local region is weighted. For the second score component calculated for the second region 47 of each local region, the main target weighting factor set in the main target range 44 of the filter contributes, and the peripheral range 45 of the weighting filter. Evaluation data calculated (integrated) so as to contribute to the peripheral weighting coefficient set in (1) is obtained.

そして、評価値算出部18は、上記の畳み込み演算を利用して生成された複数の局所領域の評価データに基づいて、注目する一定範囲から合焦位置を判定する指標となる1つの評価値を算出するための統計処理を行う(ステップS7)。例えば、評価値算出部18は、各画像データの全画像領域に亘る複数の評価データの中から最大値を取得して評価値とする。このとき、図9(b)に示すようなターゲット合焦状態の評価データは、ターゲット41に相当する位置でピークを有するため、図9(a)に示すような周辺合焦状態の評価データに比べて、高い評価値が得られる。   Then, the evaluation value calculation unit 18 obtains one evaluation value that serves as an index for determining the in-focus position from a certain range of interest based on the evaluation data of a plurality of local regions generated using the convolution operation. Statistical processing for calculation is performed (step S7). For example, the evaluation value calculation unit 18 acquires the maximum value from a plurality of evaluation data over the entire image area of each image data and sets it as the evaluation value. At this time, since the evaluation data of the target in-focus state as shown in FIG. 9B has a peak at a position corresponding to the target 41, the evaluation data in the peripheral in-focus state as shown in FIG. In comparison, a high evaluation value can be obtained.

なお、評価値算出部18は、図9(b)に示すような統計処理前の段階において、ターゲット41に合焦した場合の評価値の最大値が損なわれない解像度を維持できるなら、空間フィルタリング処理(ステップS3)の後に画像データの縮小処理(画素サイズ縮小処理)を行うことによって、その後の演算量を減らしてもよい(ステップS4)。   If the evaluation value calculation unit 18 can maintain a resolution that does not impair the maximum value of the evaluation value when focused on the target 41 in the stage before statistical processing as shown in FIG. By performing image data reduction processing (pixel size reduction processing) after the processing (step S3), the subsequent calculation amount may be reduced (step S4).

合焦位置判定部19は、異なる複数の各焦点位置において評価値算出部18で算出された評価値を分析し、最大の評価値が得られた焦点位置を、合焦位置として検出する(ステップS8)。例えば、各焦点位置の評価データの内、図9(b)のターゲット合焦状態の評価データがターゲット41に相当する位置でピークを有して最大の評価値が得られる場合には、このターゲット合焦状態の画像データを得たときの焦点位置(ターゲット41にピントを合わせた焦点位置)が、合焦位置として検出される。   The focus position determination unit 19 analyzes the evaluation value calculated by the evaluation value calculation unit 18 at each of a plurality of different focus positions, and detects the focus position at which the maximum evaluation value is obtained as the focus position (step) S8). For example, among the evaluation data of each focal position, when the evaluation data in the target in-focus state in FIG. 9B has a peak at a position corresponding to the target 41 and the maximum evaluation value is obtained, this target The focus position (focus position focused on the target 41) when the image data in focus is obtained is detected as the focus position.

なお、本実施形態では、周波数フィルタを用いた空間フィルタリング処理と、加重フィルタを用いた追加的なフィルタリング処理とを、別個に行う例を説明したが、本発明は、この例に限定されない。例えば、他の実施形態では、周波数フィルタと加重フィルタとを予め結合させた結合空間フィルタを用いて、畳み込み演算を空間フィルタリング処理と共に行ってもよい。   In the present embodiment, the example in which the spatial filtering process using the frequency filter and the additional filtering process using the weighting filter are performed separately has been described, but the present invention is not limited to this example. For example, in another embodiment, the convolution operation may be performed together with the spatial filtering process using a combined spatial filter in which a frequency filter and a weighting filter are combined in advance.

また、本実施形態では、加重フィルタを用いた畳み込み演算によって、第1領域46の第1のスコア成分に対して正の値の主対象重み係数を寄与させると共に、第2領域47の第2のスコア成分に対して負の値の周辺重み係数を寄与させる例を説明したが、本発明は、この例に限定されない。例えば、第1領域46の第1のスコア成分に対して正の値の主対象重み係数を寄与させるフィルタと、第2領域47の第2のスコア成分に対して負の値の周辺重み係数を寄与させるフィルタとを別個に備えて、各フィルタ処理結果を加算することで、各局所領域の評価データを算出してもよい。あるいは、第1領域46の第1のスコア成分に対して正の値の主対象重み係数を寄与させ、また、第2領域47の第2のスコア成分に対して負の値の周辺重み係数を寄与させることができれば、加重フィルタ等のフィルタを用いた畳み込み演算以外の手法を適用してもよい。   In the present embodiment, a positive main object weighting coefficient is contributed to the first score component in the first area 46 by convolution using a weighting filter, and the second area 47 second Although an example in which a negative peripheral weight coefficient is contributed to the score component has been described, the present invention is not limited to this example. For example, a filter that contributes a positive main object weighting factor to the first score component in the first region 46 and a negative peripheral weighting factor to the second score component in the second region 47. The evaluation data of each local region may be calculated by separately providing a filter to be contributed and adding each filter processing result. Alternatively, a positive main object weight coefficient is made to contribute to the first score component of the first area 46, and a negative peripheral weight coefficient is made to the second score component of the second area 47. As long as it can contribute, methods other than the convolution calculation using filters, such as a weighting filter, may be applied.

上述のように、本実施形態によれば、撮像システム1のオートフォーカス装置は、被写体40の画像のコントラストに応じて被写体40に対する焦点制御状態を決定する装置である。このオートフォーカス装置は、評価値算出部18と、合焦位置判定部19とを備える。評価値算出部18は、複数の焦点位置のそれぞれにおいて被写体40を撮像して得られる複数の画像データのそれぞれについて、合焦位置の判定に用いられる評価値を算出する。合焦位置判定部19は、複数の焦点位置のそれぞれに対して算出された複数の評価値に基づいて合焦位置を判定する。また、評価値算出部18は、各画像データに含まれる複数の局所領域のそれぞれについて、被写体40のフォーカスのターゲット41を含む大きさの第1領域46に対して算出される第1のスコア成分と、第1領域46の周囲でターゲット41の周辺部分42を少なくとも一部以上含む大きさの第2領域47に対して算出される第2のスコア成分とを用いて、第1のスコア成分に正の重みで寄与し、第2のスコア成分に負の重みで寄与するように計算した評価データを生成し、各画像データ内の複数の局所領域のそれぞれについて生成された複数の評価データに基づいて評価値を算出する。   As described above, according to the present embodiment, the autofocus device of the imaging system 1 is a device that determines the focus control state for the subject 40 according to the contrast of the image of the subject 40. The autofocus device includes an evaluation value calculation unit 18 and a focus position determination unit 19. The evaluation value calculation unit 18 calculates an evaluation value used for determining the in-focus position for each of a plurality of image data obtained by imaging the subject 40 at each of a plurality of focal positions. The focus position determination unit 19 determines the focus position based on a plurality of evaluation values calculated for each of the plurality of focus positions. Further, the evaluation value calculation unit 18 calculates the first score component calculated for the first region 46 having a size including the focus target 41 of the subject 40 for each of the plurality of local regions included in each image data. And the second score component calculated for the second region 47 having a size including at least a part of the peripheral portion 42 of the target 41 around the first region 46, Based on a plurality of evaluation data generated for each of a plurality of local regions in each image data, generating evaluation data that contributes with a positive weight and contributes to a second score component with a negative weight To calculate an evaluation value.

例えば、評価値算出部18は、各画像データ内の各局所領域の画素データに対して、正の重みに対応する正の係数を第1領域46に与えると共に負の重みに対応する負の係数を第2領域47に与える空間的加重フィルタを用いた畳み込み演算を行い、畳み込み演算の結果に基づいて評価データを生成するとよい。   For example, the evaluation value calculation unit 18 gives a positive coefficient corresponding to a positive weight to the first area 46 and a negative coefficient corresponding to a negative weight for the pixel data of each local area in each image data. It is good to perform the convolution operation using the spatial weighting filter which gives to the 2nd area | region 47, and to generate evaluation data based on the result of the convolution operation.

また、例えば、評価値算出部18は、各画像データ内の各局所領域の画素データに対して所定のバンドパス特性を持つ空間的周波数フィルタを用いた周波数フィルタ処理を行い、周波数フィルタ処理後のデータに基づいて振幅成分の大小を表す値へ換算する換算処理を行い、換算処理の結果に基づいて第1のスコア成分及び第2のスコア成分を算出するとよい。あるいは、評価値算出部18は、加重フィルタと周波数フィルタとを予め結合させた結合空間フィルタを用いて畳み込み演算を行ってもよい。   Further, for example, the evaluation value calculation unit 18 performs a frequency filter process using a spatial frequency filter having a predetermined bandpass characteristic on the pixel data of each local region in each image data, and after the frequency filter process A conversion process for converting the amplitude component into a value representing the magnitude of the amplitude component may be performed based on the data, and the first score component and the second score component may be calculated based on the result of the conversion process. Alternatively, the evaluation value calculation unit 18 may perform a convolution operation using a combined spatial filter in which a weighting filter and a frequency filter are combined in advance.

更に、例えば、評価値算出部18は、各画像データ内の画素データとして、各画素位置に結像される被写体40の輝度に線形又は非線形な関係を持つ階調に相当する情報を用いて、階調が各画像データ内の複数の局所領域毎に分布したコントラストに相当する指標を算出する。   Further, for example, the evaluation value calculation unit 18 uses, as pixel data in each image data, information corresponding to a gradation having a linear or nonlinear relationship with the luminance of the subject 40 imaged at each pixel position, An index corresponding to contrast in which gradation is distributed for each of a plurality of local regions in each image data is calculated.

なお、評価値算出部18は、例えば、各画像データについて、複数の評価データの中から最大値を評価値とするとよく、合焦位置判定部19は、複数の焦点位置のそれぞれに対する複数の評価値の中から最大値が得られる焦点位置を合焦位置として判定するとよい。   For example, the evaluation value calculation unit 18 may set the maximum value among a plurality of evaluation data as the evaluation value for each image data, and the focus position determination unit 19 may perform a plurality of evaluations for each of the plurality of focus positions. The focal position where the maximum value is obtained from the values may be determined as the in-focus position.

これらのような構成により、オートフォーカス装置は、フォーカスのターゲット41とこのターゲット41の周辺部分42とで合焦する焦点位置が異なる被写体の場合でも、ターゲット41にピントを合わせた合焦位置を検出することができる。そのため、例えば、電極等の突起状部材を有する電子部品のように、周辺部分42よりも小面積のターゲット41を有する被写体を突起部の先端側から本撮影する場合でも、突起部の先端にピントを合わせた合焦位置を検出することができる。あるいは、凹部を有する部品を凹みの正面から本撮影する場合でも、凹部の深部にピントを合わせた合焦位置を検出することができる。また、オートフォーカス装置は、撮影するタイミングに応じてターゲット41の位置が変動する場合でも、複雑な処理や構成を備えることなく、迅速且つ確実にターゲット41の合焦位置を検出することができる。そのため、このオートフォーカス装置をマシンビジョンシステム等に採用する場合には、撮影及び検査の処理速度の向上や、処理負担の軽減、更には、設備コストの抑制を実現することができる。   With such a configuration, the autofocus device detects the in-focus position where the target 41 is in focus even when the focus target 41 and the peripheral portion 42 of the target 41 are in different focus positions. can do. For this reason, for example, even when an object having a target 41 having a smaller area than the peripheral portion 42 is photographed from the distal end side of the projection portion, such as an electronic component having a projecting member such as an electrode, the tip of the projection portion is focused. The in-focus position can be detected. Alternatively, even when an image of a component having a recess is taken from the front of the recess, it is possible to detect the in-focus position where the deep portion of the recess is in focus. In addition, the autofocus device can detect the in-focus position of the target 41 quickly and reliably without providing complicated processing and configuration even when the position of the target 41 varies depending on the timing of shooting. Therefore, when this autofocus device is employed in a machine vision system or the like, it is possible to improve the processing speed of photographing and inspection, reduce the processing load, and further reduce the equipment cost.

また、本実施形態によれば、評価値算出部18は、周波数フィルタ処理後のデータに対して画素サイズ縮小処理を行い、縮小処理後のデータに基づいて第1のスコア成分及び第2のスコア成分を算出してもよい。   Further, according to the present embodiment, the evaluation value calculation unit 18 performs a pixel size reduction process on the data after the frequency filter process, and based on the data after the reduction process, the first score component and the second score Components may be calculated.

これにより、オートフォーカス装置は、オートフォーカス動作における処理速度を向上すると共に、処理負担を軽減することが可能となる。   Thus, the autofocus device can improve the processing speed in the autofocus operation and reduce the processing load.

また、本実施形態によれば、撮像システム1のオートフォーカス装置は、第1領域46の大きさ及び第2領域47の大きさの少なくとも一方を変更することができる領域設定部16を備えてもよいし、第1のスコア成分に寄与させる正の値の主対象重み係数(正の重み)及び第2のスコア成分に寄与させる負の値の周辺重み係数(負の重み)の少なくとも一方を変更することができる寄与率設定部20を備えてもよい。   In addition, according to the present embodiment, the autofocus device of the imaging system 1 includes the area setting unit 16 that can change at least one of the size of the first area 46 and the size of the second area 47. It is good to change at least one of a positive main weighting factor (positive weight) contributing to the first score component and a negative peripheral weighting factor (negative weight) contributing to the second score component. You may provide the contribution rate setting part 20 which can do.

これらにより、オートフォーカス装置は、被写体40においてピントを合わせるべきターゲット41について、被写体40(例えば、マシンビジョンシステム等での検査製品)毎に、詳細な設定を行うことが可能となる。   Accordingly, the autofocus device can make detailed settings for each subject 40 (for example, an inspection product in a machine vision system or the like) for the target 41 to be focused on in the subject 40.

本実施形態では、加重フィルタ生成部17が主対象範囲44の周囲の周辺範囲45に対して負の重み係数を均一に設定して加重フィルタを生成する構成について説明したが、本発明はこの構成に限定されない。他の実施形態では、加重フィルタ生成部17は、各画像データの各局所領域において第1領域46と第2領域47との間に、重みが0である不感帯としての第3領域を持つように、正の値の主対象重み係数が設定される主対象範囲44と、負の値の周辺重み係数が設定される周辺範囲45との間に、0の重み係数が設定される不感帯範囲を有して加重フィルタを生成してもよい。このような他の実施形態によれば、例えば、撮影側から見て突起部のターゲット41の先端が微小面積を有し、先端から基端にかけて面積が増加している被写体40を撮影する場合や、撮影側から見て凹部のターゲット41の深部が微小面積を有し、深部から凹部縁側にかけて面積が増加している被写体40を撮影する場合でも、ターゲット41の先端や深部以外での合焦を回避して、確実にターゲット41の合焦位置を検出することができる。あるいは、加重フィルタ生成部17は、周辺範囲45を内側(ターゲット41に近い側)から外側(ターゲット41より遠い側)にかけて多段階領域に分割し、より外側の段階領域に対して、より少ない負の重み係数を設定して加重フィルタを生成してもよい。   In the present embodiment, the configuration in which the weighting filter generation unit 17 generates the weighting filter by uniformly setting the negative weighting coefficient for the peripheral range 45 around the main target range 44 has been described. It is not limited to. In another embodiment, the weighting filter generation unit 17 has a third region as a dead zone having a weight of 0 between the first region 46 and the second region 47 in each local region of each image data. There is a dead band range in which a zero weighting factor is set between a main target range 44 in which a positive main weighting factor is set and a peripheral range 45 in which a negative peripheral weighting factor is set. Thus, a weighting filter may be generated. According to such another embodiment, for example, when shooting the subject 40 in which the tip of the projection target 41 has a very small area when viewed from the shooting side and the area increases from the tip to the base end. Even when shooting the subject 40 in which the deep portion of the target 41 in the concave portion has a very small area when viewed from the photographing side and the area increases from the deep portion to the edge of the concave portion, focusing on the tip of the target 41 other than the deep portion is possible. By avoiding this, the in-focus position of the target 41 can be reliably detected. Alternatively, the weighting filter generation unit 17 divides the peripheral range 45 from the inner side (side closer to the target 41) to the outer side (side farther from the target 41) into multi-step regions, and reduces the negative range with respect to the outer step region. A weighting filter may be generated by setting a weighting factor.

また、本実施形態では、合焦位置判定部19が、複数の焦点位置のそれぞれに対する複数の評価値の中から最大値が得られる焦点位置を合焦位置として判定する例を説明したが、本発明はこの例に限定されない。例えば、他の実施形態では、合焦位置判定部19は、複数の焦点位置に対する複数の評価値の中から局所的ピーク位置を1つ以上算出し、所定の適正分布に最も適する局所的ピーク位置が得られた焦点位置を合焦位置として判定してもよい。この場合、撮像システム1は、ターゲット41の合焦位置に対して適正な分布範囲又は極性の情報を示す所定の適正分布を取得するために適正分布取得部21を備えて構成されるとよい。適正な分布範囲や極性の情報は、複数の焦点位置に亘って見られる1つ以上の局所的ピーク位置の内、最適なものを評価するための情報である。例えば、「分布範囲」は、複数の焦点位置の中で、近距離側や遠距離側等の予め想定できる範囲である。これにより、被写体40において焦点位置の異なる2つ以上の突起部や凹部が存在する場合でも、最適なターゲット41を選択してフォーカスを合わせることが可能となる。   Further, in the present embodiment, an example has been described in which the focus position determination unit 19 determines, as the focus position, the focus position at which the maximum value is obtained from a plurality of evaluation values for each of the plurality of focus positions. The invention is not limited to this example. For example, in another embodiment, the in-focus position determination unit 19 calculates one or more local peak positions from among a plurality of evaluation values for a plurality of focal positions, and a local peak position that is most suitable for a predetermined appropriate distribution. The focal position at which is obtained may be determined as the in-focus position. In this case, the imaging system 1 may be configured to include an appropriate distribution acquisition unit 21 in order to acquire a predetermined appropriate distribution indicating information on an appropriate distribution range or polarity with respect to the in-focus position of the target 41. The information on the appropriate distribution range and polarity is information for evaluating an optimum one of one or more local peak positions seen over a plurality of focal positions. For example, the “distribution range” is a range that can be assumed in advance, such as a short distance side or a long distance side, among a plurality of focal positions. Thus, even when there are two or more protrusions or recesses having different focal positions in the subject 40, it is possible to select the optimum target 41 and achieve the focus.

なお、本実施形態では、領域設定部16が、ターゲット41を含む大きさの主対象範囲44と、主対象範囲44の周囲の周辺範囲45とを設定する構成を説明したが、本発明はこの構成に限定されない。例えば、他の実施形態では、領域設定部16は、ターゲット41を含む大きさの主対象範囲44の他に、ターゲット41の周辺部分42を少なくとも一部以上含む複数の領域を設定してもよい。また、領域設定部16は、主対象範囲44や周辺範囲45の形状として、矩形に限定されず、ターゲット41やその周辺部分42に対応する領域であれば、他の形状を設定することもできる。   In the present embodiment, the region setting unit 16 has described the configuration in which the main target range 44 having a size including the target 41 and the peripheral range 45 around the main target range 44 are described. It is not limited to the configuration. For example, in another embodiment, the region setting unit 16 may set a plurality of regions including at least a part of the peripheral portion 42 of the target 41 in addition to the main target range 44 having a size including the target 41. . Further, the region setting unit 16 is not limited to a rectangle as the shape of the main target range 44 and the peripheral range 45, and can also set other shapes as long as it is a region corresponding to the target 41 and its peripheral portion 42. .

また、本発明は、請求の範囲及び明細書全体から読み取ることのできる発明の要旨又は思想に反しない範囲で適宜変更可能であり、そのような変更を伴うオートフォーカス装置やオートフォーカス用プログラムもまた本発明の技術思想に含まれる。   In addition, the present invention can be appropriately changed without departing from the gist or concept of the invention that can be read from the claims and the entire specification, and an autofocus device and an autofocus program that involve such a change are also included. It is included in the technical idea of the present invention.

1 撮像システム
10 光学系
11 光学系駆動部
12 撮像部
13 撮像駆動部
14 A/D変換部
15 画像処理部
16 領域設定部
17 加重フィルタ生成部
18 評価値算出部
19 合焦位置判定部
20 寄与率設定部
21 適正分布取得部
30 制御部
31 記憶部
32 記録媒体
33 操作部
34 表示部
40 被写体
41 ターゲット
42 周辺部分
43 全画像領域
44 主対象範囲
45 周辺範囲
46 第1領域
47 第2領域
DESCRIPTION OF SYMBOLS 1 Imaging system 10 Optical system 11 Optical system drive part 12 Imaging part 13 Imaging drive part 14 A / D conversion part 15 Image processing part 16 Area | region setting part 17 Weight filter generation part 18 Evaluation value calculation part 19 Focus position determination part 20 Contribution Rate setting unit 21 Proper distribution acquisition unit 30 Control unit 31 Storage unit 32 Recording medium 33 Operation unit 34 Display unit 40 Subject 41 Target 42 Peripheral part 43 Total image area 44 Main target range 45 Peripheral range 46 First area 47 Second area

Claims (13)

被写体の画像のコントラストに応じて前記被写体に対する焦点制御状態を決定するオートフォーカス装置であって、
複数の焦点位置のそれぞれにおいて前記被写体を撮像して得られる複数の画像のそれぞれについて、合焦位置の判定に用いられる評価値を算出する評価値算出部と、
前記複数の焦点位置のそれぞれに対して算出された複数の前記評価値に基づいて、合焦位置を判定する合焦位置判定部と、を備え、
前記評価値算出部は、前記各画像に含まれる複数の局所領域のそれぞれについて、前記被写体のフォーカスのターゲットを含む大きさの第1領域に対して算出される第1のスコア成分と、前記第1領域の周囲で前記ターゲットの周辺部分を少なくとも一部以上含む大きさの第2領域に対して算出される第2のスコア成分とを用いて、前記第1のスコア成分に正の重みで寄与し、前記第2のスコア成分に負の重みで寄与するように計算した評価データを生成し、前記各画像内の前記複数の局所領域のそれぞれについて生成された複数の前記評価データに基づいて前記評価値を算出することを特徴とするオートフォーカス装置。
An autofocus device that determines a focus control state for the subject according to a contrast of an image of the subject,
An evaluation value calculation unit that calculates an evaluation value used to determine the in-focus position for each of a plurality of images obtained by imaging the subject at each of a plurality of focal positions;
A focus position determination unit that determines a focus position based on the plurality of evaluation values calculated for each of the plurality of focus positions;
The evaluation value calculation unit includes, for each of a plurality of local regions included in each image, a first score component calculated for a first region having a size including a focus target of the subject, Using a second score component calculated for a second region having a size including at least a part of the periphery of the target around one region, and contributing to the first score component with a positive weight And generating evaluation data calculated to contribute to the second score component with a negative weight, and based on the plurality of evaluation data generated for each of the plurality of local regions in each image An autofocus device characterized by calculating an evaluation value.
前記評価値算出部は、前記各画像内の前記各局所領域の画素データに対して、前記正の重みに対応する正の係数を前記第1領域に与えると共に前記負の重みに対応する負の係数を前記第2領域に与える空間的加重フィルタを用いた畳み込み演算を行い、前記畳み込み演算の結果に基づいて前記評価データを生成することを特徴とする請求項1に記載のオートフォーカス装置。   The evaluation value calculation unit gives a positive coefficient corresponding to the positive weight to the first region and a negative coefficient corresponding to the negative weight for the pixel data of each local region in each image. The autofocus device according to claim 1, wherein a convolution operation using a spatial weighting filter that gives a coefficient to the second region is performed, and the evaluation data is generated based on a result of the convolution operation. 前記評価値算出部は、前記各画像内の前記各局所領域の画素データに対して所定のバンドパス特性を持つ空間的周波数フィルタを用いた周波数フィルタ処理を行い、前記周波数フィルタ処理後のデータに基づいて振幅成分の大小を表す値へ換算する換算処理を行い、前記換算処理の結果に基づいて前記第1のスコア成分及び前記第2のスコア成分を算出することを特徴とする請求項1又は2に記載のオートフォーカス装置。   The evaluation value calculation unit performs frequency filter processing using a spatial frequency filter having a predetermined bandpass characteristic on the pixel data of each local region in each image, and the data after the frequency filter processing is performed. The conversion processing for converting the amplitude component into a value representing the magnitude of the amplitude component is performed, and the first score component and the second score component are calculated based on the result of the conversion processing. 2. The autofocus device according to 2. 前記評価値算出部は、前記加重フィルタと前記周波数フィルタとを予め結合させた結合空間フィルタを用いて前記畳み込み演算を行うことを特徴とする請求項3に記載のオートフォーカス装置。   4. The autofocus device according to claim 3, wherein the evaluation value calculation unit performs the convolution operation using a combined spatial filter in which the weighting filter and the frequency filter are combined in advance. 前記評価値算出部は、前記各画像内の画素データとして、各画素位置に結像される前記被写体の輝度に線形又は非線形な関係を持つ階調に相当する情報を用いて、前記階調が前記各画像内の前記複数の局所領域毎に分布したコントラストに相当する指標を算出することを特徴とする請求項1ないし4の何れか1項に記載のオートフォーカス装置。   The evaluation value calculation unit uses, as pixel data in each image, information corresponding to a gradation having a linear or nonlinear relationship with luminance of the subject imaged at each pixel position, 5. The autofocus device according to claim 1, wherein an index corresponding to a contrast distributed for each of the plurality of local regions in each image is calculated. 前記評価値算出部は、前記周波数フィルタ処理後のデータに対して画素サイズ縮小処理を行い、前記縮小処理後のデータに基づいて前記第1のスコア成分及び前記第2のスコア成分を算出することを特徴とする請求項3に記載のオートフォーカス装置。   The evaluation value calculation unit performs a pixel size reduction process on the data after the frequency filter process, and calculates the first score component and the second score component based on the data after the reduction process. The autofocus device according to claim 3. 前記評価値算出部は、前記第1領域と前記第2領域との間に、重みが0である不感帯としての第3領域を持つ前記加重フィルタを用いることを特徴とする請求項2に記載のオートフォーカス装置。   The said evaluation value calculation part uses the said weighting filter which has a 3rd area | region as a dead zone whose weight is 0 between the said 1st area | region and the said 2nd area | region. Autofocus device. 前記評価値算出部は、前記各画像について、前記複数の評価データの中から最大値を前記評価値とすることを特徴とする請求項1ないし7の何れか1項に記載のオートフォーカス装置。   The autofocus device according to any one of claims 1 to 7, wherein the evaluation value calculation unit sets a maximum value among the plurality of evaluation data as the evaluation value for each image. 前記合焦位置判定部は、前記複数の焦点位置のそれぞれに対する前記複数の評価値の中から最大値が得られる焦点位置を合焦位置として判定することを特徴とする請求項1ないし8の何れか1項に記載のオートフォーカス装置。   The focus position determination unit determines a focus position at which a maximum value is obtained from the plurality of evaluation values for each of the plurality of focus positions as a focus position. The autofocus device according to claim 1. 前記焦点位置に対して適正な分布範囲または極性の情報を取得する適正分布取得部を備え、
前記合焦位置判定部は、前記複数の焦点位置に対する前記複数の評価値の中から局所的ピーク位置を1つ以上算出し、前記適正分布に最も適する前記局所的ピーク位置が得られた前記焦点位置を合焦位置として判定することを特徴とする請求項1ないし9の何れか1項に記載のオートフォーカス装置。
An appropriate distribution acquisition unit for acquiring information on an appropriate distribution range or polarity with respect to the focal position;
The focus position determination unit calculates one or more local peak positions from the plurality of evaluation values with respect to the plurality of focus positions, and the focus at which the local peak position most suitable for the appropriate distribution is obtained. The autofocus device according to claim 1, wherein the position is determined as a focus position.
前記第1領域の大きさ及び前記第2領域の大きさの少なくとも一方を変更することができる領域設定部を備えることを特徴とする請求項1ないし10の何れか1項に記載のオートフォーカス装置。   The autofocus device according to any one of claims 1 to 10, further comprising an area setting unit capable of changing at least one of a size of the first area and a size of the second area. . 前記第1のスコア成分に寄与させる前記正の重み及び前記第2のスコア成分に寄与させる前記負の重みの少なくとも一方を変更することができる寄与率設定部を備えることを特徴とする請求項1ないし11の何れか1項に記載のオートフォーカス装置。   2. A contribution rate setting unit capable of changing at least one of the positive weight contributing to the first score component and the negative weight contributing to the second score component. The autofocus device according to any one of 11 to 11. 請求項1ないし12の何れかに記載のオートフォーカス装置としてコンピュータを機能させるためのオートフォーカス用プログラム。   An autofocus program for causing a computer to function as the autofocus device according to any one of claims 1 to 12.
JP2016117797A 2016-06-14 2016-06-14 Autofocus device and autofocus program Active JP6685550B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2016117797A JP6685550B2 (en) 2016-06-14 2016-06-14 Autofocus device and autofocus program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2016117797A JP6685550B2 (en) 2016-06-14 2016-06-14 Autofocus device and autofocus program

Publications (2)

Publication Number Publication Date
JP2017224923A true JP2017224923A (en) 2017-12-21
JP6685550B2 JP6685550B2 (en) 2020-04-22

Family

ID=60688463

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2016117797A Active JP6685550B2 (en) 2016-06-14 2016-06-14 Autofocus device and autofocus program

Country Status (1)

Country Link
JP (1) JP6685550B2 (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05284415A (en) * 1992-04-02 1993-10-29 Olympus Optical Co Ltd Autoamtic focusing device
JP2004029105A (en) * 2002-06-21 2004-01-29 Casio Comput Co Ltd Autofocus device and af evaluated value acquiring method
JP2008033060A (en) * 2006-07-28 2008-02-14 Kyocera Corp Imaging apparatus and imaging method, and image processor
JP2009077175A (en) * 2007-09-20 2009-04-09 Sanyo Electric Co Ltd Electronic camera
JP2010266699A (en) * 2009-05-15 2010-11-25 Hoya Corp Image capturing apparatus
JP2012132957A (en) * 2010-12-20 2012-07-12 Samsung Electronics Co Ltd Imaging apparatus and setup method therefor
US20140043522A1 (en) * 2012-08-10 2014-02-13 Canon Kabushiki Kaisha Image pickup apparatus and control method therefor
JP2015167308A (en) * 2014-03-04 2015-09-24 キヤノン株式会社 Photometry method suitable for face detection autofocus control

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05284415A (en) * 1992-04-02 1993-10-29 Olympus Optical Co Ltd Autoamtic focusing device
JP2004029105A (en) * 2002-06-21 2004-01-29 Casio Comput Co Ltd Autofocus device and af evaluated value acquiring method
JP2008033060A (en) * 2006-07-28 2008-02-14 Kyocera Corp Imaging apparatus and imaging method, and image processor
JP2009077175A (en) * 2007-09-20 2009-04-09 Sanyo Electric Co Ltd Electronic camera
JP2010266699A (en) * 2009-05-15 2010-11-25 Hoya Corp Image capturing apparatus
JP2012132957A (en) * 2010-12-20 2012-07-12 Samsung Electronics Co Ltd Imaging apparatus and setup method therefor
US20140043522A1 (en) * 2012-08-10 2014-02-13 Canon Kabushiki Kaisha Image pickup apparatus and control method therefor
JP2014035516A (en) * 2012-08-10 2014-02-24 Canon Inc Image pickup device and control method thereof
JP2015167308A (en) * 2014-03-04 2015-09-24 キヤノン株式会社 Photometry method suitable for face detection autofocus control

Also Published As

Publication number Publication date
JP6685550B2 (en) 2020-04-22

Similar Documents

Publication Publication Date Title
US9581436B2 (en) Image processing device, image capturing apparatus, and image processing method
JP6309922B2 (en) Imaging system and imaging method
US9641769B2 (en) Image capture apparatus and method for controlling the same
US9131145B2 (en) Image pickup apparatus and control method therefor
JP5882789B2 (en) Image processing apparatus, image processing method, and program
CN110557559B (en) Image processing apparatus, image processing method, and storage medium
US10311327B2 (en) Image processing apparatus, method of controlling the same, and storage medium
JP2016197231A (en) Display control device and method, and imaging device
JP5127628B2 (en) Image processing apparatus and image processing method
JP6555990B2 (en) Distance measuring device, imaging device, and distance measuring method
US10747089B2 (en) Imaging apparatus and control method of the same
JP2018132613A (en) Focus detection device and imaging device
US20220159191A1 (en) Image pickup apparatus
US20180309925A1 (en) Control apparatus, image capturing apparatus, control method, and storage medium
JP6171110B2 (en) Focus control device, focus control method, focus control program, lens device, imaging device
JP6685550B2 (en) Autofocus device and autofocus program
US20200077032A1 (en) Image processing apparatus and electronic apparatus
US10237469B2 (en) Information processing apparatus, information processing method, and storage medium
KR101112056B1 (en) Method for processing image of camera module
JP6467823B2 (en) Imaging device
JP2018152095A (en) Image processing apparatus, imaging apparatus, and image processing program
JP6464553B2 (en) Lens drive control device, electronic camera, and lens drive control program
US20160212322A1 (en) Control apparatus, image pickup apparatus, control method, and non-transitory computer-readable storage medium
JP2017118293A (en) Image processing apparatus, imaging apparatus, image processing method, image processing program, and storage medium
JP6714434B2 (en) Imaging device, control method thereof, program, and storage medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20190603

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20200214

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20200325

R150 Certificate of patent or registration of utility model

Ref document number: 6685550

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250