JP7150105B2 - 3D image processing device and 3D image processing method - Google Patents

3D image processing device and 3D image processing method Download PDF

Info

Publication number
JP7150105B2
JP7150105B2 JP2021115017A JP2021115017A JP7150105B2 JP 7150105 B2 JP7150105 B2 JP 7150105B2 JP 2021115017 A JP2021115017 A JP 2021115017A JP 2021115017 A JP2021115017 A JP 2021115017A JP 7150105 B2 JP7150105 B2 JP 7150105B2
Authority
JP
Japan
Prior art keywords
image
distance image
distance
gradation
height
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
JP2021115017A
Other languages
Japanese (ja)
Other versions
JP2021177186A (en
Inventor
真達 下平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Keyence Corp
Original Assignee
Keyence Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Keyence Corp filed Critical Keyence Corp
Publication of JP2021177186A publication Critical patent/JP2021177186A/en
Application granted granted Critical
Publication of JP7150105B2 publication Critical patent/JP7150105B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Description

本発明は、三次元画像処理装置及び三次元画像処理方法に関する。 The present invention relates to a 3D image processing apparatus and a 3D image processing method.

工場等数多くの生産現場では、人の目視に頼っていた検査を自動化・高速化する画像処理装置が導入されている。画像処理装置は、ベルトコンベア等の生産ラインを流れてくるワークをカメラによって撮像し、得られた画像データを用いて所定領域のエッジ検出や面積計算等の計測処理を実行する。そして、計測処理の処理結果に基づいて、ワークの欠け検出やアライメントマークの位置検出等の検査を行い、ワークの欠けや位置ずれの有無を判定する判定信号を出力する。このように、画像処理装置は、FAセンサの一つとして利用されることがある。 Many production sites such as factories have introduced image processing devices that automate and speed up inspections that used to rely on human visual inspection. The image processing device uses a camera to capture an image of a workpiece that is flowing through a production line such as a belt conveyor, and uses the obtained image data to perform measurement processing such as edge detection and area calculation of a predetermined area. Then, based on the processing result of the measurement processing, inspections such as workpiece chipping detection and alignment mark position detection are performed, and a determination signal for determining the presence or absence of workpiece chipping and positional deviation is output. Thus, the image processing device may be used as one of the FA sensors.

FAセンサとして用いられる画像処理装置が計測処理の対象とする画像は、主に、高さ情報を含まない輝度画像である。そのため、上述したワークの欠け検出についていえば、欠けた部分の二次元形状を安定的に検出することは得意であるが、傷の凹み具合等、輝度画像としては現れ難い三次元形状を安定的に検出することは困難である。例えば、検査時にワークを照らす照明の種類や照明方向を工夫して、傷の凹みに起因する陰影を検出して、間接的に三次元形状を検出することも考えられるが、輝度画像の中で常に明瞭な陰影が検出されるとは限らない。不明瞭な陰影が検出されたときに不良品を良品と誤って判定する誤判定を防ぐために、例えば判定閾値を安全側に偏らせると、良品を大量に不良品として判定し、歩留まりの悪化を招く虞がある。 An image targeted for measurement processing by an image processing apparatus used as an FA sensor is mainly a luminance image that does not contain height information. For this reason, when it comes to detecting chipping of workpieces as described above, we are good at stably detecting the two-dimensional shape of chipped portions, but we are good at stably detecting three-dimensional shapes that are difficult to appear in luminance images, such as the degree of dents in scratches. is difficult to detect. For example, it is conceivable to indirectly detect the three-dimensional shape by detecting shadows caused by dents in scratches by devising the type and direction of lighting that illuminates the workpiece during inspection. Clear shadows are not always detected. In order to prevent erroneous judgment of defective products as non-defective products when unclear shadows are detected, for example, if the judgment threshold is biased toward the safe side, a large number of non-defective products will be judged as defective, resulting in a decrease in yield. There is a risk of inviting

そこで、カメラの受光光量に応じた濃淡値を画素値とする輝度画像だけでなく、カメラとワークまでの距離に応じた濃淡値を画素値とすることで、高さを二次元的に表現した距離画像(例えば特許文献1参照)を用いた外観検査が考えられる。 Therefore, in addition to the luminance image in which the pixel value is the grayscale value corresponding to the amount of light received by the camera, the height is expressed two-dimensionally by using the grayscale value as the pixel value according to the distance between the camera and the workpiece. Appearance inspection using a distance image (see, for example, Patent Document 1) is conceivable.

三次元画像処理装置の一例を、図160の模式図に示す。この三次元画像処理装置は、受光素子等の撮像手段を備えたヘッド部と、ヘッド部と接続され、ヘッド部で撮像した画像データを送られて、取得した画像データから距離画像を生成するコントローラ部で構成される。 An example of a three-dimensional image processing apparatus is shown in the schematic diagram of FIG. This three-dimensional image processing apparatus includes a head unit having an imaging means such as a light receiving element, and a controller that is connected to the head unit, receives image data captured by the head unit, and generates a distance image from the acquired image data. consists of

ここで三角測距の原理を、図160に基づいて説明する。ヘッド部は、投光部110から出射される入射光の光軸と、受光部120に入射する反射光の光軸(受光部120の光軸)との間の角度αが予め設定されている。ここでワーク上にワークが載置されない場合には、投光部110から出射される入射光は、ワークの載置面の点Oにより反射され、受光部120に入射される。一方、ワーク上にワークが載置される場合、投光部110から出射される入射光は、ワークの表面の点Aにより反射され、反射光となって受光部120に入射される。そして点Oと点Aとの間のX方向における距離dを測定し、この距離dに基づいてワークの表面の点Aの高さhを算出する。 Here, the principle of triangulation will be explained with reference to FIG. In the head portion, an angle α between the optical axis of the incident light emitted from the light projecting portion 110 and the optical axis of the reflected light entering the light receiving portion 120 (the optical axis of the light receiving portion 120) is set in advance. . Here, when no work is placed on the work, the incident light emitted from the light projecting section 110 is reflected by the point O on the placement surface of the work and enters the light receiving section 120 . On the other hand, when a work is placed on the work, the incident light emitted from the light projecting section 110 is reflected by a point A on the surface of the work and enters the light receiving section 120 as reflected light. Then, the distance d in the X direction between the points O and A is measured, and the height h of the point A on the surface of the workpiece is calculated based on this distance d.

上述した三角測距の計測原理を応用して、ワークの表面の全ての点の高さを算出することにより、ワークの三次元的な形状が測定される。パターン投影法はワークの表面の全ての点に入射光を照射するために、投光部110からは所定の構造化パターンに従って入射光が出射され、ワーク表面で反射した反射光を受光し、受光した複数のパターン画像に基づいてワークの三次元形状を効率よく測定する。 The three-dimensional shape of the workpiece is measured by calculating the heights of all points on the surface of the workpiece by applying the measurement principle of triangulation described above. In the pattern projection method, all points on the surface of the workpiece are irradiated with incident light. Therefore, the incident light is emitted from the light projection unit 110 according to a predetermined structured pattern, and the reflected light reflected on the surface of the workpiece is received. To efficiently measure the three-dimensional shape of a workpiece based on a plurality of pattern images.

このようなパターン投影法には、位相シフト法や空間コード化法、マルチスリット法等が知られている。パターン投影法を用いた三次元計測処理によって、投影パターンを変化させて複数回の撮像をヘッド部で繰り返し、コントローラ部に送出する。コントローラ部では、ヘッド部から送られるパターン投影画像に基づいて演算を行い、ワークの高さ情報を有する距離画像を得ることができる。 As such pattern projection methods, a phase shift method, a spatial encoding method, a multi-slit method, and the like are known. By three-dimensional measurement processing using a pattern projection method, the projection pattern is changed, and the head section repeats imaging a plurality of times, and sends it to the controller section. In the controller section, calculation is performed based on the pattern projection image sent from the head section, and a distance image having height information of the workpiece can be obtained.

一方、既存の画像処理装置では、主に輝度を画素値とした輝度画像が使用されている。例えば、ライン上を搬送されるワークに対して、モノクロのカメラでワークの外観を光学的な濃淡で表現した輝度画像を撮像して、画像処理によって検査を行うシステムが存在する。このような状況において、新たに三次元計測装置、及びそこから出力される三次元データ(ポイントクラウドデータ)を処理する処理装置を導入しようとすると、相当コストがかかる。 On the other hand, existing image processing apparatuses mainly use a luminance image in which luminance is used as a pixel value. For example, there is a system that inspects a workpiece conveyed on a line by image processing by capturing a brightness image that expresses the appearance of the workpiece with optical shading using a monochrome camera. Under such circumstances, if a new three-dimensional measuring device and a processing device for processing three-dimensional data (point cloud data) output therefrom are introduced, a considerable cost is incurred.

そこで、高さ情報を画像の濃淡として表現した距離画像として表現すれば、扱う画像データ自体は既存の輝度画像と同等となるため、既存の輝度画像を用いた画像処理装置の設備においても、距離画像を扱えることとなる。 Therefore, if the height information is represented as a distance image that expresses the gradation of the image, the image data itself to be handled is equivalent to the existing luminance image. It can handle images.

この場合において、従来の輝度画像においては、比較的低い階調数の画像が利用されていた。例えば一画素当たりの情報を8階調で表現した画像が多く利用されている。一方で、高さ情報を有する画像データについては、高さ情報を表現するため、多くの階調数(例えば16階調)を要する。このため、距離画像を既存の低階調の画像を扱う画像処理装置にて処理できるようにするには、多階調の距離画像を、比較的低階調の距離画像に変換する必要がある。(以下、多階調の距離画像を低階調の距離画像に変換した画像を「低階調距離画像」と呼び、従来の、輝度情報を有する輝度画像を「輝度画像」と呼ぶ。) In this case, in the conventional luminance image, an image with a relatively low number of gradations is used. For example, images in which information per pixel is expressed in eight gradations are often used. On the other hand, image data having height information requires a large number of gradations (for example, 16 gradations) to express the height information. Therefore, in order to process the distance image with an existing image processing device that handles low-tone images, it is necessary to convert the multi-tone distance image into a comparatively low-tone distance image. . (Hereinafter, an image obtained by converting a multi-tone distance image into a low-tone distance image is called a "low-tone distance image", and a conventional luminance image having luminance information is called a "luminance image".)

このように、従来から利用されている輝度画像に加えて、階調変換された低階調距離画像を利用することで、ワークの正常・異常を判定する検査に際して、従来の形状の抽出といった画像処理のみならず、高さ情報を利用した高さの測定等の処理を、三次元画像処理装置において利用することが可能となる。 In this way, in addition to the luminance image that has been used conventionally, by using the low-gradation-converted low-gradation-distance image, an image such as the conventional shape extraction can be used when inspecting whether a workpiece is normal or abnormal. It is possible to use not only processing but also processing such as height measurement using height information in the three-dimensional image processing apparatus.

この場合において、高階調(例えば16階調)の高さ情報を、既存の輝度画像と同じ階調数(例えば8階調)に変換する階調変換が必須になる。このとき、階調変換パラメータが適切に設定されないと、検査に必要な高さ情報が欠落してしまい、検査に適した画像を取得できない場合がある。 In this case, gradation conversion for converting height information of high gradation (for example, 16 gradations) into the same number of gradations as the existing luminance image (for example, 8 gradations) is essential. At this time, if the gradation conversion parameters are not appropriately set, height information necessary for inspection may be lost, and an image suitable for inspection may not be obtained.

そこで、検査対象のワークの高さ情報を用いて、階調変換パラメータを適切に設定し、階調変換の基準高さを決定することが考えられる。 Therefore, it is conceivable to use the height information of the workpiece to be inspected to appropriately set the gradation conversion parameters and determine the reference height for gradation conversion.

しかしながら、使用者の検査対象ワークに高さ方向のばらつきが存在する場合、当初指定した階調変換パラメータにより階調変換を行うだけでは、検査に適した画像を取得できないことがあった。 However, when there is variation in the height direction of the work to be inspected by the user, it may not be possible to obtain an image suitable for inspection simply by performing gradation conversion using the initially specified gradation conversion parameters.

特許第4969478号公報Japanese Patent No. 4969478

本発明は、従来のこのような問題点を解決するためになされたものである。本発明の主な目的は、距離画像を低階調距離画像に変換する際に、高さ情報の欠落を抑制して精度の低下を抑えた三次元画像処理装置及び三次元画像処理方法を提供することにある。 The present invention has been made to solve such conventional problems. A main object of the present invention is to provide a 3D image processing apparatus and a 3D image processing method that suppress the loss of height information and suppress the deterioration of accuracy when converting a distance image into a low gradation distance image. to do.

課題を解決するための手段及び発明の効果Means for solving the problem and effects of the invention

上記の目的を達成するために、本発明の第1の側面に係る三次元画像処理装置によれば、
検査対象物の高さ情報を含む距離画像を取得すると共に、該距離画像に基づいて画像処理を行うことが可能な三次元画像処理装置であって、検査対象物の画像を撮像する撮像手段と、前記撮像手段で撮像された画像に基づいて、距離画像を生成可能な距離画像生成手段と、前記距離画像生成手段で生成された距離画像を、該距離画像の階調数よりも低い階調数の距離画像に階調変換する際の基準となる基準面を設定するための基準面設定手段と、前記基準面設定手段で設定された基準面の高さを基準として、前記距離画像を、該距離画像の階調数よりも低い階調数の、該距離画像が有する高さ情報を画像の濃淡値に置き換えた低階調距離画像に階調変換するための階調変換手段と、前記階調変換手段による階調変換に際して、局所的な形状変化を抽出する方向を指定するための抽出方向入力手段と、前記階調変換手段で階調変換された低階調距離画像に対して、所定の検査処理を実行するための検査実行手段とを備え、前記基準面設定手段は、前記距離画像生成手段により生成された距離画像から、高周波成分を除いた曲面を演算し、該演算された曲面を基準面として設定するよう構成され、前記抽出方向入力手段が、局所的な形状変化を抽出する方向として、距離画像のX方向、Y方向、又はXY方向のいずれかを指定可能とできる。上記構成により、抽出方向入力手段で指定された方向における検査対象物の変化を抽出でき、いいかると該指定された方向において変化しない形状、例えば長手方向に連続する溝などは無視して、正確な形状抽出が可能となる。
In order to achieve the above object, according to the three-dimensional image processing device according to the first aspect of the present invention,
A three-dimensional image processing apparatus capable of acquiring a distance image including height information of an inspection object and performing image processing based on the distance image, comprising imaging means for taking an image of the inspection object. a distance image generating means capable of generating a distance image based on the image captured by said imaging means; a reference plane setting means for setting a reference plane to be used as a reference for gradation conversion into a number of distance images; gradation conversion means for performing gradation conversion to a low gradation distance image in which the height information of the distance image is replaced by the grayscale value of the image, and which has a gradation number lower than that of the distance image ; Extraction direction input means for designating a direction for extracting a local shape change at the time of gradation conversion by the gradation conversion means; inspection executing means for executing a predetermined inspection process, wherein the reference plane setting means calculates a curved surface from which high-frequency components are removed from the distance image generated by the distance image generating means; A curved surface is set as a reference surface , and the extraction direction input means can specify any of the X direction, Y direction, or XY direction of the range image as the direction for extracting the local shape change . With the above configuration, it is possible to extract changes in the inspection object in the direction specified by the extraction direction input means. shape extraction becomes possible.

また、第2の側面に係る三次元画像処理装置によれば、上記構成に加えて、前記距離画像生成手段は、前記三次元画像処理装置で三次元画像処理を行う運用時に、前記撮像手段により撮像された検査対象物の入力画像に基づいて検査対象物の距離画像を逐次生成し、前記基準面設定手段が、逐次生成された距離画像の高さ情報に基づいて基準面を再設定することにより、検査対象物の高さに応じて基準面を変更するように構成できる。 Further, according to the three-dimensional image processing apparatus according to the second aspect, in addition to the above configuration, the distance image generating means may generate a Sequentially generating range images of the inspection object based on the input image of the captured inspection target, and the reference plane setting means resetting the reference plane based on height information of the sequentially generated range images. Therefore, the reference plane can be changed according to the height of the inspection object.

さらにの側面に係る三次元画像処理装置によれば、上記いずれかの構成に加えて、前記階調変換手段が、階調変換に際して、距離画像を一旦縮小し、フィルタ処理を行った後拡大して自由曲面画像を作成し、該自由曲面画像と距離画像との差分を取ることで、距離画像の形状変化を抽出するものであり、該距離画像の縮小に際して、前記抽出方向入力手段で指定された方向に対してのみ縮小を行うことができる。上記構成により、抽出方向入力手段で指定された方向以外に対しては縮小を行わず、指定された方向に対してのみ距離画像を縮小することで、自由曲面画像に指定された方向における一様に連続する高さ情報を残し、これとの差分を取ることで該方向における一様に連続する緩やかな形状変化を排除して、必要な形状のみを抽出することが可能となる。
Further , according to the three-dimensional image processing apparatus according to the third aspect, in addition to any one of the above configurations, the tone conversion means once reduces the distance image and performs filter processing upon tone conversion. A free-form surface image is created by post-expansion, and a difference between the free-form surface image and the distance image is taken to extract the shape change of the distance image. You can only shrink in the direction specified by . With the above configuration, by reducing the distance image only in the specified direction without reducing the direction other than the direction specified by the extraction direction input means, the uniform image in the specified direction of the free-form surface image By leaving continuous height information and taking a difference from this, it is possible to eliminate uniformly continuous gradual shape changes in that direction and extract only the necessary shape.

さらにまた、第の側面に係る三次元画像処理装置によれば、上記いずれかの構成に加えて、さらに検査対象物に対して光切断法で投光するための投光手段を備えており、前記撮像手段は、前記投光手段で投光された画像を撮像し、前記距離画像生成手段は光切断法で得られたプロファイルを合成して距離画像を生成するよう構成できる。
Furthermore, according to the three-dimensional image processing apparatus according to the fourth aspect, in addition to any one of the above configurations, it further includes a light projecting means for projecting light onto the inspection object by the light section method. The image capturing means may capture an image projected by the light projecting means, and the distance image generating means may generate a distance image by synthesizing profiles obtained by a light section method.

さらにまた、第の側面に係る三次元画像処理装置によれば、上記いずれかの構成に加えて、さらに撮像手段の光軸に対して斜め方向から入射光を所定の投影パターンの構造化照明として投光するための投光手段を備えており、前記撮像手段は、前記投光手段で投光され、検査対象物で反射された反射光を取得して複数のパターン投影画像を撮像し、前記距離画像生成手段は、前記撮像手段で撮像された複数のパターン投影画像に基づいて、距離画像を生成するよう構成できる。上記構成により、パターン投影を利用した距離画像を用いた高さ計測等の検査処理を実現できる。
さらにまた、第6の側面に係る三次元画像処理装置によれば、上記いずれかの構成に加えて、さらに、前記階調変換手段による階調変換に際して、前記基準面に基づいて抽出すべき高さ情報を指定するための抽出高さ設定手段を備えており、前記抽出高さ設定手段は、前記抽出すべき高さ情報として、前記基準面よりも高い側、低い側、又は高低両方のいずれかを指定可能とし、前記高い側が指定された場合、前記階調変換手段は、前記基準面が前記低階調距離画像の距離レンジの下限となるように階調変換し、前記低い側が指定された場合、前記階調変換手段は、前記基準面が前記低階調距離画像の距離レンジの上限となるように階調変換し、前記高低両方が指定された場合、前記階調変換手段は、前記基準面が前記低階調距離画像の距離レンジの中間となるように階調変換することができる。
Furthermore, according to the three-dimensional image processing apparatus according to the fifth aspect, in addition to any one of the above configurations, incident light is projected obliquely to the optical axis of the imaging means for structured illumination in a predetermined projection pattern. wherein the imaging means captures a plurality of pattern projection images by acquiring reflected light projected by the light projecting means and reflected by the inspection object, The distance image generating means can be configured to generate a distance image based on a plurality of pattern projection images captured by the imaging means. With the above configuration, inspection processing such as height measurement using a distance image using pattern projection can be realized.
Furthermore, according to the 3D image processing apparatus according to the sixth aspect, in addition to any one of the above configurations, a height to be extracted based on the reference plane when performing gradation conversion by the gradation conversion means and extracting height setting means for specifying height information, and the extracting height setting means selects the height information to be extracted, which is higher or lower than the reference plane, or both higher and lower than the reference plane. When the higher side is specified, the gradation conversion means performs gradation conversion so that the reference plane becomes the lower limit of the distance range of the low gradation distance image, and the lower side is specified. In this case, the gradation conversion means performs gradation conversion so that the reference plane becomes the upper limit of the distance range of the low gradation distance image. The gradation conversion can be performed so that the reference plane is in the middle of the distance range of the low gradation distance image.

さらにまた、第7の側面に係る三次元画像処理方法によれば、検査対象物の高さ情報を含む距離画像を取得すると共に、該距離画像に基づいて画像処理を行う三次元画像処理方法であって、撮像手段の光軸に対して斜め方向から入射光を所定の投影パターンの構造化照明として投光手段で投光する工程と、前記投光手段で投光され、検査対象物で反射された反射光を取得して複数のパターン投影画像を撮像手段で撮像する工程と、前記撮像手段で撮像された複数のパターン投影画像に基づいて、距離画像を距離画像生成手段で生成する工程と、前記距離画像生成手段で生成された距離画像を、該距離画像の階調数よりも低い階調数の距離画像に階調変換する際の階調変換条件を構成する階調変換パラメータとして、該階調変換を行う基準となる基準面を設定する工程と、前記設定された基準面の高さを基準として、前記距離画像を、該距離画像の階調数よりも低い階調数の、該距離画像が有する高さ情報を画像の濃淡値に置き換えた低階調距離画像に階調変換する工程と、前記基準面の設定に際して、局所的な形状変化を抽出する方向として、距離画像のX方向、Y方向、又はXY方向のいずれかを指定するよう促す工程と、前記階調変換された低階調距離画像に対して、所定の検査処理を実行する工程とを含み、前記階調変換に際して、距離画像から高周波成分を除いた曲面を演算し、該演算された曲面を基準面として低階調距離画像に階調変換することができる。
Furthermore, according to the three-dimensional image processing method according to the seventh aspect, a three-dimensional image processing method for acquiring a distance image including height information of an inspection object and performing image processing based on the distance image a step of projecting incident light from an oblique direction with respect to an optical axis of an imaging means as structured illumination of a predetermined projection pattern by a projection means; a step of acquiring the reflected light and capturing a plurality of pattern projection images by an imaging means; and a step of generating a distance image by a distance image generation means based on the plurality of pattern projection images captured by the imaging means. , as a gradation conversion parameter constituting a gradation conversion condition for gradation conversion of the distance image generated by the distance image generating means to a distance image having a lower gradation number than the distance image, setting a reference plane that serves as a reference for performing the tone conversion; and using the height of the set reference plane as a reference, converting the distance image to a number of tones lower than that of the distance image; a step of tone-converting the height information of the distance image into a low-tone distance image in which the grayscale value of the image is replaced ; prompting to specify one of the X direction, the Y direction, or the XY direction; At the time of conversion, a curved surface from which high-frequency components are removed from the distance image is calculated, and the calculated curved surface can be used as a reference surface for gradation conversion into a low-gradation distance image.

さらにまた、第の側面に係る三次元画像処理方法によれば、上記いずれかに加えて、前記階調変換に際して、距離画像を一旦縮小し、フィルタ処理を行い、拡大して自由曲面画像を作成し、該自由曲面画像と距離画像との差分を取ることで、距離画像の形状変化を抽出しするものであり、該距離画像の縮小に際して、前記階調変換において局所的な形状変化を抽出する方向を指定するための抽出方向入力手段で指定された方向に対してのみ縮小を行うことができる。これにより、抽出方向入力手段で指定された方向に対しては縮小を行わず、指定された方向以外で距離画像を縮小することで、自由曲面画像に指定された方向における高さ情報を残し、これとの差分を取ることで該方向における緩やかな形状変化を排除して、必要な形状のみを抽出することが可能となる。
さらにまた、第9の側面に係る三次元画像処理方法によれば、上記いずれかに加えて、さらに、前記階調変換に際して、前記基準面に基づいて抽出すべき高さ情報として、前記基準面よりも高い側、低い側、又は高低両方のいずれかを指定するよう促す工程を備えており、前記高い側が指定された場合、前記基準面が、前記低階調距離画像の距離レンジの下限となるように階調変換し、前記低い側が指定された場合、前記基準面が、前記低階調距離画像の距離レンジの上限となるように階調変換し、前記高低両方が指定された場合、前記基準面が、前記低階調距離画像の距離レンジの中間となるように階調変換することができる。
さらにまた、第10の側面に係る三次元画像処理方法によれば、検査対象物の高さ情報を含む距離画像を取得すると共に、該距離画像に基づいて画像処理を行うことが可能な三次元画像処理装置であって、検査対象物の画像を撮像する撮像手段と、前記撮像手段で撮像された画像に基づいて、距離画像を生成可能な距離画像生成手段と、前記距離画像生成手段で生成された距離画像を、該距離画像の階調数よりも低い階調数の距離画像に階調変換する際の基準となる基準面を設定するための基準面設定手段と、前記基準面設定手段で設定された基準面の高さを基準として、前記距離画像を、該距離画像の階調数よりも低い階調数の、該距離画像が有する高さ情報を画像の濃淡値に置き換えた低階調距離画像に階調変換するための階調変換手段と、前記階調変換手段による階調変換に際して、前記基準面に基づいて抽出すべき高さ情報を指定するための抽出高さ設定手段と、前記階調変換手段で階調変換された低階調距離画像に対して、所定の検査処理を実行するための検査実行手段とを備え、前記基準面設定手段は、前記距離画像生成手段により生成された距離画像から、高周波成分を除いた曲面を演算し、該演算された曲面を基準面として設定するよう構成され、前記抽出高さ設定手段は、前記抽出すべき高さ情報として、前記基準面よりも高い側、低い側、又は高低両方のいずれかを指定可能とし、前記高い側が指定された場合、前記抽出高さ設定手段は、前記基準面が前記低階調距離画像の距離レンジの下限となるように階調変換し、前記低い側が指定された場合、前記抽出高さ設定手段は、前記基準面が前記低階調距離画像の距離レンジの上限となるように階調変換し、前記高低両方が指定された場合、前記抽出高さ設定手段は、前記基準面が前記低階調距離画像の距離レンジの中間となるように階調変換することができる。
さらにまた、第11の側面に係る三次元画像処理方法によれば、検査対象物の高さ情報を含む距離画像を取得すると共に、該距離画像に基づいて画像処理を行う三次元画像処理方法であって、撮像手段の光軸に対して斜め方向から入射光を所定の投影パターンの構造化照明として投光手段で投光する工程と、前記投光手段で投光され、検査対象物で反射された反射光を取得して複数のパターン投影画像を撮像手段で撮像する工程と、前記撮像手段で撮像された複数のパターン投影画像に基づいて、距離画像を距離画像生成手段で生成する工程と、前記距離画像生成手段で生成された距離画像を、該距離画像の階調数よりも低い階調数の距離画像に階調変換する際の階調変換条件を構成する階調変換パラメータとして、該階調変換を行う基準となる基準面を設定する工程と、前記設定された基準面の高さを基準として、前記距離画像を、該距離画像の階調数よりも低い階調数の、該距離画像が有する高さ情報を画像の濃淡値に置き換えた低階調距離画像に階調変換する工程と、
前記階調変換に際して、前記基準面に基づいて抽出すべき高さ情報として、前記基準面よりも高い側、低い側、又は高低両方のいずれかを指定するよう促す工程と、前記階調変換された低階調距離画像に対して、所定の検査処理を実行する工程とを含み、前記階調変換に際して、距離画像から高周波成分を除いた曲面を演算し、該演算された曲面を基準面として低階調距離画像に階調変換し、前記高い側が指定された場合、前記基準面が、前記低階調距離画像の距離レンジの下限となるように階調変換し、前記低い側が指定された場合、前記基準面が、前記低階調距離画像の距離レンジの上限となるように階調変換し、前記高低両方が指定された場合、前記基準面が、前記低階調距離画像の距離レンジの中間となるように階調変換することができる。
Furthermore, according to the three-dimensional image processing method according to the eighth aspect, in addition to any of the above, when performing the tone conversion, the distance image is once reduced, filtered, and enlarged to form a free-form surface image. By taking the difference between the free-form surface image and the distance image, the shape change of the distance image is extracted. When the distance image is reduced, the local shape change is extracted in the gradation conversion. Reduction can be performed only in the direction designated by the extraction direction input means for designating the direction of extraction. As a result, the distance image is reduced in a direction other than the designated direction without reducing in the direction designated by the extraction direction input means, leaving the height information in the designated direction in the free-form surface image. By taking the difference from this, it is possible to eliminate the gradual shape change in the direction and extract only the necessary shape.
Furthermore, according to the three-dimensional image processing method according to the ninth aspect, in addition to any of the above, the height information to be extracted based on the reference plane at the time of the gradation conversion is the reference plane a step of prompting the user to specify one of a higher side, a lower side, or both higher and lower than, and when the higher side is specified, the reference plane is the lower limit of the distance range of the low gradation distance image. When the lower side is designated, the gradation conversion is performed so that the reference plane becomes the upper limit of the distance range of the low gradation distance image, and when both the high and low are designated, The gradation conversion can be performed so that the reference plane is in the middle of the distance range of the low gradation distance image.
Furthermore, according to the three-dimensional image processing method according to the tenth aspect, a distance image including height information of an inspection object is acquired, and image processing can be performed based on the distance image. An image processing apparatus comprising imaging means for capturing an image of an object to be inspected, distance image generating means capable of generating a distance image based on the image captured by the imaging means, and generating by the distance image generating means. a reference plane setting means for setting a reference plane that serves as a reference when tone-converting the obtained distance image into a distance image having a number of tones lower than the number of tones of the distance image; Using the height of the reference plane set in 1 as a reference, the distance image is obtained by replacing the height information of the distance image with the grayscale value of the image, with the number of gradations lower than the number of gradations of the distance image. gradation conversion means for converting gradation into a gradation distance image; and extraction height setting means for designating height information to be extracted based on the reference plane when the gradation conversion is performed by the gradation conversion means. and inspection execution means for executing a predetermined inspection process on the low-gradation distance image that has been tone-converted by the tone conversion means, wherein the reference plane setting means corresponds to the distance image generation means. A curved surface excluding high-frequency components is calculated from the distance image generated by and the calculated curved surface is set as a reference plane. Either a higher side, a lower side, or both higher and lower than the reference plane can be specified, and when the higher side is specified, the extraction height setting means determines that the reference plane is the distance When tone conversion is performed so as to be the lower limit of the range and the lower side is specified, the extraction height setting means performs tone conversion so that the reference plane is the upper limit of the distance range of the low tone distance image. When both the height and the low are specified, the extraction height setting means can carry out tone conversion so that the reference plane is in the middle of the distance range of the low tone distance image.
Furthermore, according to the three-dimensional image processing method according to the eleventh aspect, the three-dimensional image processing method acquires a distance image including height information of an inspection object and performs image processing based on the distance image. a step of projecting incident light from an oblique direction with respect to an optical axis of an imaging means as structured illumination of a predetermined projection pattern by a projection means; a step of acquiring the reflected light and capturing a plurality of pattern projection images by an imaging means; and a step of generating a distance image by a distance image generation means based on the plurality of pattern projection images captured by the imaging means. , as a gradation conversion parameter constituting a gradation conversion condition for gradation conversion of the distance image generated by the distance image generating means to a distance image having a lower gradation number than the distance image, setting a reference plane that serves as a reference for performing the tone conversion; and using the height of the set reference plane as a reference, converting the distance image to a number of tones lower than that of the distance image; a step of gradation conversion into a low gradation distance image in which the height information of the distance image is replaced with the grayscale value of the image;
a step of prompting the user to specify any one of a higher side, a lower side, or both higher and lower than the reference plane as height information to be extracted based on the reference plane when performing the gradation conversion; performing a predetermined inspection process on the obtained low-gradation distance image, calculating a curved surface from which high-frequency components are removed from the distance image in the tone conversion, and using the calculated curved surface as a reference surface. When tone conversion is performed to a low tone distance image and the high side is specified, tone conversion is performed such that the reference plane is the lower limit of the distance range of the low tone distance image, and the low side is specified. gradation conversion is performed so that the reference plane is the upper limit of the distance range of the low gradation distance image, and when both the high and low are specified, the reference plane is the distance range of the low gradation distance image It is possible to perform gradation conversion so as to be in the middle of .

本発明の実施の形態に係る画像処理装置を含む三次元画像処理システムのシステム構成例を示す図である。1 is a diagram showing a system configuration example of a 3D image processing system including an image processing device according to an embodiment of the present invention; FIG. 本発明の変形例に係る三次元画像処理システムのシステム構成例を示す図である。FIG. 10 is a diagram showing a system configuration example of a 3D image processing system according to a modification of the present invention; 本発明の実施の形態2に係る三次元画像処理装置のハードウェア構成を示す模式図である。FIG. 5 is a schematic diagram showing the hardware configuration of a 3D image processing apparatus according to Embodiment 2 of the present invention; 図4Aは本発明の実施の形態3に係る三次元画像処理装置のヘッド部、図4Bは実施の形態4に係る三次元画像処理装置のヘッド部をそれぞれ示す模式図である。4A is a schematic diagram showing a head portion of a three-dimensional image processing apparatus according to Embodiment 3 of the present invention, and FIG. 4B is a schematic diagram showing a head portion of a three-dimensional image processing apparatus according to Embodiment 4 of the present invention. 本発明の実施の形態3に係る三次元画像処理装置を示すブロック図である。FIG. 10 is a block diagram showing a three-dimensional image processing device according to Embodiment 3 of the present invention; 図5のコントローラ部を示すブロック図である。FIG. 6 is a block diagram showing a controller unit of FIG. 5; 本実施形態に係る画像処理装置の処理動作を示すフローチャートである。4 is a flowchart showing processing operations of the image processing apparatus according to the embodiment; 設定時における静的変換の手順を示すフローチャートである。10 is a flow chart showing a procedure of static conversion at the time of setting; 三次元画像処理プログラムで「撮像」を追加した初期画面を示すイメージ図である。FIG. 10 is an image diagram showing an initial screen to which "imaging" is added in the three-dimensional image processing program; 撮像設定メニューで画像登録を選択した状態を示すイメージ図である。FIG. 11 is an image diagram showing a state in which image registration is selected in the imaging setting menu; 画像登録画面の画面例を示すイメージ図である。FIG. 10 is an image diagram showing an example of an image registration screen; 距離画像を登録中の画面例を示すイメージ図である。FIG. 10 is an image diagram showing an example of a screen during registration of a distance image; 輝度画像を登録中の画面例を示すイメージ図である。FIG. 10 is an image diagram showing an example of a screen during registration of a luminance image; 撮像設定画面を示すイメージ図である。FIG. 11 is an image diagram showing an imaging setting screen; 撮像有効設定画面を示すイメージ図である。FIG. 11 is an image diagram showing an imaging enable setting screen; 三次元計測設定画面を示すイメージ図である。FIG. 10 is an image diagram showing a three-dimensional measurement setting screen; 選択可能な前処理の種類を示すイメージ図である。FIG. 4 is an image diagram showing selectable types of preprocessing. 計測不能基準設定欄で設定可能な選択肢を示すイメージ図である。FIG. 10 is an image diagram showing options that can be set in the non-measurable standard setting field; 計測不能基準設定欄で「なし」を選択した例を示すイメージ図である。FIG. 11 is an image diagram showing an example in which "none" is selected in the non-measurable standard setting column; 計測不能基準設定欄で「低」を選択した例を示すイメージ図である。FIG. 11 is an image diagram showing an example in which "low" is selected in the non-measurable standard setting column; 計測不能基準設定欄で「中」を選択した例を示すイメージ図である。FIG. 11 is an image diagram showing an example in which "medium" is selected in the non-measurable standard setting column; 計測不能基準設定欄で「高」を選択した例を示すイメージ図である。FIG. 11 is an image diagram showing an example in which "high" is selected in the non-measurable standard setting column; 均等間隔処理設定欄で設定可能な選択肢を示すイメージ図である。FIG. 10 is an image diagram showing options that can be set in the equal interval processing setting field; 均等間隔処理をON、「表示画像」選択欄を「高さ画像」とした例を示すイメージ図である。FIG. 11 is an image diagram showing an example in which equal interval processing is turned on and the 'display image' selection field is set to 'height image'; 均等間隔処理をON、「表示画像」選択欄を「濃淡画像」とした例を示すイメージ図である。FIG. 10 is an image diagram showing an example in which equal interval processing is turned on and the “display image” selection field is set to “grayscale image”; 均等間隔処理をOFF、距離画像を表示した例を示すイメージ図である。FIG. 10 is an image diagram showing an example of displaying a distance image with equal interval processing turned off; 均等間隔処理をOFF、輝度画像を表示した例を示すイメージ図であFIG. 10 is an image diagram showing an example of displaying a luminance image with equal interval processing turned off; 空間コード設定欄で設定可能な選択肢を示すイメージ図である。FIG. 10 is an image diagram showing options that can be set in the space code setting field; 「表示画像」選択欄で「高さ画像」を選択し第二画像表示領域に距離画像を表示させた状態を示すイメージ図である。FIG. 10 is an image diagram showing a state in which a "height image" is selected in the "display image" selection field and a distance image is displayed in the second image display area. 「表示画像」選択欄で「濃淡画像」を選択し第二画像表示領域に輝度画像を表示させた状態を示すイメージ図である。FIG. 11 is an image diagram showing a state in which a “grayscale image” is selected in the “display image” selection field and a luminance image is displayed in the second image display area; 空間コード設定欄でOFFを選択した例を示すイメージ図である。FIG. 10 is an image diagram showing an example in which OFF is selected in the space code setting field; 「表示画像」選択欄で「濃淡画像」を表示させた状態を示している。It shows a state in which a "grayscale image" is displayed in the "display image" selection column. プロジェクタ選択設定欄で設定可能な選択肢を示すイメージ図である。FIG. 5 is an image diagram showing options that can be set in a projector selection setting field; プロジェクタ選択設定欄で「1」を選択した例を示すイメージ図である。FIG. 11 is an image diagram showing an example in which "1" is selected in the projector selection setting field; プロジェクタ選択設定欄で「2」を選択した例を示すイメージ図である。FIG. 11 is an image diagram showing an example in which "2" is selected in the projector selection setting field; プロジェクタ選択設定欄で「1+2」を選択した例を示すイメージ図である。FIG. 11 is an image diagram showing an example in which "1+2" is selected in the projector selection setting field; 「表示画像」選択欄で設定可能な選択肢を示すイメージ図である。FIG. 10 is an image diagram showing options that can be set in the “display image” selection field; 「表示画像」選択欄で「縞投光-プロジェクタ1」を選択して、第二画像表示領域に第一プロジェクタのパターン投影画像を表示させた例を示すイメージ図である。FIG. 10 is an image diagram showing an example of displaying a pattern projection image of the first projector in the second image display area by selecting "stripe projection-projector 1" in the "display image" selection column. 「表示画像」選択欄で「縞投光-プロジェクタ2」を選択して、第二画像表示領域に第二プロジェクタのパターン投影画像を表示させた例を示すイメージ図である。FIG. 10 is an image diagram showing an example of displaying a pattern projection image of the second projector in the second image display area by selecting "stripe projection-projector 2" in the "display image" selection field. シャッタースピード設定欄を「1/15」に設定した三次元計測設定画面を示すイメージ図である。FIG. 10 is an image diagram showing a three-dimensional measurement setting screen in which the shutter speed setting field is set to "1/15"; シャッタースピード設定欄を「1/30」に設定した三次元計測設定画面を示すイメージ図である。FIG. 10 is an image diagram showing a three-dimensional measurement setting screen in which the shutter speed setting field is set to "1/30"; 濃淡レンジ設定欄を「普通(0)」に設定した三次元計測設定画面を示すイメージ図である。FIG. 11 is an image diagram showing a three-dimensional measurement setting screen in which the grayscale range setting field is set to "normal (0)"; 濃淡レンジ設定欄を「高い(1)」に設定した三次元計測設定画面を示すイメージ図である。FIG. 10 is an image diagram showing a three-dimensional measurement setting screen in which the grayscale range setting field is set to “high (1)”; 図9の状態から「高さ計測」処理ユニットを追加する様子を示すイメージAn image showing how the "height measurement" processing unit is added from the state in Fig. 9 図44を経て「高さ計測」処理ユニットが追加された初期画面を示すイメージ図である。45 is an image diagram showing an initial screen to which a "height measurement" processing unit has been added through FIG. 44; FIG. 高さ計測設定画面を示すイメージ図である。It is an image figure which shows a height measurement setting screen. 検査対象領域設定画面を示すイメージ図である。FIG. 11 is an image diagram showing an inspection target area setting screen; 図47の「計測領域」設定欄のドロップダウンメニューを表示させた状態を示すイメージ図である。FIG. 48 is an image diagram showing a state in which the drop-down menu of the "measurement area" setting column in FIG. 47 is displayed; 「計測領域」設定欄において「回転矩形」を選択した状態を示すイメージ図である。FIG. 11 is an image diagram showing a state in which "rotated rectangle" is selected in the "measurement area" setting field; 計測領域編集画面を示すイメージ図である。FIG. 10 is an image diagram showing a measurement area editing screen; 計測領域編集画面の「計測領域」設定欄で「円周」を選択した状態を示すイメージ図である。FIG. 10 is an image diagram showing a state in which "circumference" is selected in the "measurement area" setting field of the measurement area edit screen; 第二「高さ計測」処理ユニットを追加した初期画面を示すイメージ図である。FIG. 11 is an image diagram showing an initial screen to which a second “height measurement” processing unit is added; 計測領域として「回転矩形」を設定した状態を示すイメージ図である。FIG. 11 is an image diagram showing a state in which a “rotated rectangle” is set as a measurement area; 計測領域として「回転矩形」を設定する状態を示すイメージ図である。FIG. 10 is an image diagram showing a state in which a “rotated rectangle” is set as a measurement area; 計測領域として「回転矩形」が設定された状態を示すイメージ図である。FIG. 10 is an image diagram showing a state in which a “rotated rectangle” is set as a measurement area; 「数値演算」処理ユニットを追加しようとする状態を示すイメージ図である。FIG. 10 is an image diagram showing a state in which a "numerical operation" processing unit is to be added; 「数値演算」処理ユニットが追加された初期画面を示すイメージ図である。FIG. 10 is an image diagram showing an initial screen to which a “numerical calculation” processing unit has been added; 数値演算編集画面を表示させた状態を示すイメージ図である。FIG. 10 is an image diagram showing a state in which a numerical calculation edit screen is displayed; 図58の数値演算編集画面に演算式を入力した状態を示すイメージ図である。FIG. 59 is an image diagram showing a state in which an arithmetic expression is input to the numerical calculation edit screen of FIG. 58; 「数値演算」処理ユニットが設定された初期画面を示すイメージ図である。FIG. 10 is an image diagram showing an initial screen on which a “numerical calculation” processing unit is set; 「エリア」処理ユニットを追加した初期画面を示すイメージ図である。FIG. 11 is an image diagram showing an initial screen to which an "area" processing unit has been added; エリア設定画面を示すイメージ図である。FIG. 11 is an image diagram showing an area setting screen; 回転矩形の詳細を設定する領域設定画面を示すイメージ図である。FIG. 11 is an image diagram showing an area setting screen for setting details of a rotated rectangle; 回転矩形が設定された領域設定画面を示すイメージ図である。FIG. 11 is an image diagram showing an area setting screen on which a rotated rectangle is set; 高さ抽出選択画面を示すイメージ図である。FIG. 11 is an image diagram showing a height extraction selection screen; 一点指定画面のGUIを示すイメージ図である。FIG. 11 is an image diagram showing a GUI of a one-point designation screen; 一点指定画面のGUIを示すイメージ図である。FIG. 11 is an image diagram showing a GUI of a one-point designation screen; 一点指定画面のGUIを示すイメージ図である。FIG. 11 is an image diagram showing a GUI of a one-point designation screen; 図69Aは、入力画像のプロファイルを示すイメージ図、図69Bは図69Aの入力画像を階調変換した低階調距離画像のプロファイルを示すイメージ図である。FIG. 69A is an image diagram showing the profile of the input image, and FIG. 69B is an image diagram showing the profile of the low tone distance image obtained by tone-converting the input image of FIG. 69A. 図68の状態からゲインを増加させた状態を示すイメージ図である。FIG. 69 is an image diagram showing a state in which the gain is increased from the state of FIG. 68; 図70の状態からゲインを低下させた状態を示すイメージ図である。FIG. 71 is an image diagram showing a state in which the gain is lowered from the state of FIG. 70; 図71で詳細設定を選択した状態を示すイメージ図である。FIG. 72 is an image diagram showing a state in which detailed setting is selected in FIG. 71; 一点指定用の強調方法詳細設定画面のGUIを示すイメージ図である。FIG. 11 is an image diagram showing a GUI of an emphasis method detail setting screen for specifying one point; 図73の状態から「抽出高さ」設定欄のドロップダウンリストを表示させた状態を示すイメージ図である。FIG. 74 is an image diagram showing a state in which a drop-down list of "extraction height" setting fields is displayed from the state of FIG. 73; 図75Aは、入力画像のプロファイルを示すイメージ図、図75Bは図75Aの入力画像を基準面を基準で示したイメージ図、図75Cは図75Bを階調変換した低階調距離画像のプロファイルを示すイメージ図である。75A is an image diagram showing the profile of the input image, FIG. 75B is an image diagram showing the input image of FIG. 75A with reference to the reference plane, and FIG. 75C is an image diagram showing the profile of the low gradation distance image obtained by gradation conversion of FIG. 75B is. 図76Aは輝度画像、図76Bは高階調の距離画像、図76Cは図76Bを階調変換した低階調距離画像、図76Dは図76Cよりもゲインを上げた低階調距離画像、図76Eは図76Dよりもノイズ除去を上げた低階調距離画像、図76Fは図76Eで「抽出高さ」を高い側に設定した低階調距離画像を、それぞれ示すイメージ図である。76A is a luminance image, FIG. 76B is a high gradation distance image, FIG. 76C is a low gradation distance image obtained by gradation conversion of FIG. 76B, FIG. 76D is a low gradation distance image with a higher gain than FIG. 76C, and FIG. 76E 76F is an image diagram showing a low gradation distance image in which noise removal is higher than that in FIG. 76D, and a low gradation distance image in which the "extraction height" is set on the higher side in FIG. 76E. 図77Aは、入力画像のプロファイルを示すイメージ図、図77Bは図77Aの入力画像を「抽出高さ」を高い側に設定して階調変換した低階調距離画像のプロファイルを示すイメージ図である。77A is an image diagram showing the profile of the input image, and FIG. 77B is an image diagram showing the profile of the low gradation distance image obtained by gradation conversion of the input image of FIG. 77A by setting the "extraction height" on the high side. 階調変換画像を表示させた状態を示すイメージ図である。FIG. 10 is an image diagram showing a state in which a gradation-converted image is displayed; 図79Aは一点指定で基準面を設定する方法が有効なワークの例を示す斜視図、図79Bは図79Aで撮像した距離画像を階調変換した低階調距離画像のイメージ図である。FIG. 79A is a perspective view showing an example of a workpiece for which the method of setting a reference plane by specifying one point is effective, and FIG. 79B is an image diagram of a low gradation distance image obtained by converting the gradation of the distance image captured in FIG. 79A. 高さ抽出選択画面のGUIを示すイメージ図である。FIG. 11 is an image diagram showing a GUI of a height extraction selection screen; 三点指定画面のGUIを示すイメージ図である。FIG. 11 is an image diagram showing a GUI of a three-point designation screen; 図81の状態から高さ抽出手段で一点目を指定する状態を示すイメージ図である。FIG. 82 is an image diagram showing a state in which the first point is designated by the height extracting means from the state of FIG. 81; 図82の状態からさらに二点目を指定する状態を示すイメージ図である。FIG. 83 is an image diagram showing a state in which a second point is further specified from the state in FIG. 82; 図83の状態からさらに三点目を指定する状態を示すイメージ図である。FIG. 84 is an image diagram showing a state in which a third point is further specified from the state in FIG. 83; 三点指定用の詳細設定画面のGUIを示すイメージ図である。FIG. 11 is an image diagram showing a GUI of a detailed setting screen for specifying three points; 図86Aは三点指定で基準面を設定する方法が有効なワークの例を示す斜視図、図86Bは図86Aで撮像した距離画像を階調変換した低階調距離画像のイメージ図、図86Cは図86Bを二値化した画像のイメージ図、図86Dは図86Aのワークに傾きがある場合に一点指定で得られた二値化画像のイメージ図である。FIG. 86A is a perspective view showing an example of a workpiece for which the method of setting a reference plane by specifying three points is effective; FIG. 86B is an image diagram of a low-gradation distance image obtained by converting the gradation of the distance image captured in FIG. 86A; FIG. 86B is an image diagram of a binarized image, and FIG. 86D is an image diagram of a binarized image obtained by specifying one point when the workpiece in FIG. 86A has an inclination. 図87Aは三点指定で基準面を設定する方法が有効な他のワークの例を示す斜視図、図87Bは図87Aで撮像した距離画像を階調変換した低階調距離画像のイメージ図、図87Cは図87Bを二値化した画像のイメージ図、図87Dは図87Aのワークに傾きがある場合に一点指定で得られた二値化画像のイメージ図である。FIG. 87A is a perspective view showing an example of another workpiece for which the method of setting a reference plane by specifying three points is effective, and FIG. 87B is an image diagram of a low gradation distance image obtained by converting the gradation of the distance image captured in FIG. 87A. 87C is an image diagram of a binarized image of FIG. 87B, and FIG. 87D is an image diagram of a binarized image obtained by specifying one point when the workpiece in FIG. 87A has an inclination. 高さ動的抽出設定画面のGUIを示すイメージ図である。FIG. 11 is an image diagram showing a GUI of a height dynamic extraction setting screen; 「計算方法」選択欄のドロップダウンボックスを示すイメージ図である。FIG. 11 is an image diagram showing a drop-down box in a “calculation method” selection field; 平均高さ基準設定画面を示すイメージ図である。FIG. 11 is an image diagram showing an average height reference setting screen; マスク領域設定画面を示すイメージ図である。FIG. 11 is an image diagram showing a mask area setting screen; 平面基準詳細設定画面を示すイメージ図である。FIG. 11 is an image diagram showing a plane reference detail setting screen; 図93Aは平均高さ基準で基準面を設定する方法が有効なワークの例を示す斜視図、図93Bは図93Aで撮像した距離画像を階調変換した低階調距離画像のイメージ図である。FIG. 93A is a perspective view showing an example of a workpiece for which the method of setting the reference plane based on the average height is effective, and FIG. 93B is an image diagram of a low gradation distance image obtained by converting the gradation of the distance image captured in FIG. 93A. 平面基準詳細設定画面を示すイメージ図である。FIG. 11 is an image diagram showing a plane reference detail setting screen; 図94の画面で無効画素指定欄の詳細を示すイメージ図である。95 is an image diagram showing details of an invalid pixel designation field on the screen of FIG. 94; FIG. 自由曲面基準設定画面を示すイメージ図である。FIG. 10 is an image diagram showing a free-form surface reference setting screen; 図96で「抽出サイズ」指定欄の数値を大きくした状態を示すイメージ図である。FIG. 97 is an image diagram showing a state in which the numerical value in the "extraction size" designation field in FIG. 96 is increased. 図98Aは自由曲面基準で基準面を設定する方法が有効なワークの例を示す斜視図、図98Bは図98Aで撮像した距離画像を階調変換した低階調距離画像のイメージ図である。FIG. 98A is a perspective view showing an example of a workpiece for which the method of setting a reference plane based on a free-form surface reference is effective, and FIG. 98B is an image diagram of a low-gradation distance image obtained by converting the gradation of the distance image captured in FIG. 98A. 図90の状態から抽出領域設定ダイヤログを表示させた状態を示すイメージ図である。FIG. 91 is an image diagram showing a state in which an extraction area setting dialog is displayed from the state of FIG. 90; 図99の抽出領域選択欄で「矩形」を選択した状態を示すイメージ図である。99. FIG. 99 is an image diagram showing a state in which "rectangle" is selected in the extraction area selection column of FIG. 図100の状態から抽出領域編集ダイヤログを表示させた状態を示すイメージ図である。FIG. 101 is an image diagram showing a state in which an extraction area edit dialog is displayed from the state in FIG. 100; 図99のマスク領域選択欄で「円形」を選択した状態を示すイメージ図である。99. FIG. 99 is an image diagram showing a state in which "circle" is selected in the mask area selection column of FIG. 図102の状態からマスク領域編集ダイヤログを表示させた状態を示すイメージ図である。FIG. 103 is an image diagram showing a state in which the mask area edit dialog is displayed from the state in FIG. 102; 「エリア」処理ユニットで高さ抽出を設定した状態を示すイメージ図である。FIG. 10 is an image diagram showing a state in which height extraction is set in the "area" processing unit; フィルタ処理設定画面を示すイメージ図である。FIG. 11 is an image diagram showing a filter processing setting screen; 二値化レベル設定画面を示すイメージ図である。FIG. 11 is an image diagram showing a binarization level setting screen; フィルタ処理設定した状態を示すイメージ図である。FIG. 10 is an image diagram showing a state in which filter processing is set; 判定条件設定画面を示すイメージ図である。FIG. 11 is an image diagram showing a determination condition setting screen; 判定条件が設定された状態を示すイメージ図である。FIG. 10 is an image diagram showing a state in which determination conditions are set; 「ブロブ」処理ユニットを追加した初期画面を示すイメージ図である。FIG. 10 is an image diagram showing an initial screen with the addition of a “blob” processing unit; 「ブロブ」処理ユニットにおいてフィルタ処理を設定する様子を示すイメージ図である。FIG. 10 is an image diagram showing how filtering is set in the “blob” processing unit; 「ブロブ」処理ユニットにおいて検出条件を設定する様子を示すイメージ図である。FIG. 10 is an image diagram showing how detection conditions are set in a “blob” processing unit; 「ブロブ」処理ユニットにおいて判定条件を設定する様子を示すイメージ図である。FIG. 10 is an image diagram showing how a determination condition is set in a “blob” processing unit; 初期画面に「色検査」処理ユニットを追加しようとする状態を示すイメージ図である。FIG. 11 is an image diagram showing a state in which a "color inspection" processing unit is to be added to the initial screen; 「色検査」処理ユニットに円の領域を設定する様子を示すイメージ図である。FIG. 10 is an image diagram showing how a circular area is set in the “color inspection” processing unit; 「色検査」処理ユニットに円の領域設定を行った状態を示すイメージ図である。FIG. 11 is an image diagram showing a state in which a circle area is set in the "color inspection" processing unit; 「色検査」処理ユニットに濃度平均を設定した状態を示すイメージ図である。FIG. 10 is an image diagram showing a state in which density average is set in the "color inspection" processing unit; 「色検査」処理ユニットを設定した初期画面を示すイメージ図である。FIG. 11 is an image diagram showing an initial screen on which a "color inspection" processing unit is set; 実施の形態3に係る三次元画像処理装置のヘッド部での運用時の処理の流れを示すフローチャートである。10 is a flow chart showing the flow of processing during operation in the head unit of the 3D image processing apparatus according to Embodiment 3; 実施の形態4に係る三次元画像処理装置のヘッド部での運用時の処理の流れを示すフローチャートである。14 is a flow chart showing the flow of processing during operation in the head unit of the 3D image processing apparatus according to Embodiment 4; 実施の形態1に係る階調変換方法を示すフローチャートである。4 is a flowchart showing a tone conversion method according to Embodiment 1; 実施の形態3に係る三次元画像処理装置のコントローラ部での運用時の処理の流れを示すフローチャートである。10 is a flow chart showing the flow of processing during operation in the controller section of the 3D image processing apparatus according to Embodiment 3; 三次元画像処理プログラムの初期画面を示すイメージ図である。FIG. 4 is an image diagram showing an initial screen of a three-dimensional image processing program; 輝度画像上でサーチ対象領域を設定した状態を示すイメージ図である。FIG. 4 is an image diagram showing a state in which a search target area is set on a luminance image; 距離画像上で検査対象領域を複数設定した状態を示すイメージ図である。FIG. 4 is an image diagram showing a state in which a plurality of inspection target areas are set on a distance image; 図125の距離画像を拡大した状態を示すイメージ図である。FIG. 126 is an image diagram showing a state in which the distance image in FIG. 125 is enlarged; 三次元画像処理プログラムで高さ計測を実行する状態を示すイメージ図である。FIG. 4 is an image diagram showing a state in which height measurement is executed by a three-dimensional image processing program; 位相シフト法と空間コード化法を組み合わせて距離画像を生成するためのデータフロー図である。FIG. 4 is a data flow diagram for generating a range image by combining the phase shift method and the spatial encoding method; 空間コード化法を使用しないで位相シフト法のみで距離画像を生成するためのデータフロー図である。FIG. 4 is a data flow diagram for generating a range image using only the phase shift method without using the spatial encoding method; XY等ピッチ化をOFFしてZ画像を得る手順を示すデータフロー図である。FIG. 5 is a data flow diagram showing a procedure for obtaining a Z image by turning off XY equal pitch conversion; ポイントクラウドデータを出力する例を示す図である。It is a figure which shows the example which outputs point cloud data. 運用時における静的変換の手順を示すフローチャートである。FIG. 10 is a flow chart showing a procedure of static conversion during operation; FIG. 運用時における動的変換の手順を示すフローチャートである。10 is a flow chart showing a procedure of dynamic conversion during operation; 検査対象のワークを示す斜視図である。1 is a perspective view showing a workpiece to be inspected; FIG. 予め複数の階調変換パラメータセットを準備しておく方法を示す模式図である。FIG. 4 is a schematic diagram showing a method of preparing a plurality of gradation conversion parameter sets in advance; 図135の方法の手順を示すフローチャートである。Figure 136 is a flow chart showing the steps of the method of Figure 135; 高さの変動が殆どないワークの例を示す斜視図である。FIG. 10 is a perspective view showing an example of a workpiece with almost no height variation; 図138Aは高さの変動を検知したいワークの例を示す斜視図、図138Bは図138Aで撮像した距離画像を階調変換した低階調距離画像のイメージ図である。FIG. 138A is a perspective view showing an example of a work whose height variation is desired to be detected, and FIG. 138B is an image diagram of a low gradation distance image obtained by gradation conversion of the distance image captured in FIG. 138A. 動的変換(平均高さ基準)による基準面の指定が有効なワークの例を示す斜視図である。FIG. 10 is a perspective view showing an example of a workpiece for which specification of a reference plane by dynamic conversion (average height reference) is effective; 動的変換(平面基準)による基準面の指定が有効なワークの例を示す斜視図である。FIG. 10 is a perspective view showing an example of a workpiece for which specification of a reference plane by dynamic transformation (plane reference) is effective; 動的変換(自由曲面基準)による基準面の指定が有効なワークの例を示す斜視図である。FIG. 11 is a perspective view showing an example of a workpiece for which designation of a reference plane by dynamic conversion (free-form surface reference) is effective; 適切な画像が得られるまで階調変換パラメータの調整を繰り返す手順を示すフローチャートである。4 is a flow chart showing a procedure for repeating adjustment of tone conversion parameters until an appropriate image is obtained; 図142において画像が適切かどうかの判定を省略した手順を示すフローチャートである。FIG. 143 is a flow chart showing the procedure in FIG. 142 omitting the judgment as to whether or not the image is appropriate; 階調変換パラメータ調整の具体的手順を示すフローチャートである。5 is a flowchart showing a specific procedure for tone conversion parameter adjustment; 図145Aはワークの外観、図145Bは図145Aのワークから得られた距離画像のイメージ、図145Cは図145Bの距離画像に対し高さ検査処理のために検査対象領域を設定した状態を示すイメージ、図145Dは図145Bの距離画像に対し画像検査処理のために検査対象領域を設定した状態を示すイメージ、図145Eは図145Dの距離画像に対して階調変換を行った低階調距離画像のイメージを、それぞれ示す図である。FIG. 145A shows the appearance of the work, FIG. 145B shows the image of the distance image obtained from the work of FIG. 145A, and FIG. 145D is an image showing a state in which an inspection target area is set for image inspection processing in the distance image of FIG. 145B, and FIG. 145E is a low gradation distance image obtained by performing gradation conversion on the distance image of FIG. 145D. 1 is a diagram showing an image of each. 設定時の手順を示すフローチャートである。4 is a flowchart showing a procedure for setting; 図145Aのワークに対して「エリア」処理ユニットの設定を行う画面を示すイメージ図である。145B is an image diagram showing a screen for setting an "area" processing unit for the work of FIG. 145A; FIG. 図147で高さ抽出の条件を設定する画面を示すイメージ図である。148 is an image diagram showing a screen for setting conditions for height extraction in FIG. 147; FIG. 運転時の手順を示すフローチャートである。4 is a flow chart showing a procedure during operation; 図149の検査処理で階調変換を行う場合の手順を示すフローチャートである。FIG. 150 is a flow chart showing a procedure when tone conversion is performed in the inspection process of FIG. 149; FIG. 図149の検査処理で階調変換を行わない場合の手順を示すフローチャートである。FIG. 150 is a flow chart showing a procedure when gradation conversion is not performed in the inspection processing of FIG. 149; FIG. 検査処理条件を設定する手順を示すフローチャートである。4 is a flowchart showing a procedure for setting inspection processing conditions; 画像設定画面を示すイメージ図である。FIG. 11 is an image diagram showing an image setting screen; 輝度画像又は距離画像を選択可能な画像変数選択画面を呼び出した状態を示すイメージ図である。FIG. 10 is an image diagram showing a state in which an image variable selection screen is called from which a luminance image or a distance image can be selected; 距離画像のみ選択可能な画像変数選択画面を呼び出した状態を示すイメージ図である。FIG. 10 is an image diagram showing a state in which an image variable selection screen that allows selection of only a distance image is called. 画像を選択させた上で検査処理を選択して検査処理条件を設定する手順を示すフローチャートである。5 is a flow chart showing a procedure for selecting an image, selecting an inspection process, and setting inspection process conditions. 輝度画像と距離画像を取得した状態を示す模式図である。FIG. 4 is a schematic diagram showing a state in which a luminance image and a range image are acquired; 図157で輝度画像を選択した場合に設定可能な検査処理ツールを示す模式図である。FIG. 158 is a schematic diagram showing inspection processing tools that can be set when a luminance image is selected in FIG. 157; 図157で距離画像を選択した場合に設定可能な検査処理ツールを示す模式図である。FIG. 158 is a schematic diagram showing inspection processing tools that can be set when a distance image is selected in FIG. 157; 三角測距方式で距離画像を撮像する様子を示す模式図である。It is a schematic diagram which shows a mode that a range image is imaged by a triangulation ranging method. 自由曲面対象領域内に分布する高さ情報のフィッティングを行う手順を示すフローチャートである。4 is a flowchart showing a procedure for fitting height information distributed within a free-form surface target area; 縦方向に一様な形状の検査対象物の距離画像を示すイメージ図である。FIG. 3 is an image diagram showing a distance image of an inspection object having a uniform shape in the vertical direction; 図162の距離画像からXY方向に抽出して階調変換した低階調距離画像を示すイメージ図である。FIG. 163 is an image diagram showing a low gradation distance image extracted in the XY direction from the distance image of FIG. 162 and subjected to gradation conversion. 自由曲面基準設定画面の他の例を示すイメージ図である。FIG. 11 is an image diagram showing another example of the free-form surface reference setting screen; 図164の自由曲面基準設定画面の詳細設定画面を示すイメージ図である。165 is an image diagram showing a detailed setting screen of the free-form surface reference setting screen of FIG. 164; FIG. 図162の距離画像からY方向に抽出して階調変換した低階調距離画像を示すイメージ図である。FIG. 163 is an image diagram showing a low gradation distance image extracted in the Y direction from the distance image of FIG. 162 and subjected to gradation conversion; 縦方向に一様な形状の他の検査対象物の距離画像を示すイメージ図である。FIG. 11 is an image diagram showing a distance image of another inspection object having a uniform shape in the vertical direction; 図167の距離画像からXY方向に抽出して階調変換した低階調距離画像を示すイメージ図である。FIG. 168 is an image diagram showing a low gradation distance image obtained by extracting in the XY directions from the distance image of FIG. 167 and converting the gradation. 図167の距離画像からY方向に抽出して階調変換した低階調距離画像を示すイメージ図である。FIG. 168 is an image diagram showing a low gradation distance image extracted in the Y direction from the distance image of FIG. 167 and subjected to gradation conversion;

以下、本発明の実施の形態を図面に基づいて説明する。ただし、以下に示す実施の形態は、本発明の技術思想を具体化するための三次元画像処理装置及び三次元画像処理方法を例示するものであって、本発明は三次元画像処理装置及び三次元画像処理方法を以下のものに特定しない。また、本明細書は特許請求の範囲に示される部材を、実施の形態の部材に特定するものでは決してない。特に実施の形態に記載されている構成部品の寸法、材質、形状、その相対的配置等は特に特定的な記載がない限りは、本発明の範囲をそれのみに限定する趣旨ではなく、単なる説明例にすぎない。なお、各図面が示す部材の大きさや位置関係等は、説明を明確にするため誇張していることがある。さらに以下の説明において、同一の名称、符号については同一もしくは同質の部材を示しており、詳細説明を適宜省略する。さらに、本発明を構成する各要素は、複数の要素を同一の部材で構成して一の部材で複数の要素を兼用する態様としてもよいし、逆に一の部材の機能を複数の部材で分担して実現することもできる。 BEST MODE FOR CARRYING OUT THE INVENTION Hereinafter, embodiments of the present invention will be described with reference to the drawings. However, the embodiments shown below are examples of a three-dimensional image processing apparatus and a three-dimensional image processing method for embodying the technical idea of the present invention. The original image processing method is not specified as follows. In addition, this specification does not specify the members shown in the claims as the members of the embodiment. Unless otherwise specified, the dimensions, materials, shapes, relative arrangements, etc. of components described in the embodiments are not intended to limit the scope of the present invention, but are merely explanations. Just an example. Note that the sizes and positional relationships of members shown in each drawing may be exaggerated for clarity of explanation. Furthermore, in the following description, the same names and symbols indicate the same or homogeneous members, and detailed description thereof will be omitted as appropriate. Furthermore, each of the elements constituting the present invention may be configured with the same member so that a single member may serve as a plurality of elements, or conversely, the function of one member may be performed by a plurality of members. It can also be realized by sharing.

また本明細書において「距離画像(高さ画像)」という場合には、高さ情報を含む画像の意味で使用し、例えば距離画像に光学的な輝度画像をテクスチャ情報として貼り付けた三次元の合成画像も、距離画像に含む意味で使用する。また、本明細書において距離画像の表示形態は二次元状に表示されるものに限られず、三次元状に表示されるものも含む。
(実施の形態1)
In this specification, the term "distance image (height image)" is used to mean an image containing height information. The synthetic image is also used in the sense that it is included in the range image. Further, in this specification, the display form of the distance image is not limited to two-dimensional display, and includes three-dimensional display.
(Embodiment 1)

本発明の実施の形態1に係る三次元画像処理装置の構成を図1に示す。この三次元画像処理装置100は、ヘッド部1と、コントローラ部2とを備える。ヘッド部1は、検査対象物(ワーク)Wを照らす投光手段20と、ワークWの画像を撮像する撮像手段10と、コントローラ部2と接続するためのヘッド側通信手段36を備える。 FIG. 1 shows the configuration of a three-dimensional image processing apparatus according to Embodiment 1 of the present invention. This three-dimensional image processing apparatus 100 includes a head section 1 and a controller section 2 . The head unit 1 includes a light projecting unit 20 for illuminating an inspection object (work) W, an imaging unit 10 for capturing an image of the work W, and a head-side communication unit 36 for connecting with the controller unit 2 .

一方コントローラ部2は、撮像された画像に基づいて、エッジ検出や面積計算等の計測処理を実行する。またコントローラ部2には、液晶パネル等の表示手段4、ユーザが表示手段4上で各種操作するためのコンソール等の入力手段3、PLC(Programmable Logic Controller)等を着脱自在に接続できる。 On the other hand, the controller unit 2 executes measurement processing such as edge detection and area calculation based on the captured image. Further, to the controller unit 2, display means 4 such as a liquid crystal panel, input means 3 such as a console for the user to perform various operations on the display means 4, PLC (Programmable Logic Controller), etc. can be detachably connected.

以上の三次元画像処理装置100は、ヘッド部1の投光手段20でワークWに測定光を投光し、測定光がワークWに入射されて反射された反射光を、撮像手段10でパターン投影画像として撮像する。またパターン投影画像に基づいて距離画像を生成し、さらにこの距離画像を、各画素が有する高さ情報を輝度に置き換えた低階調距離画像に変換する。コントローラ部2は、変換された低階調距離画像に基づいて、エッジ検出や面積計算等の計測処理を実行する。 In the three-dimensional image processing apparatus 100 described above, the light projecting means 20 of the head unit 1 projects measurement light onto the work W, and the measurement light is incident on the work W and the reflected light is captured by the imaging means 10 in a pattern. Capture as a projection image. Also, a distance image is generated based on the pattern projection image, and further this distance image is converted into a low gradation distance image in which the height information of each pixel is replaced with luminance. The controller unit 2 executes measurement processing such as edge detection and area calculation based on the converted low gradation distance image.

なお検査対象物であるワークWは、例えばライン上を順次搬送される物品であり、移動又は静止している。また移動するワークは、コンベア等による平行移動の他、回転するものも含まれる。
(投光手段20)
The work W, which is an object to be inspected, is, for example, an article that is sequentially conveyed on a line, and is moving or stationary. The moving work includes parallel movement by a conveyor or the like as well as rotating work.
(Light projecting means 20)

投光手段20は、距離画像を生成するためにワークWを照らす照明として用いられる。したがって投光手段20は、距離画像を取得するための光切断法やパターン投影法に応じて、例えばワークに対してライン状のレーザ光を投光する光投影器、ワークに正弦波縞模様パターンを投影するためのパターン投影器等とすることができる。また投光手段以外に、明視野照明や暗視野照明を行うための一般的な照明装置を別途設けてもよい。あるいは投光手段20に、一般的な照明装置としての機能を持たせることも可能である。 The light projecting means 20 is used as illumination for illuminating the work W to generate a distance image. Therefore, the light projecting means 20 can be, for example, a light projector that projects linear laser light onto the work, or a sinusoidal striped pattern onto the work, depending on the light section method or pattern projection method for acquiring the distance image. can be a pattern projector or the like for projecting the . In addition to the light projecting means, a general illumination device for performing bright field illumination or dark field illumination may be separately provided. Alternatively, the light projecting means 20 can also function as a general illumination device.

コントローラ部2は、ヘッド部1から取得した距離画像データを用いて画像処理を実行し、外部接続されたPLC70等の制御機器に対し、ワークの良否等の判定結果を示す信号として判定信号を出力する。 The controller unit 2 executes image processing using the distance image data acquired from the head unit 1, and outputs a determination signal as a signal indicating the quality of the workpiece to a control device such as a PLC 70 connected externally. do.

撮像手段10は、PLC70から入力される制御信号、例えば撮像手段10から画像データを取り込むタイミングを規定する撮像トリガ信号に基づいて、ワークの撮像を行う。 The imaging means 10 images the workpiece based on a control signal input from the PLC 70, for example, an imaging trigger signal that defines the timing of capturing image data from the imaging means 10. FIG.

表示手段4は、ワークを撮像して得られた画像データや、その画像データを用いた計測処理の結果を表示するための表示装置である。一般に、ユーザは、表示手段4を視認することによって、コントローラ部2の動作状態を確認することができる。入力手段3は、表示手段4上でフォーカス位置を移動させたり、メニュー項目を選択したりするための入力装置である。なお、表示手段4にタッチパネルを使用する場合は、表示手段と入力手段を兼用できる。 The display means 4 is a display device for displaying image data obtained by imaging a workpiece and results of measurement processing using the image data. In general, the user can confirm the operating state of the controller section 2 by viewing the display means 4 . The input means 3 is an input device for moving the focus position on the display means 4 and selecting menu items. When a touch panel is used as the display means 4, the display means and the input means can be used together.

またコントローラ部2は、コントローラ部2の制御プログラムを生成するためのパーソナルコンピュータPCを接続することもできる。またパーソナルコンピュータPCには、三次元画像処理に関する設定を行う三次元画像処理プログラムをインストールして、コントローラ部2で行う処理の各種設定を行うこともできる。あるいは、このパーソナルコンピュータPC上で動作するソフトウェアによって、画像処理の処理順序を規定する処理順序プログラムを生成することができる。コントローラ部2では、その処理順序に沿って各画像処理が順次実行される。パーソナルコンピュータPCとコントローラ部2とは、通信ネットワークを介して接続されており、パーソナルコンピュータPC上で生成された処理順序プログラムは、例えば表示手段4の表示態様を規定するレイアウト情報等と共に、コントローラ部2に転送される。また逆に、コントローラ部2から処理順序プログラムやレイアウト情報等を取り込んで、パーソナルコンピュータPC上で編集することもできる。なお、この処理順序プログラムは、パーソナルコンピュータPCだけでなく、コントローラ部2においても生成できるようにしてもよい。
(変形例)
Also, the controller section 2 can be connected to a personal computer PC for generating a control program for the controller section 2 . A three-dimensional image processing program for setting three-dimensional image processing can be installed in the personal computer PC, and various settings for processing performed by the controller unit 2 can be performed. Alternatively, software running on this personal computer PC can generate a processing order program that defines the processing order of image processing. In the controller unit 2, each image processing is sequentially executed along the processing order. The personal computer PC and the controller unit 2 are connected via a communication network. 2. Conversely, it is also possible to import the processing order program, layout information, etc. from the controller unit 2 and edit them on the personal computer PC. Note that this processing order program may be generated not only by the personal computer PC but also by the controller unit 2 .
(Modification)

なお、以上の例ではコントローラ部2として専用のハードウェアを構築しているが、本発明はこの構成に限定されるものでない。例えば図2に示す変形例に係る三次元画像処理装置100’のように、汎用のパーソナルコンピュータやワークステーション等に専用の検査プログラムや三次元画像処理プログラムをインストールしたものをコントローラ部2’として機能させ、ヘッド部1に接続して利用することもできる。この三次元画像処理装置は、三次元画像処理プログラムで画像処理等、必要な設定を行った上で、ヘッド部1で撮像されたパターン投影画像に従って低階調距離画像を画像処理して、必要な検査を行う。
(ヘッド側通信手段36)
Although dedicated hardware is constructed as the controller unit 2 in the above example, the present invention is not limited to this configuration. For example, like the three-dimensional image processing apparatus 100' according to the modification shown in FIG. It can also be used by connecting to the head unit 1. This three-dimensional image processing apparatus performs image processing and other necessary settings using a three-dimensional image processing program, and then performs image processing on the low-gradation distance image according to the pattern projection image captured by the head unit 1. inspection.
(Head side communication means 36)

また、これに応じてヘッド部1側に、ヘッド側通信手段36として、専用のコントローラ部2や、コントローラ部2として機能するパーソナルコンピュータのいずれにも接続できるようなインターフェースを設けることもできる。例えばヘッド部1に、ヘッド側通信手段36として、図1に示すようにコントローラ部2と接続するためのコントローラ接続用インターフェース36Aを設けたり、あるいは図2に示すように、パーソナルコンピュータと接続するためのPC接続用インターフェース36Bを設ける。またこのようなインターフェースをユニット式に交換可能とすることで、ヘッド部の他の構成をある程度共通化して、共通のヘッド部でコントローラ部やパーソナルコンピュータのいずれにも接続可能とできる。あるいは、専用のコントローラ部2と、パーソナルコンピュータのいずれにも接続可能なインターフェースを備えた一のヘッド側通信手段を設けてもよい。またこのようなインターフェースは、既存の通信規格、例えばイーサーネット(商品名)やUSB、RS-232C等が利用できる。また、必ずしも規格化された、あるいは汎用の通信方式によらず、専用の通信方式としてもよい。
(PC接続モード)
Accordingly, an interface that can be connected to either the dedicated controller section 2 or a personal computer functioning as the controller section 2 can be provided as the head-side communication means 36 on the head section 1 side. For example, the head unit 1 is provided with a controller connection interface 36A for connecting with the controller unit 2 as shown in FIG. A PC connection interface 36B is provided. Further, by making such an interface replaceable as a unit, other configurations of the head section can be shared to some extent, and the common head section can be connected to either the controller section or the personal computer. Alternatively, one head-side communication means having an interface connectable to any of a dedicated controller section 2 and a personal computer may be provided. For such an interface, existing communication standards such as Ethernet (trade name), USB, RS-232C, etc. can be used. Also, a dedicated communication method may be used instead of a standardized or general-purpose communication method.
(PC connection mode)

さらに三次元画像処理プログラムに、ヘッド部1に接続するコントローラ部2’としてパーソナルコンピュータを使用する場合の設定を行うPC接続モードを備えることもできる。すなわちコントローラ部が専用ハードウェアであるか、パーソナルコンピュータであるかに応じて、設定可能な項目や設定内容を変化させることで、いずれの場合にも三次元画像処理に関する設定を適切に行うことが可能となる。さらに、コントローラ部2’として機能するパーソナルコンピュータに、ヘッド部1の動作確認用途、及び簡易的な計測機能を持たせたビューワプログラムをインストールして、接続されたヘッド部の動作や機能を確認できるようにしてもよい。 Furthermore, the three-dimensional image processing program can be provided with a PC connection mode for setting when a personal computer is used as the controller unit 2 ′ connected to the head unit 1 . That is, by changing the items that can be set and the setting contents depending on whether the controller unit is dedicated hardware or a personal computer, it is possible to appropriately perform settings related to 3D image processing in any case. It becomes possible. Furthermore, by installing a viewer program for checking the operation of the head unit 1 and having a simple measurement function in the personal computer functioning as the controller unit 2', the operation and functions of the connected head unit can be checked. You may do so.

なお図1に示す撮像手段10と投光手段20を利用することで得られる「距離画像」とは、ワークWを撮像する撮像手段10から、ワークWまでの距離に応じて各画素の濃淡値が変化する画像をいう。換言すれば、撮像手段10からワークWまでの距離に基づいて濃淡値が決定される画像ともいえるし、ワークWまでの距離に応じた濃淡値を有する多値画像ともいえるし、或いはワークWの高さに応じた濃淡値を有する多値画像ともいえる。さらに、輝度画像の画素ごとに、撮像手段10からの距離を濃淡値に変換した多値画像ともいえる。 The "distance image" obtained by using the imaging means 10 and the light projecting means 20 shown in FIG. refers to an image in which changes In other words, it can be said to be an image whose grayscale value is determined based on the distance from the imaging means 10 to the work W, or a multivalued image having grayscale values corresponding to the distance to the work W. It can also be said to be a multi-valued image having grayscale values corresponding to heights. Furthermore, it can also be said that the luminance image is a multivalued image obtained by converting the distance from the imaging means 10 into a grayscale value for each pixel of the luminance image.

距離画像を生成する手法としては、大きく分けて2つの方式があり、一つは、通常の画像を得るための照明条件で撮像した画像を用いて距離画像を生成するパッシブ方式(受動計測方式)、もう一つは、高さ方向の計測をするための光を能動的に照射して距離画像を生成するアクティブ方式(能動計測方式)である。パッシブ方式の代表的な手法は、ステレオ計測法である。これは、撮像手段10を2台用意し、これら2台のカメラを所定の位置関係で配置するだけで距離画像を生成できることから、輝度画像を生成するための一般的な画像処理システムを利用して距離画像を生成でき、システム構築コストを抑制することができる。しかし、ステレオ計測法では、一方のカメラによって得られる画像中の一点が、他方のカメラによって得られる画像中のどの点に対応しているのかを決定しなければならず、いわゆる対応点の決定処理に時間が掛かるという問題がある。また、計測位置は対応点のみであり、全画素ではないことから、この点においても外観検査の高速化には向かない。 There are roughly two methods for generating a depth image. One is a passive method (passive measurement method) that generates a depth image using an image captured under lighting conditions for obtaining a normal image. , and the other is an active method (active measurement method) in which a distance image is generated by actively irradiating light for measuring in the height direction. A typical passive method is the stereo measurement method. Since a range image can be generated simply by preparing two imaging means 10 and arranging these two cameras in a predetermined positional relationship, a general image processing system for generating a luminance image can be used. The distance image can be generated by using the system, and the system construction cost can be suppressed. However, in the stereo measurement method, it is necessary to determine to which point in the image obtained by the other camera a point in the image obtained by one camera corresponds. There is a problem that it takes time to In addition, since the measurement positions are only corresponding points and not all pixels, this point is also not suitable for speeding up the appearance inspection.

一方で、アクティブ方式の代表的な手法は、光切断法とパターン投影法である。光切断法とは、表面の形状や粗さ等を光学的に測定する方法であり、検査対象物の面に対し、約45°の角度で細いスリット像を投影し、その像を正反射方向から観察する方法や、細いスリット状の光線束で検査対象物を切断するように照射し、表面に生じる切断線の形状を側方から観測する方法が知られている。また、光切断法では一ライン分のプロファイル(切断面)のみが得られるが、光切断を行う位置を連続的に変化させて、各位置で得られたプロファイルを合成することで、距離画像を構成することもできる。 On the other hand, typical active methods are the light section method and the pattern projection method. The light section method is a method of optically measuring the shape and roughness of the surface, and projects a thin slit image at an angle of about 45° to the surface of the inspection object, A method of observing from the side and a method of observing the shape of the cutting line generated on the surface by irradiating the object to be inspected with a thin slit-like beam of light so as to cut it are known. In the light-section method, only one line of profile (cut plane) can be obtained. Can also be configured.

ここでの光切断法は、上述したステレオ計測法において、一方のカメラを光投影器に置き換えて、ワークに対してライン状のレーザ光を投光し、物体表面の形状に応じたライン光の像の歪み具合からワークの三次元形状を復元する。光切断法は、対応点の決定が不要であるので安定した計測が可能である。しかし、1回の計測で1ライン分しか計測できないため、全画素の計測値を得ようとすると、対象物又はカメラを走査しなければならない。これに対し、パターン投影法は、ワークに投影された所定パターンの形状や位相等をずらして複数枚の画像を撮像し、撮像した複数枚の画像を解析することでワークの三次元形状を復元するものである。パターン投影法には幾つか種類があり、正弦波縞模様パターンの位相をずらして複数枚(最低3枚以上)の画像を撮像し、複数枚の画像から画素ごとに正弦波の位相を求め、求めた位相を利用してワーク表面上の三次元座標を求める位相シフト法や、2つの規則的なパターンが合成されるときに生じる一種の空間周波数のうねり現象を利用して三次元形状を復元するモアレポトグラフィ法、ワークに投影するパターン自体を撮影毎に異ならせ、例えば白黒デューティ比50%で縞幅が画面半分、4分の1、8分の1、、、と細くなっていく縞パターンを順次投影し、それぞれのパターンにてパターン投影画像の撮影を行い、ワークの高さの絶対位相を求める空間コード化法、ワークに複数の細線状のパターン照明(マルチスリット)を投影し、スリット周期より狭いピッチでパターンを移動させ、複数回撮影を行うマルチスリット法等が代表的である。 The light-section method here is the above-mentioned stereo measurement method, in which one of the cameras is replaced with a light projector, a line-shaped laser beam is projected onto the workpiece, and a line-shaped laser beam is emitted according to the shape of the object surface. The three-dimensional shape of the workpiece is restored from the degree of distortion of the image. Since the light section method does not require determination of corresponding points, stable measurement is possible. However, since only one line can be measured in one measurement, the object or camera must be scanned to obtain measurement values for all pixels. On the other hand, in the pattern projection method, multiple images are captured by shifting the shape and phase of a predetermined pattern projected onto the workpiece, and the captured multiple images are analyzed to restore the three-dimensional shape of the workpiece. It is something to do. There are several types of pattern projection methods. Multiple images (at least 3 images) are taken by shifting the phase of the sinusoidal striped pattern, and the phase of the sinusoidal wave is obtained for each pixel from the multiple images. Using the obtained phase to find the 3D coordinates on the workpiece surface, and using a kind of spatial frequency undulation phenomenon that occurs when two regular patterns are synthesized, the 3D shape is restored. Moire photography method, the pattern itself projected on the work is changed for each shooting, for example, the stripe width becomes half the screen, 1/4, 1/8, etc. at a black-and-white duty ratio of 50%. A spatial encoding method in which patterns are sequentially projected, pattern projection images are taken for each pattern, and the absolute phase of the height of the workpiece is obtained. A typical example is the multi-slit method, in which the pattern is moved at a pitch narrower than the slit cycle and the images are taken multiple times.

本実施形態に係る三次元画像処理装置100では、上述した位相シフト法と空間コード化法を組み合わせて距離画像を生成する。これにより、ワーク又はヘッドを相対的に動かすことなく、距離画像を生成することができる。本発明は、位相シフト法及び空間コード化法によって距離画像を生成することに限られず、他の方法によって距離画像を生成しても構わない。また、上述した方法以外の方法、例えば光レーダ法(タイムオブフライト)、合焦点法、共焦点法、白色光干渉法等、距離画像を生成するために考え得る如何なる手法を採用しても構わない。 The 3D image processing apparatus 100 according to this embodiment generates a range image by combining the phase shift method and the spatial encoding method described above. Thereby, a distance image can be generated without relatively moving the workpiece or the head. The present invention is not limited to generating the range image by the phase shift method and the spatial encoding method, and the range image may be generated by other methods. In addition, any conceivable method for generating a range image may be adopted, such as a method other than the above-described methods, such as an optical radar method (time of flight), a focusing method, a confocal method, and a white light interferometry. do not have.

なお図1に示す撮像手段10と投光手段20の配置レイアウトは、ワークWに対して斜め方向から投光し、ワークWからの反射光をほぼ垂直な方向で受光できるよう、投光手段20を斜めに、撮像手段10を鉛直姿勢に保持するように配置している。このように投光方向と撮像方向とを一致させず、傾斜させることで、ワークWの表面形状の凹凸に起因する陰影を捉えたパターン投影画像を撮像できる。
(実施の形態2)
The arrangement layout of the imaging means 10 and the light projecting means 20 shown in FIG. is obliquely arranged so that the imaging means 10 is held in a vertical posture. In this way, by tilting the light projection direction and the imaging direction instead of matching them, it is possible to capture a pattern projection image that captures shadows caused by the unevenness of the surface shape of the workpiece W.
(Embodiment 2)

ただ本発明は、この配置例に限定されるものでなく、例えば図3に示す実施の形態2に係る三次元画像処理装置200のように、撮像手段10側をワークWに対して傾斜姿勢に、投光手段20側を鉛直姿勢に保持する配置例としてもよい。このような配置のヘッド部1Bによっても、同様に投光方向と撮像方向とを傾斜させて、ワークWの陰影を捉えたパターン投影画像を撮像できる。
(実施の形態3)
However, the present invention is not limited to this arrangement example. Alternatively, the light projecting means 20 side may be held in a vertical position. With the head unit 1B arranged in this manner, a pattern projection image capturing the shadow of the workpiece W can be captured by similarly tilting the light projection direction and the imaging direction.
(Embodiment 3)

さらに、投光手段や撮像手段の一方又は両方を複数配置することもできる。例えば、実施の形態3として図4Aに示す三次元画像処理装置300のように、撮像手段10をワークWに対して鉛直姿勢に保持する一方、撮像手段10を中心に2つの投光手段20を両側に配置して、左右からそれぞれ投光するヘッド部1Cとして構成することもできる。このように投光の方向が異なるパターン投影画像をそれぞれ撮像することで、一方向からの投光ではワークW自体で陰影パターンが隠れてしまう等、パターン投影画像を部分的に撮像できない状態が生じて高さ計測が不正確又は不可能となる事態を低減できる。特に、ワークに対して相対する方向(例えば左右や前後)から投光するように投光手段20を配置すれば、ワーク自体で遮られて撮像できない可能性を大幅に低減できる。
(実施の形態4)
Furthermore, one or both of the light projecting means and the imaging means can be arranged in plurality. For example, as in the three-dimensional image processing apparatus 300 shown in FIG. 4A as Embodiment 3, while the imaging means 10 is held in a vertical posture with respect to the work W, two light projecting means 20 are arranged around the imaging means 10. It can also be configured as a head portion 1C that is arranged on both sides and projects light from the left and right respectively. By capturing the pattern projection images with different light projection directions in this way, a state where the pattern projection images cannot be partially captured occurs, for example, the shadow pattern is hidden by the workpiece W itself when the light is projected from one direction. Inaccurate or impossible height measurements can be reduced. In particular, by arranging the light projecting means 20 so as to project light from a direction opposite to the work (for example, right and left or front and back), the possibility that the work itself is blocked and cannot be imaged can be greatly reduced.
(Embodiment 4)

また、以上の例では撮像手段を一台、投光手段を二台とする構成について説明したが、逆に撮像手段を二台、投光手段を一台とする構成とすることもできる。このような例を実施の形態4に係る三次元画像処理装置400として図4Bに示す。この例に示すヘッド部1Dでは、投光手段20をワークWに対して鉛直姿勢に保持し、図においてその左右に撮像手段10をそれぞれ、ワークWに対して傾斜姿勢に配置させている。この構成でも、ワークWを異なる傾斜角度から撮像できるので、実施の形態3と同様にパターン投影画像が部分的に撮像困難となる事態を抑制できる。またこの方法であれば、一回の投光で2枚のパターン投影画像を同時に撮像できるため、処理時間を短縮化できる利点も得られる。 In addition, in the above example, the configuration in which one image capturing means and two light projecting means are provided has been described. Such an example is shown in FIG. 4B as a three-dimensional image processing apparatus 400 according to the fourth embodiment. In the head unit 1D shown in this example, the light projecting means 20 is held in a vertical posture with respect to the work W, and the imaging means 10 on the left and right sides thereof are arranged in a tilted posture with respect to the work W in the drawing. Even with this configuration, the workpiece W can be imaged from different angles of inclination, so that it is possible to prevent the pattern projection image from becoming partially difficult to be imaged, as in the case of the third embodiment. Also, with this method, two pattern projection images can be captured simultaneously by one light projection, so there is an advantage that the processing time can be shortened.

その反面、2つの撮像手段で異なる角度から同じワークを撮像しても、撮像している部位や視野等が異なるため、各画素の位置を一致させる作業が必要となり、誤差も発生する可能性がある。これに対し、上述した実施の形態3によれば、撮像手段を共通化したことで、いずれの投光手段から測定光を投光しても、同一の視野の画像を撮像できるため、このような統合作業を不要とでき、また統合作業に伴う誤差の発生も回避して、処理を簡素化できる利点が得られる。 On the other hand, even if the same workpiece is imaged from different angles with two imaging means, the parts and fields of view being imaged are different, so it is necessary to match the position of each pixel, and there is a possibility that errors will occur. be. On the other hand, according to the above-described third embodiment, since the image capturing means is shared, the image of the same field of view can be captured regardless of which light projecting means projects the measurement light. It is possible to eliminate the need for such integration work, avoid the occurrence of errors associated with the integration work, and obtain the advantage of simplifying the processing.

なお以上の例では、各ヘッド部において撮像手段10と投光手段20とを一体的に構成した例を説明したが、本発明はこの構成に限られない。例えば、撮像手段10と投光手段20とを別個の部材で構成したヘッド部とすること可能である。また、撮像手段や投光手段を3以上設けることも可能である。
(ブロック図)
In the above example, an example in which the imaging means 10 and the light projecting means 20 are integrally configured in each head portion has been described, but the present invention is not limited to this configuration. For example, the imaging means 10 and the light projecting means 20 can be made into a head section composed of separate members. Also, it is possible to provide three or more image capturing means and light projecting means.
(Block Diagram)

次に、本発明の実施の形態3に係る三次元画像処理装置300の構成を示すブロック図を図5に示す。三次元画像処理装置300は、図5に示すように、ヘッド部1と、コントローラ部2とを備える。
(ヘッド部1)
Next, FIG. 5 shows a block diagram showing the configuration of a three-dimensional image processing apparatus 300 according to Embodiment 3 of the present invention. The three-dimensional image processing apparatus 300 includes a head section 1 and a controller section 2, as shown in FIG.
(Head part 1)

このヘッド部1は、投光手段20と、撮像手段10と、ヘッド側制御部30と、ヘッド側演算部31と、記憶手段38と、ヘッド側通信手段36等を備えている。投光手段20は、測定光源21、パターン生成部22及び複数のレンズ23、24、25を含む。撮像手段10は、図示しないがカメラ及び複数のレンズを含む。
(投光手段20)
The head unit 1 includes a light projecting unit 20, an imaging unit 10, a head-side control unit 30, a head-side computing unit 31, a storage unit 38, a head-side communication unit 36, and the like. The light projecting means 20 includes a measurement light source 21 , a pattern generator 22 and a plurality of lenses 23 , 24 and 25 . The imaging means 10 includes a camera and a plurality of lenses (not shown).
(Light projecting means 20)

投光手段20は、撮像手段の光軸に対して斜め方向から入射光を所定の投影パターンの構造化照明として投光するための部材である。この投光手段20には、プロジェクタが利用でき、光学部材であるレンズやパターン生成部22等が含まれる。投光手段20は、静止若しくは移動するワークの位置の斜め上方に配置される。なおヘッド部1は、複数の投光手段20を含むこともできる。図5の例においては、ヘッド部1は2つの投光手段20を含む。ここでは、第一の方向からワークに対して測定用照明光を照射可能な第一プロジェクタ20A(図5において右側)と、第一の方向とは異なる第二の方向からワークに対して測定用照明光を照射可能な第二プロジェクタ20B(図5において左側)を、それぞれ配置している。第一プロジェクタ20A、第二プロジェクタ20Bは撮像手段10の光軸を挟んで対称に配置される。第一プロジェクタ20A、第二プロジェクタ20Bからワークに対し、交互に測定光を投光して、それぞれの反射光のパターンを撮像手段10で撮像する。 The light projecting means 20 is a member for projecting incident light from an oblique direction with respect to the optical axis of the imaging means as structured illumination of a predetermined projection pattern. A projector can be used as the light projecting means 20, and includes a lens, a pattern generation unit 22, and the like, which are optical members. The light projecting means 20 is arranged obliquely above the position of the stationary or moving workpiece. Note that the head section 1 can also include a plurality of light projecting means 20 . In the example of FIG. 5, the head section 1 includes two light projecting means 20. In the example of FIG. Here, a first projector 20A (on the right side in FIG. 5) capable of irradiating the workpiece with illumination light for measurement from a first direction and a projector for measurement from a second direction different from the first direction. A second projector 20B (left side in FIG. 5) capable of emitting illumination light is arranged. The first projector 20A and the second projector 20B are arranged symmetrically with the optical axis of the imaging means 10 interposed therebetween. Measurement light is projected alternately from the first projector 20A and the second projector 20B onto the workpiece, and the pattern of each reflected light is imaged by the imaging means 10 .

各第一プロジェクタ20A、第二プロジェクタ20Bの測定光源21は、例えば白色光を出射するハロゲンランプや白色光を出射する白色LED(発光ダイオード)等が利用できる。測定光源21から出射された測定光は、レンズにより適切に集光された後、パターン生成部22に入射する。 A halogen lamp that emits white light, a white LED (light emitting diode) that emits white light, or the like can be used as the measurement light source 21 of each of the first projector 20A and the second projector 20B. The measurement light emitted from the measurement light source 21 is incident on the pattern generator 22 after being appropriately condensed by the lens.

さらに、距離画像を生成するためのパターン投影画像を取得する測定光を出射するための投光手段に加え、通常の光学画像(輝度画像)を撮像するための観察用照明光源を設けることもできる。観察用照明光源には、LEDの他、半導体レーザ(LD)やハロゲンライト、HID等を利用できる。特に撮像素子としてカラーで撮像可能な素子を用いた場合は、観察用照明光源に白色光源を利用できる。 Furthermore, in addition to the projection means for emitting the measurement light for acquiring the pattern projection image for generating the distance image, an observation illumination light source for capturing a normal optical image (brightness image) can be provided. . As an illumination light source for observation, a semiconductor laser (LD), a halogen light, an HID, or the like can be used in addition to an LED. In particular, when a device capable of color imaging is used as the imaging device, a white light source can be used as the illumination light source for observation.

測定光源21から出射された測定光は、レンズ113により適切に集光された後、パターン生成部112に入射する。パターン生成部22は、任意のパターンの照明を実現できる。例えば、白字に黒字、黒字に白字等、ワークや背景の色に応じてパターンを反転させ、見易い、あるいは測定し易い適切なパターンを表現できる。このようなパターン生成部22は、例えばDMD(デジタルマイクロミラーデバイス)が利用できる。DMDは、画素毎に微小なミラーをON/OFFさせて任意のパターンを表現できる。これにより、白と黒を反転させたパターンを容易に照射できる。パターン生成部22にDMDを用いることで、任意のパターンを容易に生成でき、機械的なパターンマスクの準備やその入れ替え作業を不要とできるので、装置の小型化と迅速な計測ができる利点がある。また、DMDを用いたパターン生成部112は、すべての画素をONとする全照明パターンの照射によって、通常の照明と同様に利用できるので、輝度画像の撮像にも利用できる。またパターン生成部22は、LCD(液晶ディスプレイ)、LCOS(Liquid Crystal on Silicon:反射型液晶素子)又はマスクとすることもできる。パターン生成部22に入射した測定光は、予め設定されたパターン及び予め設定された強度(明るさ)に変換されて出射される。パターン生成部22により出射された測定光は、複数のレンズにより撮像手段10の観察・測定可能な視野よりも大きい径を有する光に変換された後、ワークに照射される。
(撮像手段10)
The measurement light emitted from the measurement light source 21 is appropriately condensed by the lens 113 and then enters the pattern generator 112 . The pattern generation unit 22 can realize arbitrary pattern illumination. For example, by inverting the pattern according to the color of the workpiece or the background, such as black on white or white on black, an appropriate pattern that is easy to see or measure can be expressed. A DMD (digital micromirror device), for example, can be used for such a pattern generator 22 . A DMD can express an arbitrary pattern by turning on/off a minute mirror for each pixel. This makes it possible to easily irradiate a pattern in which white and black are reversed. By using a DMD for the pattern generation unit 22, arbitrary patterns can be easily generated, and mechanical pattern mask preparation and replacement work are not required, so there is an advantage that the device can be made compact and measurements can be made quickly. . In addition, the pattern generation unit 112 using the DMD can be used in the same manner as normal illumination by irradiating all illumination patterns with all pixels turned on, so it can also be used to capture a luminance image. The pattern generator 22 can also be an LCD (liquid crystal display), an LCOS (liquid crystal on silicon: reflective liquid crystal element), or a mask. The measurement light incident on the pattern generator 22 is converted into a preset pattern and a preset intensity (brightness) and emitted. The measurement light emitted by the pattern generator 22 is converted by a plurality of lenses into light having a diameter larger than the observable/measurable field of view of the imaging means 10, and then irradiated onto the workpiece.
(Imaging means 10)

撮像手段10は、投光手段20で投光され、ワークWKで反射された反射光を取得して複数のパターン投影画像を撮像するためのカメラを備える。このようなカメラには、CCDやCMOS等が利用できる。この例では高解像度の得られるモノクロCCDカメラを利用している。なお、カラーで撮像可能なカメラを使用することも可能であることはいうまでも無い。また撮像手段は、パターン投影画像以外に、通常の輝度画像を撮像することも可能である。 The imaging means 10 is provided with a camera for capturing a plurality of pattern projection images by acquiring reflected light projected by the light projecting means 20 and reflected by the workpiece WK. A CCD, a CMOS, or the like can be used for such a camera. In this example, a monochrome CCD camera capable of obtaining high resolution is used. Needless to say, it is also possible to use a camera capable of capturing images in color. In addition to the pattern projection image, the image capturing means can also capture a normal luminance image.

ヘッド側制御部30は、撮像手段10及び投光手段20である第一プロジェクタ20A、第二プロジェクタ20Bを制御するための部材である。例えば、投光手段20がワークに対して測定光を投光してパターン投影画像を得るための投光パターンの作成を、ヘッド部側制御部30で行う。これによって撮像手段10で、投光手段20から位相シフト用の投影パターンを投影させて位相シフト画像を撮像させ、また投光手段20から空間コード化用の投影パターンを投影させて空間コード画像を撮像させる。このようにヘッド側制御部30は、撮像手段10で位相シフト画像と空間コード画像を撮像するよう、投光手段を制御するための投光制御手段として機能する。 The head-side control section 30 is a member for controlling the first projector 20A and the second projector 20B, which are the imaging means 10 and the light projecting means 20 . For example, the head unit side control unit 30 creates a light projection pattern for obtaining a pattern projection image by projecting the measurement light onto the work by the light projection unit 20 . As a result, the imaging means 10 projects a projection pattern for phase shift from the light projecting means 20 to capture a phase shift image, and projects a projection pattern for spatial encoding from the light projecting means 20 to produce a spatial code image. Take an image. In this manner, the head-side control unit 30 functions as light projection control means for controlling the light projection means so that the image pickup means 10 picks up the phase shift image and the space code image.

ヘッド側演算部31は、フィルタ処理部34と距離画像生成手段32を含む。距離画像生成手段32は、撮像手段10で撮像された複数のパターン投影画像に基づいて、距離画像を生成する。 The head-side calculator 31 includes a filter processor 34 and a distance image generator 32 . A distance image generating means 32 generates a distance image based on the plurality of pattern projection images captured by the imaging means 10 .

ヘッド側記憶手段38は、各種設定や画像等を保持するための部材であり、半導体メモリやハードディスク等の記憶素子が利用できる。例えば、撮像手段10で撮像されたパターン投影画像を保持するための輝度画像記憶部38b、及び距離画像生成手段32で生成された距離画像を保持するための距離画像記憶部38aを含む。 The head-side storage means 38 is a member for holding various settings, images, etc., and a storage element such as a semiconductor memory or a hard disk can be used. For example, it includes a luminance image storage unit 38b for holding the pattern projection image captured by the imaging unit 10 and a distance image storage unit 38a for holding the distance image generated by the distance image generation unit 32.

ヘッド側通信手段36は、コントローラ部2と通信を行うための部材である。ここではコントローラ部2のコントローラ側通信手段42と接続されて、データ通信を行う。例えば、距離画像生成手段32で生成された距離画像を、コントローラ部2に対して送出する。
(距離画像生成手段32)
The head-side communication means 36 is a member for communicating with the controller section 2 . Here, it is connected to the controller side communication means 42 of the controller section 2 to perform data communication. For example, the distance image generated by the distance image generating means 32 is sent to the controller section 2 .
(Distance image generating means 32)

距離画像生成手段32は、ワークWKを撮像する撮像手段10からワークWKまでの距離に応じて各画素の濃淡値が変化する距離画像を生成する手段である。例えば、位相シフト法で距離画像を生成する場合は、ワークに対して正弦波縞模様パターンを位相ずらして投影するように、ヘッド側制御部30が投光手段20を制御し、それに応じて正弦波縞模様パターンの位相がずれた画像を複数枚撮像するように、ヘッド側制御部30が撮像手段10を制御する。そしてヘッド側制御部30は、複数枚の画像から画素毎に正弦波の位相を求め、求めた位相を利用して距離画像を生成する。 The distance image generation means 32 is a means for generating a distance image in which the grayscale value of each pixel changes according to the distance from the imaging means 10 for imaging the work WK to the work WK. For example, when the distance image is generated by the phase shift method, the head-side control unit 30 controls the light projecting unit 20 so as to project a sinusoidal fringe pattern onto the workpiece with a phase shift. The head-side control section 30 controls the imaging means 10 so as to pick up a plurality of images in which the phases of the wavy fringe pattern are shifted. Then, the head-side control unit 30 obtains the phase of the sine wave for each pixel from the plurality of images, and uses the obtained phase to generate the distance image.

また空間コード化法を用いて距離画像を生成する場合は、光が照射される空間を、多数の断面略扇状の小空間に分け、この小空間には一連の空間コード番号を付す。このため、ワークの高さが高くても、言い換えると高低差が大きくても、光が照射される空間内にあれば、空間コード番号から高さが演算できる。したがって、高さの高いワークについても全体にわたって形状を計測できる。 When a range image is generated using the spatial encoding method, the space irradiated with light is divided into a large number of small spaces having a substantially fan-shaped cross section, and these small spaces are given a series of space code numbers. Therefore, even if the height of the work is high, in other words, even if the height difference is large, the height can be calculated from the space code number as long as the work is in the space irradiated with light. Therefore, it is possible to measure the shape of a tall workpiece over its entirety.

このようにしてヘッド部側で距離画像を生成し、コントローラ部側に送出することで、ヘッド部からコントローラ部側に送出すべきデータ量を低減でき、大量のデータ転送によって生じ得る処理の遅れを回避できる。 By generating the distance image on the head section side and sending it to the controller side in this way, the amount of data to be sent from the head section to the controller side can be reduced, and the delay in processing that may occur due to the transfer of a large amount of data can be reduced. can be avoided.

なお、本実施形態ではヘッド部1側で距離画像の生成処理を行うようにしているが、例えばコントローラ部2側で距離画像の生成処理を担うこともできる。また、距離画像から低階調距離画像への階調変換は、コントローラ部で行う他、ヘッド部側で行わせることもできる。この場合は、ヘッド側演算部31が階調変換手段の機能を実現する。
(コントローラ部2)
In this embodiment, the distance image generation processing is performed on the head unit 1 side, but the distance image generation processing may be performed on the controller unit 2 side, for example. In addition, the gradation conversion from the distance image to the low gradation distance image can be performed by the head unit as well as by the controller unit. In this case, the head-side computing section 31 implements the function of the gradation converting means.
(Controller section 2)

またコントローラ部2は、コントローラ側通信手段42と、コントローラ側制御部と、コントローラ側演算部と、コントローラ側記憶手段と、検査実行手段50と、コントローラ側設定手段41とを備えている。コントローラ側通信手段42は、ヘッド部1のヘッド側通信手段36と接続されてデータ通信を行う。コントローラ側制御部は、各部材の制御を行うための部材である。コントローラ側演算部は、画像処理部60の機能を実現する。画像処理部60は、画像サーチ手段64や階調変換手段46等の機能を実現する。
(階調変換手段)
The controller section 2 also includes controller-side communication means 42 , controller-side control section, controller-side calculation section, controller-side storage means, inspection execution means 50 , and controller-side setting means 41 . The controller-side communication means 42 is connected to the head-side communication means 36 of the head section 1 to perform data communication. The controller-side control section is a member for controlling each member. The controller-side calculation unit implements the functions of the image processing unit 60 . The image processing unit 60 implements functions such as the image search means 64 and the gradation conversion means 46 .
(gradation conversion means)

階調変換手段46は、距離画像に基づいて、高階調の距離画像を、低階調の低階調距離画像に階調変換する(詳細な手順については後述する)。これによって、ヘッド部で生成された高さ情報を有する距離画像を、既存の設備でも扱える二次元の濃淡画像として表現することで、計測処理や検査処理に資することができる。また、距離画像の生成処理と、階調変換処理とを、ヘッド部とコントローラ部とで分担して、負荷を分散できる利点も得られる。なお、ヘッド部側で距離画像の生成に加え、低階調距離画像の生成も行わせてもよい。このような処理はヘッド側演算部で行うことができる。これによって、コントローラ部側の負荷を一層軽減して、効率のよい運用が可能となる。 The gradation conversion means 46 gradation-converts the high gradation distance image into a low gradation low gradation distance image based on the distance image (detailed procedure will be described later). As a result, a distance image having height information generated by the head unit can be expressed as a two-dimensional grayscale image that can be handled by existing equipment, thereby contributing to measurement processing and inspection processing. In addition, the distance image generation processing and the gradation conversion processing can be divided between the head unit and the controller unit, thereby providing the advantage of distributing the load. In addition to the generation of the distance image, the head section may also generate the low-gradation distance image. Such processing can be performed by the head-side computing unit. As a result, the load on the controller side is further reduced, and efficient operation becomes possible.

さらに階調変換手段は、距離画像のすべてを階調変換するのでなく、好ましくは、必要な部分のみを選択して、階調変換する。具体的には、予め検査対象領域設定手段(詳細は後述)で設定された検査対象領域と対応する部分のみを階調変換する。このようにすることで、多階調の距離画像を低階調の距離画像に変換する処理を、検査対象領域のみに限ることで階調変換に要する負荷を軽減できる。またこのことは処理時間の短縮化にも寄与する。すなわち、処理時間の短縮化を図ることで、FA用途の検査のような処理時間の限られた用途においても好適に利用でき、リアルタイム処理が実現される。 Further, the gradation conversion means preferably selects only a necessary portion of the distance image and performs gradation conversion instead of performing gradation conversion on the entire distance image. Specifically, only a portion corresponding to an inspection target area set in advance by an inspection target area setting means (details will be described later) is tone-converted. By doing so, the load required for tone conversion can be reduced by limiting the process of converting a multi-tone distance image into a low-tone distance image only for the inspection target area. This also contributes to shortening the processing time. That is, by shortening the processing time, it can be suitably used even in applications with limited processing time, such as FA inspection, and real-time processing is realized.

コントローラ側記憶手段は、各種設定や画像を保持するための部材であり、半導体記憶素子やハードディスク等が利用できる。 The controller-side storage means is a member for holding various settings and images, and a semiconductor storage element, hard disk, or the like can be used.

コントローラ側設定手段41は、コントローラ部に対する各種設定を行うための部材であり、コントローラ部に接続されたコンソール等の入力手段3を介してユーザからの操作を受け付け、必要な条件等をコントローラ側に指示する。例えば、階調変換条件設定手段43や基準面設定手段44、空間コード化切替手段45、間隔均等化処理設定手段47、投光切替手段48、シャッタースピード設定手段49等の機能を実現する。 The controller-side setting means 41 is a member for performing various settings for the controller section, receives operations from the user via the input means 3 such as a console connected to the controller section, and sends necessary conditions and the like to the controller side. instruct. For example, the functions of a gradation conversion condition setting means 43, a reference plane setting means 44, a space encoding switching means 45, an interval equalization processing setting means 47, a light projection switching means 48, a shutter speed setting means 49 and the like are realized.

基準面設定手段44は、コントローラ側通信手段42で受信された距離画像を、二次元の低階調距離画像に変換する階調変換を行う際の階調変換条件を構成する階調変換パラメータとして、この階調変換を行う基準面を、該距離画像に基づいて設定する。階調変換手段46は、基準面設定手段44で設定された基準面を基準として、距離画像を、この距離画像の階調数よりも低い階調数の、高さ情報を画像の濃淡値に置き換えた低階調距離画像に階調変換する。 The reference plane setting means 44 sets the distance image received by the controller-side communication means 42 as a gradation conversion parameter constituting a gradation conversion condition when performing gradation conversion for converting the distance image into a two-dimensional low gradation distance image. , the reference plane for this gradation conversion is set based on the distance image. Using the reference plane set by the reference plane setting means 44 as a reference, the gradation conversion means 46 converts the distance image into a gradation number lower than the gradation number of the distance image, and converts the height information into the gradation value of the image. Gradation conversion is performed to the replaced low-gradation distance image.

検査実行手段50は、階調変換手段46で階調変換された低階調距離画像に対して、所定の検査処理を実行する。
(ハードウェア構成)
The inspection execution means 50 performs a predetermined inspection process on the low tone distance image that has been tone-converted by the tone conversion means 46 .
(Hardware configuration)

次にコントローラ部2のハードウェア構成例を、図6のブロック図に示す。この図に示すコントローラ部2は、各種プログラムに基づき数値計算や情報処理を行うと共に、ハードウェア各部の制御を行う主制御部51を有している。主制御部51は、例えば、中央演算処理装置としてのCPUと、主制御部51が各種プログラムを実行する際のワークエリアとして機能するRAM等のワークメモリと、起動プログラムや初期化プログラム等が格納されたROM,フラッシュROM,又はEEPROM等のプログラムメモリとを有している。 Next, an example of hardware configuration of the controller section 2 is shown in the block diagram of FIG. The controller unit 2 shown in this figure performs numerical calculations and information processing based on various programs, and has a main control unit 51 that controls each hardware unit. The main control unit 51 stores, for example, a CPU as a central processing unit, a work memory such as a RAM that functions as a work area when the main control unit 51 executes various programs, a startup program, an initialization program, and the like. and a program memory such as a hardened ROM, flash ROM, or EEPROM.

またコントローラ部2は、撮像手段10や投光手段20等を含むヘッド部1と接続して、ワークに対して正弦波縞模様パターンを、位相をずらして投影するよう投光手段20を制御し、撮像手段10での撮像により得られた画像データを取り込むためのコントローラ側接続部52と、入力手段3からの操作信号が入力される操作入力部53と、液晶パネル等の表示手段4に対して画像を表示させる表示用DSP等から構成される表示制御部54と、外部のPLC70やパーソナルコンピュータPC等と通信可能に接続される通信部55と、一時的なデータを保持するRAM56と、設定内容を保存するコントローラ側記憶手段57と、パーソナルコンピュータPCにインストールされた三次元画像処理プログラムで設定されたデータを保持するための補助記憶手段58と、エッジ検出や面積計算等の計測処理を実行する演算用DSP等から構成される画像処理部60と、画像処理部60での処理結果等に基づいて所定の検査を行った結果を出力するための出力部59等を備えている。これらの各ハードウェアは、バス等の電気的な通信路(配線)を介し、通信可能に接続されている。 Further, the controller unit 2 is connected to the head unit 1 including the imaging means 10 and the light projecting means 20, etc., and controls the light projecting means 20 to project the sinusoidal striped pattern onto the workpiece with a phase shift. , a controller-side connection unit 52 for capturing image data obtained by imaging with the imaging unit 10, an operation input unit 53 for inputting an operation signal from the input unit 3, and a display unit 4 such as a liquid crystal panel. A display control unit 54 composed of a display DSP or the like for displaying an image by using the display control unit 54, a communication unit 55 communicably connected to an external PLC 70, a personal computer PC or the like, a RAM 56 for holding temporary data, a setting A controller-side storage means 57 for storing contents, an auxiliary storage means 58 for holding data set by a three-dimensional image processing program installed in a personal computer PC, and executing measurement processing such as edge detection and area calculation. and an output unit 59 for outputting the results of predetermined inspections based on the processing results of the image processing unit 60 and the like. These pieces of hardware are communicably connected via an electrical communication path (wiring) such as a bus.

主制御部51内のプログラムメモリには、コントローラ側接続部52、操作入力部53、表示制御部54、通信部55、及び画像処理部60の各部を、CPUのコマンド等により制御するための制御プログラムが格納されている。また、上述した処理順序プログラム、すなわちパーソナルコンピュータPCにおいて生成され、パーソナルコンピュータPCから転送された処理順序プログラムは、プログラムメモリに格納される。 In the program memory in the main control unit 51, control for controlling each unit of the controller side connection unit 52, the operation input unit 53, the display control unit 54, the communication unit 55, and the image processing unit 60 by commands of the CPU, etc. program is stored. Further, the processing order program described above, that is, the processing order program generated in the personal computer PC and transferred from the personal computer PC is stored in the program memory.

通信部55は、外部のPLC70に接続されたセンサ(光電センサ等)でトリガ入力があったときに、PLC70から撮像トリガ信号を受信するインターフェース(I/F)として機能する。また、パーソナルコンピュータPCから転送されてくる三次元画像処理プログラムや表示手段4の表示態様を規定するレイアウト情報等を受信するインターフェース(I/F)としても機能する。 The communication unit 55 functions as an interface (I/F) that receives an imaging trigger signal from the PLC 70 when a sensor (such as a photoelectric sensor) connected to the external PLC 70 receives a trigger input. It also functions as an interface (I/F) for receiving a three-dimensional image processing program transferred from the personal computer PC, layout information specifying the display mode of the display means 4, and the like.

主制御部51のCPUは、通信部55を介してPLC70から撮像トリガ信号を受信すると、コントローラ側接続部52に対して撮像指令(コマンド)を送る。また、処理順序プログラムに基づいて、画像処理部60に対して、実行すべき画像処理を指示するコマンドを送信する。なお、撮像トリガ信号を生成する装置として、PLC70ではなく、光電センサ等のトリガ入力用のセンサを、通信部55に直接接続するように構成してもよい。 Upon receiving the imaging trigger signal from the PLC 70 via the communication section 55 , the CPU of the main control section 51 sends an imaging instruction (command) to the controller-side connection section 52 . Also, based on the processing order program, it transmits a command for instructing the image processing to be executed to the image processing section 60 . As a device for generating the imaging trigger signal, instead of the PLC 70 , a trigger input sensor such as a photoelectric sensor may be directly connected to the communication unit 55 .

操作入力部53は、ユーザの操作に基づき入力手段3からの操作信号を受信するインターフェース(I/F)として機能する。表示手段4には、入力手段3を用いたユーザの操作内容が表示される。例えば入力手段3にコンソールを用いる場合は、表示手段4上に表示されるカーソルを上下左右に移動させる十字キー、決定ボタン、又はキャンセルボタン等の各部品を配置できる。これらの各部品を操作することによって、ユーザは表示手段4上で、画像処理の処理順序を規定するフローチャートを作成したり、各画像処理のパラメータ値を編集したり、基準領域の設定をしたり、基準登録画像を編集したりすることができる。 The operation input unit 53 functions as an interface (I/F) that receives operation signals from the input means 3 based on user's operations. The contents of the user's operation using the input means 3 are displayed on the display means 4 . For example, when a console is used as the input means 3, each part such as a cross key for moving the cursor displayed on the display means 4 up, down, left, or right, an enter button, or a cancel button can be arranged. By manipulating these components, the user can create a flow chart defining the processing order of image processing, edit parameter values for each image processing, and set a reference area on the display means 4. , the reference registration image can be edited.

コントローラ側接続部52は、画像データの取り込みを行う。具体的には、例えばCPUから撮像手段10の撮像指令を受信すると、撮像手段10に対して画像データ取り込み信号を送信する。そして、撮像手段10で撮像が行われた後、撮像して得られた画像データを取り込む。取り込んだ画像データは、一旦バッファリング(キャッシュ)され、予め用意しておいた画像変数に代入される。なお、「画像変数」とは、数値を扱う通常の変数と異なり、対応する画像処理ユニットの入力画像として割り付けることで、計測処理や画像表示の参照先となる変数をいう。 The controller-side connection unit 52 takes in image data. Specifically, for example, when an imaging command for the imaging means 10 is received from the CPU, an image data capture signal is transmitted to the imaging means 10 . After the imaging is performed by the imaging means 10, the image data obtained by the imaging is captured. The captured image data is temporarily buffered (cached) and assigned to an image variable prepared in advance. The term "image variable" refers to a variable that is assigned as an input image to the corresponding image processing unit and serves as a reference for measurement processing and image display, unlike normal variables that handle numerical values.

画像処理部60は、画像データに対する計測処理を実行する。具体的には、まずコントローラ側接続部52が上述した画像変数を参照しつつ、フレームバッファから画像データを読み出して、画像処理部60内のメモリへ内部転送を行う。そして、画像処理部60は、そのメモリに記憶された画像データを読み出して、計測処理を実行する。また画像処理部60には、階調変換手段46、異常点ハイライト手段62、画像サーチ手段64等が含まれる。 The image processing unit 60 executes measurement processing on image data. Specifically, first, the controller-side connection unit 52 reads the image data from the frame buffer while referring to the image variables described above, and internally transfers the read image data to the memory in the image processing unit 60 . The image processing unit 60 then reads out the image data stored in the memory and executes measurement processing. The image processing section 60 also includes a gradation converting means 46, an abnormal point highlighting means 62, an image searching means 64, and the like.

表示制御部54は、CPUから送られてきた表示指令(表示コマンド)に基づいて、表示手段4に対して所定画像(映像)を表示させるための制御信号を送信する。例えば、計測処理前又は計測処理後の画像データを表示するために、表示手段4に対して制御信号を送信する。また、表示制御部54は、入力手段3を用いたユーザの操作内容を表示手段4に表示させるための制御信号も送信する。 The display control unit 54 transmits a control signal for displaying a predetermined image (video) to the display means 4 based on a display command (display command) sent from the CPU. For example, a control signal is transmitted to the display means 4 in order to display image data before or after measurement processing. The display control unit 54 also transmits a control signal for causing the display unit 4 to display the content of the user's operation using the input unit 3 .

以上のようなハードウェアで構成されたヘッド部1やコントローラ部2は、各種プログラム等によって、図5の各手段や機能をソフトウェア的に実現可能な構成としている。この例では、図1のコンピュータに、三次元画像処理プログラムをインストールして、三次元画像処理に必要な設定を行う態様を採用している。
(階調変換)
The head section 1 and the controller section 2, which are configured by hardware as described above, are configured so that each means and function in FIG. 5 can be implemented by software using various programs. In this example, a three-dimensional image processing program is installed in the computer shown in FIG. 1, and settings necessary for three-dimensional image processing are performed.
(gradation conversion)

以上の三次元画像処理装置は、ワークの距離画像を取得し、この距離画像に対して画像処理を行い、この結果に対して検査を行う。本実施の形態における三次元画像処理装置は、距離画像の画素値である高さ情報をそのまま用いて演算を行う高さ検査処理に加えて、既存のハードウェアを用いて面積やエッジ等の情報を用いた演算を行う画像検査処理の、2種類の検査を実施することができる。ここで、高さ検査処理の精度を維持するためには、多階調な距離画像を生成する必要がある。一方、既存のハードウェアではこのような多階調な距離画像に画像検査処理を実施することはできない。そのため、既存のハードウェアを用いて画像検査処理を行うために、多階調な距離画像に階調変換を施し、低階調距離画像を生成する。 The three-dimensional image processing apparatus described above acquires a distance image of a workpiece, performs image processing on this distance image, and inspects the result. The three-dimensional image processing apparatus according to the present embodiment performs height inspection processing in which height information, which is the pixel value of a distance image, is used as it is to perform calculations. Two types of inspection can be performed: an image inspection process that performs calculations using . Here, in order to maintain the accuracy of height inspection processing, it is necessary to generate a multi-gradation distance image. On the other hand, existing hardware cannot perform image inspection processing on such a multi-gradation range image. Therefore, in order to perform image inspection processing using existing hardware, a multi-gradation distance image is subjected to gradation conversion to generate a low-gradation distance image.

しかしながら、多階調の距離画像の高さ情報を、そのまま低階調の距離画像に変換したのでは、高さ情報の精度が損なわれるという問題がある。FA用途等で利用される一般的な画像は、モノクロで各画素の濃淡値を8階調で表現した画像が多い。これに対して距離画像は、16階調画像のような高階調の画像が用いられている。このため、多階調の距離画像を低階調距離画像に階調変換する際に、高さ情報が相当量損なわれることとなり、検査の精度に影響を与える。かといって、精度を高めるために既存の画像処理で扱う画像の階調数を上げるには導入コストが高騰するとともに、処理負荷が高くなり、利用に対するハードルが高くなる。 However, if the height information of the multi-gradation distance image is directly converted into the low-gradation distance image, there is a problem that the accuracy of the height information is impaired. Many of the general images used for FA applications are monochrome images in which the grayscale value of each pixel is expressed in eight gradations. On the other hand, the distance image uses a high-gradation image such as a 16-gradation image. For this reason, when converting a multi-tone distance image into a low-tone distance image, a considerable amount of height information is lost, which affects the accuracy of inspection. On the other hand, if the number of gradations of an image handled by existing image processing is increased in order to improve accuracy, the introduction cost rises, the processing load increases, and the hurdles to use increase.

そこで、このような階調変換に際して、必要な高さ情報が維持されるような階調変換の条件を設定することが必要となる。以下、その方法及び手順について詳述する。
(高さ検査又は画像検査)
Therefore, upon such tone conversion, it is necessary to set conditions for tone conversion such that necessary height information is maintained. The method and procedure will be described in detail below.
(height inspection or image inspection)

まず、三次元画像処理装置を用いて高さ検査処理を行う処理動作を、図7のフローチャートに基づいて説明する。この三次元画像処理装置は、計算処理を行うためのツールとして、距離画像に対して高さ検査を行う高さ検査処理ツールと、既存の輝度画像に対して画像検査を行う各種の画像検査処理ツールとを備えている。ここでは、高さ検査処理について説明する。 First, processing operations for performing height inspection processing using the three-dimensional image processing apparatus will be described based on the flowchart of FIG. This three-dimensional image processing device includes a height inspection processing tool for performing height inspection on distance images and various image inspection processing for performing image inspection on existing luminance images as tools for performing calculation processing. with tools. Here, height inspection processing will be described.

最初に、距離画像を生成する(ステップS71)。具体的には、距離画像生成手段32が、撮像手段10と投光手段20とを用いて距離画像を生成する。次いで、所望の計算処理を選択する(ステップS72)。ここでは、計算処理に必要なツールを選択する。 First, a distance image is generated (step S71). Specifically, the distance image generating means 32 generates a distance image using the imaging means 10 and the light projecting means 20 . Next, a desired calculation process is selected (step S72). Here you select the tools you need for your calculations.

画像検査処理ツールを選択する場合は、ステップS73に進み、上記ステップS71で得られた高階調の距離画像に対して、階調変換処理を行い、低階調の距離画像に変換する。これによって、既存の画像処理装置が備えている検査処理ツールでも、低階調距離画像を扱えるようになる。なお、階調変換処理は、高階調の距離画像の全域に対して行うのでなく、好ましくは画像検査処理のために設定された検査対象領域内でのみ行う。 If the image inspection processing tool is selected, the process proceeds to step S73, and the high-gradation range image obtained in step S71 is subjected to gradation conversion processing to be converted into a low-gradation range image. As a result, even inspection processing tools provided in existing image processing apparatuses can handle low-gradation distance images. Note that the gradation conversion process is preferably performed only within the inspection target area set for the image inspection process, instead of being performed on the entire range image of high gradation.

一方、高さ検査ツールを選択する場合は、多階調距離画像が有する高さ情報をそのまま利用するため、階調変換を行うことなく、ステップS74に進む。 On the other hand, if the height inspection tool is selected, the height information of the multi-tone distance image is used as it is, so the process proceeds to step S74 without tone conversion.

さらに、検査実行手段50が、各種計算処理を行い(ステップS74)、次いでこの計算結果に基づいて、ワークが良品であるか否かを判定する(ステップS75)。判定信号出力手段160は、検査実行手段50によってワークが良品であると判定された場合には(ステップS75:YES)、判定信号としてOK信号をPLC70に出力し(ステップS76)、検査実行手段50によってワークが良品でない、すなわち不良品であると判定された場合には(ステップS75:NO)、判定信号としてNG信号をPLC70に出力する(ステップS77)。
(設定モード)
Furthermore, the inspection executing means 50 performs various calculation processes (step S74), and then determines whether or not the work is a non-defective product based on the calculation results (step S75). If the inspection execution means 50 determines that the workpiece is non-defective (step S75: YES), the determination signal output means 160 outputs an OK signal to the PLC 70 as a determination signal (step S76). If it is determined that the workpiece is not good, that is, is defective (step S75: NO), an NG signal is output to the PLC 70 as a determination signal (step S77).
(setting mode)

次に、このような高さ検査や画像検査の処理実行に先立ち、三次元画像処理装置に対して各種の設定を行う設定モードにおける手順の一例を、図8のフローチャートに基づいて説明する。最初にステップS81において、設定用の画像(設定用画像)を選択する。ここでは、予め検査処理の対象となる画像を入力して、登録画像として保存したものを呼び出したり、あるいは新たな入力画像を取得して、これに対して設定を行うこともできる。ここでは、運用時に逐次入力される入力画像を代替的に示すものとして、ワークを撮像して得られる入力画像を、登録画像として登録している。また、予め登録しておいた登録画像を呼び出してもよい。次にステップS82において、階調変換方法を選択させる。ここでは、静的変換又は動的変換のいずれかの選択をユーザに促す。次にステップS83において、階調変換パラメータを調整する。ここでは、ステップS82で静的変換を選択した場合は、ステップS81で取得された画像に対して階調変換パラメータを調整する。階調変換パラメータの調整方法については、後述する。なお、以上説明した手順は一例であり、異なる順序とすることもできる。例えば画像の取得は、階調変換方法の選択後に行わせてもよい。
(設定手順の詳細)
Next, an example of procedures in a setting mode for performing various settings for the three-dimensional image processing apparatus prior to execution of height inspection and image inspection will be described with reference to the flowchart of FIG. First, in step S81, an image for setting (image for setting) is selected. Here, an image to be inspected can be input in advance and stored as a registered image can be called up, or a new input image can be obtained and settings can be made for it. Here, an input image obtained by picking up a workpiece is registered as a registered image as an alternative to input images that are sequentially input during operation. Alternatively, a registered image that has been registered in advance may be called. Next, in step S82, the gradation conversion method is selected. Here, the user is prompted to select either static or dynamic conversion. Next, in step S83, the gradation conversion parameters are adjusted. Here, if static conversion is selected in step S82, tone conversion parameters are adjusted for the image acquired in step S81. A method of adjusting the tone conversion parameters will be described later. Note that the procedure described above is an example, and a different order is also possible. For example, acquisition of an image may be performed after selection of a gradation conversion method.
(Details of setting procedure)

次に、設定時の手順の詳細について説明する。三次元画像処理装置においては、運用モードに先立ち、設定モードにおいて予め必要な設定を行う。このような設定を行うための各種設定手段は、例えばコントローラ部2側に設けることができる。例えば図1の例では、コントローラ部2に接続された入力手段3の一形態であるコンソールが利用できる。また、これに代えて、又はこれに加えて、上述の通りコントローラ部2に接続されたパーソナルコンピュータにインストールした三次元画像処理プログラムに、このような設定手段の機能を実現させることもできる。以下、ここでは図1に示すパーソナルコンピュータにインストールした三次元画像処理プログラムを用いて、各設定を行う手順の詳細を、図9~図113に示す三次元画像処理プログラムのユーザインターフェース(GUI)画面に基づいて説明する。なお、これらのGUIの例では、距離画像を「高さ画像」、輝度画像を「濃淡画像」と、それぞれ表示している。
(距離画像、輝度画像の登録工程)
Next, the details of the procedure for setting will be described. In the three-dimensional image processing apparatus, necessary settings are performed in the setting mode prior to the operation mode. Various setting means for performing such settings can be provided on the controller section 2 side, for example. For example, in the example of FIG. 1, a console, which is one form of the input means 3 connected to the controller section 2, can be used. Alternatively, or in addition to this, the three-dimensional image processing program installed in the personal computer connected to the controller unit 2 as described above can be made to realize the function of such setting means. Hereafter, using the three-dimensional image processing program installed in the personal computer shown in FIG. 1, the details of the procedure for making each setting will be explained using the user interface (GUI) screens of the three-dimensional image processing program shown in FIGS. will be explained based on In these GUI examples, the distance image is displayed as a "height image" and the luminance image is displayed as a "grayscale image".
(Registration process of distance image and luminance image)

まず、距離画像と輝度画像の登録を行う。ここでは、図9に示す三次元画像処理プログラムの初期画面260から、「撮像」処理ユニット263の設定を行う。具体的には「撮像」処理ユニットのボタン263のボタンを押下する。これにより、図10の撮像設定メニュー269に切り替わる。
(三次元画像処理プログラム)
First, a range image and a luminance image are registered. Here, the setting of the "imaging" processing unit 263 is performed from the initial screen 260 of the three-dimensional image processing program shown in FIG. Specifically, the button of the button 263 of the "imaging" processing unit is pressed. This switches to the imaging setting menu 269 of FIG.
(three-dimensional image processing program)

図10のGUI画面例では、画面の右側に画像を表示させる第一画像表示領域111を設け、左側には複数の設定項目を表すボタンを複数配置した設定項目ボタン領域112が設けられる。設定項目ボタン領域112には、「画像登録」ボタン113、「撮像設定」ボタン284、「カメラ設定」ボタン、「トリガ設定」ボタン、「フラッシュ設定」ボタン、「照明ボリューム」ボタン、「照明拡張ユニット」ボタン、「保存」ボタン等が設けられている。ユーザは設定項目ボタン領域112中から、所望の設定項目ボタンを選択して、必要な設定項目の設定ができる。 In the GUI screen example of FIG. 10, a first image display area 111 for displaying an image is provided on the right side of the screen, and a setting item button area 112 in which a plurality of buttons representing a plurality of setting items are arranged is provided on the left side of the screen. The setting item button area 112 includes an "image registration" button 113, an "imaging setting" button 284, a "camera setting" button, a "trigger setting" button, a "flash setting" button, a "lighting volume" button, a "lighting extension unit ” button, a “Save” button, and the like are provided. The user can select desired setting item buttons from the setting item button area 112 to set necessary setting items.

図10の撮像設定メニュー269において、設定項目ボタン領域112に設けられた「画像登録」ボタン113を押下すると、図11の画像登録画面270に切り替わる。この画面から登録対象、カメラ選択、登録先等、各種の設定を行うことができる。ここでは、操作領域に設けられた各種のボタン等によって所望の画像に調整した上で、登録すなわち画像データの保存を行う。ここでは、第二画像表示領域121に距離画像が表示されており、さらにこの画像に割り当てられた画像変数が操作領域122に表示される。図11の例では、撮像手段を選択する「カメラ選択」欄271で「カメラ1」が選択されており、この「カメラ1」で撮像された距離画像として、画像変数「&Cam1Img」が「カメラ選択」欄271の下方に表示される。 When the "image registration" button 113 provided in the setting item button area 112 is pressed in the imaging setting menu 269 of FIG. 10, the screen is switched to the image registration screen 270 of FIG. From this screen, various settings such as registration target, camera selection, registration destination, etc. can be performed. Here, after adjusting to a desired image using various buttons provided in the operation area, registration, that is, saving of the image data is performed. Here, the distance image is displayed in the second image display area 121 and the image variables assigned to this image are displayed in the operation area 122 . In the example of FIG. 11, "camera 1" is selected in the "camera selection" column 271 for selecting the imaging means, and the image variable "&Cam1Img" is set to "camera selection" as the distance image captured by this "camera 1". ” column 271 is displayed.

設定終了後に操作領域の下段に設けられた「登録」ボタン272を押下すると、図12に示すように現在第二画像表示領域121で表示中の距離画像の登録が開始され、進捗状況がグラフィカルに表示される。また、図13に示すように輝度画像の登録も併せて行われる。この例では、先に距離画像が距離画像記憶部38aに保存され、次に輝度画像が輝度画像記憶部38bに保存される。また、距離画像の画像変数「&Cam1Img」及び輝度画像の画像変数「&Cam1GrayImg」も、それぞれ記録される。これらの画像変数は、各画像に対して固有の変数が各々付与されているので、登録画像を呼び出す際の指標として利用できる。ただ、この例は一例であり、各画像の登録順序を逆にしたり、同時に登録してもよい。このように、登録画像として距離画像と輝度画像とを同時に保存することで、ユーザは各画像の登録の手間を省力化できる。ただ、距離画像と輝度画像とを登録画像として個別に登録する構成とすることも可能である。
(位相シフト法)
When the "Register" button 272 provided at the bottom of the operation area is pressed after the setting is completed, registration of the distance image currently displayed in the second image display area 121 is started as shown in FIG. 12, and the progress is displayed graphically. Is displayed. In addition, as shown in FIG. 13, luminance image registration is also performed. In this example, the distance image is first stored in the distance image storage unit 38a, and then the luminance image is stored in the luminance image storage unit 38b. The image variable “&Cam1Img” of the distance image and the image variable “&Cam1GrayImg” of the luminance image are also recorded. These image variables are assigned unique variables to each image, and can be used as indexes when calling registered images. However, this example is only an example, and the order of registration of each image may be reversed, or the images may be registered simultaneously. In this way, by simultaneously storing the distance image and the luminance image as registered images, the user can save labor in registering each image. However, it is also possible to adopt a configuration in which the distance image and the luminance image are individually registered as registered images.
(Phase shift method)

ここでワークの変位及び三次元形状を非接触で計測する手法の一として、位相シフト法について説明する。位相シフト法は格子パターン投影法、縞走査法等とも呼ばれる。この方法では、照度分布を正弦波状に変動させた格子パターンをもつ光線をワークに投影する。しかも、正弦波の位相の異なる3つ以上の格子パターンで投影し、高さ計測点の各明度値を光線の投影方向とは別の角度から各パターン毎に撮像し、各明度値より格子パターンの位相値を計算する。計測点の高さに応じて、計測点に投影され、格子パターンの位相が変化し、基準となる位置で反射された光線により観察される位相とは異なった位相の光線が観察される。そこで、計測点における光線の位相を計算し、三角測量の原理を利用して、光学装置の幾何関係式に代入することにより計測点(従って物体)の高さを計測し、三次元形状を求める方法である。位相シフト法によれば、ワークの高さを格子パターン周期を小さくすることにより高分解能で計測することができるが、測定できる高さの範囲が、位相のずれ量で2π以内となる低い高さのもの(高低差の小さいもの)しか計測できない。
(空間コード化法)
Here, a phase shift method will be described as one of methods for non-contact measurement of the displacement and three-dimensional shape of a workpiece. The phase shift method is also called a lattice pattern projection method, a fringe scanning method, or the like. In this method, a light beam having a grid pattern in which the illuminance distribution is varied sinusoidally is projected onto the workpiece. Moreover, three or more lattice patterns with different phases of the sine wave are projected, and each brightness value of the height measurement point is imaged for each pattern from an angle different from the projection direction of the light beam, and the lattice pattern is obtained from each brightness value. Calculate the phase value of . Depending on the height of the measurement point, the phase of the grating pattern projected onto the measurement point changes, and a light ray with a phase different from the phase observed by the light ray reflected at the reference position is observed. Therefore, by calculating the phase of the light ray at the measurement point and substituting it into the geometric relational expression of the optical device using the principle of triangulation, the height of the measurement point (and thus the object) is measured, and the three-dimensional shape is obtained. The method. According to the phase shift method, the height of the workpiece can be measured with high resolution by reducing the grating pattern period. Only objects with a small height difference can be measured.
(Spatial encoding method)

そこで、空間コード化法を兼用する。空間コード化法によれば、光が照射される空間を、多数の断面略扇状の小空間に分け、この小空間に一連の空間コード番号を付す。このため、ワークの高さが高くても、すなわち高低差が大きくても、光が照射される空間内にあれば、空間コード番号から高さが演算できる。したがって、高さの高いワークについても全体にわたって形状を計測できる。このように空間コード化法によれば、許容高さのレンジ(ダイナミックレンジ)が広く、高さの高いワークについても全体にわたって形状を計測できる。 Therefore, the spatial encoding method is also used. According to the space coding method, a space to be irradiated with light is divided into a large number of small spaces having substantially fan-shaped cross sections, and a series of space code numbers are assigned to the small spaces. Therefore, even if the height of the work is high, that is, even if the height difference is large, the height can be calculated from the space code number as long as the work is in the space irradiated with light. Therefore, it is possible to measure the shape of a tall workpiece over its entirety. In this way, according to the spatial encoding method, the allowable height range (dynamic range) is wide, and the shape of the entire workpiece can be measured even for a tall workpiece.

次に、撮像手段で距離画像を撮像する設定例を、図14~図42に基づいて説明する。上述した画像の登録に先立ち、図10の撮像設定メニュー269から、「撮像設定」ボタン284を押下すると、図14の撮像設定画面280となる。撮像設定画面280では。撮像に関する基本的な設定を行える。例えば「撮像有効設定」ボタンを押下すると図15の撮像有効設定画面が表示され、三次元画像処理装置に接続されている撮像手段すなわちカメラを選択できる。例えば撮像手段として、通常の輝度画像を撮像するモノクロCCDカメラやカラーCCDカメラに代えて、あるいはこれに加えて、高さ情報を取得可能なカメラを接続することで、距離画像を三次元画像処理装置に取り込むことが可能となる。また、複数の撮像手段を三次元画像処理装置に接続している際に、いずれの撮像手段を使用するか、一以上を選択できる。 Next, setting examples for capturing a distance image by the imaging means will be described with reference to FIGS. 14 to 42. FIG. 14. When the "imaging setting" button 284 is pressed from the imaging setting menu 269 of FIG. 10 prior to registering the image described above, the imaging setting screen 280 of FIG. On the imaging setting screen 280 . You can make basic settings related to imaging. For example, when the "imaging effective setting" button is pressed, the imaging effective setting screen of FIG. 15 is displayed, and the imaging means, that is, the camera connected to the three-dimensional image processing apparatus can be selected. For example, by connecting a camera capable of acquiring height information in place of or in addition to a monochrome CCD camera or a color CCD camera that captures a normal luminance image as an imaging means, the distance image is subjected to three-dimensional image processing. It becomes possible to take it into the device. Also, when a plurality of imaging means are connected to the three-dimensional image processing apparatus, one or more imaging means can be selected.

また、図14の撮像設定画面280から、操作領域に設けられた「詳細設定」ボタン282を押下すると、図16に示す三次元計測設定画面290となる。なお図16では説明の都合上、異なるワークを表示させている。図16の三次元計測設定画面290は、リアルタイム更新手段にあたる「連続更新で表示する」欄292、シャッタースピード設定手段49にあたるシャッタースピード設定欄294、濃淡レンジ設定欄296、前処理設定欄310、計測不能基準設定欄312、均等間隔処理設定欄314、空間コード設定欄316、プロジェクタ選択設定欄318、「表示画像」選択欄322等を備えている。
(リアルタイム更新手段)
14, pressing a "detailed setting" button 282 provided in the operation area brings up a three-dimensional measurement setting screen 290 shown in FIG. In addition, in FIG. 16, different works are displayed for convenience of explanation. The three-dimensional measurement setting screen 290 of FIG. 16 includes a "continuous update display" field 292 corresponding to real-time updating means, a shutter speed setting field 294 corresponding to shutter speed setting means 49, a grayscale range setting field 296, a preprocessing setting field 310, a measurement It has an impossibility criterion setting column 312, an equal interval processing setting column 314, a space code setting column 316, a projector selection setting column 318, a "display image" selection column 322, and the like.
(Real-time update means)

ここでは、操作領域において設定が変更された場合、第二画像表示領域121上で表示中の画像に対して変更後の設定に更新するリアルタイム更新手段を備えている。リアルタイム更新手段はON/OFFを切り替えることができる。図16の画面例において、リアルタイム更新手段の一形態として操作領域の上段に設けられた「連続更新で表示する」欄292をONとすることで、リアルタイム更新機能を動作させることができる。 Here, real-time updating means is provided for updating the image being displayed on the second image display area 121 to the changed setting when the setting is changed in the operation area. The real-time updating means can be switched ON/OFF. In the screen example of FIG. 16, the real-time update function can be operated by turning ON the "display by continuous update" column 292 provided in the upper part of the operation area as one form of the real-time update means.

図16の例では、操作領域において設定可能な項目として、シャッタースピード、濃淡レンジ、前処理、計測不能基準、均等間隔処理、空間コード、プロジェクタ選択、表示画像等が挙げられる。以下、順次説明する。
(シャッタースピード設定手段49)
In the example of FIG. 16, items that can be set in the operation area include shutter speed, grayscale range, pre-processing, non-measurable criteria, uniform interval processing, space code, projector selection, display image, and the like. They will be described in order below.
(Shutter speed setting means 49)

撮像手段による撮像時のシャッタースピードを調整するためのシャッタースピード設定手段49の一態様として、図16の例では、シャッタースピード設定欄294を設けている。シャッタースピード設定欄294から、シャッタースピードをユーザが指定できる。ここでは、ドロップダウンボックスから、予め設定されたシャッタースピード、例えば1/15、1/30、1/60、1/120、1/240、1/500、1/1000、、、、1/20000を選択する。選択された数値に応じた秒数が、右側の数値表示欄295に表示される。また、任意のシャッタースピードを数値で直接指定することもできる。例えばドロップダウンボックスの選択肢として「数値入力」を選択すると、数値表示欄295のグレーアウトが解除され、直接数値を入力可能となる。このようにしてシャッタースピード設定欄294で指定された数値に基づき、撮像手段であるカメラ(撮像素子)の露光時間が調整される。なおシャッタースピードの調整に際しては、距離画像よりも輝度画像の濃淡画像を第二画像表示領域121に表示させた方が、確認作業が容易となる。さらに、上記リアルタイム更新機能によって、シャッタースピード設定欄294でシャッタースピードを変更した画像が、速やかに第二画像表示領域121に反映されることで、ユーザは現在の設定が妥当かどうかを視覚的に確認でき、調整作業を容易に行うことが可能となる。
(濃淡レンジ設定欄296)
In the example of FIG. 16, a shutter speed setting field 294 is provided as one mode of the shutter speed setting means 49 for adjusting the shutter speed at the time of imaging by the imaging means. The user can specify the shutter speed from the shutter speed setting field 294 . Here, select a preset shutter speed from the drop-down box, e.g. to select. The number of seconds corresponding to the selected numerical value is displayed in the numerical display field 295 on the right side. You can also specify the desired shutter speed directly with a numerical value. For example, when "numerical value input" is selected as an option in the drop-down box, graying out of the numerical value display column 295 is canceled, and a numerical value can be directly input. Based on the numerical value specified in the shutter speed setting field 294 in this way, the exposure time of the camera (imaging device), which is the imaging means, is adjusted. When adjusting the shutter speed, it is easier to check if the grayscale image of the luminance image is displayed in the second image display area 121 rather than the distance image. Furthermore, the real-time update function allows the user to visually check whether the current settings are appropriate by quickly reflecting the image for which the shutter speed has been changed in the shutter speed setting field 294 in the second image display area 121. This makes it possible to confirm and easily perform the adjustment work.
(Darkness range setting field 296)

濃淡レンジ設定欄296においては、濃淡画像である輝度画像のダイナミックレンジを調整する。ここではドロップダウンボックスから、「低い(-1)」、「普通(0)」、「高い(1)」のいずれかを選択することで、ダイナミックレンジが増減される。
(前処理設定欄310)
In the grayscale range setting field 296, the dynamic range of the luminance image, which is a grayscale image, is adjusted. Here, the dynamic range is increased or decreased by selecting one of "Low (-1)", "Normal (0)", and "High (1)" from the drop-down box.
(Pre-processing setting field 310)

前処理設定欄310においては、ヘッド部で距離画像を生成する前に行う共通のフィルタ処理を規定する。共通フィルタ処理としては、例えば、平均化フィルタ、メディアンフィルタ、ガウシアンフィルタのフィルタ等が考えられる。ここではパターン投影画像に対するフィルタ処理として、図17の例では、ドロップダウンボックスにより、「なし」、「メディアン」、「ガウシアン」、「平均」のいずれかを選択する。なおフィルタ処理は、距離画像を生成する前に行う前処理の他、ヘッド部1側で得られた距離画像に対しても行うことができる。
(計測不能基準設定欄312)
In the preprocessing setting field 310, a common filtering process to be performed before the distance image is generated by the head unit is specified. Examples of common filtering include an averaging filter, a median filter, and a Gaussian filter. In the example of FIG. 17, one of "none", "median", "gaussian", and "average" is selected as the filtering process for the pattern projection image. In addition to the preprocessing performed before generating the distance image, the filtering process can also be performed on the distance image obtained by the head unit 1 side.
(Measurable standard setting field 312)

計測不能基準設定欄312では、ノイズ成分をカットするレベルを設定する。すなわち計測不能基準設定欄312で設定された量だけ、高さ計測を行わない。パターン投影画像を用いた三次元の高さ情報の計測においては、ある程度の光量がないと、正確な高さ情報を計測できない。その一方で、多重反射が生じている場合等は、明るすぎるため光量を落とす必要がある。このように、撮像されたパターン投影画像に応じてノイズ成分カット量を選択する。具体的には、各画素の高さ情報を演算するためデータに対して、ノイズによる無効データと見なす閾値を決定する。 In the non-measurable standard setting field 312, a level for cutting noise components is set. That is, height measurement is not performed for the amount set in the non-measurable standard setting column 312 . In measuring three-dimensional height information using a pattern projection image, accurate height information cannot be measured unless there is a certain amount of light. On the other hand, when there is multiple reflection, the amount of light must be reduced because it is too bright. In this manner, the noise component cut amount is selected according to the captured pattern projection image. Specifically, a threshold is determined for the data to be considered as invalid data due to noise in order to calculate the height information of each pixel.

ここでは図18に示すように、ドロップダウンボックスから、「高」、「中」、「低」、「なし」のいずれかを選択する。なお「なし」を選択すると、ノイズ成分カットを行わず、すべての画素について高さ計測を行う。例えば図19に示す例では、計測不能基準設定欄312で「なし」を選択しており、ノイズデータを含めたあらゆる点で高さデータを算出している。この画面からは判別し難いが、ワークの角の部分等で、ノイズデータによって不正な高さが計測されている。 Here, as shown in FIG. 18, one of "high", "medium", "low" and "none" is selected from the drop-down box. If "none" is selected, height measurement is performed for all pixels without cutting noise components. For example, in the example shown in FIG. 19, "none" is selected in the non-measurable reference setting column 312, and height data is calculated at all points including noise data. Although it is difficult to distinguish from this screen, an incorrect height is measured due to noise data at the corner of the workpiece.

一方、図20に示す例では、計測不能基準設定欄312で「低」を選択しており、ノイズデータに基づく高さ情報が不正な点が減少している。さらに図21に示す例では、計測不能基準設定欄312で「中」を選択しており、さらに高さ情報が不正な点が減少している。 On the other hand, in the example shown in FIG. 20, "low" is selected in the non-measurable standard setting column 312, and the number of incorrect height information based on noise data is reduced. Furthermore, in the example shown in FIG. 21, "medium" is selected in the non-measurable standard setting column 312, and the number of points with incorrect height information is reduced.

その一方で、測定不能であることを示す黒点が特にワークの左下の領域で増大し、ノイズと見なされて高さ計測ができない位置が増えていることも、図21から確認できる。さらに、図22に示す例では、計測不能基準設定欄312で「高」を選択した状態を示しており、ノイズ成分の除去が効き過ぎている結果、本来残しておきたいデータまで失われていることが確認できる。このように、ノイズ除去の閾値を示す測定不能基準の設定が低すぎる場合は、ノイズを元に高さを計算することとなる。逆に高すぎると、本来残しておきたい箇所も無効と見なされてしまうことになる。このためユーザは、上記リアルタイム更新機能を利用することで、測定不能基準の設定を調整すると共に、調整後の画像を第二画像表示領域で確認し、設定の結果を直接画像で参照しながら、適切な値に調整することができる。
(均等間隔処理設定欄314)
On the other hand, it can also be confirmed from FIG. 21 that the number of black dots indicating that measurement is impossible has increased particularly in the lower left area of the workpiece, and that the number of positions where height measurement is impossible due to being regarded as noise is increasing. Furthermore, the example shown in FIG. 22 shows a state in which "high" is selected in the non-measurable standard setting field 312, and as a result of excessive noise component removal, even data that should be retained is lost. can be confirmed. Thus, if the setting of the unmeasurable standard indicating the noise removal threshold is too low, the height will be calculated based on the noise. On the other hand, if it is too high, the part that should be left will be regarded as invalid. Therefore, by using the real-time update function, the user can adjust the setting of the non-measurable standard, check the adjusted image in the second image display area, and directly refer to the setting result on the image. Can be adjusted to a suitable value.
(Equal interval processing setting field 314)

均等間隔処理設定欄314では、画角による誤差の補正を行う。均等間隔処理設定欄314は、間隔均等化処理設定手段47として機能する。均等間隔処理設定欄314では、図23に示すようにONとOFFを選択できる。均等間隔処理をONとすることで、xy方向に等ピッチに並んだ距離画像を取得する。ここではXY方向の位置が高さ(Z座標)によらず等間隔な等ピッチ画像を、第二画像表示領域121に表示させる。例えば、XY平面における寸法の検査を行うような用途では、均等間隔処理をONとする必要がある。なお、補正されてデータが無くなった部分は無効として扱う。図24、図25は、均等間隔処理をONとした状態を示している。図24の例では、「表示画像」選択欄322を「高さ画像」すなわち距離画像として第二画像表示領域121に表示させた例を、図25は「濃淡画像」を選択して輝度画像を表示させた例を、それぞれ示している。 In the equal interval processing setting field 314, error correction due to the angle of view is performed. The equal interval processing setting column 314 functions as the interval equalizing processing setting means 47 . In the equal interval processing setting field 314, ON and OFF can be selected as shown in FIG. By turning on the equal interval processing, distance images arranged at equal pitches in the xy direction are obtained. In this case, the second image display area 121 is caused to display equipitch images in which the positions in the XY directions are at equal intervals regardless of the height (Z coordinate). For example, in applications such as inspecting dimensions on the XY plane, it is necessary to turn on the equal spacing process. In addition, the part where the data is lost due to the correction is treated as invalid. 24 and 25 show a state in which the equal spacing process is turned ON. In the example of FIG. 24, the "display image" selection field 322 is displayed in the second image display area 121 as the "height image", that is, the distance image. Displayed examples are shown respectively.

一方、均等間隔処理をOFFとすると、図26で示すように目で見たままの画像(Z画像)となり、画面の端部に進むに従ってXY方向に歪みが生じる。ただ、均等間隔処理を行わない分、画像の表示までに要する時間が短くて済む。なお図27は、表示画像欄で「濃淡画像」を選択して、第二画像表示領域121で輝度画像を表示させた例を示している。
(空間コード設定欄316)
On the other hand, if the equal interval processing is turned off, the image (Z image) as seen by the eye is obtained as shown in FIG. 26, and distortion occurs in the XY directions toward the edges of the screen. However, since the equal interval processing is not performed, the time required until the image is displayed can be shortened. Note that FIG. 27 shows an example in which a “grayscale image” is selected in the display image field and a luminance image is displayed in the second image display area 121 .
(Spatial code setting field 316)

空間コード設定欄316では、空間コード化法の使用の有無を選択する。すなわち空間コード設定欄316は、空間コード化切替手段45として機能する。この三次元画像処理装置では、距離画像の生成に位相シフト法を必須としており、位相シフト法に加えて、空間コード化法の適用の有無を空間コード設定欄316で選択できる。空間コード設定欄316では、図28に示すようにONとOFFを選択できる。空間コード設定欄316をONとすると、空間コード化法と位相シフト法の組み合わせで高さ計測を行う。この例を図29、図30に示す。これらの図において、図29は第二画像表示領域121に表示させる画像として距離画像を選択した状態を示している。具体的には、「表示画像」選択欄322で「高さ画像」を選択している。一方図30は第二画像表示領域121に輝度画像を表示させた状態を示しており、「表示画像」選択欄322で「濃淡画像」を選択している。位相シフト法に加えて、空間コード化法を用いることで、適切な距離画像を取得することができる。具体的には、空間コード化法によって、位相シフト法による位相ジャンプの補正(位相アンラップ)ができるので、高さのダイナミックレンジを広く確保しつつ、高分解能で計測できる。ただし、撮像時間はOFFの場合と比較して約2倍となる。 In the space code setting column 316, use or non-use of the space encoding method is selected. That is, the space code setting column 316 functions as the space code switching means 45 . In this three-dimensional image processing apparatus, the phase shift method is essential for generating the range image, and in addition to the phase shift method, whether or not to apply the spatial encoding method can be selected in the space code setting field 316 . In the space code setting column 316, ON and OFF can be selected as shown in FIG. When the space code setting field 316 is turned ON, height measurement is performed by a combination of the space code method and the phase shift method. This example is shown in FIGS. 29 and 30. FIG. In these figures, FIG. 29 shows a state in which the distance image is selected as the image to be displayed in the second image display area 121. FIG. Specifically, the “height image” is selected in the “display image” selection field 322 . On the other hand, FIG. 30 shows a state in which a luminance image is displayed in the second image display area 121, and a “grayscale image” is selected in the “display image” selection field 322. FIG. Appropriate range images can be obtained by using a spatial encoding method in addition to the phase shift method. Specifically, since the spatial encoding method can correct the phase jump (phase unwrap) by the phase shift method, it is possible to measure with high resolution while ensuring a wide dynamic range of height. However, the imaging time is approximately doubled compared to the case of OFF.

一方、図31、図32に示すように、空間コード設定欄316でOFFを選択すると、位相シフト法のみで高さ計測を行う。この場合は、高さの計測ダイナミックレンジが狭くなるので、高さの相違が大きいワークの場合は、位相が1周期以上ずれてしまうと、正しく高さの計測ができない。逆に、高さの変化が少ないワークの場合は、空間コード化法による縞画像の撮像や合成を行わないので、その分だけ処理を高速化でき、撮像時間を約半分にできるメリットがある。例えば、高さ方向の差異が少ないワークを計測する際には、ダイナミックレンジを大きく取る必要がないため、位相シフト法のみでも高精度な高さ計測性能を維持しつつ、処理時間を短くすることができる。この場合は、高さの計測ダイナミックレンジが狭くなるので、高さの相違が大きいワークの場合は、位相が1周期以上ずれてしまうと、正しく高さの計測ができない。逆に、高さの変化が少ないワークの場合は、空間コードをOFFとすることで、撮像時間を半分にできるという利点が得られる。 On the other hand, as shown in FIGS. 31 and 32, when OFF is selected in the space code setting field 316, height measurement is performed only by the phase shift method. In this case, since the height measurement dynamic range is narrowed, in the case of a work having a large difference in height, if the phase shifts by one period or more, the height cannot be measured correctly. Conversely, in the case of a workpiece with little change in height, the striped image is not picked up or synthesized by the spatial encoding method, so the processing speed can be increased accordingly, and the imaging time can be reduced by about half. For example, when measuring workpieces with small differences in the height direction, it is not necessary to take a large dynamic range, so even with the phase shift method alone, it is possible to shorten the processing time while maintaining high-precision height measurement performance. can be done. In this case, since the height measurement dynamic range is narrowed, in the case of a work having a large difference in height, if the phase shifts by one period or more, the height cannot be measured correctly. Conversely, in the case of a workpiece with little change in height, turning off the spatial code has the advantage of halving the imaging time.

図31の例では、「表示画像」選択欄322で「高さ画像」すなわち距離画像を表示させた状態を示しており、一方図32の例では、「表示画像」選択欄322で「濃淡画像」を表示させた状態を示している。 In the example of FIG. 31, the "display image" selection field 322 shows a state in which a "height image", that is, a distance image is displayed. ” is displayed.

なお、この例では位相シフト法を必須としているが、位相シフト法のON/OFFを選択可能としてもよい。
(プロジェクタ選択設定欄318)
Although the phase shift method is essential in this example, it may be possible to select ON/OFF of the phase shift method.
(Projector selection setting field 318)

プロジェクタ選択設定欄318は、第一プロジェクタと第二プロジェクタのON/OFFを切り替える投光切替手段48として機能する。ここでは、プロジェクタ選択設定欄318では、2つの投光手段である第一プロジェクタ、第二プロジェクタの内から、使用する投光手段(プロジェクタ)を選択する。このプロジェクタ選択設定欄318の例では、図33に示すように、ドロップダウンボックスから、「1」(第一プロジェクタ)、「2」(第二プロジェクタ)、「1+2」(第一プロジェクタと第二プロジェクタ)のいずれかを選択する。 The projector selection setting field 318 functions as the light projection switching means 48 for switching ON/OFF of the first projector and the second projector. Here, in the projector selection setting field 318, the light projecting means (projector) to be used is selected from among the two light projecting means, the first projector and the second projector. In this example of the projector selection setting field 318, as shown in FIG. 33, "1" (first projector), "2" (second projector), "1+2" (first projector and second projector).

プロジェクタ選択設定欄318で「1」又は「2」を選択した場合、すなわち第一プロジェクタ又は第二プロジェクタのいずれか一方からの投光である片投光の場合は、投光で陰になる部分の高さ計測は行われない。図34の例では、プロジェクタ選択設定欄318で「1」を選択した例、図35の例では「2」を選択した例を、それぞれ示している。各画面において、影になる部分のデータが黒色で表示されており、ワーク上で高さの計測ができない領域が存在することが、それぞれの画面から確認できる。また、これらの図から明らかな通り、計測不能となる領域は、投光手段によって異なることが判る。いいかえると、一方の投光手段では測定不能領域となっても、他方の投光手段では投光が可能となり、よって高さ計測も可能な領域が多く存在する。そこで、これらを組み合わせることで、測定不能領域を低減できる。特に、第一プロジェクタと第二プロジェクタで、ワークを両側から挟み込むように配置することで、第一プロジェクタからの第一投光と第二プロジェクタからの第二投光とが相対する方向となってワークに照射されるため、いずれか一方の投光では影となる領域であっても、真逆の方向となる他方からの投光によって影となるリスクを低減できる。 When "1" or "2" is selected in the projector selection setting field 318, i.e., in the case of single projection, which is projection of light from either the first projector or the second projector, the portion shaded by the projection height measurement is not performed. The example in FIG. 34 shows an example in which "1" is selected in the projector selection setting field 318, and the example in FIG. 35 shows an example in which "2" is selected. On each screen, the data of the shadowed portion is displayed in black, and it can be confirmed from each screen that there are areas on the workpiece where the height cannot be measured. Moreover, as is clear from these figures, it can be seen that the non-measurable region differs depending on the light projecting means. In other words, even if one of the light projecting means cannot be measured, the other light projecting means can project light, and therefore there are many areas where the height can be measured. Therefore, by combining these, the unmeasurable region can be reduced. In particular, by arranging the first projector and the second projector so as to sandwich the workpiece from both sides, the first light from the first projector and the second light from the second projector are in opposite directions. Since the workpiece is irradiated with the light, even if an area is shadowed by one of the light projections, the risk of being shadowed by the light projected from the opposite direction can be reduced.

具体的には、図36に示すように、プロジェクタ選択設定欄318で「1+2」を選択すると、第一プロジェクタ及び第二プロジェクタの両方から投光させる両投光に切り替えられる。この状態で、いずれか一方のプロジェクタからの投光では陰になる部分であっても、他方のプロジェクタで投光可能であれば、これを補間することができる。ただしこの場合は、片投光に比べて約2倍の撮像時間を要する。ユーザは、検査対象のワークの凹凸の加減や、許容される撮像時間等に応じて、いずれの投光を用いるかを選択する。
(「表示画像」選択欄322)
Specifically, as shown in FIG. 36, when "1+2" is selected in the projector selection setting field 318, both the first projector and the second projector are switched to both projection. In this state, even if a portion is shaded by the projection of light from one of the projectors, it can be interpolated if the other projector can project light. However, in this case, it takes about twice as much imaging time as compared to the one-way projection. The user selects which projection light to use according to the unevenness of the workpiece to be inspected, the allowable imaging time, and the like.
(“Display image” selection field 322)

「表示画像」選択欄322では、第二画像表示領域121に表示される画像を選択する。例えば、検査の用途に応じて表示対象を選択することで、各設定の妥当性を実際に表示された画像から視覚的に確認することができる。特に、上述したリアルタイム更新手段をONとすることで、設定の変更を逐次更新して変化の前後で対比できるので、用途に即して意図した画像となるよう、イメージに基づいて設定を調整できる。また各設定パラメータの意味に習熟していない初心者であっても、画像を見ながら設定できる利点も得られる。この例では、図37に示すように「表示画像」選択欄322から、「高さ画像」、「濃淡画像」、「白とび・黒つぶれ画像」、「縞投光-プロジェクタ1」、「縞投光-プロジェクタ2」のいずれかを選択する。「高さ画像」は距離画像であり、高さ毎に等高線状に色分けして着色した画像を表示する。「濃淡画像」は輝度画像である。この例では、位相シフト法に基づいて撮像した複数のパターン投影画像を合成した画像を、輝度画像として利用している。ただ、ワークに照明を照射して撮像手段で光学的な画像を撮像し、輝度画像として利用することもできる。
(異常点ハイライト手段62)
In the “display image” selection field 322, an image displayed in the second image display area 121 is selected. For example, by selecting a display target according to the purpose of inspection, the validity of each setting can be visually confirmed from the actually displayed image. In particular, by turning on the above-described real-time updating means, it is possible to sequentially update the setting change and compare before and after the change, so that the setting can be adjusted based on the image so that the intended image is obtained according to the application. . Also, even a beginner who is not familiar with the meaning of each setting parameter can obtain the advantage of being able to set while viewing the image. In this example, as shown in FIG. 37, from the "display image" selection field 322, "height image", "grayscale image", "brightness/blackout image", "stripe projection - projector 1", "stripe image" Select either “projection-projector 2”. A "height image" is a distance image, and a colored image is displayed by color-coding contour lines for each height. A "grayscale image" is a luminance image. In this example, an image obtained by synthesizing a plurality of pattern projection images captured based on the phase shift method is used as the luminance image. However, it is also possible to illuminate the workpiece, capture an optical image with the imaging means, and use it as a brightness image.
(Abnormal point highlighting means 62)

さらに三次元画像処理装置は、図5に示すように異常点ハイライト手段62を備えている。例えば上述した「表示画像」選択欄322で選択可能な「白とび・黒つぶれ画像」は、輝度画像に対して、飽和して白とびした画素や光量が不足した黒つぶれ画素等を部分的に着色した画像である。このように、画像中で正確な値が得られていない、測定精度の信頼性が低いと思われる部位を、着色処理によってハイライトさせることで、ユーザに対して測定精度の低い部分を視覚的に告知し、所望の検査用途に応じた画像が得られているかどうかを確認しやすくしている。この例では、白とび画素を黄色、黒つぶれ画素を青色に、それぞれ着色している。これによりユーザは、色を手掛かりにして白つぶれした領域が画像中でどのように分布しているかを目視により確認できる。また第二画像表示領域121の下部には、白とび画素及び黒つぶれ画素の画素数をカウントして表示させている。これを参照しながら、これらの画素数が0に近づくよう、ユーザは各設定項目を調整する。 Further, the three-dimensional image processing apparatus is provided with abnormal point highlighting means 62 as shown in FIG. For example, the "brightness/blackout image" that can be selected in the above-described "display image" selection field 322 partially replaces the luminance image with saturated whiteout pixels and insufficient light amount blackout pixels. It is a colored image. In this way, areas in the image where accurate values are not obtained and where the reliability of measurement accuracy is thought to be low are highlighted by coloring processing, so that the user can visually see areas where measurement accuracy is low. to make it easier to check whether an image suitable for the desired inspection application has been obtained. In this example, overexposed pixels are colored yellow, and overexposed pixels are colored blue. With this, the user can visually confirm how the blocked-out areas are distributed in the image, using the color as a clue. Also, in the lower part of the second image display area 121, the numbers of overexposed pixels and overexposed pixels are displayed. While referring to this, the user adjusts each setting item so that the number of pixels approaches zero.

なお着色される色や態様はこれに限られず、他の色で表示させたり、点滅表示させる等、既知の様々な態様を適宜利用できる。また、白とび画素と黒つぶれ画素で着色する色を変更することで、測定の信頼性が低くなっている理由をユーザに対して告知でき、よって対応策も講じやすくなる。ただ、白とび画素と黒つぶれ画素に対して同様の色やハイライトを施してもよい。 Note that the color and manner of coloring are not limited to these, and various known manners such as displaying in other colors or blinking can be used as appropriate. In addition, by changing the color of the overexposed pixels and overexposed pixels, the user can be notified of the reason why the reliability of the measurement is low, thereby making it easier to take countermeasures. However, the same color or highlight may be given to overexposed pixels and overexposed pixels.

「縞投光-プロジェクタ1」は、第一プロジェクタのみでパターン投影して得られる濃淡で表現されたパターン投影画像である。また「縞投光-プロジェクタ2」は、第二プロジェクタのみで得られるパターン投影画像である。図38に、「表示画像」選択欄322で「縞投光-プロジェクタ1」を選択して、第二画像表示領域121に第一プロジェクタのパターン投影画像を表示させた例、図39に、「縞投光-プロジェクタ2」を選択して、第二画像表示領域121に第二プロジェクタのパターン投影画像を表示させた例を、それぞれ示す。この画面から縞画像を確認することにより、ワークの高さが計測できない場合の原因の特定、例えばワークの材質が半透明であるため、投光した光が潜り込んでいる等、パターン投影を得ることが困難なワークであることが、距離画像を生成する前の元のパターン投影画像から確認できる。 “Stripe projection-projector 1” is a pattern projection image represented by gradation obtained by pattern projection with only the first projector. "Stripe projection-projector 2" is a pattern projection image obtained only by the second projector. FIG. 38 shows an example in which "stripe projection - projector 1" is selected in the "display image" selection field 322 and the pattern projection image of the first projector is displayed in the second image display area 121. FIG. An example in which the pattern projection image of the second projector is displayed in the second image display area 121 by selecting "stripe projection-projector 2" is shown. By checking the stripe image on this screen, it is possible to identify the cause when the height of the workpiece cannot be measured. It can be confirmed from the original pattern projection image before the distance image is generated that it is a difficult work.

ユーザは、第二画像表示領域121に表示される画像を参照しながら、シャッタスピードと濃淡レンジが適切かをどうかを確認し、適切な値に調整する。具体的には、第二画像表示領域121に白とび・黒つぶれ画像を表示させた状態で、白とび画素や黒つぶれ画素が少なくなるように確認しながら調整する。例えば、シャッタースピード設定欄294でシャッタースピードを調整することによって、黒つぶれ画素、すなわち光量が足りず暗すぎる部位がなくなるようにする。また濃淡レンジを調整することで、白とび画素、すなわち明るすぎる部位がなくなるようにする。図16の例では、白とび・黒つぶれ画像中に、暗すぎるので黒つぶれ画素が多い。このため、シャッタースピードの調整を行う。 While referring to the image displayed in the second image display area 121, the user confirms whether the shutter speed and the grayscale range are appropriate, and adjusts them to appropriate values. Specifically, in a state in which a blown-out/black-out image is displayed in the second image display area 121, adjustment is performed while confirming that over-exposed pixels and blocked-up black pixels are reduced. For example, by adjusting the shutter speed in the shutter speed setting field 294, blackout pixels, that is, portions that are too dark due to insufficient light amount are eliminated. Also, by adjusting the grayscale range, overexposed pixels, ie, overly bright portions, are eliminated. In the example of FIG. 16, there are many blackened pixels in the overexposed/blackened image because the image is too dark. Therefore, the shutter speed is adjusted.

例えばシャッタースピード設定欄294を「1/120」に設定した図16の状態から、図40に示すように「1/15」に切り替えると、輝度画像が多少明るくなり、黒つぶれ画素数が0になったことが判る。ただし、白とび画素数は逆に増えてしまっている。そこで図41に示すようにシャッタースピードを「1/30」に切り替えると、黒つぶれ画素数が0のまま、白とび画素数も減少していることが判る。 For example, if the state of FIG. 16 in which the shutter speed setting field 294 is set to "1/120" is switched to "1/15" as shown in FIG. I know what happened. However, the number of overexposed pixels has increased. Therefore, when the shutter speed is switched to "1/30" as shown in FIG. 41, it can be seen that the number of blown-up pixels remains zero while the number of blown-up pixels also decreases.

さらに濃淡レンジ設定欄296を「低い(-1)」に設定した図41の状態から、図42に示すように「普通(0)」に切り替えて一段階上げると、白とび画素が減少したことが判る。さらに図43に示すように「高い(1)」に切り替えると、白とび画素が0になったことが判る。これによって白とび画素数、黒つぶれ画素数が共に0となって、シャッタースピードと濃淡レンジの調整作業を終了する。 41, in which the density range setting field 296 is set to "low (-1)", is switched to "normal (0)" as shown in FIG. I know. Furthermore, as shown in FIG. 43, when switching to "high (1)", it can be seen that overexposed pixels are reduced to zero. As a result, both the number of overexposed pixels and the number of overexposed pixels become 0, and the operation of adjusting the shutter speed and the grayscale range is completed.

以上のようにして、所望の撮像条件に設定した後、上述した図12~図13に示すように、距離画像と輝度画像の登録を行い、画像登録作業を終了する。
(高さ計測設定手順)
After setting the desired imaging conditions as described above, the distance image and the luminance image are registered as shown in FIGS.
(Height measurement setting procedure)

次に、運用時に逐次入力される検査対象のワークの入力画像に対して、高さ計測を行う領域を設定する手順について、図44~図55に基づいて説明する。ここでは、入力される複数のワークを代表する典型的なワークを、上述した手順によって予め登録画像として登録しておき、この登録画像に対して、高さ計測を行う領域を指定する。 Next, a procedure for setting an area for height measurement in an input image of a work to be inspected that is sequentially input during operation will be described with reference to FIGS. 44 to 55. FIG. Here, a typical work representative of a plurality of input works is registered in advance as a registered image by the above-described procedure, and a region whose height is to be measured is specified for this registered image.

具体的には、図9の初期画面260から、図44~図45に示すように「高さ計測」処理ユニット266の追加を行う。図44の例では、フロー表示領域261において「撮像」処理ユニット263の下部に、右クリック等で表示される第一サブメニュー370から「追加」を選択し、第二サブメニュー372中の「計測」を選択して表示される「計測」メニュー373でリストされる検査処理の内、「高さ計測」を行う「高さ計測」処理ユニット266を追加する。これによって、図45に示すように、フロー表示領域261において「撮像」処理ユニット263の下部に、新たに「高さ計測」処理ユニット266が追加される。このように、「計測」メニュー373は検査実行手段で実行される検査処理を選択するための検査処理選択手段として機能する。
(検査対象領域設定画面120)
Specifically, a "height measurement" processing unit 266 is added from the initial screen 260 in FIG. 9 as shown in FIGS. In the example of FIG. 44, select "Add" from the first submenu 370 displayed by right-clicking or the like below the "imaging" processing unit 263 in the flow display area 261, and select "Measurement" in the second submenu 372. is selected to add a "height measurement" processing unit 266 that performs "height measurement" among the inspection processes listed in the "measurement" menu 373 displayed. As a result, as shown in FIG. 45, a new “height measurement” processing unit 266 is added below the “imaging” processing unit 263 in the flow display area 261 . Thus, the "measurement" menu 373 functions as inspection process selection means for selecting inspection processes to be executed by the inspection execution means.
(Inspection target area setting screen 120)

次に、「高さ計測」処理ユニット266で行うべき設定として、領域を設定する手順について、図46~図49に基づいて説明する。まず図45の画面から、「高さ計測」処理ユニットの編集画面を呼び出すと、図46に示す高さ計測設定画面460に移行する。図46のGUI画面例でも、図10と同様、画面の右側に画像を表示させる第一画像表示領域111を設け、左側には設定項目ボタンを複数配置した設定項目ボタン領域112が設けられる。設定項目ボタン領域112には、「画像登録」ボタン113、「画像設定」ボタン114、「領域設定」ボタン115、「前処理」ボタン117、「検出条件」ボタン118、「詳細設定」ボタン119、「判定条件」ボタン、「表示設定」ボタン、「保存」ボタン等が設けられている。この画面から、ユーザは検査対象領域設定手段に相当する「領域設定」ボタン115を押下すると、図47に示す検査対象領域設定画面120に遷移する。検査対象領域設定画面120においては、検査を行う領域を指定することができる。図47の例では、画面の左に第二画像表示領域121を設け、画面の右側に各種の操作を行う操作領域122を配置している。操作領域122の上段には、第二画像表示領域121で表示される画像を選択するための「表示画像」選択欄124が設けられる。図47の例では、「表示画像」選択欄124で登録画像が選択されている。さらにその下方には、検査を実行する領域を指定する検査対象領域設定手段として、「計測領域」設定欄126が設けられている。 Next, a procedure for setting an area as a setting to be performed by the "height measurement" processing unit 266 will be described with reference to FIGS. 46 to 49. FIG. First, when the edit screen of the "height measurement" processing unit is called from the screen of FIG. 45, the screen shifts to a height measurement setting screen 460 shown in FIG. In the GUI screen example of FIG. 46 as well, as in FIG. 10, a first image display area 111 for displaying an image is provided on the right side of the screen, and a setting item button area 112 in which a plurality of setting item buttons are arranged is provided on the left side of the screen. The setting item button area 112 includes an "image registration" button 113, an "image setting" button 114, an "area setting" button 115, a "preprocessing" button 117, a "detection condition" button 118, a "detailed setting" button 119, A "judgment condition" button, a "display setting" button, a "save" button, etc. are provided. From this screen, when the user presses a "set area" button 115 corresponding to inspection target area setting means, the screen transitions to an inspection target area setting screen 120 shown in FIG. On the inspection area setting screen 120, an area to be inspected can be specified. In the example of FIG. 47, a second image display area 121 is provided on the left side of the screen, and an operation area 122 for performing various operations is arranged on the right side of the screen. A “display image” selection field 124 for selecting an image to be displayed in the second image display area 121 is provided in the upper part of the operation area 122 . In the example of FIG. 47, a registered image is selected in the “display image” selection field 124 . Furthermore, below it, a "measurement area" setting column 126 is provided as an inspection target area setting means for specifying an area to be inspected.

「計測領域」設定欄126では、予め規定された領域を選択できる。ここでは、「計測領域」設定欄126を選択すると、図48に示すようにドロップダウンボックスが表示され、所望の計測領域の形状を選択できる。この例では、選択可能な計測領域の形状の候補として、「なし」、「矩形」、「回転矩形」、「円」、「楕円」、「円周」、「円弧」、「多角形」、「複合領域」等が表示される。なお「なし」を選択すると、第二画像表示領域121に表示される画像の全体を検査対象領域として利用する。 A predetermined area can be selected in the “measurement area” setting field 126 . Here, when the "measurement area" setting field 126 is selected, a drop-down box is displayed as shown in FIG. 48, and the desired shape of the measurement area can be selected. In this example, the selectable measurement area shape candidates are "none", "rectangle", "rotated rectangle", "circle", "ellipse", "circumference", "arc", "polygon", "Complex area" or the like is displayed. If "none" is selected, the entire image displayed in the second image display area 121 is used as the inspection target area.

さらに、「計測領域」設定欄126において選択された形状に応じて、詳細な寸法等の設定が可能となる。図48の例では、ワークに消しゴムを用いており、また「計測領域」設定欄126においては、図49に示すように「回転矩形」を選択した例を示している。この状態で「編集」ボタン128を押下すると、図50に示す計測領域編集画面130が表示される。図50の例では、第二画像表示領域121において、回転矩形がワーク上に重ねて表示される。ここでは消しゴムのケースの部分に、矩形状の計測領域が描かれて、距離画像上に重ねて表示される。また回転矩形の基本ベクトルが回転矩形の枠状内に矢印で表示されると共に、計測領域編集画面130の画面で、回転矩形の幅、高さと、中心のXY座標、基本ベクトルの傾斜角度等が表示される。ユーザは計測領域編集画面130上から数値を直接入力するか、あるいは回転矩形に表示されたハンドルをマウス等で操作して、回転矩形の形状や位置等を任意に調整できる。 Further, according to the shape selected in the "measurement area" setting field 126, it is possible to set detailed dimensions and the like. In the example of FIG. 48, an eraser is used for the workpiece, and in the "measurement area" setting column 126, "rotated rectangle" is selected as shown in FIG. When the "edit" button 128 is pressed in this state, a measurement area edit screen 130 shown in FIG. 50 is displayed. In the example of FIG. 50, in the second image display area 121, a rotated rectangle is displayed superimposed on the workpiece. Here, a rectangular measurement area is drawn on the eraser case and displayed superimposed on the distance image. In addition, the basic vector of the rotated rectangle is displayed as an arrow within the frame of the rotated rectangle, and the width and height of the rotated rectangle, the XY coordinates of the center, the inclination angle of the basic vector, etc. are displayed on the screen of the measurement area editing screen 130. Is displayed. The user can arbitrarily adjust the shape, position, etc. of the rotated rectangle by directly inputting numerical values on the measurement area edit screen 130 or by operating the handles displayed on the rotated rectangle with a mouse or the like.

なお計測領域編集画面130において設定可能な項目は、「計測領域」設定欄126において選択された形状に応じて変化する。例えば、「円周」を選択した場合は、図51に示すように、円周の外径や内径の寸法の指定等、円周に関するパラメータの設定が可能となる。さらに、図47の画面から、マスク領域を指定することも可能である。マスク領域としては、円形やドーナツ状、矩形状その他の多角形状、自由曲線等が指定できる。このようにして、検査対象のワークの形状に応じて、適切に検査対象領域を設定し、穴あき部分や背景等、検査に無用な領域を排除して、処理の効率化を図ることができる。
(第二計測表示領域)
Items that can be set on the measurement area edit screen 130 change according to the shape selected in the “measurement area” setting field 126 . For example, when "circumference" is selected, as shown in FIG. 51, it is possible to set parameters related to the circumference, such as specification of the outer diameter and inner diameter of the circumference. Furthermore, it is also possible to designate a mask area from the screen of FIG. As the mask area, a circular shape, a doughnut shape, a rectangular shape, other polygonal shapes, a free curve, and the like can be specified. In this way, it is possible to appropriately set the inspection target area according to the shape of the workpiece to be inspected, and eliminate unnecessary areas for inspection such as perforated portions and backgrounds, thereby improving the processing efficiency. .
(Second measurement display area)

このようにして計測領域が設定されると、図49に示すようにワーク上に設定済みの計測領域が重ねて表示される。続いて、他の計測領域を指定する場合は、同様の作業を繰り返す。すなわち、図52に示すように、フロー表示領域261において「高さ計測」処理ユニット266の下部に、さらに別の第二「高さ計測」処理ユニット266Bを追加する。そして図53、図54に示すように、新たな計測領域として回転矩形を、ここではワークである消しゴムの、ケースで覆われていない領域上に設定している。この結果、図55に示すように、新たに設定された第二計測領域がワーク上に重ねて表示される。 When the measurement area is set in this manner, the set measurement area is superimposed on the work as shown in FIG. Subsequently, when specifying another measurement area, the same operation is repeated. That is, as shown in FIG. 52 , another second “height measurement” processing unit 266B is added below the “height measurement” processing unit 266 in the flow display area 261 . Then, as shown in FIGS. 53 and 54, a rotated rectangle is set as a new measurement area on the area of the eraser, which is the work here, not covered by the case. As a result, as shown in FIG. 55, the newly set second measurement area is superimposed on the work and displayed.

なお、上記の例では、一の「高さ計測」処理ユニットで一の高さ計測処理が行われる。すなわち、複数の高さ計測処理を行うには、複数の「高さ計測」処理ユニットをそれぞれ追加する必要がある。ただ、一の「高さ計測」処理ユニットにおいて複数の高さ計測処理が行われるように構成することも可能であることはいうまでもない。
(計測処理)
In the above example, one height measurement process is performed by one "height measurement" processing unit. That is, in order to perform a plurality of height measurement processes, it is necessary to add a plurality of "height measurement" processing units. However, it goes without saying that it is also possible to configure a single "height measurement" processing unit to perform a plurality of height measurement processes.
(measurement processing)

このようにして計測領域の設定が終了すると、次に実際に計測を行う処理を追加する。ここでは、図56に示すように、フロー表示領域261において第二「高さ計測」処理ユニット266Bの下部に、「演算」を行う「数値演算」処理ユニットを追加する。「数値演算」処理ユニットで実行される演算の内容として、数値演算や画像演算、キャリブレーション、画像連結等が選択できる。ここでは、図57に示すように数値演算を選択した「数値演算」処理ユニットを追加している。
(「数値演算」処理ユニット)
When the setting of the measurement area is completed in this way, next, a process of actually performing measurement is added. Here, as shown in FIG. 56, in the flow display area 261, a "numerical calculation" processing unit that performs "calculation" is added below the second "height measurement" processing unit 266B. Numerical calculations, image calculations, calibration, image concatenation, etc. can be selected as the content of calculations to be executed by the "numerical calculation" processing unit. Here, as shown in FIG. 57, a "numerical calculation" processing unit is added in which numerical calculation is selected.
(“numerical operation” processing unit)

「数値演算」処理ユニットにおいては、具体的な演算式を入力することができる。例えば図58に示すように、数式を直接入力可能な数値演算編集画面を表示させ、ユーザが演算式を規定する。ここでは、電卓状の入力パッドを用意し、またコピーや切り取り、貼り付け等の編集ボタンも用意して、演算式の作成を容易にしている。ユーザはこの画面から、所望の演算式を入力する。入力された演算式の例を、図59に示す。 In the "numerical operation" processing unit, a concrete arithmetic expression can be input. For example, as shown in FIG. 58, a numerical calculation edit screen is displayed on which a mathematical expression can be directly input, and the user specifies the arithmetic expression. Here, a calculator-like input pad is prepared, and edit buttons such as copy, cut, and paste are also prepared to facilitate creation of arithmetic expressions. The user inputs a desired arithmetic expression from this screen. FIG. 59 shows an example of an input arithmetic expression.

このようにして数値演算処理の内容が規定されると、図60に示すように初期画面260において、第三画像表示領域262上に演算式が表示される。
(「エリア」処理ユニット)
When the content of the numerical calculation process is defined in this way, the calculation formula is displayed in the third image display area 262 on the initial screen 260 as shown in FIG.
("area" processing unit)

さらにまた、図61の例では「数値演算」処理ユニットの下に、「エリア」処理ユニットを追加している。「エリア」処理ユニットでは、実際に合否判定等を行う条件を規定する。具体的には、登録画像や入力画像に応じて、距離画像を低階調距離画像に階調変換するための階調変換条件を適切に変化させるべく、階調変換パラメータ(詳細は後述)の基準となる情報を取得するための領域や、この領域から高さを抽出する条件、あるいは距離画像を生成する際に、フィルタ処理を行う条件等を設定する。すなわち、「エリア」処理ユニットでは、領域設定、高さ抽出、前処理、判定等を設定する。まず、領域設定を行う手順については、上述した登録画像と同様である。すなわち、図62に示すようなエリア設定画面620から、設定項目ボタン領域112に配置された「領域設定」ボタン115を押下すると、図63に示す領域設定画面となり、対象となる領域を指定する。ここでも回転矩形を選択し、さらに詳細な座標等を必要に応じて指定する。このようにして、「エリア」処理ユニットにおける領域が決定され、図64に示すように第二画像表示領域において回転矩形がワーク上に重ねて表示される。
(高さ抽出設定画面)
Furthermore, in the example of FIG. 61, an "area" processing unit is added below the "numerical calculation" processing unit. In the "area" processing unit, the conditions for actually making pass/fail judgments are defined. Specifically, in order to appropriately change the gradation conversion conditions for gradation conversion of the distance image to the low gradation distance image according to the registered image and the input image, the gradation conversion parameter (details will be described later) A region for acquiring reference information, a condition for extracting height from this region, a condition for filtering when generating a distance image, and the like are set. That is, in the "area" processing unit, area setting, height extraction, preprocessing, judgment, etc. are set. First, the procedure for setting the area is the same as for the registered image described above. That is, when the "area setting" button 115 arranged in the setting item button area 112 is pressed on the area setting screen 620 as shown in FIG. 62, the area setting screen shown in FIG. 63 is displayed, and the target area is specified. Again, select a rotated rectangle, and specify detailed coordinates and the like as necessary. In this way, the area in the "area" processing unit is determined, and the rotated rectangle is displayed superimposed on the workpiece in the second image display area as shown in FIG.
(Height extraction setting screen)

次に高さ抽出の設定を行う。高さ抽出の設定とは、階調変換を行う際の階調変換パラメータを設定することである。すなわち図62の設定項目ボタン領域112中から、「高さ抽出」ボタン116を押下すると、図65に示す高さ抽出選択画面140に移行し、表示画像や抽出方法等が選択可能となる。高さ抽出選択画面140でも、図47等と同様、画面の左に第二画像表示領域121を設け、画面の右側に各種の操作を行う操作領域122を配置している。操作領域122の上段には、第二画像表示領域121で表示される画像を選択するための「表示画像」選択欄124が設けられる。図65の例では、「表示画像」選択欄124で登録画像が選択されている。さらにその下方には、高さ抽出機能の抽出方法を選択する抽出方法選択手段142が設けられる。 Next, set height extraction. The setting of height extraction is to set the gradation conversion parameter when performing gradation conversion. That is, when the "height extraction" button 116 is pressed in the setting item button area 112 in FIG. 62, the height extraction selection screen 140 shown in FIG. 65 is displayed, and the display image, extraction method, etc. can be selected. The height extraction selection screen 140 also has a second image display area 121 on the left side of the screen and an operation area 122 for performing various operations on the right side of the screen, as in FIG. 47 and the like. A “display image” selection field 124 for selecting an image to be displayed in the second image display area 121 is provided in the upper part of the operation area 122 . In the example of FIG. 65, a registered image is selected in the “display image” selection field 124 . Furthermore, an extraction method selection means 142 for selecting an extraction method for the height extraction function is provided below it.

ここで「高さ抽出」ボタン116は、階調変換手段により距離画像の階調変換を行うための階調変換パラメータを設定する階調変換条件設定手段43として機能する。特に階調変換条件設定手段43は、画像の高さ情報を必要としない処理を、検査処理選択手段で選択した場合に表示される。逆に、画像の高さ情報を必要とする処理を検査処理選択手段で選択した場合は、この階調変換条件設定手段を表示させない。具体的には、検査処理ツールとして「高さ計測」処理ユニット266を選択した場合は、フロー表示領域261に「高さ抽出」ボタンが表示されない。これ以外の検査処理ツール、例えば「エリア」処理ユニットや「ブロブ」処理ユニット267、「色検査」処理ユニット267B、「Shapetrax2」処理ユニット264、「位置補正」処理ユニット265等に関しては、「高さ抽出」ボタン116が表示され、階調変換条件を設定可能としている。このようにすることで、階調変換が必要な場合には階調変換条件設定手段43を表示させて、ユーザに必要な設定を促す一方、階調変換が不要な場合は、階調変換の条件を設定する手段そのものを非表示として、ユーザが不要な設定で混乱することを回避し、使い勝手のよい環境が実現される。
(抽出方法選択手段142)
Here, the "extract height" button 116 functions as the gradation conversion condition setting means 43 for setting gradation conversion parameters for performing gradation conversion of the distance image by the gradation conversion means. In particular, the gradation conversion condition setting means 43 is displayed when a process that does not require image height information is selected by the inspection process selecting means. Conversely, when a process requiring image height information is selected by the inspection process selection means, the gradation conversion condition setting means is not displayed. Specifically, when the “height measurement” processing unit 266 is selected as the inspection processing tool, the “height extraction” button is not displayed in the flow display area 261 . For other inspection processing tools, such as the "area" processing unit, the "blob" processing unit 267, the "color inspection" processing unit 267B, the "Shapetrax2" processing unit 264, the "position correction" processing unit 265, etc., the "height An "extract" button 116 is displayed to enable setting of tone conversion conditions. By doing so, the gradation conversion condition setting means 43 is displayed when gradation conversion is necessary, and the user is urged to make necessary settings. By hiding the means for setting the conditions, the user is prevented from being confused by unnecessary settings, and a user-friendly environment is realized.
(Extraction method selection means 142)

抽出方法選択手段142では、階調変換方法を指定する。例えば静的変換又は動的変換のいずれかをユーザに選択させる。図65の例では、予め選択肢として、静的変換に該当する「一点指定」又は「三点指定(平面)」、動的変換に該当する「リアルタイム抽出」のいずれかを、ドロップダウンボックスから選択させる。
(一点指定画面150)
The extraction method selection means 142 designates a gradation conversion method. For example, let the user select either static conversion or dynamic conversion. In the example of FIG. 65, one of "single-point designation" or "three-point designation (plane)" corresponding to static transformation, or "real-time extraction" corresponding to dynamic transformation is selected from the drop-down box. Let
(One point designation screen 150)

図65の画面で、抽出方法選択手段142から「一点指定」を選択すると、図66の一点指定画面150に移行する。なお、図66~図96においては、説明のためワークとして50円玉を用いた例を示している。図66の一点指定画面150では、第二画像表示領域121上で指定した部位の高さを基準の高さ(基準高さ)として設定する。図66の例では、画面右の操作領域122中に設けられた「抽出」ボタン144を選択すると、図67に示す画面となり、画面左の第二画像表示領域121上の任意の位置を指定できるようになる。ここでは、高さ抽出手段を用いて、第二画像表示領域121に表示されたワーク中で、高さの中心となる位置を指定する。図67の例では、高さ抽出手段は、スポイト状のアイコンSIを表示した「抽出」ボタン144で構成されており、この「抽出」ボタン144を押下すると、第二画像表示領域121上に点状のポインタ146が表示される。このポインタ146で指定された位置が、距離レンジの中間の高さとして登録される。 If "single point designation" is selected from the extraction method selection means 142 on the screen of FIG. 65, the screen shifts to the single point designation screen 150 of FIG. 66 to 96 show an example using a 50-yen coin as the workpiece for the sake of explanation. On the one-point designation screen 150 in FIG. 66, the height of the part designated on the second image display area 121 is set as the reference height (reference height). In the example of FIG. 66, when the "Extract" button 144 provided in the operation area 122 on the right side of the screen is selected, the screen shown in FIG. 67 appears, and any position on the second image display area 121 on the left side of the screen can be specified become. Here, the height extracting means is used to specify the center position of the height in the work displayed in the second image display area 121 . In the example of FIG. 67, the height extracting means consists of an "extract" button 144 displaying a dropper-shaped icon SI. A pointer 146 with a shape is displayed. The position designated by this pointer 146 is registered as the middle height of the distance range.

またポインタ146で指定された点の周辺の高さを求める範囲を、「抽出領域」指定欄145で指定できる。「抽出領域」指定欄145では、平均高さを求める領域の一辺を画素数で指定する。図67の例では「抽出領域」指定欄145で「16」を指定しており、ポインタ146で指定された点を中心とする16画素×16画素の領域内の、平均高さを抽出して、ポインタ146で抽出された高さとする。なお、第二画像表示領域121上においてポインタ146で指定される領域の大きさを、「抽出領域」指定欄145で指定される数値に連動させて変化させることもできる。 Also, the range for obtaining the height around the point designated by the pointer 146 can be designated in the “extraction region” designation field 145 . In the "extraction area" specification column 145, one side of the area for which the average height is to be calculated is specified by the number of pixels. In the example of FIG. 67, "16" is specified in the "extraction area" specification column 145, and the average height within the area of 16 pixels×16 pixels centered on the point specified by the pointer 146 is extracted. , be the height extracted by the pointer 146 . The size of the area specified by the pointer 146 on the second image display area 121 can be changed in conjunction with the numerical value specified in the “extraction area” specification field 145 .

また「Z高さ」表示欄152には、指定された部位の高さ情報が数値として表示される(図68の例では「Z高さ」表示欄152に1.253と表示される)。例えば、距離レンジを28=256階調(0~255)で表現する場合、高さ抽出手段で指定された高さを、その中心値としてゲイン(濃度値/mm;詳細は後述)が128となるように設定される。この構成により、ユーザは検査したい高さを直接画面上で指定することで、指定された高さを中心とする範囲で、低階調な距離画像に階調変換されるため、必要な高さ情報が損なわれる事態を回避できる。
(簡易表示機能)
Also, in the "Z height" display field 152, the height information of the designated part is displayed as a numerical value (in the example of FIG. 68, 1.253 is displayed in the "Z height" display field 152). For example, when expressing the distance range with 2 8 =256 gradations (0 to 255), the gain (density value/mm; details will be described later) is 128 with the height specified by the height extraction means as the central value. is set to be With this configuration, the user can specify the height to be inspected directly on the screen, and the range around the specified height will be converted into a low-gradation distance image. Avoid loss of information.
(simple display function)

以上のようにして階調変換に必要な階調変換パラメータとして、距離レンジとスパンが決定されると、高階調な距離画像を低階調距離画像に階調変換することが可能となる。また第二画像表示領域121上には、図68に示すように、現在操作領域122で設定されている階調変換条件で階調変換された低階調距離画像が、簡易的に表示される。また、操作領域122で階調変換条件を変更すると、これに応じて第二画像表示領域121上の階調変換後の低階調距離画像の簡易表示も、変更後の階調変換条件に応じて更新される。これにより、ユーザは階調変換条件の調整後の変化を視覚的に速やかに確認でき、試行錯誤による調整作業を容易に行うことが可能となる。このように第二画像表示領域121で表示される画像は、階調変換前の距離画像を表示させるモード、階調変換後の低階調距離画像を表示させるモード、及び通常の輝度画像を表示させるモードを切り替えることで、変更できる。
(ゲイン調整手段)
When the distance range and span are determined as tone conversion parameters necessary for tone conversion in the manner described above, it becomes possible to tone-convert a high-tone distance image into a low-tone distance image. Also, on the second image display area 121, as shown in FIG. 68, a low gradation distance image that has undergone gradation conversion under the gradation conversion conditions currently set in the operation area 122 is simply displayed. . Further, when the gradation conversion conditions are changed in the operation area 122, the simple display of the low gradation distance image after the gradation conversion on the second image display area 121 is also performed according to the changed gradation conversion conditions. updated. As a result, the user can quickly visually confirm the change in the gradation conversion condition after the adjustment, and can easily perform the adjustment work by trial and error. As described above, the image displayed in the second image display area 121 includes a mode for displaying a distance image before tone conversion, a mode for displaying a low tone distance image after tone conversion, and a mode for displaying a normal luminance image. It can be changed by switching the mode to make it work.
(Gain adjusting means)

さらにユーザは、ゲイン調整手段を用いて、階調変換パラメータの一であるゲイン調整を行うことができる。図68の例では、操作領域122の中段に強調方法設定欄154が設けられており、ここにゲイン調整手段としてゲイン調整欄156が配置される。ゲイン調整欄156には、現在のゲインが数値で表示されている。ここでゲイン[階調/mm]とは、階調変換を行う際のスパンに該当するパラメータである。例えば16階調の距離画像を8階調に階調変換する際は、1mm当たりを8階調中の何階調として変換するかを設定する。ゲイン値を大きくすれば、コントラストがはっきりした階調変換となる。例えばゲイン値を100[階調/mm]に設定すると、1階調当たり0.010mmとなるような階調変換に設定される。また変換前の距離画像の高さ情報が、1階調当たり0.00025mmの分解能であったとすると、求めた基準面と入力高さデータとの差が、変換前にN階調であった場合、変換後はN[階調]×0.00025[mm/階調]×100[階調/mm]=N×0.025階調として算出できる。 Furthermore, the user can use the gain adjustment means to perform gain adjustment, which is one of the gradation conversion parameters. In the example of FIG. 68, an emphasis method setting field 154 is provided in the middle of the operation area 122, and a gain adjustment field 156 is arranged here as gain adjustment means. The current gain is displayed numerically in the gain adjustment field 156 . Here, the gain [gradation/mm] is a parameter corresponding to the span when performing gradation conversion. For example, when converting a distance image of 16 gradations into 8 gradations, the number of gradations out of 8 gradations per mm is set. Increasing the gain value results in gradation conversion with clear contrast. For example, if the gain value is set to 100 [gradation/mm], the gradation conversion is set such that 0.010 mm per gradation. If the height information of the distance image before conversion has a resolution of 0.00025 mm per gradation, the difference between the obtained reference plane and the input height data is N gradations before conversion. , after conversion, can be calculated as N [gradation]×0.00025 [mm/gradation]×100 [gradation/mm]=N×0.025 gradation.

ここで基準面とは、一点指定や後述する平均高さ基準、三点指定、平面基準、自由曲面基準等の方法で求めた面であり、階調変換時の基準となる面である。例えば、図69Aに示すように、16階調の変換前の距離画像(入力画像)の断面プロファイルが実線で示すような形状である場合、その基準面を波線で示す。このような入力画像を、16階調から8階調に階調変換した低階調距離画像のプロファイルは、図69Bに示すようになり、基準面からの差分に対してそのままゲイン(変換係数)がかかるような状態となる。 Here, the reference plane is a plane determined by a method such as one-point specification, average height standard, three-point specification, plane standard, or free-form surface standard, and serves as a reference for tone conversion. For example, as shown in FIG. 69A, when the cross-sectional profile of the range image (input image) before conversion to 16 gradations has a shape indicated by solid lines, the reference plane is indicated by broken lines. FIG. 69B shows the profile of the low-gradation distance image obtained by converting such an input image from 16-gradation to 8-gradation. is applied.

また、上述したゲイン値に応じて1階調当たりの高さ(ゲイン値の逆数)も自動的に演算されて、併せて表示させることもできる。図68の例では、ゲイン値として250[階調/mm]、1階調あたりの高さとして0.0040mmが表示されている。ユーザはゲイン値を変更することで、ゲイン値の調整が可能となる。例えばゲイン値を増加させると、図68の画面から図70の画面に示すように、濃度差を強調して高さ情報を細かく検査できる反面、検査可能な高さ範囲が狭くなる。逆にゲイン値を低下させると、図71に示すように広い高さ範囲まで検査できる反面、細かな変化が損なわれる。このように、ゲイン調整手段でゲインを調整させると、その階調変換条件で得られる階調変換画像を第二画像表示領域121で確認できる。これによりユーザは、リアルタイムに更新される階調変換画像を確認しながら、検査目的等に応じて、適切なゲイン値に調整できる。
(抽出高さの設定)
In addition, the height per gradation (the reciprocal of the gain value) can be automatically calculated according to the gain value described above and displayed together. In the example of FIG. 68, 250 [gradation/mm] is displayed as the gain value, and 0.0040 mm is displayed as the height per gradation. The user can adjust the gain value by changing the gain value. For example, if the gain value is increased, as shown in the screens of FIGS. 68 to 70, the height information can be inspected in detail by emphasizing the density difference, but the inspectable height range is narrowed. Conversely, if the gain value is lowered, a wide height range can be inspected as shown in FIG. 71, but fine changes are impaired. In this way, by adjusting the gain with the gain adjusting means, the gradation-converted image obtained under the gradation conversion conditions can be confirmed in the second image display area 121 . As a result, the user can adjust the gain value appropriately according to the inspection purpose or the like while confirming the tone-converted image updated in real time.
(Setting extraction height)

さらに、強調方法の設定項目は、ゲイン値の他、抽出高さの設定も含めることができる。例えば図72の画面において、操作領域122の右下に設けられた「詳細設定」ボタン158を押下すると、図73の強調方法詳細設定画面160に切り替わり、強調方法設定欄154に上述したゲイン調整欄156に加えて、「抽出高さ」設定欄162が表示される。「抽出高さ」設定欄162では、高さ抽出手段で抽出すべき高さ情報として、領域内に含まれる高い高さ情報、低い高さ情報、高いものと低いものの両方の高さ情報のいずれかを選択できる。ここでは、図74に示すように、「抽出高さ」設定欄162に設けられたドロップダウンリストによって「高い側」、「低い側」、「高低両方」のいずれかを選択できる。例えば、「高い側」を選択すると、ポインタ146で指定された位置の高さが、距離レンジの下限となるように階調変換される。この結果、指定された高さよりも高い側のみが抽出された低階調距離画像が生成される。同様に「低い側」を選択すると、ポインタ146で指定された位置の高さが距離レンジの上限となるように階調変換される。この結果、指定された高さよりも低い側のみが抽出された低階調距離画像が生成される。さらに「高低両方」の場合は、ポインタ146で指定された位置の高さが上述した距離レンジの中間となるように階調変換される。なお、階調変換後に範囲外となった画素は、低い側が黒(8階調の場合、画素値0)に、高い側が白(画素値255)にクリッピングされる。 Further, setting items for the enhancement method can include setting of extraction height in addition to gain value. For example, in the screen of FIG. 72, when the "details setting" button 158 provided at the lower right of the operation area 122 is pressed, the screen is switched to the emphasis method detail setting screen 160 of FIG. In addition to 156, an "extraction height" setting field 162 is displayed. In the "extraction height" setting field 162, the height information to be extracted by the height extraction means is any of high height information, low height information, and both high and low height information included in the area. You can choose Here, as shown in FIG. 74, any one of “high side”, “low side”, and “both high and low” can be selected from a drop-down list provided in the “extraction height” setting field 162 . For example, if the "higher side" is selected, gradation conversion is performed so that the height of the position specified by the pointer 146 becomes the lower limit of the distance range. As a result, a low gradation distance image is generated in which only the side higher than the designated height is extracted. Similarly, if the "lower side" is selected, tone conversion is performed so that the height of the position designated by the pointer 146 becomes the upper limit of the distance range. As a result, a low gradation distance image is generated in which only the side lower than the specified height is extracted. Furthermore, in the case of "both high and low", gradation conversion is performed so that the height of the position specified by the pointer 146 is the middle of the distance range described above. Pixels outside the range after gradation conversion are clipped to black on the lower side (pixel value 0 in the case of 8 gradations) and to white on the higher side (pixel value 255).

さらに、図73の強調方法詳細設定画面160においては、ノイズを除去するためのノイズ除去設定欄164や、無効画素に与える値を指定するための無効画素指定欄166も設けられている。
(ノイズ除去設定欄164)
Further, in the enhancement method detail setting screen 160 of FIG. 73, a noise removal setting column 164 for removing noise and an invalid pixel specifying column 166 for specifying a value to be given to invalid pixels are also provided.
(Noise removal setting field 164)

ノイズ除去設定欄164では、階調変換パラメータの一として、基準面から何mm分の差分をノイズとして除去するかを指定する。例えば、ノイズ除去パラメータを0.080mmと設定すると、基準面から0.080mm分の差分は除去される。ここで変換前の高さ情報が1階調あたり0.00025mmの分解能であるとすると、0.080[mm]÷0.00025[mm]=320[階調]の差分は、無視される動作となる。この様子を、図75A~図75Cに基づいて説明する。これらの図において図75Aは、図69Aと同様、16階調の変換前の距離画像の断面プロファイルを実線で、その基準面を波線で示すと共に、さらにノイズ除去される範囲を一点鎖線で示している。このような入力画像に対し、基準面を基準にノイズ除去を行った結果、図75Bに示すプロファイルとなる。さらに図75Bの距離画像に対して、16階調から8階調に階調変換した低階調距離画像のプロファイルは、図75Cに示すようになり、残った成分に対してゲイン(変換係数)をかけた状態となる。 In the noise removal setting field 164, as one of the gradation conversion parameters, how many mm difference from the reference plane is to be removed as noise is specified. For example, if the noise removal parameter is set to 0.080 mm, the difference of 0.080 mm from the reference plane is removed. Here, if the height information before conversion has a resolution of 0.00025 mm per gradation, the difference of 0.080 [mm] ÷ 0.00025 [mm] = 320 [gradation] is ignored. becomes. This state will be described with reference to FIGS. 75A to 75C. 75A, similar to FIG. 69A, the cross-sectional profile of the distance image before conversion to 16 gradation is indicated by a solid line, its reference plane is indicated by a wavy line, and the range to be noise-removed is indicated by a dashed-dotted line. there is A profile shown in FIG. 75B is obtained as a result of performing noise removal on such an input image with reference to the reference plane. Furthermore, the profile of the low gradation distance image obtained by performing gradation conversion from 16 gradation to 8 gradation for the distance image in FIG. 75B is as shown in FIG. is applied.

さらに、ゲイン調整とノイズ除去の効果を、図76A~図76Fに基づいて説明する。まず図76Aに示すような輝度画像と、図76Bに示すような高階調(16階調)の距離画像を得たとする。ここで、図76Bの距離画像を、初期設定(ここでは、ゲインが100[階調/mm]、ノイズ除去が0.000[mm]とする。)のまま、低階調(8階調)に階調変換した低階調距離画像を、図76Cに示す。この低階調距離画像は、コントラストが比較的低い。そこで、この状態からゲインを上げると、図76Dに示すように、コントラストが高くなった低階調距離画像が新たに図76Bから階調変換されて、表示される。ただ、この画像ではノイズ成分も大きくなっている。図76Dの例では、ゲインが1000[階調/mm]、ノイズ除去が0.000[mm]に設定されている。そこで、図76Dからノイズ除去量を大きくした低階調距離画像を、図76Eに示す。ここでは、ゲインが1000[階調/mm]、ノイズ除去が0.080[mm]に設定されている。これによってノイズ成分は低減されたが、一方で左上の「E」の右上に、基準面よりも低い高さのノイズが存在することが確認できる。そこで、図74等に示す「抽出高さ」設定欄182において「高い側」に設定すると、基準面が最低値(画素値0)となるように変換されるため、基準面よりも低い部分は無視され、基準面よりも高い側のみが抽出される結果、図76Fに示すような低階調距離画像が得られる。例えば図77Aに示すようなプロファイルの距離画像(16階調)に対して、「抽出高さ」を「高い側」に設定すると、基準面からの高い側のみが抽出されるような結果となり、図77Bに示すような低階調距離画像(8階調)が得られる。このようにして、図76C等に比べてコントラストが高く、かつノイズ成分も少ない低階調距離画像を得ることができる。この例では、最終的な階調変換パラメータとして、ゲインを1000[階調/mm]、ノイズ除去を0.080[mm]、「抽出高さ」を「高い側」にそれぞれ設定して、図76Bの距離画像から図76Fの低階調距離画像に階調変換している。 Further, the effects of gain adjustment and noise removal will be described with reference to FIGS. 76A to 76F. First, assume that a luminance image as shown in FIG. 76A and a distance image with high gradation (16 gradations) as shown in FIG. 76B are obtained. Here, the distance image in FIG. 76B is set to low gradation (8 gradations) with the initial settings (here, the gain is 100 [gradation/mm] and the noise reduction is 0.000 [mm]). FIG. 76C shows a low gradation distance image that has undergone gradation conversion to . This low tone distance image has relatively low contrast. Therefore, when the gain is increased from this state, as shown in FIG. 76D, a low gradation distance image with increased contrast is newly gradation-converted from FIG. 76B and displayed. However, the noise component is also large in this image. In the example of FIG. 76D, the gain is set to 1000 [gradation/mm] and the noise reduction is set to 0.000 [mm]. Therefore, FIG. 76E shows a low gradation distance image obtained by increasing the amount of noise removal from FIG. 76D. Here, the gain is set to 1000 [gradation/mm] and the noise reduction is set to 0.080 [mm]. Although the noise component was reduced by this, it can be confirmed that noise having a height lower than that of the reference plane exists in the upper right of the upper left "E". Therefore, if the "extraction height" setting field 182 shown in FIG. As a result of ignoring and extracting only the side higher than the reference plane, a low gradation distance image as shown in FIG. 76F is obtained. For example, if the "extraction height" is set to the "high side" for the profile distance image (16 gradations) shown in FIG. 77A, the result is that only the high side from the reference plane is extracted. A low gradation distance image (8 gradations) as shown in FIG. 77B is obtained. In this way, it is possible to obtain a low gradation distance image with higher contrast and less noise components than those in FIG. 76C or the like. In this example, the final gradation conversion parameters are set to 1000 [gradation/mm] for gain, 0.080 [mm] for noise reduction, and ``high side'' for "extraction height". The distance image of 76B is tone-converted into the low-tone distance image of FIG. 76F.

このようにして、一点指定の実行に必要な条件が設定されると、指定された階調変換条件、すなわち基準高さ等に従って、入力画像が高階調な距離画像から低階調距離画像に階調変換され、図78に示すように、第一画像表示領域111に表示される。 When the conditions necessary for executing one-point designation are set in this way, the input image is scaled from a high-gradation range image to a low-gradation range image according to the specified gradation conversion conditions, that is, the reference height and the like. It is tone-converted and displayed in the first image display area 111 as shown in FIG.

ここで、基準面を一点指定で指定する方法が有効なワークの例を、図79A~図79Bに基づいて説明する。図79Aは、ワークの計測面において平面的な傾斜がない、又は多少の傾斜があっても検査処理に影響しないワークWK7を示している。ここでは、鋳物の表面に数字や文字列が立体的に形成されたワークWK7に対して、文字列が適切かどうかをOCRによって読み取る検査処理を行う。このような用途において、図67等に示した「抽出」ボタン144を押下することで、第二画像表示領域121上にスポイト状のアイコンSIを表示させる。そしてポインタ146で、図79Aに示すようにワークWK7上面の、文字列の形成されていない平面(背景面)の一点を指定する。これにより、ポインタ146で指定された抽出領域(図67の例では16画素)の高さを基準面として、階調変換が行われ、図79Bに示す低階調距離画像に変換される。この低階調距離画像では、ワークWK7の平面を背景として、ここから突出した文字列部分が綺麗に抽出されるので、正確なOCRを実行し易くできる。このように一点指定は、ワークに多少傾きがあっても検査処理には影響のないケースに有効に利用できる。また一点指定は低負荷で高速に処理できる利点も挙げられる。
(三点指定)
Here, an example of a workpiece for which the method of designating a reference surface by specifying one point is effective will be described with reference to FIGS. 79A and 79B. FIG. 79A shows a workpiece WK7 that does not have a planar inclination on the measurement surface of the workpiece, or that has a slight inclination that does not affect the inspection process. Here, an inspection process of reading whether or not the character string is appropriate is performed on the workpiece WK7 in which numbers and character strings are three-dimensionally formed on the surface of the casting by OCR. In such a use, the dropper-shaped icon SI is displayed on the second image display area 121 by pressing the "extract" button 144 shown in FIG. Then, with the pointer 146, one point on the upper surface of the work WK7 on which no character string is formed (background surface) is designated as shown in FIG. 79A. As a result, gradation conversion is performed using the height of the extraction region (16 pixels in the example of FIG. 67) designated by the pointer 146 as a reference plane, and the low gradation distance image shown in FIG. 79B is obtained. In this low gradation distance image, the character string portion protruding from the plane of the work WK7 is clearly extracted from the plane of the work WK7 as a background, so that accurate OCR can be easily performed. In this way, one-point designation can be effectively used in cases where the inspection process is not affected even if the workpiece is tilted to some extent. One point specification also has the advantage of low load and high speed processing.
(three points designation)

以上は、一点指定による階調変換条件の設定方法について説明した。次に三点指定による階調変換条件の設定方法について、図80~図85のGUI画面に基づいて説明する。三点指定とは、ユーザが指定した三点から求められる平面を基準面として、距離画像を低階調距離画像に階調変換する方法である。基準面も、上述した一点指定の基準高さと同様、例えば距離画像の高さ情報の内、低階調距離画像に階調変換される高さ範囲(距離レンジ)の中間の高さとする。あるいは、距離レンジの上限(階調変換される最も高い位置)や下限(階調変換される最も低い位置)とすることもできる。 The method for setting tone conversion conditions by specifying one point has been described above. Next, a method of setting tone conversion conditions by specifying three points will be described with reference to the GUI screens of FIGS. 80 to 85. FIG. The three-point designation is a method of tone-converting a distance image into a low-tone distance image using a plane obtained from three points designated by the user as a reference plane. Similarly to the one-point designation reference height described above, the reference plane is, for example, the middle height of the height range (distance range) in which the height information of the distance image is gradation-converted into the low-gradation distance image. Alternatively, the upper limit (highest position for tone conversion) or lower limit (lowest position for tone conversion) of the distance range can be used.

図62の三次元画像処理プログラムのGUI画面で「高さ抽出」ボタン116を押下し、図80に示す高さ抽出選択画面140に移行した状態で、抽出方法選択手段142で階調変換方法として、「三点指定(平面)」を選択する。これにより、図81に示す高さ抽出設定を行う三点指定画面170が表示される。
(三点指定画面170)
In the state where the "height extraction" button 116 is pressed on the GUI screen of the three-dimensional image processing program in FIG. 62 and the height extraction selection screen 140 shown in FIG. , select "Three points (plane)". As a result, a three-point designation screen 170 for performing height extraction setting shown in FIG. 81 is displayed.
(Three-point designation screen 170)

三点指定画面170では、階調変換の基準となる基準面を、第二画像表示領域121上で3点指定して設定する。このため図81の三点指定画面170では、高さ抽出手段が設けられる。具体的には、画面右の操作領域122中に設けられた「抽出」ボタン144を選択することで、図82に示す画面となり、画面左の第二画像表示領域121上で任意の位置を三点指定できるようになる。ここでは、高さ抽出手段として図67と同様に点状のポインタ146が表示されており、ユーザは所望の位置をマウスやトラックボール、あるいはタッチパネル等のポインティングデバイスで順次指定していく。まず一点目を第二画像表示領域121上で指定すると、指定された位置で図83のように矩形状が十字状に変化して、指定済みの位置を示すと共に、次の二点目を、同じくポインタ146でもって指定できるようになる。この時点で、図82に表示されているカラーの距離画像は、指定された一点目の高さを含む水平面を基準として階調変換を行い、階調変換後の低階調距離画像を濃淡画像として第二画像表示領域に表示する。さらに二点目を指定すると、図84に示すように二点目の位置が矩形状から十字状に変化すると共に、三点目が指定可能となる。この時点で、指定された2点の高さを含む傾斜面を基準として再度階調変換を行い、低階調距離画像を更新する。そして三点目を指定すると、これら指定済みの三点を含む平面でもって基準面が設定される。また、高さ抽出手段で各点を指定する際に、高さ抽出画面表示領域上で現在指定されている点の高さを、「Z高さ」表示欄152に表示させてもよい。 On the three-point designation screen 170 , three points on the second image display area 121 are designated and set as a reference plane that serves as a reference for gradation conversion. For this reason, the three-point designation screen 170 in FIG. 81 is provided with height extracting means. Specifically, by selecting the "Extract" button 144 provided in the operation area 122 on the right side of the screen, the screen shown in FIG. You will be able to specify points. Here, a point-like pointer 146 is displayed as height extracting means in the same manner as in FIG. 67, and the user sequentially designates a desired position with a mouse, trackball, or a pointing device such as a touch panel. First, when the first point is specified on the second image display area 121, the rectangular shape changes to a cross shape at the specified position as shown in FIG. Similarly, the pointer 146 can be used to specify. At this point, the color distance image displayed in FIG. is displayed in the second image display area. When the second point is further specified, the position of the second point changes from a rectangular shape to a cross shape as shown in FIG. 84, and the third point can be specified. At this point, the gradation conversion is performed again based on the inclined surface including the height of the two designated points, and the low gradation distance image is updated. Then, when the third point is specified, the reference plane is set by a plane containing these three specified points. Further, when each point is specified by the height extraction means, the height of the point currently specified on the height extraction screen display area may be displayed in the “Z height” display field 152 .

さらに、基準面の情報として、傾斜角を表示させることもできる。図84の例では、操作領域122に設けられた高さ抽出表示欄172において、基準面のX方向傾き、Y方向傾き、及び三点目のZ方向高さが表示されている。 Furthermore, the inclination angle can be displayed as the information of the reference plane. In the example of FIG. 84, the height extraction display field 172 provided in the operation area 122 displays the X-direction tilt, the Y-direction tilt, and the Z-direction height of the third point.

また、一点指定と同様、必要に応じて強調方法を指定することもできる。例えば、ゲイン調整手段を用いて、ゲイン調整を行ったり、三点指定「詳細設定」ボタン174を押下して図85に示すような三点指定詳細設定画面180を呼び出し、強調方法設定欄154にゲイン調整欄156に加えて「抽出高さ」設定欄182を表示させ、高さ抽出手段で抽出すべき高さ情報として、ドロップダウンリストから「高い側」、「低い側」、「高低両方」のいずれかを選択できる。 Also, as with single point designation, the emphasis method can also be designated as necessary. For example, use the gain adjustment means to adjust the gain, or press the three-point designation "detailed setting" button 174 to call the three-point designation detailed setting screen 180 as shown in FIG. In addition to the gain adjustment field 156, an "extraction height" setting field 182 is displayed, and height information to be extracted by the height extraction means is selected from a drop-down list of "high side", "low side", and "both high and low". You can choose either

このようにして、指定された三点で規定される任意の平面を基準面として、距離画像の階調変換を行うことが可能となる。この結果、上述した一点指定のような水平な平面を基準とする階調変換のみならず、傾斜させた平面を基準面とした階調変換も可能となる。例えば、ワーク表面の傾斜面の傷や異物を検査する用途において、傾斜面のままでは距離レンジが狭くなるところ、傾斜面に沿って基準面を設定することで、傾斜面をキャンセルでき、効率よく傷や異物を検出できる。このようにして、ワークや検査目的に応じて高さ情報を活用した、柔軟な階調変換を実現できる。 In this way, it is possible to perform gradation conversion of a distance image using an arbitrary plane defined by three specified points as a reference plane. As a result, not only the gradation conversion based on the horizontal plane, such as the one-point specification described above, but also the gradation conversion using an inclined plane as the reference plane becomes possible. For example, when inspecting for scratches or foreign matter on an inclined surface of a workpiece, the distance range would be narrower if the inclined surface were left as it was. Scratches and foreign objects can be detected. In this way, it is possible to realize flexible gradation conversion using height information according to the workpiece and inspection purpose.

ここで、基準面を三点指定で指定する方法が有効なワークの例を、図86A~図86Dに基づいて説明する。図86Aは、ワークの計測面において平面的な傾斜が生じていたり、微小な平面傾斜が存在すると、検査処理の結果に影響するようなワークWK8を示している。ここでは、基板上に形成されたボールグリッドアレイ(BGA)を検出する検査処理を行う。このような用途において、図84等に示した「抽出」ボタン144を押下することで、第二画像表示領域121上にスポイト状のアイコンSIを表示させる。そしてポインタ146で、図86Aに示すように、ワークWK8上面の内、BGAが形成されていない点を三点指定する。これにより、指定された三点を含む平面が基準面として抽出されて、階調変換が行われ、図86Bに示す低階調距離画像に変換される。この低階調距離画像では、ワークWK8の平面を背景として、ここから突出したBGAが綺麗に抽出されるので、例えばこれを図86Cに示すように二値化してBGAの形状を確認できる。この方法であれば、ワークWK8の平面に傾きがあっても正確に検出できる利点が得られる。仮に図86Aに示すワークWK8に傾きがあると、例えば一点指定では二値化された画像が図86Dに示すようになって、正しく検出できない。これに対して、三点指定では上述の通り傾きを補正して正確な検出結果が得られる。このように三点指定は、平面の傾きが検査処理結果に影響するケースで有効である。 Here, an example of a workpiece for which the method of specifying the reference surface by three-point specification is effective will be described with reference to FIGS. 86A to 86D. FIG. 86A shows a work WK8 in which the result of the inspection process is affected if there is a planar tilt on the measurement surface of the work or if there is a minute planar tilt. Here, an inspection process for detecting a ball grid array (BGA) formed on the substrate is performed. In such a use, the dropper-shaped icon SI is displayed on the second image display area 121 by pressing the "extract" button 144 shown in FIG. Then, with the pointer 146, as shown in FIG. 86A, three points on the upper surface of the workpiece WK8 where no BGA is formed are specified. As a result, a plane containing the specified three points is extracted as a reference plane, and gradation conversion is performed to convert it into the low gradation distance image shown in FIG. 86B. In this low gradation distance image, the BGA projecting from the plane of the workpiece WK8 is clearly extracted against the background, so that the shape of the BGA can be confirmed by binarizing it, for example, as shown in FIG. 86C. This method has the advantage of being able to accurately detect even if the plane of the work WK8 is tilted. If the workpiece WK8 shown in FIG. 86A is tilted, for example, one-point specification results in a binarized image as shown in FIG. 86D, which cannot be detected correctly. On the other hand, in three-point designation, the inclination is corrected as described above, and an accurate detection result is obtained. In this way, three-point designation is effective in cases where the inclination of the plane affects the result of inspection processing.

さらに、図87Aに示すような平面状のワークWK9の上面に緩やかな窪みを有する場合に、この窪みを検出する検査処理を考える。ここでは図87Aに示すように計測領域ROIを、窪みを含む領域に設定する。これにより、窪みを含んだ計測領域ROI内全体の高さデータから求めた平面を基準面として階調変換され、図87Bに示すような低階調距離画像が得られる。この例では最小二乗法で基準面を推定している。さらに得られた低階調距離画像を二値化して、図87Cに示す二値化画像を得る。これによって傾きを補正して、安定的に窪みの部分だけを抽出できる。仮に傾きがある状態で一点指定によって二値化画像を求めると、図87Dに示すような結果となって、傾斜面によって窪みの検出が困難となることが判る。このように、精度の高い基準面の推定に、三点指定が有効である。なお処理時間の面では、一点指定よりも処理時間がかかるものの、比較的高速に処理可能である。 Further, consider an inspection process for detecting a recess when the upper surface of a planar work WK9 as shown in FIG. 87A has a gentle recess. Here, as shown in FIG. 87A, the measurement area ROI is set to an area including a depression. As a result, gradation conversion is performed using the plane obtained from the height data of the entire measurement region ROI including the dent as the reference plane, and a low gradation distance image as shown in FIG. 87B is obtained. In this example, the reference plane is estimated by the method of least squares. Further, the obtained low-tone distance image is binarized to obtain the binarized image shown in FIG. 87C. This makes it possible to correct the tilt and stably extract only the recessed portion. If a binarized image is obtained by specifying one point in a state where there is an inclination, the result shown in FIG. 87D is obtained, and it can be seen that the inclined surface makes it difficult to detect depressions. In this way, three-point designation is effective for estimating a reference plane with high accuracy. In terms of processing time, although the processing time is longer than that of specifying one point, the processing can be performed at a relatively high speed.

以上は、設定段階で予め階調変換条件を指定して、運用時には指定された条件で階調変換を行う静的変換について説明した。いいかえると、静的変換では、階調変換パラメータは入力画像によらず一定値である。次に、検査対象の入力画像に応じて階調変換条件を調整する動的変換の具体例について、説明する。まず動的変換には、距離画像を低階調距離画像に階調変換する際に、残すべき高さ情報の基準を補正するため具体的な方法として、
(B1)入力画像に対して指定された平均抽出領域内の平均高さ(平均距離)を平均基準高さとして階調変換する平均高さ基準、
(B2)入力画像の指定領域内の推定平面を生成し、これを基準面として階調変換する平面基準、
(B3)入力画像から高周波成分を除いた自由曲面を生成し、これを基準面として階調変換する自由曲面基準
が含まれる。以下、各方法について順次説明する。
(B1:平均高さ基準)
In the above description, the static conversion is described in which the gradation conversion conditions are specified in advance at the setting stage and the gradation conversion is performed under the specified conditions during operation. In other words, in static conversion, the gradation conversion parameter is a constant value regardless of the input image. Next, a specific example of dynamic conversion for adjusting tone conversion conditions according to an input image to be inspected will be described. First, for dynamic conversion, as a specific method for correcting the standard of height information to be left when converting a distance image to a low-gradation distance image,
(B1) Average height reference for gradation conversion using the average height (average distance) in the average extraction area specified for the input image as the average reference height,
(B2) a plane reference for generating an estimated plane within a specified area of the input image and using this as a reference plane for gradation conversion;
(B3) A free-form surface reference is included in which a free-form surface is generated by removing high-frequency components from the input image and used as a reference surface for gradation conversion. Each method will be described below in order.
(B1: average height standard)

平均高さ基準は、入力画像毎に、指定された平均抽出領域内の平均高さを演算し、これを平均基準高さとして階調変換する方法である。平均基準高さを規定するための平均抽出領域は、運用に先立って予め設定される(上述した図8のステップS83)。以下、図8のステップS83において、平均抽出領域を指定する手順の一例について、図62、図65、図88~図92のGUIに基づいて説明する。まず、図62のGUI画面で「高さ抽出」ボタン116を選択して、図65の高さ抽出選択画面140に進み、抽出方法選択手段142で動的変換に該当する「リアルタイム抽出」を選択すると、図88の高さ動的抽出設定画面190となる。この例では、再びワークに消しゴムを用いた例を示している。次に抽出方法選択手段142の下方に設けられた「計算方法」選択欄192において、動的変換の基準を指定する。ここでは図89に示すようにドロップダウンボックスで、「平均高さ基準」、「平面基準」、「自由曲面基準」のいずれかを選択する。ここでは、「平均高さ基準」を選択する。これにより図90の平均高さ基準設定画面210に移行する。なお、図90、図91では説明の都合上、ワークに50円玉を用いた例を示している。 The average height reference is a method of calculating the average height within a designated average extraction area for each input image and using this as the average reference height for gradation conversion. The average extraction area for defining the average reference height is preset prior to operation (step S83 in FIG. 8 described above). An example of the procedure for specifying the average extraction area in step S83 of FIG. 8 will be described below with reference to the GUIs of FIGS. 62, 65, and 88 to 92. First, select the "height extraction" button 116 on the GUI screen of FIG. 62 to proceed to the height extraction selection screen 140 of FIG. Then, the height dynamic extraction setting screen 190 of FIG. 88 is displayed. In this example, an example using an eraser as the workpiece is shown again. Next, in the "calculation method" selection column 192 provided below the extraction method selection means 142, the standard of dynamic conversion is specified. Here, any one of "average height standard", "plane standard", and "free curved surface standard" is selected from a drop-down box as shown in FIG. Here, select "Average height standard". As a result, the screen shifts to the average height reference setting screen 210 in FIG. For convenience of explanation, FIGS. 90 and 91 show an example in which a 50-yen coin is used as the workpiece.

なお、動的変換に関する設定時には、実際の運用時に入力される距離画像とは異なる画像に対して、平均基準高さ等を設定する必要がある。このため、運用時のワークと対応する画像を事前に撮像し、これを登録画像として保存しておき、動的変換の設定に際しては登録画像を読み込んで、これを運用時のワーク画像に代用する形で各種の設定を行う。このため、図65等の画面において、「表示画像」選択欄124にて、該当する「登録画像」を指定する。 It should be noted that, when making settings related to dynamic conversion, it is necessary to set an average reference height and the like for an image different from the distance image input during actual operation. For this reason, an image corresponding to the workpiece during operation is captured in advance and saved as a registered image, and when setting dynamic conversion, the registered image is read and used as a substitute for the workpiece image during operation. Make various settings in the form. Therefore, the corresponding "registered image" is specified in the "display image" selection field 124 on the screen of FIG. 65 or the like.

平均高さ基準設定画面210では、別途設定された検査対象領域をそのまま用いるか、必要に応じて任意の平均抽出領域を指定する。平均抽出領域の指定は、矩形状、あるいは四隅の指定、中心と半径の指定による円形、自由曲線等、任意の方式が利用できる。また、ワークの一点のみを指定したり、逆にワークの全体、あるいは第二画像表示領域121で表示される画像の全体を、平均抽出領域とすることもできる。あるいは、上述の通り別途指定された検査対象領域を、平均抽出領域として利用することもできる。これらの場合は、高さ抽出手段による平均抽出領域の指定作業を省略してもよい。
(マスク領域)
On the average height reference setting screen 210, a separately set inspection target area is used as it is, or an arbitrary average extraction area is designated as necessary. Any method can be used for specifying the average extraction area, such as a rectangular shape, four corners, a circle by specifying the center and radius, or a free curve. It is also possible to designate only one point of the workpiece, or conversely, the entire workpiece or the entire image displayed in the second image display area 121 to be the average extraction area. Alternatively, as described above, the separately specified inspection target area can be used as the average extraction area. In these cases, the task of designating the average extraction area by the height extraction means may be omitted.
(mask area)

また、平均抽出領域に対して、平均高さを抽出しないマスク領域を指定することもできる。例えば図90の画面から、操作領域122に設けられた「抽出領域」ボタン194を押下すると、図91に示すマスク領域設定画面220に移行する。このマスク領域設定画面220上から、平均高さの抽出に不要なマスク領域を一以上指定できる。マスク領域の指定にも、上述の通り第二画像表示領域121上から、矩形状や円形状等、任意の領域を指定することで行える。 Moreover, it is possible to specify a mask area from which the average height is not extracted for the average extraction area. For example, when the "extraction area" button 194 provided in the operation area 122 is pressed on the screen of FIG. 90, the mask area setting screen 220 shown in FIG. 91 is displayed. On this mask area setting screen 220, one or more mask areas that are unnecessary for extracting the average height can be specified. The mask area can also be specified by specifying an arbitrary area such as a rectangular shape or a circular shape from the second image display area 121 as described above.

さらに、必要に応じてゲイン調整等を行うこともできる。例えば図90の画面から、操作領域122の右下に設けた「詳細設定」ボタン196を押下すると、図92に示す平均高さ基準詳細設定画面230に移行し、強調方法設定欄154にゲイン調整に加えて、抽出高さの指定やノイズ除去等の詳細な設定項目が表示される。 Furthermore, gain adjustment etc. can also be performed as needed. For example, when the "details setting" button 196 provided at the lower right of the operation area 122 is pressed from the screen of FIG. In addition, detailed setting items such as specification of extraction height and noise removal are displayed.

このようにして平均抽出領域が規定されると、設定画面を終了する。階調変換の際には、この平均抽出領域に含まれる高さ情報の平均値(平均基準高さ)を、基準高さとして、階調変換を行う。例えば、平均基準高さが、距離レンジの中心値(28=256階調の場合は0~255の距離レンジの中心値である128)となるようにして階調変換する。また、平均抽出領域に含まれるすべての点の高さ情報を必ずしもすべて利用する必要はなく、適宜間引く、あるいは平均化する等、処理を簡略化することもできる。 After the average extraction area is defined in this manner, the setting screen is terminated. At the time of gradation conversion, gradation conversion is performed using the average value (average reference height) of the height information contained in this average extraction area as the reference height. For example, gradation conversion is performed so that the average reference height becomes the center value of the distance range (128, which is the center value of the distance range from 0 to 255 in the case of 2 8 =256 gradations). Moreover, it is not necessary to use all the height information of all the points included in the average extraction area, and the processing can be simplified by appropriately thinning out or averaging.

そして運用時において、後述する図133に示す手順で動的変換が行われる。例えばライン上を搬送されるワークを撮像して距離画像を生成し(ステップS13301)、上記で設定された平均抽出領域の平均高さを演算し(ステップS13302)、これに基づいて階調変換を実行して低階調距離画像を生成し(ステップS13303)、得られた低階調距離画像に対して検査を行う(ステップS13304)。この方法であれば、ワークの高さ方向にばらつきがある場合でも、ワーク毎に階調変換の基準面を毎回再設定できるため、ワークの高さ方向のばらつきによらず、正確な検査が実現できる。 During operation, dynamic conversion is performed according to the procedure shown in FIG. 133, which will be described later. For example, a workpiece conveyed on a line is imaged to generate a distance image (step S13301), the average height of the average extraction area set above is calculated (step S13302), and gradation conversion is performed based on this. A low gradation distance image is generated by execution (step S13303), and the obtained low gradation distance image is inspected (step S13304). With this method, even if there is variation in the height direction of the workpiece, the reference plane for gradation conversion can be reset for each workpiece, so accurate inspection can be achieved regardless of variations in the height direction of the workpiece. can.

ここで、基準面を平均高さ基準で指定する方法が有効なワークの例を、図93A~図93Bに基づいて説明する。図93Aは、上述した図79Aと同様、ワークの計測面において平面的な傾斜がないか、多少の傾斜があっても検査処理に影響しないワークWK7であり、鋳物の表面に数字や文字列が立体的に形成されたワークWK7に対して、文字列が適切かどうかをOCRによって読み取る検査処理を行う。このような用途において、図92等に示した抽出領域設定画面で、第二画像表示領域121上に矩形状に平均高さ基準を決定する計測領域ROIを設定する。ここでは図93Aに示すように、ワークWK7上面で文字列を囲む平面を計測領域ROIとして指定する。これにより、計測領域ROIの高さを基準面として、階調変換が行われ、図93Bに示す低階調距離画像に変換される。この低階調距離画像でも、図79Bと同様、ワークWK7の平面を背景として、ここから突出した文字列部分が綺麗に抽出されるので、正確なOCRを実行し易くできる。また、上述した図79AではワークWK7上の一点のみを指定することから、選択した点がノイズの影響を受ける可能性があるのに対し、図93Aでは平面で指定することから、このようなのノイズの影響を低減できる利点が得られる。
(平面基準)
An example of a workpiece for which the method of designating the reference plane based on the average height is effective will now be described with reference to FIGS. 93A and 93B. FIG. 93A shows a workpiece WK7 that does not affect the inspection process even if there is no planar inclination or slight inclination on the measurement surface of the workpiece, similar to FIG. 79A described above. An inspection process for reading whether the character string is appropriate or not is performed on the three-dimensionally formed work WK7 by OCR. In such a use, a rectangular measurement region ROI for determining the average height reference is set on the second image display region 121 on the extraction region setting screen shown in FIG. 92 and the like. Here, as shown in FIG. 93A, a plane surrounding the character string on the upper surface of the work WK7 is designated as the measurement region ROI. As a result, gradation conversion is performed using the height of the measurement region ROI as a reference plane, and the low gradation distance image shown in FIG. 93B is obtained. As in FIG. 79B, the low gradation distance image also allows the character string portion projecting from the plane of the work WK7 to be cleanly extracted from the plane of the work WK7 as a background, thereby facilitating accurate OCR. In addition, since only one point on the workpiece WK7 is specified in FIG. 79A described above, the selected point may be affected by noise, whereas in FIG. It has the advantage of reducing the influence of
(plane reference)

以上は、平均高さ基準でもって動的変換を行う例について説明した。次に、別の動的変換として、入力画像に対して予め指定された基準面推定領域内に含まれる平面を推定し、この推定面を基準面として階調変換する平面基準について説明する。この方法では、例えばワークの表面が傾斜している場合等に、傾斜成分をキャンセルして階調変換を行えるため、上述した静的変換の三点指定と同様に活用できる利点が得られる。以下、平面基準の具体的な設定方法を説明する。平面基準においても、上述した平均高さ基準と同様、基準面を決定するための基準面推定領域は、運用に先立って予め設定される(上述した図8のステップS83)。以下、図8のステップS83において、基準面推定領域を指定する手順の一例について、図62、図88、図92~図95のGUIに基づいて説明する。まず、図62のGUI画面で「高さ抽出」ボタン116を選択して、図80の高さ抽出選択画面140に進み、抽出方法選択手段142で動的変換に該当する「リアルタイム抽出」を選択すると、図88の高さ動的抽出設定画面190となる。次に「計算方法」選択欄192において、図89に示すように動的変換の基準として、「平面基準」を選択すると、図92の平面基準設定画面に移行する。 An example of performing dynamic conversion based on the average height has been described above. Next, as another dynamic transformation, a plane reference for estimating a plane included in a reference plane estimation region specified in advance for an input image and performing gradation conversion using this estimated plane as a reference plane will be described. In this method, for example, when the surface of the workpiece is inclined, the gradient component can be canceled and the gradation conversion can be performed. Therefore, it has the advantage of being able to be utilized in the same manner as the three-point specification of the static conversion described above. A specific method for setting the plane reference will be described below. Also in the plane reference, the reference plane estimation area for determining the reference plane is set in advance (step S83 in FIG. 8 described above), similarly to the average height reference described above. An example of the procedure for specifying the reference plane estimation area in step S83 of FIG. 8 will be described below based on the GUIs of FIGS. 62, 88, and 92 to 95. FIG. First, select the "height extraction" button 116 on the GUI screen of FIG. 62 to proceed to the height extraction selection screen 140 of FIG. Then, the height dynamic extraction setting screen 190 of FIG. 88 is displayed. Next, in the "calculation method" selection column 192, as shown in FIG. 89, when "plane reference" is selected as a reference for dynamic conversion, the plane reference setting screen shown in FIG. 92 is displayed.

平面基準設定画面では、上述した図80の高さ抽出選択画面140における高さ抽出手段と同様、別途設定された検査対象領域をそのまま用いるか、必要に応じて任意の基準面推定領域を指定する。基準面推定領域の指定は、矩形状、あるいは四隅の指定、中心と半径の指定による円形、自由曲線等、任意の方式が利用できる。また、ワークの一点のみを指定したり、逆にワークの全体、あるいは第二画像表示領域121で表示される画像の全体を、基準面推定領域とすることもできる。 On the plane reference setting screen, similarly to the height extraction means in the height extraction selection screen 140 of FIG. 80, the separately set inspection target area is used as it is, or an arbitrary reference plane estimation area is specified as necessary. . The reference plane estimation area can be specified by any method such as a rectangular shape, a circle by specifying four corners, a circle by specifying a center and a radius, or a free curve. It is also possible to designate only one point on the workpiece, or conversely, to set the entire workpiece or the entire image displayed in the second image display area 121 as the reference plane estimation area.

また、基準面推定領域に対して、推定面を推定しないマスク領域を指定することもできることは、上述した図90等と同様である。さらに、必要に応じてゲイン調整や抽出高さの指定、ノイズ除去等を行うこともできるのも、上記と同様である。例えば、図92の画面において、操作領域122に設けられた「詳細設定」ボタン222を押下すると、図94の平面基準詳細設定画面240となり、強調方法設定欄154にはゲイン調整欄156に加え、抽出高さを指定する「抽出高さ」設定欄162やノイズ除去のためのノイズ除去設定欄164、無効画素を指定するための無効画素指定欄166が表示され、これらの詳細な設定が可能となる。また無効画素指定欄166においては、図95に示すように、距離を求められなかった無効な画素を指定された規定値の他、背景の画素値やユーザが指定する任意の値で埋めることができる。 Also, it is possible to specify a mask area in which the estimation plane is not estimated for the reference plane estimation area, as in FIG. 90 and the like described above. Furthermore, it is also possible to perform gain adjustment, extraction height specification, noise removal, etc., as required, as in the above case. For example, on the screen of FIG. 92, when the "detailed setting" button 222 provided in the operation area 122 is pressed, the plane reference detailed setting screen 240 of FIG. 94 is displayed. An "extraction height" setting field 162 for designating an extraction height, a noise removal setting field 164 for noise removal, and an invalid pixel designation field 166 for designating invalid pixels are displayed, and these detailed settings can be made. Become. In the invalid pixel specification field 166, as shown in FIG. 95, invalid pixels for which the distance cannot be obtained can be filled with a specified default value, a background pixel value, or an arbitrary value specified by the user. can.

このようにして基準面推定領域が規定されると、設定画面を終了する。階調変換の際には、この基準面推定領域に含まれる高さ情報から、平面状の推定面を演算する。基準面推定領域内に分布する高さ情報のフィッティングには、最小二乗法等、既知の方法が適宜利用できる。なお、基準面推定領域に含まれるすべての点の高さ情報を推定面の演算に利用する必要は必ずしもなく、適宜間引く、あるいは平均化する等、処理を簡略化することもできることは上述の通りである。 When the reference plane estimation area is defined in this manner, the setting screen is terminated. At the time of gradation conversion, a planar estimated plane is calculated from the height information included in this reference plane estimated area. A known method such as the least squares method can be appropriately used for fitting the height information distributed within the reference plane estimation region. It should be noted that it is not always necessary to use the height information of all points included in the reference plane estimation area for calculation of the estimation plane, and it is possible to simplify the processing by appropriately thinning out or averaging, as described above. is.

このようにして推定面が決定されると、この推定面を基準として、階調変換を行う。例えば、推定面が距離レンジの中心値となるようにして階調変換する。また、演算された推定面の情報を表示させることもできる。例えば図92に示す例では、操作領域122に設けられた推定面表示欄において、推定面のX方向傾き、Y方向傾き、及び推定面のZ方向高さが表示されている。なお、この例では推定面を一枚の平面としたが、複数枚の平面を組み合わせた推定面とすることもできる。また、この例では推定面を平面としたが、推定面を球面等の単純な曲面として演算することも可能である。 After the estimated plane is determined in this way, tone conversion is performed with reference to this estimated plane. For example, gradation conversion is performed so that the estimated plane becomes the central value of the distance range. It is also possible to display information on the calculated estimated surface. For example, in the example shown in FIG. 92, in the estimated plane display field provided in the operation area 122, the tilt in the X direction, the tilt in the Y direction, and the height in the Z direction of the estimated plane are displayed. In this example, the estimated plane is one plane, but it is also possible to combine a plurality of planes to make the estimated plane. Also, in this example, the estimated surface is a flat surface, but it is also possible to calculate the estimated surface as a simple curved surface such as a spherical surface.

また基準面を平面基準で指定する方法が有効なワークの例として、上述した図86Aや図87Aが挙げられる。このようなワークに対して平面基準を設定することで、仮にワークの上面に傾斜があっても傾斜分を補正して基準面が検出されるため、上述した三点指定と同様、正確なBGAパターンの検出が実現される。
(B3:自由曲面基準)
Examples of workpieces for which the method of designating the reference plane based on the plane reference is effective include the above-described FIG. 86A and FIG. 87A. By setting a plane reference for such a workpiece, even if the upper surface of the workpiece is inclined, the reference plane can be detected by correcting the inclination. Pattern detection is achieved.
(B3: free-form surface reference)

最後に、入力画像の所定の領域(自由曲面対象領域)から高周波成分を除いた自由曲面を生成し、これを基準面として階調変換する自由曲面基準について説明する。例えばワークが曲面を有する等、単純な平面では近似が困難な場合は、検査したい領域の高さ情報を精度よく抽出することが難しい。そこで、入力画像から高周波成分を除いて単純化した画像を生成して、この画像の表面形状(自由曲面)を基準面として利用することで、大まかな形状やなだらかな変化を無視し、急激な変化を生じている部分、すなわち細かな形状のみを残した検査を可能とできる。 Finally, a free-form surface reference is described in which a free-form surface is generated by removing high-frequency components from a predetermined area (free-form surface target area) of an input image, and tone conversion is performed using this as a reference surface. For example, when the workpiece has a curved surface, and approximation using a simple plane is difficult, it is difficult to accurately extract the height information of the area to be inspected. Therefore, by generating a simplified image by removing high-frequency components from the input image and using the surface shape (free-form surface) of this image as a reference plane, rough shapes and gentle changes can be ignored, and sudden changes can be avoided. It is possible to perform an inspection while leaving only the part where the change occurs, that is, the fine shape.

以下、自由曲面基準の具体的な設定方法を、図62~図96のGUIに基づいて説明する。自由曲面基準においても、上述した平均高さ基準等と同様、基準面を決定するための必要な条件は運用に先立って予め設定される(上述した図8のステップS83)。まず、図62のGUI画面で「高さ抽出」ボタン116を選択して、図80の高さ抽出選択画面140に進み、抽出方法選択手段142で動的変換に該当する「リアルタイム抽出」を選択すると、図88の高さ動的抽出設定画面190となる。次に「計算方法」選択欄192において、図89に示すように動的変換の基準として、「自由曲面基準」を選択する。これにより図96の自由曲面基準設定画面250に移行する。 A specific method for setting the free-form surface reference will be described below with reference to the GUIs of FIGS. 62 to 96. FIG. In the free-form surface reference as well, the necessary conditions for determining the reference surface are set in advance (step S83 in FIG. 8 described above), similarly to the above-described average height reference and the like. First, select the "height extraction" button 116 on the GUI screen of FIG. 62 to proceed to the height extraction selection screen 140 of FIG. Then, the height dynamic extraction setting screen 190 of FIG. 88 is displayed. Next, in the "calculation method" selection column 192, as shown in FIG. 89, "free curved surface reference" is selected as the reference for dynamic transformation. As a result, the free-form surface reference setting screen 250 shown in FIG. 96 is displayed.

自由曲面基準設定画面250でも、任意の領域を自由曲面対象領域として指定することも可能であるが、好ましくは、第二画像表示領域121で表示される画像の全体、又は別途指定された検査対象領域を、そのまま自由曲面対象領域として利用する。自由曲面対象領域として指定された領域から、高調波成分を除去して自由曲面を生成する。そして第二画像表示領域121上で表示される自由曲面対象領域に、自由曲面を基準面として階調変換を行った階調変換画像を重ねて表示させる。また、階調変換に際して、必要に応じてゲイン調整や抽出高さの指定、ノイズ除去等を行うこともできるのも、上述した図90等と同様である。
(抽出サイズ調整手段)
Although it is possible to designate an arbitrary area as the free-form surface target area on the free-form surface reference setting screen 250 as well, preferably, the entire image displayed in the second image display area 121 or a separately designated inspection object The area is used as it is as the free-form surface target area. A free-form surface is generated by removing harmonic components from the area specified as the free-form surface target area. Then, a gradation-converted image obtained by performing gradation conversion using the free-form surface as a reference plane is superimposed and displayed on the free-form surface object area displayed on the second image display area 121 . In addition, gain adjustment, designation of extraction height, noise removal, etc., can be performed as necessary at the time of gradation conversion, as in FIG. 90 and the like described above.
(Extraction size adjustment means)

さらに、自由曲面基準で抽出される抽出面の細かさ(抽出サイズ)を調整する抽出サイズ調整機能も備えている。具体的には、図96において、操作欄の「抽出面の詳細設定」欄に、抽出サイズ調整手段として「抽出サイズ」指定欄252を設けている。「抽出サイズ」指定欄252の数値を増減させると、これに応じて自由曲面の曲率が変化し、抽出可能な欠陥のサイズが変動する。ここでは、設定されたサイズ以下の凹凸が抽出されるように、自由曲面画像が生成され、第二画像表示領域121に表示される。抽出サイズを大きくすると滑らかな自由曲面が生成され、設定された抽出サイズに応じた大きさの欠陥が抽出できる。一方、抽出サイズを小さくすると、ワークの表面形状に沿った自由曲面が生成されるようになり、設定された抽出サイズに応じた小さな欠陥のみが抽出される。例えば、抽出サイズを大きくすると図97に示すように自由曲面がワークの表面形状に対して滑らかとなるので、平滑化された基準面でもって抽出される凹凸が明瞭になる。逆に数値を小さくすると、図90に示すように自由曲面がワークの表面形状の凹凸に沿った詳細な形状に近づくため、結果としてこのような複雑な基準面でもって抽出される凹凸は不鮮明となる。また、「抽出サイズ」指定欄252の数値を増減させると、これにつれて第二画像表示領域121において表示されている自由曲面対象領域内の階調変換画像も、基準面として内部的に生成される自由曲面の状態が変化し、基準面からの差分として抽出・表示される対象物の大きさがリアルタイムに変化する。ユーザは、第二画像表示領域121を参照しながら、「抽出サイズ」指定欄252の数値を最適に調整できる。 It also has an extraction size adjustment function that adjusts the fineness (extraction size) of the extraction surface extracted based on the free-form surface. Specifically, in FIG. 96, an "extraction size" designation field 252 is provided as an extraction size adjustment means in the "detailed setting of extraction surface" field of the operation field. By increasing or decreasing the numerical value in the "extraction size" designation field 252, the curvature of the free-form surface changes accordingly, and the size of extractable defects changes. Here, a free-form surface image is generated and displayed in the second image display area 121 so that unevenness having a size equal to or less than the set size is extracted. When the extraction size is increased, a smooth free-form surface is generated, and defects of a size corresponding to the set extraction size can be extracted. On the other hand, if the extraction size is reduced, a free-form surface along the surface shape of the workpiece is generated, and only small defects corresponding to the set extraction size are extracted. For example, if the extraction size is increased, the free-form surface becomes smooth with respect to the surface shape of the workpiece as shown in FIG. Conversely, if the numerical value is decreased, the free-form surface becomes closer to a detailed shape along the unevenness of the surface shape of the workpiece as shown in FIG. Become. In addition, when the numerical value of the "extraction size" designation field 252 is increased or decreased, the gradation-converted image within the free-form surface target area displayed in the second image display area 121 is also internally generated as a reference plane accordingly. The state of the free-form surface changes, and the size of the object extracted and displayed as the difference from the reference surface changes in real time. The user can optimally adjust the numerical value in the “extraction size” designation field 252 while referring to the second image display area 121 .

このようにして自由曲面対象領域が規定されると、設定画面を終了する。階調変換の際には、この自由曲面対象領域に含まれる画像の高さ情報から、自由曲面を演算する。自由曲面対象領域内に分布する高さ情報のフィッティングには、図161のフローチャートに示すように、設定された抽出サイズに応じた画像縮小処理(ステップS1611)とフィルタ処理(ステップS1612)と画像拡大処理(ステップS1613)を行って、自由曲面画像を生成する方法が利用できる。フィルタ処理には、例えばメディアンフィルタが利用できる。このようにして自由曲面が決定されると、元の画像から差分を取ることで(ステップS1614)、抽出される凹凸などを明確にできる。あるいは、上述の通り最小二乗法等、既知の方法が適宜利用できる。なお、自由曲面対象領域に含まれるすべての点の高さ情報を推定面の演算に利用する必要は必ずしもなく、適宜間引く、あるいは平均化する等、処理を簡略化できることは上述の通りである。このようにして自由曲面が決定されると、この自由曲面を基準として、階調変換を行う。例えば、自由曲面が距離レンジの中心値となるように階調変換する。 When the free-form surface target area is defined in this manner, the setting screen is terminated. At the time of gradation conversion, a free-form surface is calculated from the height information of the image included in this free-form surface target area. As shown in the flowchart of FIG. 161, the fitting of the height information distributed within the free-form surface target region includes image reduction processing (step S1611), filtering processing (step S1612), and image enlargement processing according to the set extraction size. A method of performing processing (step S1613) to generate a free-form surface image can be used. A median filter, for example, can be used for filtering. When the free-form surface is determined in this way, the difference can be taken from the original image (step S1614) to clarify extracted irregularities and the like. Alternatively, as described above, a known method such as the method of least squares can be used as appropriate. As described above, it is not always necessary to use the height information of all points included in the free-form surface target area for calculation of the estimated surface, and the processing can be simplified by appropriately thinning out or averaging. After the free-form surface is determined in this manner, tone conversion is performed with reference to this free-form surface. For example, gradation conversion is performed so that the free-form surface becomes the central value of the distance range.

ここで、基準面を自由曲面で指定する方法が有効なワークの例を、図98A~図98Bに基づいて説明する。図98Aは、ワークの曲面状の面に含まれる突起物や窪み等の欠陥を検出する検査処理を示している。ここで計測領域ROIとして曲面から欠陥を含む領域を指定する。そして、指定された計測領域ROI内に含まれる高さ情報から自由曲面を求めて、得られた自由曲面を基準面として階調変換を行う。得られた低階調距離画像を図98Bに示す。この図に示すように、自由曲面を基準として、この面より高い部分を突起物(図98Bにおいて白点で表示される)、低い部分を窪み(図98Bにおいて黒点で表示される)として、それぞれ検出できる。このように、自由曲面による基準面の指定は、曲面形状のワークに対して有効に利用できる。なお、自由曲面の検出の処理負荷は、上述した一点指定や三点指定に比べて高い。
(欠陥抽出処理)
An example of a workpiece for which the method of designating a free-form surface as a reference surface is effective will now be described with reference to FIGS. 98A and 98B. FIG. 98A shows inspection processing for detecting defects such as protrusions and depressions included in the curved surface of the work. Here, an area including a defect is designated from the curved surface as the measurement area ROI. Then, a free-form surface is obtained from the height information included in the designated measurement region ROI, and tone conversion is performed using the obtained free-form surface as a reference plane. The resulting low-gradation distance image is shown in FIG. 98B. As shown in this figure, with the free-form surface as a reference, portions higher than this surface are protrusions (represented by white dots in FIG. 98B), and portions lower than this surface are recesses (represented by black dots in FIG. 98B). detectable. Designation of a reference plane by a free-form surface in this way can be effectively used for a workpiece having a curved surface shape. Note that the processing load for detecting a free-form surface is higher than the one-point designation and three-point designation described above.
(Defect extraction processing)

上述した自由曲面基準において、図161のステップS1611で示す画像縮小処理に際して、距離画像の縦横、すなわちXY方向に対して圧縮を行うと、検査対象物の曲面の状態によっては曲面と欠陥とを分離しきれず、思うように傷を抽出できない場合がある。例えば、図162に示すようなチューブ状の検査対象物を撮像した距離画像において、抽出対象1と抽出対象2を抽出しようとする例を考える。このような距離画像に対して、自由曲面基準を選択してXY方向に画像の圧縮を行うと、図163に示すように、チューブ状の長さ方向に沿って存在する山谷も抽出されてしまい、その一方で本来抽出したい抽出対象2は綺麗に抽出されていない状態となる。
(抽出方向指定手段)
In the above-described free-form surface criterion, when the depth image is compressed in the vertical and horizontal directions, that is, in the XY directions, in the image reduction process shown in step S1611 of FIG. It may not be possible to extract the scratches as expected. For example, consider an example of trying to extract an extraction target 1 and an extraction target 2 in a distance image obtained by imaging a tube-shaped inspection object as shown in FIG. 162 . If the free-form surface criterion is selected for such a range image and the image is compressed in the XY directions, as shown in FIG. On the other hand, the extraction object 2 that is originally desired to be extracted is not extracted cleanly.
(Extraction direction designating means)

そこで、このような場合でも正確な欠陥検出が実現できるように、検査対象面において特定の方向に連続して存在する形状を除外して、欠陥すなわち局所的な凹凸を抽出する抽出方向指定機能を設けることもできる。例えば、検査条件の指定時に抽出方向を指定可能な抽出方向指定手段を設ける。具体的には図89等に示すGUIの「計算方法」選択欄192において「自由曲面基準」を選択すると、上述した図96等に代えて、図164の自由曲面基準設定画面630のGUIを表示させる。図164の自由曲面基準設定画面630においては、「抽出サイズ」指定欄252の下方に、抽出方向指定手段の一形態として「抽出方向」指定欄632を追加する。「抽出方向」指定欄632においては、抽出すべき欠陥等の局所的な形状変化を抽出する方向を指定する。この例では予め設定された選択肢として、「X」,「Y」,「XY」のいずれかをドロップダウンリスト等により選択できる。また図164の画面において「詳細設定」ボタン222を押下すると、同様に図165に示す詳細設定画面640に切り替わり、強調方法設定欄154にはゲイン調整欄156、「抽出高さ」設定欄162、ノイズ除去設定欄164、無効画素指定欄166等が表示され、これらの詳細な設定が可能となる。 Therefore, in order to realize accurate defect detection even in such cases, an extraction direction specification function is provided to extract defects, that is, local irregularities, by excluding shapes that exist continuously in a specific direction on the inspection target surface. can also be provided. For example, an extraction direction designation means is provided that can designate an extraction direction when designating inspection conditions. Specifically, when "free curved surface reference" is selected in the "calculation method" selection column 192 of the GUI shown in FIG. Let In the free-form surface reference setting screen 630 of FIG. 164, an “extraction direction” designation field 632 is added below the “extraction size” designation field 252 as a form of extraction direction designation means. In the "extraction direction" designation field 632, the direction for extracting local shape changes such as defects to be extracted is designated. In this example, one of "X", "Y" and "XY" can be selected from a drop-down list or the like as preset options. 164, the screen in FIG. 164 is similarly switched to a detailed setting screen 640 shown in FIG. A noise removal setting field 164, an invalid pixel designation field 166, and the like are displayed, and detailed settings thereof can be made.

例えば図164や図165の画面で「抽出方向」指定欄632において「Y」を選択すると、画像のY方向(図162において縦方向)における局所的な形状変化を抽出する。言い換えると、Y方向において変化しない形状、例えば縦方向に延びる溝等は無視されて、図166に示すような検出結果が得られる。同様にXを選択すると、画像のX方向(図162において横方向)における形状変化が抽出される。またXYを選択すると、図163に示したような、XY方向における局所的な形状変化が抽出される。これにより、検査対象物の形状に応じて抽出方向を指定することで、不要な形状をキャンセルして所望の形状を適切に抽出できる。例えば図167に示すような検査対象物において、文字列1、文字列2を抽出したい場合、XY方向に抽出しようとすると図168に示すように長手方向に存在する凹凸も検出されてしまうが、抽出方向としてY方向を指定することで、図169に示すようにY方向に一様な形状を除去して、所望の文字列を正確に抽出できる。 For example, if "Y" is selected in the "extraction direction" designation field 632 on the screens of FIGS. 164 and 165, local shape changes in the Y direction (vertical direction in FIG. 162) of the image are extracted. In other words, shapes that do not change in the Y direction, such as grooves extending in the vertical direction, are ignored, and the detection results shown in FIG. 166 are obtained. Similarly, if X is selected, shape change in the X direction (horizontal direction in FIG. 162) of the image is extracted. When XY is selected, local shape changes in the XY directions are extracted as shown in FIG. As a result, by designating the extraction direction according to the shape of the object to be inspected, unnecessary shapes can be canceled and the desired shape can be appropriately extracted. For example, if character strings 1 and 2 are to be extracted from an object to be inspected as shown in FIG. By specifying the Y direction as the extraction direction, a desired character string can be accurately extracted by removing uniform shapes in the Y direction as shown in FIG.

ここで具体的な欠陥抽出処理等の形状抽出方法として、図166、図169に示したY方向の抽出処理を例として説明する。上述した画像縮小処理(図161のステップS1611)において、画像のY方向にのみ縮小を行う。この結果、フィルタ処理(ステップS1612)と画像拡大処理(ステップS1613)を得て得られた基準となる自由曲面画像は、Y方向の細かい凹凸が除去され、Y方向にのみ平滑化された自由曲面画像が生成されることとなる。いいかえると、Y方向に一様なキャンセル対象の形状のみが残された画像を得られる。このため、対象となる元画像に対して、この自由曲面画像との差分を取ると(ステップS1614)、Y方向に一様なキャンセル対象の形状が除去されることとなり、結果としてY方向に細かく凹凸した形状変化のみが残されることとなる。これにより、所望の方向における形状変化のみを抽出することが実現される。 Here, as a specific shape extraction method such as defect extraction processing, extraction processing in the Y direction shown in FIGS. 166 and 169 will be described as an example. In the image reduction process described above (step S1611 in FIG. 161), the image is reduced only in the Y direction. As a result, the reference free-form surface image obtained by filtering (step S1612) and image enlargement processing (step S1613) is a free-form surface smoothed only in the Y direction with fine irregularities in the Y direction removed. An image will be generated. In other words, it is possible to obtain an image in which only the uniform shape to be canceled in the Y direction is left. Therefore, when the difference between the target original image and this free-form surface image is taken (step S1614), the shape to be canceled that is uniform in the Y direction is removed, resulting in a finer shape in the Y direction. Only the uneven shape change is left. This realizes extraction of shape changes only in a desired direction.

このような処理は、特に一方向に長い検査対象物の検査に有効である。検査対象物の長手方向に沿って抽出方向を指定することで、長手方向に沿って連続した一様形状をキャンセルでき、正確な欠陥抽出が実現できる。 Such processing is particularly effective for inspection of an inspection object that is long in one direction. By specifying the extraction direction along the longitudinal direction of the object to be inspected, uniform shapes that are continuous along the longitudinal direction can be canceled, and accurate defect extraction can be realized.

また、このような一方向に連続した検査対象物(例えばタイヤのような、一方向に一様な形状を持つ製品)の高さ情報を取得するには、構造化照明以外に、上述した光切断法を用いた検査が好適に適用できる。特に光切断法は、ライン状の切断面の形状(プロファイル)を取得する方法であるため、一方向に長い検査対象物に対して、切断位置を変化させながら連続的にプロファイルを取得し、得られたプロファイルを合成することで距離画像を取得できる。この方法であれば、検査対象物が移動する場合でも、いいかえると検査対象物を静止させなくとも検査できるため、例えば工場のライン上を搬送される製品の検査のような用途において、搬送される製品を停止させることなく不良品の検出を行うことが可能となる。 In addition, in order to acquire height information of such an object to be inspected that is continuous in one direction (for example, a product that has a uniform shape in one direction, such as a tire), in addition to structured illumination, the above-described light An inspection using a cutting method can be preferably applied. In particular, the light-section method is a method for acquiring the shape (profile) of a line-shaped cut surface, so the profile is continuously acquired while changing the cutting position for an inspection object that is long in one direction. A range image can be obtained by synthesizing the obtained profiles. With this method, even if the object to be inspected is moving, in other words, it can be inspected without being stationary. It becomes possible to detect defective products without stopping the product.

なお以上の例では、欠陥抽出処理を自由曲面基準に適用する例を説明したが、本発明は自由曲面基準に限らず、他の基準面に対しても適用できる。例えば、基準面として平均高さ基準を選択した際に、上述した欠陥抽出処理を適用することで、指定された方向に、ライン毎の平均高さを求めて、その平均高さからの差分を取ることができる。この方法によれば処理が単純なため、高速な処理が可能となる利点が得られる。
(抽出領域設定ダイヤログ148)
In the above example, the defect extraction process is applied to the free-form surface reference, but the present invention is not limited to the free-form surface reference and can be applied to other reference surfaces. For example, when the average height criterion is selected as the reference plane, the above-described defect extraction processing is applied to obtain the average height of each line in the specified direction, and the difference from the average height is calculated. can take. This method has the advantage that high-speed processing is possible because the processing is simple.
(Extraction area setting dialog 148)

さらに、高さ抽出を行うに際して、入力画像から基準平面を算出するための対象領域(抽出領域)は、検査処理を行う検査対象領域(計測領域)と同じ領域とする他、計測領域とは別個に設定することもできる。一例として、図90において、「抽出領域」ボタン147を押下すると、図99に示すように抽出領域を設定可能な抽出領域設定ダイヤログ148が表示される。この抽出領域設定ダイヤログ148には抽出領域選択欄149が設けられ、抽出領域選択欄149からユーザは「計測領域と同じ」、「矩形」、「円形」、「回転矩形」等を選択できる。「計測領域と同じ」を選択すると、上述の通り抽出領域が計測領域と同じとなる。一方、「計測領域と同じ」以外を選択することで、計測領域とは異なる領域を抽出領域として設定できる。例えば図100に示すように抽出領域選択欄149で「矩形」を選択すると、第二画像表示領域121において矩形状の枠が表示され、ユーザは所望の領域をマウスのドラッグ等によって指定できる。また図100の抽出領域選択欄149の右に設けられた「編集」ボタン324を押下すると、図101に示すように抽出領域編集ダイヤログ326が表示され、矩形状の抽出領域をxy座標で数値により指定できる。抽出領域編集ダイヤログ326で抽出領域が調整されると、その変更が第二画像表示領域121において反映される。
(マスク領域設定欄330)
Furthermore, when performing height extraction, the target area (extraction area) for calculating the reference plane from the input image is the same area as the inspection target area (measurement area) for inspection processing, and is separate from the measurement area. can also be set to As an example, in FIG. 90, pressing an "extraction area" button 147 displays an extraction area setting dialog 148, as shown in FIG. 99, in which an extraction area can be set. The extraction area setting dialog 148 is provided with an extraction area selection column 149 from which the user can select "same as measurement area", "rectangle", "circle", "rotated rectangle", and the like. If "same as measurement area" is selected, the extraction area will be the same as the measurement area as described above. On the other hand, by selecting other than "same as measurement area", an area different from the measurement area can be set as the extraction area. For example, when "Rectangle" is selected in the extraction area selection field 149 as shown in FIG. 100, a rectangular frame is displayed in the second image display area 121, and the user can specify the desired area by dragging the mouse. When the "Edit" button 324 provided to the right of the extraction area selection field 149 in FIG. 100 is pressed, an extraction area editing dialog 326 is displayed as shown in FIG. can be specified by When the extraction area is adjusted in the extraction area edit dialog 326, the change is reflected in the second image display area 121. FIG.
(Mask area setting column 330)

さらに抽出領域設定ダイヤログ148から、抽出領域としない領域を指定するためのマスク領域も設定できる。図99の例では、抽出領域選択欄149の下部にマスク領域設定欄330が設けられている。マスク領域設定欄330では、複数のマスク領域を設定できる。ここでは0~3の最大4つのマスク領域が指定でき、各マスク領域は独立して設定できる。例えば図102に示すようにマスク領域0として「円形」を選択すると、第二画像表示領域121上に円形のマスク領域0が表示される。さらにこの状態から「編集」ボタン332を押下すると、図103に示すように円形のマスク領域0の詳細を規定するためのマスク領域編集ダイヤログ334が表示される。ユーザは、円形のマスク領域0を、中心のxy座標と半径とで規定できる。マスク領域は、第二画像表示領域121において抽出領域とは異なる色の枠線で表示され、ユーザが抽出領域とマスク領域とを視覚的に区別し易くしている。図103の例では、抽出領域を緑色、マスク領域を黄色で表示している。ただ、この例に限らず、異なる色で区別したり、線の太さや線種(実線、破線等)、ハイライト(点滅や強調)等で区別することも可能であることはいうまでもない。 Furthermore, from the extraction area setting dialog 148, it is possible to set a mask area for specifying an area not to be an extraction area. In the example of FIG. 99, a mask area setting field 330 is provided below the extraction area selection field 149 . A plurality of mask areas can be set in the mask area setting column 330 . Here, a maximum of four mask areas from 0 to 3 can be specified, and each mask area can be set independently. For example, as shown in FIG. 102, when “circular” is selected as the mask area 0, the circular mask area 0 is displayed on the second image display area 121. FIG. Further, when an "edit" button 332 is pressed from this state, a mask area edit dialog 334 for defining details of the circular mask area 0 is displayed as shown in FIG. The user can define a circular mask area 0 with the xy coordinates of the center and the radius. The masked area is displayed in the second image display area 121 with a frame line of a color different from that of the extracted area, making it easier for the user to visually distinguish between the extracted area and the masked area. In the example of FIG. 103, the extraction area is displayed in green and the mask area is displayed in yellow. However, it is not limited to this example, and it goes without saying that it is also possible to distinguish by different colors, line thickness, line type (solid line, dashed line, etc.), highlight (blinking or emphasized), etc. .

このようにして、抽出領域を計測領域とは独立して設定することも可能となる。また、抽出領域の設定内容は、文字情報で表示させることもできる。例えば図90の例では、「抽出領域」ボタン147の下部にテキストで「計測領域と同じ」と表示しており、平面基準を算出する抽出領域が計測領域と同じであることを示している。またその下部には「マスク領域:無効」と表示し、抽出領域にマスク領域が設定されていないことを示している。これによってユーザは、「抽出領域」の概略をテキスト情報としても確認できる。
(前処理設定)
In this way, it is also possible to set the extraction region independently of the measurement region. Also, the setting contents of the extraction area can be displayed as character information. For example, in the example of FIG. 90, the text "same as measurement area" is displayed below the "extraction area" button 147, indicating that the extraction area for calculating the plane reference is the same as the measurement area. In addition, "mask area: invalid" is displayed below it, indicating that the mask area is not set in the extraction area. This allows the user to confirm the outline of the "extraction area" as text information as well.
(Preprocessing settings)

以上のようにして、「エリア」処理ユニットで、高さ抽出の設定を終えると、図104に示すように第三画像表示領域において、「エリア」処理ユニットで設定された領域の矩形内では、抽出された高さに基づいて階調変換された低階調距離画像が重ねて表示される。次に、前処理の設定を行う。前処理とは、上述の通り距離画像を生成する前に行う共通のフィルタ処理であり、ここでは各種のフィルタを選択できる。具体的には、図104の画面から、設定項目ボタン領域112に設けられた「前処理」ボタンを選択すると、図105のフィルタ処理設定画面340となり、適用するフィルタを選択できる。ここで選択可能なフィルタとしては、平均化フィルタ、メディアンフィルタ、ガウシアンフィルタ等が挙げられる。さらに、このようなフィルタ以外にも、例えば二値化レベルの設定も可能である。例えば図106の二値化レベル設定画面350では、二値化を行う上限値や下限値、回数を設定できる。また二値化された画素の分布を示すヒストグラムを表示させたり、入力画像に連動してヒストグラムを更新する機能を持たせてもよい。このようにしてフィルタ処理設定が終了すると、図107に示すように第三画像表示領域において、設定された領域内でフィルタ処理を経て二値化された低階調距離画像が重ねて表示される。
(判定設定)
After setting the height extraction in the "area" processing unit as described above, in the third image display area as shown in FIG. A low gradation distance image gradation-converted based on the extracted height is superimposed and displayed. Next, set the preprocessing. Preprocessing is a common filtering process performed before generating a range image as described above, and various filters can be selected here. Specifically, when the "preprocessing" button provided in the setting item button area 112 is selected from the screen of FIG. 104, a filter processing setting screen 340 of FIG. 105 is displayed, and a filter to be applied can be selected. Filters that can be selected here include an averaging filter, a median filter, a Gaussian filter, and the like. Furthermore, other than such filters, for example, it is also possible to set a binarization level. For example, on the binarization level setting screen 350 of FIG. 106, the upper limit value, the lower limit value, and the number of times of binarization can be set. It may also have a function of displaying a histogram indicating the distribution of binarized pixels or updating the histogram in conjunction with the input image. When the filter processing setting is completed in this way, the low gradation distance image binarized through the filter processing within the set region is superimposed and displayed in the third image display region as shown in FIG. .
(judgment setting)

さらに「エリア」処理ユニットでは、設定された領域、高さ抽出、前処理等の条件にしたがって、入力画像を低階調距離画像に階調変換した後、この低階調距離画像に対して高さ検査や画像検査等の判定を行う条件についても規定する。例えば図107の画面から、設定項目ボタン領域112に設けられた「判定条件」ボタンを押下すると、図108の判定条件設定画面360となり、判定条件を設定する。この例では、二値化された低階調距離画像の画素をカウントして、その数値が所定の範囲内にあるときをOK、ないときをNGに設定している。図108の例では、判定条件が0~30であり、現在値が166であるため、NGと判定され、図109に示すように、第三画像表示領域において「判定結果:NG」と赤文字で表示される。このように、判定結果がNGの場合は、文字を赤文字とする等、目立つ態様とすることで、運用時にユーザが認識し易くできる。
(「ブロブ」処理ユニット267)
Furthermore, in the "area" processing unit, after tone-converting the input image into a low-tone distance image according to conditions such as the set area, height extraction, and preprocessing, this low-tone distance image is It also specifies the conditions for judging depth inspections and image inspections. For example, when the "judgment condition" button provided in the setting item button area 112 is pressed on the screen of FIG. 107, the judgment condition setting screen 360 of FIG. 108 is displayed and the judgment condition is set. In this example, the pixels of the binarized low gradation distance image are counted, and OK is set when the numerical value is within a predetermined range, and NG is set when it is not. In the example of FIG. 108, since the determination condition is 0 to 30 and the current value is 166, it is determined to be NG, and as shown in FIG. is displayed. In this way, when the determination result is NG, the characters are displayed in red or otherwise conspicuous, thereby making it easier for the user to recognize them during operation.
("blob" processing unit 267)

また、以上は高さ情報を用いた高さ検査に基づく判定について説明したが、本発明はこれに限らず、従来の輝度画像に対する画像検査に基づいた判定処理を加えることも可能である。このような画像検査をブロブと呼ぶ。例えば図110に示すように、フロー表示領域261において「エリア」処理ユニットの下部に、ブロブ(画像検査)を行う「ブロブ」処理ユニット267を追加する。「ブロブ」処理ユニット267においても、上記と同様に、対象領域を設定し前処理を設定したり(図111)、検出条件を設定したりして(図112)、判定条件を設定して判定結果を出力させることができる(図113)。
(「色検査」処理ユニット267B)
Also, although the determination based on height inspection using height information has been described above, the present invention is not limited to this, and it is also possible to add determination processing based on conventional image inspection for luminance images. Such an image inspection is called a blob. For example, as shown in FIG. 110, a “blob” processing unit 267 that performs blob (image inspection) is added below the “area” processing unit in the flow display area 261 . In the "blob" processing unit 267, similarly to the above, the target area is set and the preprocessing is set (Fig. 111), the detection conditions are set (Fig. 112), the judgment conditions are set and judgment is made. The result can be output (Fig. 113).
(“Color Inspection” processing unit 267B)

さらに、撮像手段としてカラーCCDカメラを接続している場合等、カラーの光学画像を入力できる場合は、色検査を組み合わせることも可能である。例えば図114に示すように、フロー表示領域261において「ブロブ」処理ユニット267の下部に、計測処理として色検査を行う「色検査」処理ユニット267Bを追加する。「色検査」処理ユニット267Bにおいても、上記と同様に、対象領域を設定したり(図115、図116)、濃度平均等の詳細設定を行ったりして(図117)、判定条件を設定して判定結果を出力させることができる(図118)。 Furthermore, when a color CCD camera is connected as imaging means, or when a color optical image can be input, color inspection can be combined. For example, as shown in FIG. 114, a “color inspection” processing unit 267B that performs color inspection as measurement processing is added below the “blob” processing unit 267 in the flow display area 261 . In the "color inspection" processing unit 267B, similarly to the above, the target area is set (FIGS. 115 and 116), detailed settings such as density average are made (FIG. 117), and judgment conditions are set. can output the determination result (FIG. 118).

以上のようにして、設定モードにて各種の設定を行った後、運用モードにおいて実際にワークを撮像して入力画像を取得し、高さ検査や画像検査の結果に基づいて判定処理を行う。なお、上記の例では、設定モードにおいても判定結果を出力可能な構成とすることで、判定結果をイメージを設定段階でユーザに認識し易くしている。ただ、判定結果は運用モードにおいてのみ出力可能とすることも可能であることはいうまでもない。
(運用モード)
After various settings are made in the setting mode as described above, an input image is acquired by actually imaging the work in the operation mode, and determination processing is performed based on the results of height inspection and image inspection. In the above example, the user can easily recognize the image of the determination result at the setting stage by adopting a configuration in which the determination result can be output even in the setting mode. However, it goes without saying that the determination result can be output only in the operation mode.
(operation mode)

次に、図4A、図4Bに示す三次元画像処理装置におけるヘッド部、コントローラ部内部での、運用時の処理について、図119、図120のフローチャートに基づいて説明する。まず、図4A、図5に示す実施の形態3に係る三次元画像処理装置のヘッド部での運用時の処理の流れを、図119のフローチャートに基づいて説明する。
(実施の形態3に係る処理の流れ)
Next, processing during operation inside the head unit and the controller unit in the three-dimensional image processing apparatus shown in FIGS. 4A and 4B will be described based on the flowcharts of FIGS. First, the flow of processing during operation in the head unit of the three-dimensional image processing apparatus according to Embodiment 3 shown in FIGS. 4A and 5 will be described based on the flowchart in FIG.
(Flow of processing according to Embodiment 3)

まず、外部からトリガが入力されると(ステップS11901)、第一プロジェクタ20Aから一の投光パターンがワークに投光され(ステップS11902)、撮像手段で撮像する(ステップS11903)。次に、すべての投光パターンについて撮像が終了したかどうかを判定し(ステップS11904)、未だの場合は投光パターンを切り替えて(ステップS11905)、ステップS11902に戻って処理を繰り返す。ここでは、位相シフト法を用いた投光パターンでパターン投影画像を8枚、さらに空間コード化法を用いた投光パターンでパターン投影画像を8枚の、計16枚のパターン投影画像を撮像する。 First, when a trigger is input from the outside (step S11901), one light projection pattern is projected from the first projector 20A onto the work (step S11902), and the image is picked up by the imaging means (step S11903). Next, it is determined whether or not imaging has been completed for all light projection patterns (step S11904). If not, the light projection pattern is switched (step S11905), and the process returns to step S11902 to repeat the process. Here, 8 pattern projection images are taken with the light projection pattern using the phase shift method, and 8 pattern projection images are taken with the light projection pattern using the spatial encoding method, for a total of 16 pattern projection images. .

一方、ステップS11904においてすべての投光パターンを撮像し終えた場合は、ステップS11906とステップS11907に分岐する。まずステップS11906において三次元計測演算を実行し、距離画像Aを生成する。 On the other hand, if all projection patterns have been captured in step S11904, the process branches to steps S11906 and S11907. First, in step S11906, three-dimensional measurement calculation is executed to generate a distance image A. FIG.

その一方でステップS11907において、位相シフト法で撮像した複数のパターン投影画像(パターン投影画像群)から、これを平均した平均画像A’を演算する。 On the other hand, in step S11907, an average image A' is calculated by averaging a plurality of pattern projection images (pattern projection image group) captured by the phase shift method.

以上のステップS11902~S11906は、第一プロジェクタ20Aからのパターン投光による三次元計測である。次に第二プロジェクタ20Bからのパターン投光による三次元計測を行う。ここでは、ステップS11906に続いてステップS11908において、ステップS11902~S11905と同様に、第二プロジェクタ20Bから投光パターンがワークに投光され(ステップS11908)、撮像手段で撮像し、(ステップS11909)、すべての投光パターンについて撮像が終了したかどうかを判定する(ステップS11910)。未だの場合は投光パターンを切り替えて(ステップS11911)ステップS11902に戻り処理を繰り返し、一方すべての投光パターンを撮像し終えた場合は、ステップS11912とステップS11912に分岐する。ステップS11912においては三次元計測演算を実行し、距離画像Bを生成する。一方ステップS11913においては、位相シフト法で撮像したパターン投影画像群の平均画像B’を演算する。このようにして三次元距離画像A、Bが生成されると、ステップS11914において、三次元距離画像A、Bを合成して、距離画像を生成する。またステップS11915において、平均画像A’、B’を用いて、これらを合成した輝度画像(平均二次元濃淡画像)を生成する。このようにして、図5の三次元画像処理装置において、ワークの高さ情報を有する距離画像が取得される。なお輝度画像が不要の場合は、ステップS11907、S11913、S11915を省略できる。
(実施の形態4の処理の流れ)
The above steps S11902 to S11906 are three-dimensional measurement by pattern projection from the first projector 20A. Next, three-dimensional measurement is performed by pattern projection from the second projector 20B. Here, in step S11908 following step S11906, similarly to steps S11902 to S11905, the light projection pattern is projected onto the workpiece from the second projector 20B (step S11908), an image is captured by the imaging means (step S11909), It is determined whether or not imaging has been completed for all projection patterns (step S11910). If not, the projection pattern is switched (step S11911) and the process returns to step S11902 to repeat the processing. In step S11912, a three-dimensional measurement calculation is executed and a distance image B is generated. On the other hand, in step S11913, an average image B' of the pattern projection image group captured by the phase shift method is calculated. After the three-dimensional distance images A and B are generated in this manner, the three-dimensional distance images A and B are synthesized to generate a distance image in step S11914. Also, in step S11915, using the average images A' and B', a luminance image (average two-dimensional grayscale image) is generated by synthesizing them. In this manner, the distance image having the height information of the workpiece is obtained in the three-dimensional image processing apparatus of FIG. Note that steps S11907, S11913, and S11915 can be omitted if the luminance image is unnecessary.
(Flow of processing in Embodiment 4)

以上は、図4Aに示す実施の形態3に係る三次元画像処理装置のヘッド部の処理の流れについて説明した。次に図4Bに示す実施の形態4に係る三次元画像処理装置のヘッド部の処理の流れについて、図120のフローチャートに基づいて説明する。説明する。まず、外部からトリガが入力されると(ステップS12001)、投光手段20から一の投光パターンがワークに投光され(ステップS12002)、第一撮像手段10Aで撮像し、(ステップS12003)、同時に第二撮像手段10Bでも撮像する(ステップS12004)。そしてすべての投光パターンについて撮像が終了したかどうかを判定する(ステップS12005)。未だの場合は投光パターンを切り替えて(ステップS12006)ステップS12002に戻り処理を繰り返し、一方すべての投光パターンを撮像し終えた場合は、ステップS12007~ステップS12010に分岐する。ステップS12007においては三次元計測演算を実行し、距離画像Aを生成する。ステップS12008においては三次元計測演算を実行し、距離画像Bを生成する。一方、ステップS12009において、位相シフト法で撮像したパターン投影画像群の平均画像A’を演算し、またステップS12010において、位相シフト法で撮像したパターン投影画像群の平均画像B’を演算する。そしてステップS12011において、ステップS12007、S12008で得られた三次元距離画像A、Bを合成して、距離画像を生成する。またステップS12009、10で得られた平均画像A’、B’を合成した輝度画像を生成する。この方法によれば、同時に2枚の画像を撮像できるので、撮像時間の短縮化を図ることができる。
(検査対象領域設定手段)
The processing flow of the head unit of the three-dimensional image processing apparatus according to the third embodiment shown in FIG. 4A has been described above. Next, the processing flow of the head unit of the 3D image processing apparatus according to Embodiment 4 shown in FIG. 4B will be described based on the flowchart of FIG. explain. First, when a trigger is input from the outside (step S12001), one light projection pattern is projected from the light projecting means 20 onto the workpiece (step S12002), the image is captured by the first image capturing means 10A (step S12003), At the same time, the second imaging means 10B also takes an image (step S12004). Then, it is determined whether or not imaging has been completed for all projection patterns (step S12005). If not, the projection pattern is switched (step S12006), and the process returns to step S12002 to repeat the processing. In step S12007, a three-dimensional measurement calculation is executed and a distance image A is generated. In step S12008, a three-dimensional measurement calculation is executed and a distance image B is generated. On the other hand, in step S12009, the average image A' of the pattern projection image group captured by the phase shift method is calculated, and in step S12010, the average image B' of the pattern projection image group captured by the phase shift method is calculated. In step S12011, the three-dimensional distance images A and B obtained in steps S12007 and S12008 are synthesized to generate a distance image. Also, a luminance image is generated by synthesizing the average images A' and B' obtained in steps S12009 and S10. According to this method, two images can be captured at the same time, so that the imaging time can be shortened.
(Inspection target area setting means)

実際の運用時の検査に際して、ワークに対して検査実行手段50で検査を実行する対象となる領域(検査対象領域)を、予め指定しておく必要がある。このような検査対象領域の設定は、設定段階において検査対象領域設定手段により行われる。検査対象領域設定手段は、上述の通りコントローラ部2側に設けたり、あるいは三次元画像処理プログラムにて実現させることもできる。具体的には、上述の通り図62に示す三次元画像処理プログラムの検査対象領域設定手段に相当する「領域設定」ボタン115を押下すると、図47に示す検査対象領域設定画面120に遷移し、この検査対象領域設定画面120において、検査を行う領域を指定することができる。 For inspection during actual operation, it is necessary to specify in advance an area (inspection target area) to be inspected by the inspection execution means 50 on the workpiece. Such setting of the inspection target area is performed by the inspection target area setting means in the setting stage. The inspection target area setting means can be provided on the controller section 2 side as described above, or can be realized by a three-dimensional image processing program. Specifically, as described above, when the "set area" button 115 corresponding to the inspection area setting means of the three-dimensional image processing program shown in FIG. 62 is pressed, the screen changes to the inspection area setting screen 120 shown in FIG. On this inspection area setting screen 120, an area to be inspected can be specified.

このようにして検査対象領域を指定すると、この検査対象領域に対して三次元画像処理装置が画像処理を行い、さらに検査を実行する。すなわち図121のフローチャートに示すように、距離画像に対して検査対象領域を割り当て(ステップS12101)、この距離画像に基づいて階調変換パラメータを設定し(ステップS12102)、この階調変換パラメータに従って階調変換を行い(ステップS12103)、さらに階調変換画像に対して画像処理を行い、所定検査を行う(ステップS12104)。 When the inspection target area is specified in this way, the three-dimensional image processing device performs image processing on the inspection target area, and further performs inspection. That is, as shown in the flowchart of FIG. 121, an inspection target area is assigned to a distance image (step S12101), tone conversion parameters are set based on this distance image (step S12102), and tone conversion parameters are set according to the tone conversion parameters. Tone conversion is performed (step S12103), image processing is performed on the tone-converted image, and predetermined inspection is performed (step S12104).

なお階調変換処理は、上述した検査対象領域設定手段で設定された検査対象領域に対して行われる。すなわちこの例では、検査対象領域設定手段を、階調変換対象領域を指定する階調変換対象領域指定手段と共通としている。ただ、階調変換処理のパラメータを決めるのに用いる領域を、検査対象領域とは独立して設定してもよい。例えば検査対象領域設定手段、あるいはこれとは別個に用意した階調変換パラメータ作成用領域指定手段を用いて、階調変換パラメータ作成用領域を指定する。
(運用時のコントローラ部の動作フロー)
Note that the gradation conversion process is performed on the inspection target area set by the inspection target area setting means described above. That is, in this example, the inspection target area setting means is shared with the gradation conversion target area specifying means for specifying the gradation conversion target area. However, the area used to determine the parameters of the gradation conversion process may be set independently of the inspection target area. For example, the area for gradation conversion parameter creation is specified using the inspection target area setting means or the gradation conversion parameter creation area specifying means prepared separately.
(Operation flow of the controller during operation)

次に、ヘッド部側で得られた距離画像を、運用時にコントローラ部側で処理する手順を、図122のフローチャート、及び図123~図127のGUIに基づいて説明する。ここで図123~図126は三次元画像処理プログラムのGUIを示している。図123に示す三次元画像処理プログラムのGUIは初期画面260を示しており、画面の左側にフロー表示領域261を、右側に第三画像表示領域262を、それぞれ設けている。フロー表示領域261においては、三次元画像処理装置で行う各処理の内容を処理ユニット状に繋いだフロー図が表示される。ここでは処理ユニットとして、「撮像」処理ユニット263、「Shapetrax2」処理ユニット264、「位置補正」処理ユニット265、「高さ計測」処理ユニット266がフロー表示領域261に表示されている。また運用前の設定の段階では、各処理ユニットを選択して詳細な設定を行える。また第三画像表示領域262には、処理内容に応じて輝度画像や距離画像、あるいは検査結果等が表示される。図123の例では、ワーク(この例ではIC)を撮像した輝度画像が表示されており、後述するサーチ対象領域SAが緑色の枠状に表示されている。
(撮像ステップ)
Next, the procedure for processing the distance image obtained on the head side on the controller side during operation will be described with reference to the flowchart of FIG. 122 and the GUIs of FIGS. 123 to 126 show the GUI of the three-dimensional image processing program. The GUI of the three-dimensional image processing program shown in FIG. 123 shows an initial screen 260, with a flow display area 261 on the left side of the screen and a third image display area 262 on the right side. In the flow display area 261, a flow diagram is displayed in which the contents of each process performed by the three-dimensional image processing apparatus are connected in the form of processing units. Here, as processing units, an “imaging” processing unit 263 , a “Shapetrax2” processing unit 264 , a “position correction” processing unit 265 , and a “height measurement” processing unit 266 are displayed in the flow display area 261 . Also, at the stage of setting before operation, each processing unit can be selected and detailed settings can be made. In addition, in the third image display area 262, a brightness image, a distance image, or an inspection result is displayed according to the content of processing. In the example of FIG. 123, a luminance image obtained by picking up a workpiece (IC in this example) is displayed, and a search target area SA, which will be described later, is displayed in a green frame.
(imaging step)

まず図122のステップS12201において、距離画像と輝度画像をヘッド部1から取得する。ここでは、ヘッド部側でパターン投影画像を撮像し、距離画像と輝度画像を生成する。図123のGUIの例では、フロー表示領域261に表示される「撮像」処理ユニット263が該当する。 First, in step S12201 in FIG. 122, a distance image and a luminance image are obtained from the head unit 1. Here, a pattern projection image is captured on the head unit side to generate a distance image and a luminance image. In the GUI example of FIG. 123, the “imaging” processing unit 263 displayed in the flow display area 261 corresponds.

画像データは、先に距離画像をヘッド部からコントローラ部に送信し、次いで輝度画像もコントローラ部に送信する。なお、逆に輝度画像を先に転送した上で距離画像を転送したり、これらの転送を同時に行ってもよい。
(サーチステップ)
As for the image data, the distance image is first transmitted from the head unit to the controller unit, and then the luminance image is also transmitted to the controller unit. Conversely, the luminance image may be transferred first and then the distance image may be transferred, or these transfers may be performed at the same time.
(search step)

さらにステップS12202において、運用時に入力される入力画像に対し、コントローラ部でパターンサーチを行う。すなわち、撮像された輝度画像に含まれるワークの動きに追従するように、検査したい部位を特定する。図123の例では、フロー表示領域261に表示される「Shapetrax2」処理ユニット264がパターンサーチに該当する。ここではワークを撮像した輝度画像(入力画像)に対して、図5の画像サーチ手段64がパターンサーチを行い、位置決めを行う。具体的には、予め設定された検査対象領域が、入力された輝度画像中のどこに含まれるか、位置を特定する。パターンサーチを行うサーチ対象領域SAは、予め設定される。例えば図124の例では、第三画像表示領域に表示される輝度画像上で、サーチ対象領域SAが矩形状に指定されている。
(位置補正ステップ)
Further, in step S12202, the controller unit performs pattern search on the input image input during operation. That is, the part to be inspected is specified so as to follow the motion of the workpiece included in the picked-up luminance image. In the example of FIG. 123, the "Shapetrax2" processing unit 264 displayed in the flow display area 261 corresponds to the pattern search. Here, the image search means 64 in FIG. 5 performs pattern search on the brightness image (input image) of the workpiece and performs positioning. Specifically, the position of the preset inspection target area is specified in the input luminance image. A search target area SA for pattern search is set in advance. For example, in the example of FIG. 124, the search target area SA is specified in a rectangular shape on the luminance image displayed in the third image display area.
(Position correction step)

次にステップS12203において、パターンサーチの結果を用いて検査対象領域を位置補正する。図123の例では、フロー表示領域261に表示される「位置補正」処理ユニット265が該当する。検査対象領域は、検査対象領域設定画面において予め設定される。図125の例では、第三画像表示領域に表示された距離画像上で、検査対象領域が複数、設定されている。詳細には、図126に示すようにワークであるICの各ピンに対して矩形状の領域が設定されている。位置補正は、例えば正規化相関サーチにより位置ずれ量を算出する方法やパターンサーチの結果に基づく方法等によって行われる。このようにして位置補正により、次段で実行される検査処理の検査対象領域の位置が補正される。
(検査処理ステップ)
Next, in step S12203, the position of the inspection area is corrected using the result of the pattern search. In the example of FIG. 123, the “position correction” processing unit 265 displayed in the flow display area 261 corresponds. The inspection target area is set in advance on the inspection target area setting screen. In the example of FIG. 125, a plurality of inspection target areas are set on the distance image displayed in the third image display area. Specifically, as shown in FIG. 126, a rectangular area is set for each pin of the IC, which is the work. The position correction is performed, for example, by a method of calculating the amount of positional deviation by normalized correlation search, a method based on the result of pattern search, or the like. In this manner, the position correction corrects the position of the inspection target area of the inspection process to be executed in the next stage.
(Inspection processing step)

最後にステップS12204において、補正された位置にて距離画像を用いて検査を実行する。図123の例では、フロー表示領域261に表示される「高さ計測」処理ユニット266が該当する。また図127の例では、高さ計測を実行している。すなわち、補正された位置の検査対象領域でそれぞれ高さが計測され検査される。例えば平面高さが所定の基準値以内かどうかを判定して、判定結果を出力する。 Finally, in step S12204, inspection is performed using the distance image at the corrected position. In the example of FIG. 123, the “height measurement” processing unit 266 displayed in the flow display area 261 corresponds. Also, in the example of FIG. 127, height measurement is executed. That is, the height is measured and inspected in each inspection target area at the corrected position. For example, it determines whether or not the plane height is within a predetermined reference value, and outputs the determination result.

なお以上の手順では、輝度画像を用いて位置補正を行った上で、距離画像に基づいて検査を行う例を説明した。ただ、本発明はこれに限らず、位置補正を行う画像、検査処理を行う画像を任意に設定できる。例えば上記と逆に、距離画像を用いて位置補正を行った上で、輝度画像を用いて検査処理を実行することもできる。一例として、白地の背景に白色のワークが置かれた場合のように、輝度画像では正確なパターンサーチが困難な例においては、距離画像を使用して高さ情報に基づいたパターンサーチが有効となる。また、検査処理についても、高さ情報に基づく判定処理のみならず、例えばワークに印字された文字列をOCRによって読み取る等、輝度画像を用いた画像処理結果によって判定することもできる。
(高さ情報の出力形式)
In the above procedure, an example has been described in which inspection is performed based on the distance image after the position correction is performed using the luminance image. However, the present invention is not limited to this, and an image for position correction and an image for inspection processing can be arbitrarily set. For example, conversely to the above, it is also possible to perform position correction using a distance image and then execute inspection processing using a luminance image. For example, when a white workpiece is placed against a white background, where it is difficult to perform an accurate pattern search using a luminance image, pattern searches based on height information using a depth image are effective. Become. Also, the inspection process can be performed not only based on the height information, but also based on the result of image processing using a luminance image, such as reading a character string printed on the work by OCR.
(Output format of height information)

計測した三次元の高さ情報はそれぞれX,Y,Zの値を持った三次元ポイントクラウドデータとして求められる。また実際に求められた値を、どのように出力するかについて、三次元ポイントクラウドデータ以外に、例えばZ画像、XY等ピッチZ画像に変換することもできる。
(1:Z画像)
The measured three-dimensional height information is obtained as three-dimensional point cloud data having X, Y, and Z values. In addition to the three-dimensional point cloud data, it is also possible to convert the actually obtained values into, for example, a Z image or an XY pitch Z image, in addition to the three-dimensional point cloud data.
(1:Z image)

Z画像とは、Z座標のみの高さ画像データである。例えば撮像手段で撮像されたワークの位置の凹凸が重要で、X,Y座標は正確でなくても良いような場合は、X,Y座標は不要なので、Z座標のみのデータであるZ画像を出力すれば足りる。この場合は伝送するデータ量が少なくなり、伝送時間を短縮することができる。また通常の二次元の撮像手段と同じく、画像としてデータを扱えるので、既存の二次元画像用の画像処理装置を用いて画像処理を行うこともできる。
(2:XY等ピッチZ画像)
A Z image is height image data of only Z coordinates. For example, if the unevenness of the position of the work imaged by the imaging means is important and the X and Y coordinates do not need to be accurate, the X and Y coordinates are unnecessary, so the Z image, which is data only for the Z coordinates, is used. Output is enough. In this case, the amount of data to be transmitted is reduced, and the transmission time can be shortened. In addition, since the data can be handled as an image in the same way as a normal two-dimensional imaging means, image processing can be performed using an existing image processing device for two-dimensional images.
(2: XY equal pitch Z image)

XY等ピッチZ画像とは、XY座標を高さによらず等ピッチとした高さ画像データである。具体的には、XY座標を等ピッチとした場合の位置におけるZ座標を、周辺のポイントクラウドデータから補間演算してXY等ピッチZ画像を求める。 The XY equal-pitch Z image is height image data in which the XY coordinates are equal-pitch regardless of the height. Specifically, an XY equal-pitch Z image is obtained by interpolating the Z-coordinate at a position where the XY coordinates are equal-pitch from the surrounding point cloud data.

一般に撮像手段のレンズが対物テレセントリックレンズではない場合は、撮像されたワークの高さ位置(Z座標)により、撮像手段で撮像される位置(X,Y座標)が異なる。このため、撮像素子上で同じ位置に写った物であっても、高さによって実際のXY座標位置は異なることになる。例えば体積のような、立体的な差異を検査したい場合は、カメラに対して近くにワークがあると値が大きくなり、遠くにあると値が小さくなってしまうので不都合となる。そこで、ポイントクラウドデータから、XY均等ピッチのZデータを求めることによって、高さに左右されないXY位置を持ったZ画像を得ることができる。
(3:XYZ(ポイントクラウドデータ))
Generally, when the lens of the imaging means is not an objective telecentric lens, the position (X, Y coordinates) imaged by the imaging means differs depending on the height position (Z coordinate) of the imaged workpiece. Therefore, even if an object is captured at the same position on the imaging device, the actual XY coordinate position differs depending on the height. For example, when it is desired to inspect a three-dimensional difference such as volume, the value becomes large when the work is close to the camera, and becomes small when the work is far away, which is inconvenient. Therefore, by obtaining Z data with an XY uniform pitch from the point cloud data, it is possible to obtain a Z image having XY positions that are not affected by height.
(3: XYZ (point cloud data))

あるいは、ポイントクラウドデータを三次元情報としてそのまま出力することもできる。例えば、計測した三次元データをそのまま扱いたい場合に用いる。この場合はZ座標のみの場合に比べてデータ量は3倍になるが、生データであるため、三次元CADデータとの立体的な差分を求める等の用途に利用できる。
(等ピッチ画像の生成)
Alternatively, the point cloud data can be directly output as three-dimensional information. For example, it is used when you want to handle the measured three-dimensional data as it is. In this case, the amount of data is three times as large as that in the case of using only the Z coordinate, but since it is raw data, it can be used for purposes such as obtaining a three-dimensional difference from three-dimensional CAD data.
(Generation of uniform pitch image)

次に、距離画像と輝度画像に加え、画角を補正した等ピッチ画像を作成するデータフロー図を図128に示す。この図に示すように、まずヘッド部で撮像する空間コード化用パターン投光ワーク画像群から、空間コード化法に従い空間コード画像を生成する。一方、位相シフト用パターン投光ワーク画像群から、位相計算に従い位相画像を生成する。そしてこれら空間コード画像、位相画像から、位相拡張計算を行って、拡張位相画像を生成する。また、これら空間コード化用パターン投光ワーク画像群や位相シフト用パターン投光ワーク画像群に対して、フィルタをかける等、共通フィルタ処理を適用することもできる。共通フィルタ処理には、メディアンフィルタ、ガウシアンフィルタ、平均化フィルタ等の二次元フィルタの適用が挙げられる。その一方で、位相シフト用パターン投光ワーク画像群を平均化することで、輝度画像(平均濃淡画像)を生成する。
(均等間隔処理)
Next, FIG. 128 shows a data flow diagram for creating an equal-pitch image with a corrected angle of view in addition to the distance image and the luminance image. As shown in this figure, first, a spatial code image is generated according to the spatial encoding method from a group of spatial encoding pattern projection workpiece images captured by the head unit. On the other hand, a phase image is generated according to the phase calculation from the phase shift pattern projection work image group. From these spatial code image and phase image, phase extension calculation is performed to generate an extended phase image. Further, it is also possible to apply common filter processing, such as filtering, to the spatial encoding pattern projection work image group and the phase shift pattern projection work image group. Common filtering includes application of two-dimensional filters such as median filters, Gaussian filters, and averaging filters. On the other hand, a brightness image (average grayscale image) is generated by averaging the phase shift pattern projection work image group.
(Equal interval processing)

以上のようにして、ヘッド部で三次元データと輝度画像を生成した後、さらにZ画像、又は等ピッチZ画像等の距離画像を作成する。まず、距離画像をヘッド部1からコントローラ部2に転送して、位相情報を高さ情報に変換する階調変換を行う。ここでは、位相情報からX画像、Y画像、Z画像をそれぞれ求めた上で、これらXYを均等化してXY平面におけるXY等ピッチZ画像、XY等ピッチZ平均画像を取得する。このような均等間隔処理は、間隔均等化処理設定手段47にて行う。 After the three-dimensional data and the brightness image are generated by the head unit as described above, a distance image such as a Z image or an equal-pitch Z image is created. First, a distance image is transferred from the head unit 1 to the controller unit 2, and gradation conversion is performed to convert phase information into height information. Here, an X image, a Y image, and a Z image are obtained from the phase information, and these XY are equalized to acquire an XY equal-pitch Z image and an XY equal-pitch Z-average image on the XY plane. Such equal spacing processing is performed by the spacing equalization processing setting means 47 .

なお、図128の例では距離画像の生成において位相シフト法と空間コード化法を組み合わせた例を説明したが、空間コード化法を使用しないで位相シフト法のみで距離画像を生成することもできる。空間コード化処理は、図5に示す空間コード化切替手段45によってON/OFFを切り替えることができる。このような例を図129のデータフロー図に示す。この図に示すように、空間コード化法を使用しない分、撮像枚数を削減でき、高速にて距離画像を生成できる。 In the example of FIG. 128, an example in which the phase shift method and the spatial encoding method are combined in generating the range image has been described, but the range image can also be generated only by the phase shift method without using the spatial encoding method. . The spatial encoding process can be switched ON/OFF by the spatial encoding switching means 45 shown in FIG. Such an example is shown in the data flow diagram of FIG. As shown in this figure, since the space encoding method is not used, the number of captured images can be reduced and the range image can be generated at high speed.

一方で、XY等ピッチ化機能をOFFして、Z画像を得る際のデータフロー図を図130に示す。この例であれば、階調変換に際してX画像やY画像に分解する必要がないので、その分処理を簡素化できる。 On the other hand, FIG. 130 shows a data flow diagram when the XY equal pitch function is turned off and a Z image is obtained. In this example, there is no need to separate the image into the X image and the Y image for tone conversion, so the processing can be simplified accordingly.

さらに、XYZの座標情報をそのまま出力するポイントクラウドデータを出力する例を、図131に示す。この例では、位相→高さ変換後のX画像、Y画像、Z画像をそのまま出力できるので、軽負荷で出力できる利点が得られる。
(階調変換方法)
Furthermore, FIG. 131 shows an example of outputting point cloud data in which XYZ coordinate information is output as it is. In this example, since the X image, Y image, and Z image after the phase→height conversion can be output as they are, the advantage of being able to output with a light load can be obtained.
(Gradation conversion method)

次に、三次元画像処理装置の階調変換手段46が、距離画像に基づいて、高階調の距離画像を、低階調の低階調距離画像に自動的に階調変換する手順を説明する。ここでは、複数のワークが搬送されるライン上に設置される検査装置において、逐次入力される距離画像(入力画像)に対して、リアルタイムで低階調距離画像に階調変換する用途といった、複数の入力画像に対して階調変換を行う手順について説明する。この場合の階調変換処理は、大別して、(A)事前に階調変換パラメータを決定しておく方法(静的変換)と、(B)入力画像に応じて階調変換パラメータを決定する方法(動的方法)の2通りが挙げられる。以下、これらについて説明する。
(A:静的変換)
Next, a procedure for automatically converting a high-gradation distance image into a low-gradation low-gradation distance image based on the distance image by the gradation conversion means 46 of the three-dimensional image processing device will be described. . Here, in an inspection device installed on a line in which a plurality of workpieces are transported, a range image (input image) that is sequentially input is subjected to gradation conversion in real time to a low gradation range image. A procedure for performing gradation conversion on the input image will be described. The gradation conversion processing in this case is roughly classified into (A) a method of determining gradation conversion parameters in advance (static conversion) and (B) a method of deciding gradation conversion parameters according to an input image. (dynamic method). These will be described below.
(A: static conversion)

まず、予め階調変換パラメータを決定しておく静的変換について説明する。ここでは、設定時において入力画像や予め登録しておいた登録画像に対して、階調変換を行うための階調変換パラメータを調整する。そして運用時においては、設定時に設定された階調変換パラメータでもって、距離画像の階調変換を行い、階調変換後の低階調距離画像に対して検査を実行する。なお設定時における手順は、上述の図8のフローチャートに基づいて説明した通りである。
(運用時の手順)
First, static conversion in which tone conversion parameters are determined in advance will be described. Here, gradation conversion parameters for performing gradation conversion are adjusted for an input image or a registered image registered in advance at the time of setting. During operation, the gradation conversion of the distance image is performed using the gradation conversion parameters set at the time of setting, and the low gradation distance image after the gradation conversion is inspected. The procedure at the time of setting is as explained based on the above-described flowchart of FIG.
(Operation procedure)

階調変換パラメータが調整されると、この階調変換パラメータでもって運用時に入力される入力画像に対して、階調変換が行われる。ここで、運用時における静的変換の手順を、図132のフローチャートに基づいて説明する。まずステップS13201において、距離画像を取得する。ここでは、距離画像生成手段32が生成した距離画像を、コントローラ部2が取り込む。次にステップS13202において、入力された距離画像の階調変換処理を行う。ここでは、設定時に調整された階調変換パラメータに従って階調変換処理が実行され、距離画像の階調数すなわちダイナミックレンジを削減した低階調距離画像を生成する。最後に、ステップS13203において検査実行手段50により検査処理を実行する。この方法によれば、予め階調変換パラメータを設定しておくことにより、運用時は階調変換パラメータを演算する必要がなく、処理を軽負荷とできる。
(B:動的変換)
When the gradation conversion parameters are adjusted, gradation conversion is performed on the input image input during operation using the gradation conversion parameters. Here, the procedure of static conversion during operation will be described based on the flowchart in FIG. First, in step S13201, a distance image is acquired. Here, the controller section 2 takes in the distance image generated by the distance image generating means 32 . Next, in step S13202, gradation conversion processing of the input distance image is performed. Here, gradation conversion processing is executed according to the gradation conversion parameters adjusted at the time of setting, and a low gradation distance image is generated by reducing the number of gradations of the distance image, that is, the dynamic range. Finally, in step S13203, the inspection execution means 50 executes inspection processing. According to this method, by setting the gradation conversion parameters in advance, there is no need to calculate the gradation conversion parameters during operation, and the processing load can be lightened.
(B: dynamic conversion)

次に、階調変換時の階調変換パラメータを、入力画像に基づいて算出する動的変換について説明する。まず設定時の手順については、上述の通り図8のフローチャートに従って、行われる。具体的には、ステップS81において、入力画像又は登録画像を取得し、次にステップS82において、階調変換方法を選択させる。ここでは、ユーザが動的変換を選択したものとする。そしてステップS83において、階調変換パラメータを調整する。ここでは、運用時において入力される入力画像に対して、どのような条件で階調変換パラメータを演算、あるいは調整するかを、ステップS81で取得された画像に基づいて設定する。 Next, dynamic conversion for calculating tone conversion parameters for tone conversion based on an input image will be described. First, the setting procedure is performed according to the flowchart of FIG. 8 as described above. Specifically, in step S81, an input image or a registered image is obtained, and in step S82, a gradation conversion method is selected. Here, it is assumed that the user has selected dynamic conversion. Then, in step S83, the gradation conversion parameters are adjusted. Here, the conditions under which the gradation conversion parameters are to be calculated or adjusted for the input image input during operation are set based on the image acquired in step S81.

このようにして階調変換パラメータの演算条件が設定されると、運用時においては、設定された階調変換パラメータ演算条件に従って、入力画像に応じた階調変換パラメータが個別に演算される。次に、動的変換によって距離画像を低階調距離画像に階調変換する運用時の手順を、図133のフローチャートに基づいて説明する。まずステップS13301において、距離画像を取得する。ここでも上述したステップS13201と同様、距離画像生成手段32が生成した距離画像を、コントローラ部2が取り込む。次にステップS13302において、入力画像である距離画像に基づいて、階調変換パラメータを決定する。階調変換パラメータの調整方法については、上述した方法が利用できる。さらにステップS13303において、階調変換を実行する。最後に、ステップS13304において検査処理を実行する。この方法によれば、入力画像に従って階調変換パラメータを変更できるので、異なるワークに対しても柔軟に階調変換を行って正確な検査が可能となる。例えば、高さにばらつきのあるワーク表面の検査も、精度を低下させることなく行うことができる。 When the tone conversion parameter calculation conditions are set in this manner, the tone conversion parameters corresponding to the input image are individually calculated in accordance with the set tone conversion parameter calculation conditions during operation. Next, an operation procedure for tone-converting a distance image into a low-tone distance image by dynamic conversion will be described with reference to the flowchart in FIG. 133 . First, in step S13301, a distance image is acquired. Also here, the controller unit 2 captures the distance image generated by the distance image generating means 32, as in step S13201 described above. Next, in step S13302, tone conversion parameters are determined based on the distance image, which is the input image. As for the method of adjusting the tone conversion parameters, the methods described above can be used. Furthermore, in step S13303, tone conversion is executed. Finally, inspection processing is executed in step S13304. According to this method, since the gradation conversion parameters can be changed according to the input image, it is possible to flexibly perform gradation conversion for different works and perform accurate inspection. For example, it is possible to inspect the surface of a workpiece with height variations without lowering the accuracy.

ここで、動的変換の一例として、階調変換パラメータの調整によって、階調変換後の低階調距離画像を最適に作成する方法について、図134に基づいて説明する。ここでは、一の階調変換パラメータセットを動的に設定する方法と、予め複数の階調変換パラメータセットを準備しておき、動的に階調変換パラメータセットを選択する方法の二通りがある。
(1A一の階調変換パラメータセットを設定する方法)
Here, as an example of dynamic conversion, a method for optimally creating a low tone distance image after tone conversion by adjusting tone conversion parameters will be described with reference to FIG. Here, there are two methods: a method of dynamically setting one gradation conversion parameter set, and a method of preparing a plurality of gradation conversion parameter sets in advance and dynamically selecting a gradation conversion parameter set. .
(Method of setting 1A one gradation conversion parameter set)

まず、一の階調変換パラメータセットを動的に設定する方法について説明する。この方法では、入力画像である複数の距離画像の、予め定められた領域の画像情報に基づいて、階調変換に使用する階調変換パラメータの値を調整し、この調整された階調変換パラメータを用いて、階調変換手段46が距離画像の階調変換処理を実行する。ここでは、16階調の距離画像(階調変換前画像)を、8階調の低階調距離画像(階調変換後画像)に階調変換する例について説明する。また、検査対象のワークは、図134の斜視図に示すように、ワーク毎の計測面全体が上下にずれるものであり、その範囲は5mmである。また計測面全体の厚さや歪みを含めた高さ方向のレンジは0.5mmとする。このように表面高さが異なる各ワークに対して、それぞれの表面に傷を有していないかどうかを、画像処理によって検査する例を考える。距離画像を利用すると共に、距離画像を二次元の濃淡画像(低階調距離画像)に階調変換することで、既存の二次元画像用の画像処理装置でもって検査可能とできる。 First, a method of dynamically setting one gradation conversion parameter set will be described. In this method, the values of the tone conversion parameters used for tone conversion are adjusted based on the image information of a predetermined area of the plurality of distance images that are the input images, and the adjusted tone conversion parameters are adjusted. , the gradation conversion means 46 executes the gradation conversion processing of the distance image. Here, an example of tone conversion of a 16-tone distance image (image before tone conversion) to an 8-tone low tone distance image (image after tone conversion) will be described. Moreover, as shown in the perspective view of FIG. 134, the workpiece to be inspected is one in which the entire measurement surface of each workpiece is vertically displaced, and the range is 5 mm. Also, the range in the height direction including the thickness and distortion of the entire measurement surface is set to 0.5 mm. Consider an example of inspecting by image processing whether or not there is a flaw on the surface of each work having different surface heights. By using the distance image and converting the distance image into a two-dimensional grayscale image (low-gradation distance image), it is possible to perform inspection with an existing image processing device for two-dimensional images.

まず、予めワーク上の検査したい領域を、検査対象領域設定手段で検査対象領域として指定しておく。なお、検査対象領域を、入力画像である距離画像の一部を指定する他、距離画像の全体とすることもできる。この場合は、検査対象領域を指定する作業を省略してもよい。 First, an area to be inspected on the workpiece is specified in advance as an inspection area by the inspection area setting means. In addition to designating a part of the range image, which is the input image, as the inspection target area, the entire range image can also be specified. In this case, the operation of designating the inspection target area may be omitted.

最初に、検査対象領域の平均距離を求める。次に、検査対象領域の最大距離と最小距離の差(距離レンジ)を求める。さらに、距離レンジを1.2倍した数値を変換後画像の距離レンジとする。例えば、図134のワークの分布では、距離レンジが0.5mmであるとすると、これを1.2倍した0.6mmが階調変換後画像の距離レンジとして設定される。よって、平均距離を中心に±0.3mmの範囲が計測レンジとなる。 First, the average distance of the inspected area is determined. Next, the difference (distance range) between the maximum distance and the minimum distance of the inspection target area is obtained. Furthermore, the numerical value obtained by multiplying the distance range by 1.2 is used as the distance range of the post-conversion image. For example, in the workpiece distribution in FIG. 134, if the distance range is 0.5 mm, 0.6 mm obtained by multiplying this by 1.2 is set as the distance range of the post-gradation conversion image. Therefore, the range of ±0.3 mm around the average distance is the measurement range.

さらにまた、階調変換後画像の距離レンジである0.6mm(平均距離を中心に±0.3mm)の範囲が、256階調となるように、入力画像である距離画像に対するスパンを求める。なお、スパンは予め決めた定数とすることもできる。また、距離画像に対して、平均距離が-0.3mm以下のものは0とし、一方平均距離が+0.3mm以上のものは255とすることもできる。 Furthermore, the span for the distance image, which is the input image, is obtained so that the range of 0.6 mm (±0.3 mm from the average distance), which is the distance range of the image after tone conversion, has 256 tones. Note that the span can also be a predetermined constant. Also, for the distance image, it is possible to set 0 when the average distance is −0.3 mm or less, and 255 when the average distance is +0.3 mm or more.

このようにして、入力される複数の距離画像から、検査に必要な範囲を定めて、この範囲の高さ情報が階調変換後の低階調距離画像においても維持されるように、適切に階調変換パラメータを設定できる。この結果、高さ方向に分散する各ワークの傷の有無や位置等を、既存の画像処理装置を用いて適切に検査することが可能となる。
(1B 予め複数の階調変換パラメータセットを準備しておく方法)
In this way, a range necessary for inspection is determined from a plurality of input distance images, and the height information in this range is appropriately maintained even in the low gradation distance image after gradation conversion. You can set gradation conversion parameters. As a result, it is possible to appropriately inspect the presence or absence and position of scratches on each work dispersed in the height direction using an existing image processing device.
(1B Method of preparing multiple gradation conversion parameter sets in advance)

上記の実施例では、取得した距離画像の高さ情報を利用して、傷の検出に必要な高さ情報を損失しないように適切に階調変換パラメータセットを求める方法について説明した。一方で、予め複数の階調変換パラメータセットを準備しておく方法についても、以下説明する。この方法では、入力画像である複数の距離画像に対して、予め設定された複数の階調変換パラメータで階調変換された階調変換後画像をそれぞれ作成し、距離画像の予め指定された検査対象領域の画像情報に基づいて、検査に使用する階調変換後画像を選択する。 In the above embodiment, a method of appropriately obtaining a gradation conversion parameter set using height information of an acquired range image without losing height information necessary for flaw detection has been described. On the other hand, a method of preparing a plurality of tone conversion parameter sets in advance will also be described below. In this method, a plurality of distance images, which are input images, are subjected to tone conversion using a plurality of preset tone conversion parameters to create post-gradation conversion images, and a predetermined inspection of the distance images is performed. A tone-converted image to be used for inspection is selected based on the image information of the target area.

このような具体例を図135の模式図、及び図136のフローチャートに基づいて説明する。この例でも、上述した図134と同様に、ワーク毎の計測面全体が5mmの範囲で上下にずれる場合を考える。このようなワークに対して、変換中心を0.5mm毎に変化させて階調変換した階調変換後画像を、9枚作成する。そして得られた各階調変換後画像を表示手段上に、好ましくは並べて表示させ、入力画像である距離画像の平均値に一番近い変換中心による変換画像を、ユーザに選択させる。そして、ユーザにより選択された画像に適用された階調変換パラメータセットを設定する。具体的な手順は、図136に示す通り、まずワークの距離画像を生成した上で(ステップS13601)、上述の通り階調変換パラメータを変化させながら階調変換処理を複数回行う(ステップS13602)。そして得られた階調変換画像である簡易的な低階調距離画像中から、ユーザに所望の画像を選択させ(ステップS13603)、必要に応じて階調変換パラメータを調整し、得られた低階調距離画像に対して検査を行う(ステップS13604)。
(静的変換、動的変換の詳細)
Such a specific example will be described based on the schematic diagram of FIG. 135 and the flow chart of FIG. In this example as well, as in FIG. 134 described above, consider a case where the entire measurement surface of each workpiece is vertically displaced within a range of 5 mm. Nine gradation-converted images obtained by gradation conversion by changing the conversion center every 0.5 mm are created for such a work. Then, the obtained gradation-converted images are displayed, preferably side by side, on the display means, and the user selects the converted image by the conversion center closest to the average value of the range image, which is the input image. Then, a gradation conversion parameter set applied to the image selected by the user is set. Specifically, as shown in FIG. 136, the distance image of the workpiece is first generated (step S13601), and the tone conversion process is performed multiple times while changing the tone conversion parameter as described above (step S13602). . Then, the user is allowed to select a desired image from simple low gradation distance images that are gradation-converted images (step S13603), adjust the gradation conversion parameters as necessary, and obtain the obtained low gradation distance image (step S13603). The gradation distance image is inspected (step S13604).
(Details of static conversion, dynamic conversion)

次に、これら静的変換、動的変換の詳細について説明する。まず、静的変換について説明する。静的変換には、距離画像を低階調距離画像に階調変換する際に、残すべき高さ情報の基準を補正するため具体的な方法として、
(A1)指定した高さ(距離)で補正する一点指定と、
(A2)平面で補正する三点指定が利用できる。
(A1:一点指定)
Next, the details of these static conversion and dynamic conversion will be described. First, static conversion will be explained. For static conversion, as a specific method for correcting the standard of height information to be left when converting a distance image to a low-gradation distance image,
(A1) Specifying one point to correct at the specified height (distance),
(A2) A three-point specification for correction on a plane can be used.
(A1: One point designation)

一点指定は、ユーザが指定した点又は領域の高さ(距離)を基準として、距離画像を低階調距離画像に階調変換する方法である。基準高さは、例えば距離画像の高さ情報の内、低階調距離画像に階調変換される高さ範囲(距離レンジ)の中間の高さとする。あるいは、距離レンジの上限(階調変換される最も高い位置)や下限(階調変換される最も低い位置)とすることもできる。一点指定の具体的な手順は、上記図66~図78に基づいて説明した通りである。
(A2:三点指定)
One-point designation is a method of tone-converting a distance image into a low-tone distance image based on the height (distance) of a point or area designated by the user. The reference height is, for example, the middle height of the height range (distance range) in which the gradation is converted into the low gradation distance image among the height information of the distance image. Alternatively, the upper limit (highest position for tone conversion) or lower limit (lowest position for tone conversion) of the distance range can be used. The specific procedure for specifying one point is as described with reference to FIGS. 66 to 78 above.
(A2: 3 points designation)

三点指定とは、ユーザが指定した三点から求められる平面を基準面として、距離画像を低階調距離画像に階調変換する方法である。基準面も、上述した一点指定の基準高さと同様、例えば距離画像の高さ情報の内、低階調距離画像に階調変換される高さ範囲(距離レンジ)の中間の高さとする。あるいは、距離レンジの上限(階調変換される最も高い位置)や下限(階調変換される最も低い位置)とすることもできる。三点指定の具体例は、上記図81~図85のGUI画面に基づいて説明した通りである。 The three-point designation is a method of tone-converting a distance image into a low-tone distance image using a plane obtained from three points designated by the user as a reference plane. Similarly to the one-point designation reference height described above, the reference plane is, for example, the middle height of the height range (distance range) in which the height information of the distance image is gradation-converted into the low-gradation distance image. Alternatively, the upper limit (highest position for tone conversion) or lower limit (lowest position for tone conversion) of the distance range can be used. Specific examples of three-point designation are as explained based on the GUI screens of FIGS. 81 to 85 above.

ここで、静的変換による基準面の指定が有効な例を、図137に基づいて説明する。この例では、同じ高さのワークWK7が、ベルトコンベアBCによって同一面上を搬送されている。この場合は、ワークWK7の高さの変動が殆どないため、ワークに応じて基準面を変化させる動的変換は不要であり、静的変換で対応できる。特に静的変換は動的変換よりも処理が高速であり、静的変換の利点を享受できる。 Here, an example in which specification of a reference plane by static conversion is effective will be described with reference to FIG. In this example, works WK7 of the same height are conveyed on the same plane by the belt conveyor BC. In this case, since there is almost no change in the height of the work WK7, dynamic conversion for changing the reference plane according to the work is unnecessary, and static conversion can be used. In particular, static conversion is faster than dynamic conversion, and benefits from static conversion can be enjoyed.

また図138Aは、高さの変動自体を抑制したいワークの例である。この例では、ベルトコンベアBCによって搬送されるワークWK10であるボトルのキャップに、「浮き」がある場合を異常として検出する検査処理を対象としている。この場合において、静的変換を採用することで、図138Bに示す低階調距離画像のように高さの変動分を検知できる。逆に動的変換を採用すると、変動分が補正されてしまう結果、異常の検出ができなくなる。よってこのような用途において、静的変換が好適に利用できる
(B:動的変換の具体例)
Also, FIG. 138A is an example of a workpiece whose height variation itself is desired to be suppressed. In this example, the object is inspection processing for detecting, as an abnormality, the case where the cap of the bottle, which is the work WK10 conveyed by the belt conveyor BC, has "floating". In this case, by adopting static conversion, height variations can be detected as in the low gradation distance image shown in FIG. 138B. On the other hand, if dynamic conversion is adopted, as a result of correcting fluctuations, it becomes impossible to detect abnormalities. Therefore, in such applications, static conversion can be suitably used (B: specific example of dynamic conversion)

以上は、設定段階で予め階調変換条件を指定して、運用時には指定された条件で階調変換を行う静的変換について説明した。次に、検査対象の入力画像に応じて階調変換条件を調整する動的変換の具体例について、説明する。まず動的変換には、距離画像を低階調距離画像に階調変換する際に、残すべき高さ情報の基準を補正するため具体的な方法として、
(B1)入力画像に対して指定された平均抽出領域内の平均高さ(平均距離)を平均基準高さとして階調変換する平均高さ基準、
(B2)入力画像の指定領域内の推定平面を生成し、これを基準面として階調変換する平面基準、
(B3)入力画像から高周波成分を除いた自由曲面を生成し、これを基準面として階調変換する自由曲面基準
が含まれる。
In the above description, the static conversion is described in which the gradation conversion conditions are specified in advance at the setting stage and the gradation conversion is performed under the specified conditions during operation. Next, a specific example of dynamic conversion for adjusting tone conversion conditions according to an input image to be inspected will be described. First, for dynamic conversion, as a specific method for correcting the standard of height information to be left when converting a distance image to a low-gradation distance image,
(B1) Average height reference for gradation conversion using the average height (average distance) in the average extraction area specified for the input image as the average reference height,
(B2) a plane reference for generating an estimated plane within a specified area of the input image and using this as a reference plane for gradation conversion;
(B3) A free-form surface reference is included in which a free-form surface is generated by removing high-frequency components from the input image and used as a reference surface for gradation conversion.

平均基準高さを規定するための平均抽出領域は、運用に先立って予め設定される(上述した図8のステップS83)。図8のステップS83において、平均抽出領域を指定する手順の一例については、上記図88~図92のGUIに基づいて説明した通りである。一方、運用時においては、図133で説明した手順で動的変換が行われる。例えばライン上を搬送されるワークを撮像して距離画像を生成し(ステップS13301)、上記で設定された平均抽出領域の平均高さを演算し(ステップS13302)、これに基づいて階調変換を実行して低階調距離画像を生成し(ステップS13303)、得られた低階調距離画像に対して検査を行う(ステップS13304)。この方法であれば、ワークの高さ方向にばらつきがある場合でも、ワーク毎に階調変換の基準面を毎回再設定できるため、ワークの高さ方向のばらつきによらず、正確な検査が実現できる。 The average extraction area for defining the average reference height is preset prior to operation (step S83 in FIG. 8 described above). An example of the procedure for designating the average extraction area in step S83 of FIG. 8 is as described based on the GUIs of FIGS. 88 to 92 above. On the other hand, during operation, dynamic conversion is performed according to the procedure described with reference to FIG. For example, a workpiece conveyed on a line is imaged to generate a distance image (step S13301), the average height of the average extraction area set above is calculated (step S13302), and gradation conversion is performed based on this. A low gradation distance image is generated by execution (step S13303), and the obtained low gradation distance image is inspected (step S13304). With this method, even if there is variation in the height direction of the workpiece, the reference plane for gradation conversion can be reset for each workpiece, so accurate inspection can be achieved regardless of variations in the height direction of the workpiece. can.

次に、平面基準においても、上述した平均高さ基準と同様、基準面を決定するための基準面推定領域は、運用に先立って予め設定される(上述した図8のステップS83)。図8のステップS83において、基準面推定領域を指定する手順の一例については、上記図88、図92~図95のGUIに基づいて説明した通りである。運用時においては、図133で説明した手順で動的変換が行われる。例えばライン上を搬送されるワークを撮像して距離画像を生成し(ステップS13301)、上記で設定された基準面推定領域を抽出して、推定面を演算し(ステップS13302)、得られた推定面を基準として階調変換を実行して低階調距離画像を生成し(ステップS13303)、得られた低階調距離画像に対して検査を行う(ステップS13304)。この方法であれば、ワークの表面に傾き等がある場合でも、これをキャンセルしてワークの傾きによらず、正確な検査が実現できる。 Next, in the plane reference as well, the reference plane estimation area for determining the reference plane is set in advance (step S83 in FIG. 8 described above), similarly to the average height reference described above. An example of the procedure for designating the reference plane estimation area in step S83 of FIG. 8 has been described based on the GUIs of FIGS. 88 and 92 to 95 above. During operation, dynamic conversion is performed according to the procedure described with reference to FIG. For example, a workpiece conveyed on a line is imaged to generate a distance image (step S13301), the reference plane estimation area set above is extracted, an estimation plane is calculated (step S13302), and the obtained estimation A low gradation distance image is generated by performing gradation conversion with the surface as a reference (step S13303), and the obtained low gradation distance image is inspected (step S13304). With this method, even if there is an inclination or the like on the surface of the workpiece, this can be canceled and accurate inspection can be realized regardless of the inclination of the workpiece.

最後に、自由曲面基準の具体的な設定方法については、図126~図32のGUIに基づいて説明した通りである。自由曲面基準においても、上述した平均高さ基準等と同様、基準面を決定するための必要な条件は運用に先立って予め設定される(上述した図8のステップS83)。また運用時においては、図133で説明した手順で動的変換が行われる。例えばライン上を搬送されるワークを撮像して距離画像を生成し(ステップS13301)、上記で設定された自由曲面対象領域に対して、自由曲面を演算し(ステップS13302)、得られた自由曲面を基準として階調変換を実行して低階調距離画像を生成し(ステップS13303)、得られた低階調距離画像に対して検査を行う(ステップS13304)。この方法であれば、曲面状のワークの表面検査等、従来の方法では正確な検査が困難であった作業も、高精度に行える利点が得られる。 Finally, the specific method of setting the free-form surface reference is as described with reference to the GUIs of FIGS. 126-32. In the free-form surface reference as well, the necessary conditions for determining the reference surface are set in advance (step S83 in FIG. 8 described above), similarly to the above-described average height reference and the like. During operation, dynamic conversion is performed according to the procedure described with reference to FIG. For example, a workpiece conveyed on a line is imaged to generate a distance image (step S13301), a free-form surface is calculated for the above-set free-form surface target area (step S13302), and the obtained free-form surface is used as a reference to generate a low gradation distance image (step S13303), and the obtained low gradation distance image is inspected (step S13304). With this method, it is possible to obtain the advantage of being able to perform, with high accuracy, work such as the surface inspection of curved workpieces, for which accurate inspection is difficult with conventional methods.

ここで、動的変換による基準面の指定が有効な例を、図139に基づいて説明する。この例では、高さの異なるワークWK11が、ベルトコンベアBCによって同一面上を搬送されている。この場合は、ワークWK11の高さが個々に異なるため、平均高さ基準等を利用し、個体毎の高さに応じて基準面を変更し階調変換することで、ワークの高さに変動があっても最適な階調変換が可能となる。 An example in which specification of a reference plane by dynamic conversion is effective will now be described with reference to FIG. In this example, works WK11 having different heights are conveyed on the same plane by the belt conveyor BC. In this case, since the height of each workpiece WK11 is different, the height of the workpiece can be changed by changing the reference surface according to the height of each individual and performing gradation conversion using the average height standard or the like. Optimum gradation conversion is possible even if there is

また図140は、平面に微小な傾斜面と打痕のあるワークWK12の例を示している。この例では、打痕DEに起因してワークWK12の表面に微小な傾斜面が存在しているため、傾きによって打痕の検出精度に影響がでる虞がある。そこで、平面基準等を利用し、ワーク個体毎に平面を動的に求めて基準面として階調変換することで、僅かな窪みや打痕の検出といった高精度な検査が可能となる。 Also, FIG. 140 shows an example of a workpiece WK12 having a flat surface with minute inclined surfaces and dents. In this example, since the surface of the work WK12 has a minute inclined surface due to the dent DE, there is a possibility that the inclination affects the detection accuracy of the dent. Therefore, by using a plane reference or the like to dynamically obtain a plane for each individual workpiece and use it as a reference plane for gradation conversion, highly accurate inspection such as detection of slight dents and dents becomes possible.

さらに図141は、半径の異なる曲面状のワークWK13の例を示している。この例でも、自由曲面基準等を利用し、ワーク毎に曲面を求め、これを基準面として階調変換を行うことで、個体毎の形状のばらつきの影響を軽減した検査が可能となる。
(階調変換パラメータの自動調整)
Furthermore, FIG. 141 shows an example of a curved workpiece WK13 with different radii. In this example as well, by using a free-form surface reference or the like to obtain a curved surface for each workpiece and performing gradation conversion using this as a reference surface, it is possible to reduce the influence of variations in the shape of each workpiece.
(Automatic adjustment of gradation conversion parameters)

以上、階調変換パラメータを、階調変換後の画像イメージに基づいて手動で設定する手順について説明した。一方、階調変換パラメータを手動で設定する場合に、最初に設定した階調変換パラメータで階調変換した場合、ワークや環境の変化等によって、検査に適した画像が得られない場合がある。このような場合には、ユーザが画像を参照して微調整することなく、階調変換後のデータを用いて階調変換パラメータを補正し、再度変換を行うことにより検査に適した画像変換を行うこともできる。この方法では、階調変換の初期設定を行った上で、任意の階調変換パラメータを初期値としてまず階調変換を行い、その後、階調変換パラメータの調整を行う。 The procedure for manually setting the gradation conversion parameters based on the image after gradation conversion has been described above. On the other hand, when the gradation conversion parameters are set manually, if the gradation conversion is performed using the initially set gradation conversion parameters, an image suitable for inspection may not be obtained due to changes in the workpiece or environment. In such a case, the user corrects the gradation conversion parameters using the data after the gradation conversion without making fine adjustments by referring to the image. can also be done. In this method, after initial setting of tone conversion, tone conversion is first performed using arbitrary tone conversion parameters as initial values, and then the tone conversion parameters are adjusted.

例えば階調変換条件自動設定手段を、階調変換条件自動設定手段と、階調変換条件手動設定手段として機能させることができる。すなわち、階調変換条件自動設定手段で、階調変換手段が距離画像を低階調距離画像に階調変換する際の簡易的な階調変換条件を設定する。また、階調変換条件自動設定手段で設定された簡易階調変換条件に基づき、階調変換された簡易低階調距離画像を表示手段に表示させた状態で、階調変換条件手動設定手段が、階調変換条件の手動調整を受け付ける。これにより、ユーザに対していきなり階調変換条件の設定を促すのでなく、暫定的な簡易階調変換条件を自動的に設定して階調変換を行った上で、得られた一以上の簡易低階調距離画像を参照しながら、所望の階調変換条件に設定できるため、ユーザが階調変換パラメータの意味を習熟していない場合や設定に不慣れな場合でも、ある程度自動化してこのような設定作業を行い易くすることができる。 For example, the gradation conversion condition automatic setting means can function as the gradation conversion condition automatic setting means and the gradation conversion condition manual setting means. That is, the gradation conversion condition automatic setting means sets simple gradation conversion conditions when the gradation conversion means gradation-converts the distance image into the low gradation distance image. Further, while the simple low gradation distance image that has undergone gradation conversion is displayed on the display means based on the simple gradation conversion conditions set by the gradation conversion condition automatic setting means, the gradation conversion condition manual setting means , accepts manual adjustment of tone conversion conditions. As a result, instead of prompting the user to set the gradation conversion conditions abruptly, provisional simple gradation conversion conditions are automatically set and gradation conversion is performed, and then one or more simple gradation conversion conditions are obtained. Since the desired tone conversion conditions can be set while referring to the low tone distance image, even if the user is unfamiliar with the meaning of the tone conversion parameters or is unfamiliar with the settings, such parameters can be automated to some extent. Setting work can be facilitated.

具体的な手順を、図142のフローチャートに基づいて説明する。まずステップS14201において、距離画像の作成処理を実行する。次にステップS14202において、階調変換パラメータの初期値を用いて、初期の階調変換処理を行う。さらにステップS14203において、得られた階調変換画像が適切かどうかを判定し、適切でない場合はステップS14204において再度、階調変換パラメータの調整を行った後、ステップS14202に戻って処理を繰り返す。一方、ステップS14203において適切な階調変換画像が得られていると判定された場合は、ステップS14205に進み、所定の検査を実行する。 A specific procedure will be described based on the flowchart in FIG. First, in step S14201, processing for creating a distance image is executed. Next, in step S14202, initial tone conversion processing is performed using the initial values of the tone conversion parameters. Further, in step S14203, it is determined whether the obtained tone-converted image is appropriate. If not, the tone-conversion parameters are adjusted again in step S14204, and the process returns to step S14202 to repeat the process. On the other hand, if it is determined in step S14203 that an appropriate tone-converted image has been obtained, the process advances to step S14205 to execute a predetermined inspection.

なお、以上の方法ではステップS14203において階調変換パラメータが適切かどうかの判定を行っているが、この手順を省略してもよい、この場合の手順を、図143に示す。各手順は上述した図142の例とほぼ同じであり、ステップS14301において、距離画像の作成処理を実行し、次にステップS14302において、初期の階調変換処理を行う。そしてステップS14303において階調変換パラメータの調整を行った後、ステップS14304において所定の検査を行う。 In the above method, whether or not the gradation conversion parameters are appropriate is determined in step S14203, but this procedure may be omitted. The procedure in this case is shown in FIG. Each procedure is almost the same as the example of FIG. 142 described above. In step S14301, a distance image is created, and in step S14302, initial tone conversion processing is performed. After adjusting the tone conversion parameters in step S14303, a predetermined inspection is performed in step S14304.

初期の階調変換方法としては、例えば入力画像に変換関数f(x,y,z)にかける方法、入力画像にシフト,スパンをかけ、その結果をn階調に圧縮する方法、又は任意の平面を基準平面として、入力画像と基準平面との差分をとり、シフト,スパンをかけ、その結果をn階調に圧縮する方法、あるいは入力画像と基準画像との差分をとり、シフト,スパンをかけ、その結果をn階調に圧縮する方法等が挙げられる。 As an initial tone conversion method, for example, a method of applying a transformation function f(x, y, z) to an input image, a method of applying a shift or span to an input image, and compressing the result to n tones, or any other method may be used. A method of taking a plane as a reference plane, taking the difference between the input image and the reference plane, applying shift and span, and compressing the result into n gradations, or taking the difference between the input image and the reference image, and applying shift and span. and compressing the result into n gradations.

次に、階調変換後の階調変換パラメータを自動調整する具体例について説明する。階調変換パラメータの自動調整方法には、(C1)変換後の距離画像データのヒストグラムの中央値を用いる方法、(C2)ヒストグラムの最大値、最小値を用いる方法、(C3)C1とC2の組み合わせ、等が考えられる。
(C1:ヒストグラムの中央値を用いる方法)
Next, a specific example of automatically adjusting tone conversion parameters after tone conversion will be described. Methods for automatically adjusting tone conversion parameters include (C1) a method using the median value of the histogram of the range image data after conversion, (C2) a method using the maximum and minimum values of the histogram, and (C3) C1 and C2. A combination, etc. are conceivable.
(C1: method using the median value of the histogram)

まず、ヒストグラムの中央値を用いる方法について、図144のフローチャートに基づいて説明する。最初に、ステップS14401において変換後の距離画像データのヒストグラムを計算する。次にステップS14402において、ヒストグラムの中央値を求める。そしてステップS14403において、中央値が予め定めた値になるよう、階調変換パラメータを変更する。ここで変更された階調変換パラメータを用いて、再度、階調変換処理を実行する。なお、中央の前後のn個を含めた2n+1の平均値を中央値としても良い。また、最大値,最小値はそれぞれ大きい方からn個,小さい方からm個をそれぞれ取り除いた後の中央値としてもよい。
(C2:ヒストグラムの最大値、最小値を用いる方法)
First, the method using the median value of the histogram will be described with reference to the flowchart of FIG. First, in step S14401, a histogram of converted distance image data is calculated. Next, in step S14402, the median value of the histogram is obtained. Then, in step S14403, the tone conversion parameters are changed so that the median value becomes a predetermined value. The gradation conversion process is executed again using the gradation conversion parameters changed here. An average value of 2n+1 including n before and after the center may be used as the median. Also, the maximum value and the minimum value may be median values after removing the n largest values and the m smallest values, respectively.
(C2: method using maximum value and minimum value of histogram)

まず、変換後の距離画像データのヒストグラムを計算する。次にヒストグラムの最大値,最小値を求め、最大値-最小値の幅が予め定めた値になるよう、階調変換パラメータを変更する。そして変更した階調変換パラメータで再度、階調変換処理を実行する。ここで、最大値,最小値は、それぞれ大きい方からn個,小さい方からm個のそれぞれ平均値としてもよい。または最大値,最小値は、それぞれ大きい方からn個,小さい方からm個のそれぞれ取り除いた後の最大値、最小値とすることもできる。
(C3:C1とC2の組み合わせ)
First, a histogram of the range image data after conversion is calculated. Next, the maximum value and minimum value of the histogram are obtained, and the gradation conversion parameter is changed so that the width between the maximum value and the minimum value becomes a predetermined value. Then, the gradation conversion process is executed again using the changed gradation conversion parameters. Here, the maximum value and the minimum value may be the average values of the n largest values and the m smallest values, respectively. Alternatively, the maximum value and the minimum value can be the maximum value and the minimum value after removing n from the largest and m from the smallest, respectively.
(C3: combination of C1 and C2)

上記のC1とC2を組み合わせてもよい。すなわち、ヒストグラムの計算後、その中央値と最大値-最小値の幅に基づいて、階調変換パラメータを変更して、再度階調変換する。 You may combine said C1 and C2. That is, after calculating the histogram, the gradation conversion parameter is changed based on the median value and the width of maximum value-minimum value, and gradation conversion is performed again.

以上の方法では、ヒストグラムに予めローパスフィルタを適用することもできる。また、変換後の距離画像に予めローパスフィルタを適用した上で、ヒストグラムを求めても良い。 In the above method, a low-pass filter can also be applied to the histogram in advance. Alternatively, a histogram may be obtained after applying a low-pass filter to the range image after conversion in advance.

このような階調変換によって、高さ情報を含む階調数の高い距離画像を、低階調の低階調距離画像に変換できる。この低階調距離画像は二次元の画像として処理できるので、既存の二次元画像に対応した画像処理装置でも、低階調距離画像を扱うことが可能となる。例えば傷の有無を検査するためワークを撮像した距離画像に含まれる各画素の高さ情報を、濃淡値として16進数の2進数で表現する。ここで、距離画像と基準距離画像の差分を算出すると、ワークの表面に現れる浅くて小さな傷の欠陥情報は、下位8階調に集約される。このため、階調変換手段により、例えば上位8階調を削減することで、検出精度の低下を防ぎつつ、差分画像の情報量を大きく圧縮することができる。このように、階調変換手段が、差分画像の各画素の濃淡値を階調表現したときの階調のうち上位半分の階調を減らすことにより、検出精度の低下を防ぎつつ、差分画像の情報量を大きく圧縮することができる。
(階調変換処理の部分実行)
With such tone conversion, a distance image with a high number of tones including height information can be converted into a low tone distance image with a low tone. Since this low-gradation distance image can be processed as a two-dimensional image, even an existing image processing apparatus compatible with two-dimensional images can handle the low-gradation distance image. For example, height information of each pixel included in a distance image obtained by picking up an image of a work for inspecting the presence or absence of flaws is expressed as a grayscale value in binary hexadecimal. Here, when the difference between the distance image and the reference distance image is calculated, the defect information of shallow and small flaws appearing on the surface of the work is aggregated into the lower 8 gradations. Therefore, by reducing, for example, the upper eight gradations using the gradation conversion means, it is possible to greatly compress the amount of information of the differential image while preventing a decrease in detection accuracy. In this way, the gradation conversion means reduces the gradation in the upper half of the gradation when the gradation value of each pixel of the differential image is expressed in gradation, thereby preventing deterioration in the detection accuracy and converting the differential image. A large amount of information can be compressed.
(Partial execution of gradation conversion processing)

さらに階調変換処理は、距離画像のすべてに対して行うのでなく、一部においてのみ行うことができる。具体的には、階調変換手段は、距離画像の内で、指定された検査対象領域に対してのみ、階調変換処理を実行する。これにより、階調変換処理を軽減して、処理の負荷軽減、高速化が図られる。一例として、図145Aに示すような、径の異なる円柱が三重に重なった形状のワークWK14を用いて、高さ検査処理(第一検査処理)と画像検査処理(第二検査処理)を組み合わせた複数の検査処理を行う場合を考える。ここでは、高さ検査処理として、このワークWK14の円柱状の各面の高さを測定し、また画像検査処理として、ワークWK14の上から二段までの円柱状の部分で欠けや割れの検出を行う外観検査を行う。検査処理の選択は、検査処理選択手段で行う。さらに検査処理選択手段で選択された検査処理に対する具体的な設定は、検査処理設定手段で行う。
(検査処理選択手段)
Furthermore, the gradation conversion process can be performed only on a part of the range image, not on the entire range image. Specifically, the gradation conversion means executes the gradation conversion process only for the specified inspection target area in the distance image. As a result, the gradation conversion process can be reduced, and the processing load can be reduced and the speed can be increased. As an example, height inspection processing (first inspection processing) and image inspection processing (second inspection processing) are combined using a workpiece WK14 having a shape in which cylinders with different diameters are stacked threefold, as shown in FIG. 145A. Consider a case where a plurality of inspection processes are performed. Here, as height inspection processing, the height of each cylindrical surface of this work WK14 is measured, and as image inspection processing, chips and cracks are detected in the cylindrical portion from the top of the work WK14 up to two stages. Perform a visual inspection. Selection of the inspection process is performed by the inspection process selection means. Further, specific settings for the inspection process selected by the inspection process selection means are made by the inspection process setting means.
(Inspection process selection means)

検査処理選択手段は、距離画像に対して、検査実行手段で実行される検査処理を、複数の選択するための手段である。ここでは、図44、図56等に示すように、初期画面260から、処理ユニットの追加を行う際に、検査処理を選択する。具体的には、処理ユニットの「追加」のサブメニューから「計測」処理を選択して表示される、検査処理の一覧中から、所望の検査処理を選択する。この例では、「エリア」、「パターンサーチ」、「Shapetrax2」、「エッジ位置」、「エッジ幅」、「エッジピッチ」、「エッジ角度」、「ペアエッジ」、「傷」、「ブロブ」、「濃淡ブロブ」、「トレンドエッジ位置」、「トレンドエッジ幅」、「トレンドエッジ欠陥」、「濃淡検査」、「色検査」、「OCR」、「2Dコードリーダ」、「1Dコードリーダ」、「高さ計測」の中から、所望の検査処理を選択する。
(検査処理設定手段)
The inspection process selection means is means for selecting a plurality of inspection processes to be executed by the inspection execution means for the distance image. Here, as shown in FIGS. 44, 56, etc., the inspection process is selected from the initial screen 260 when adding a processing unit. Specifically, the desired inspection process is selected from the list of inspection processes displayed by selecting the "measurement" process from the "addition" submenu of the processing unit. In this example, "area", "pattern search", "Shapetrax2", "edge position", "edge width", "edge pitch", "edge angle", "pair edge", "blemish", "blob", ""GrayscaleBlob","Trend Edge Position", "Trend Edge Width", "Trend Edge Defect", "Grayscale Inspection", "Color Inspection", "OCR", "2D Code Reader", "1D Code Reader", "High Select the desired inspection process from "Length measurement".
(Inspection processing setting means)

一方、検査処理設定手段は、検査処理選択手段で選択された各検査処理について、その詳細を設定する。ここでは、図46、図63、図78等に示すように、設定項目ボタン領域112に配置された各ボタンから、各設定項目を個別に設定するよう構成している。この例では、具体的な設定項目が設定項目ボタンとして並べられており、例えば「画像登録」ボタン113、「画像設定」ボタン114、「領域設定」ボタン115、「高さ抽出」ボタン116、「前処理」ボタン117、「検出条件」ボタン118、「詳細設定」ボタン119、「判定条件」ボタン、「表示設定」ボタン、「保存」ボタン等が含まれる。このように設定項目ボタン領域112は、検査処理設定手段として機能する。
(高さ検査処理)
On the other hand, the inspection process setting means sets the details of each inspection process selected by the inspection process selection means. Here, as shown in FIGS. 46, 63, 78, etc., each setting item is configured to be individually set from each button arranged in the setting item button area 112. FIG. In this example, specific setting items are arranged as setting item buttons. It includes a "preprocessing" button 117, a "detection condition" button 118, a "detailed setting" button 119, a "determination condition" button, a "display setting" button, a "save" button, and the like. Thus, the setting item button area 112 functions as inspection processing setting means.
(Height inspection process)

図145Aのようなワーク対し、得られた距離画像の例を図145Bに示す。この距離画像は、階調変換前の16階調で表現している。このような距離画像に対し、高さ計測(高さ検査処理)を行う場合は、階調変換を行うことなく、16階調の高い精度のままの高さ情報を利用することで、高精度な検査が実現できる。具体的には、図145Cに示すように、ワークの各面の高さを計測するために、検査対象領域をワークの3つの面上にそれぞれ設定し、各検査対象領域の高さを16階調のまま計測する。
(画像検査処理)
FIG. 145B shows an example of the distance image obtained for the work as shown in FIG. 145A. This distance image is expressed in 16 gradations before gradation conversion. When performing height measurement (height inspection processing) on such a distance image, high-accuracy height information can be used without performing gradation conversion, and the high-precision height information of 16 gradations can be used. inspection can be realized. Specifically, as shown in FIG. 145C, in order to measure the height of each surface of the work, inspection areas are set on three surfaces of the work, and the height of each inspection area is set to 16 floors. Measure in tune.
(Image inspection processing)

一方、検査処理の内で高さ情報を用いない計測(画像検査処理)を行う場合は、高階調の情報は不要で、より低階調の距離画像で処理を行う方が、負荷が少ない。このため、高階調の距離画像に階調変換を行って、低階調の距離画像を得た上で処理を行う。ここで、距離画像の全体を低階調距離画像に変換する必要はなく、あくまで画像検査処理を行う対象のみに限って階調変換を行えば足りる。すなわち、階調変換を行う領域とは、一以上設定された検査対象領域の内で、高さ情報を用いない画像検査処理用に設定された検査対象領域を対象とする。図145Dに示す例では、図145Bと同様、階調変換前の高階調距離画像に対して、画像検査処理用の検査対象領域を設定する。この例では、ワークの上から二段までで欠け等を検出するために、二段目の円柱状を囲むように検査対象領域を設定する。いいかえると、三段目の円柱状は外観検査対象外なので、この部分を検査対象領域から除外するように設定する。そして、この画像処理検査用対象領域に対して、階調変換を行う。この結果得られた低階調距離画像を、図145Eに示す。この図に示す階調変換後の低階調距離画像は、8階調で表現されており、高階調距離画像に比べ高さ情報は幾分失われているものの、欠けの有無等を検出する外観検査用途には十分な精度が維持されているので、画像検査処理に支障はない。一方で、階調変換が必要な領域は、図145B等に比べて大幅に削減されているので、処理の簡素化、高速化に寄与する。 On the other hand, when performing measurement (image inspection processing) that does not use height information in inspection processing, high-gradation information is not required, and processing with a lower-gradation range image reduces the load. For this reason, the distance image of high gradation is subjected to gradation conversion to obtain the distance image of low gradation, and then the processing is performed. Here, it is not necessary to convert the entire distance image into a low-gradation distance image, and it is sufficient to perform the gradation conversion only on the object for which the image inspection process is to be performed. That is, the area to be subjected to gradation conversion is an inspection area set for image inspection processing that does not use height information, among one or more set inspection areas. In the example shown in FIG. 145D, similarly to FIG. 145B, an inspection target area for image inspection processing is set for the high gradation distance image before gradation conversion. In this example, in order to detect chipping or the like in the top two stages of the workpiece, an inspection target area is set so as to surround the cylindrical shape of the second stage. In other words, the cylindrical shape on the third stage is not subject to visual inspection, so this portion is set to be excluded from the inspection subject area. Then, gradation conversion is performed on this image processing inspection target area. The resulting low tone distance image is shown in FIG. 145E. The low gradation distance image after gradation conversion shown in this figure is expressed in 8 gradations, and although height information is somewhat lost compared to the high gradation distance image, the presence or absence of chipping can be detected. Sufficient accuracy is maintained for visual inspection applications, so there is no problem with image inspection processing. On the other hand, the area requiring tone conversion is greatly reduced compared to FIG.

このようにして、検査処理に応じて階調変換の有無が選択される。例えば図110のフロー表示領域261に表示される検査処理の内、「高さ計測」処理ユニット及び第二「高さ計測」処理ユニットにおいては、階調変換を行うことなく距離画像が有する16階調の高さ情報を利用し、高精度な高さ計測が実現される。一方で、それ以外の検査処理、例えば「数値演算」処理ユニットや「エリア」処理ユニット、「ブロブ」処理ユニット267においては、階調変換した8階調の低階調濃淡画像が使用される。なお、図示しないが輝度画像に対して検査処理(例えば、カラーの輝度画像に対する色検査)を行う場合は、高さ情報がそもそも不要であるため、当然階調変換も不要である。
(階調変換条件設定手段43の表示)
In this way, the presence or absence of gradation conversion is selected according to the inspection process. For example, among the inspection processes displayed in the flow display area 261 in FIG. High-precision height measurement is realized by using the height information of the scale. On the other hand, in other inspection processes, such as the "numerical calculation" processing unit, the "area" processing unit, and the "blob" processing unit 267, the gradation-converted 8-gradation low-gradation image is used. Although not shown, when inspection processing is performed on a luminance image (for example, color inspection on a color luminance image), since height information is not necessary in the first place, gradation conversion is naturally unnecessary.
(Display of gradation conversion condition setting means 43)

また、このような階調変換処理が必要な画像検査処理に関しては、適切な階調変換を行うための階調変換条件を、階調変換条件設定手段43から設定する。この際、階調変換条件設定手段43は、階調変換処理が必要な場合にのみ設定可能とし、逆に階調変換処理が不要な検査処理、例えば高さ検査処理においては、階調変換条件を設定不能とすることで、ユーザは余計な設定作業に惑わされることなく、必要な項目のみをスムーズに設定することが可能となる。そこで、本実施の形態においては、高さ検査処理以外の、画像の高さ情報を必要としない検査処理の設定に際しては、距離画像の階調変換を行うための階調変換パラメータを設定する階調変換条件設定手段43を表示させる一方で、高さ検査処理を設定する際には、階調変換条件設定手段43を表示させないようにしている。 For image inspection processing that requires such tone conversion processing, tone conversion conditions for performing suitable tone conversion are set by the tone conversion condition setting means 43 . At this time, the gradation conversion condition setting means 43 can be set only when gradation conversion processing is required. By disabling setting, the user can smoothly set only the necessary items without being distracted by unnecessary setting work. Therefore, in the present embodiment, when setting an inspection process that does not require height information of an image other than the height inspection process, the steps for setting the gradation conversion parameters for performing gradation conversion of the distance image are set. While the tone conversion condition setting means 43 is displayed, the gradation conversion condition setting means 43 is not displayed when setting the height inspection process.

具体的な設定時の手順を、図146のフローチャートに基づいて説明する。まずステップS14601において、検査処理を選択する。ここでは検査処理選択手段である「計測」メニューで、検査実行手段で実行される検査処理を選択する。次にステップS14602においては、ステップS14601で選択した検査処理が、階調変換を要するものか否かを判定し、階調変換を要する検査処理である場合はステップS14603に進み、階調変換を有効にすると共に、設定項目に階調変換設定手段を表示させる。 A specific setting procedure will be described with reference to the flowchart in FIG. First, in step S14601, an inspection process is selected. Here, the inspection process to be executed by the inspection execution means is selected from the "measurement" menu, which is the inspection process selection means. Next, in step S14602, it is determined whether or not the inspection process selected in step S14601 requires tone conversion. If the inspection process requires tone conversion, the process proceeds to step S14603 to enable tone conversion. At the same time, the gradation conversion setting means is displayed in the setting item.

例えば図145Aのワークに対して「エリア」処理ユニットで画像検査処理を行う際には、図147に示すように、検査処理設定手段である設定項目ボタン領域112に、階調変換条件設定手段43である「高さ抽出」ボタン116を表示させている。「高さ抽出」ボタン116を押下すると、図148に示すように、高さ抽出設定画面が表示される。ユーザはこの画面から、階調変換処理に必要な条件を各々設定できる。 For example, when image inspection processing is performed on the work in FIG. 145A by the "area" processing unit, as shown in FIG. is displayed. When the "height extraction" button 116 is pressed, a height extraction setting screen is displayed as shown in FIG. From this screen, the user can set the conditions necessary for tone conversion processing.

なお図148の例においては、右側の操作領域で設定された階調変換条件に従い、階調変換された低階調距離画像が、画像表示領域上で表示されている。これによってユーザは、現在の階調変換条件で所望の検査結果が得られるかどうかを視覚的に確認でき、階調変換条件の調整作業を容易に行える利点が得られる。特に図148の例では、検査対象領域を円形に設定して、ワークの2番目の円柱状を囲むように配置している。また検出方法を動的変換(リアルタイム抽出)とし、計算方法として平面基準を設定することにより、ワークの中央の天面と、その外周面の2面が検出されて、これらを基準平面として、ワークの表面にある傷や窪みを検出している。また、階調変換条件に従い検出された基準平面のパラメータ表示は、コンソール操作による切り換えて表示させることも可能である。 In the example of FIG. 148, a low gradation distance image that has undergone gradation conversion according to the gradation conversion conditions set in the operation area on the right side is displayed in the image display area. As a result, the user can visually confirm whether or not the desired inspection result can be obtained under the current tone conversion conditions, and thus has the advantage of being able to easily adjust the tone conversion conditions. In particular, in the example of FIG. 148, the area to be inspected is set to be circular and arranged so as to surround the second columnar workpiece. In addition, by using dynamic conversion (real-time extraction) as the detection method and setting the plane reference as the calculation method, the top surface at the center of the workpiece and its outer peripheral surface are detected. It detects scratches and dents on the surface of the The parameter display of the reference plane detected according to the gradation conversion conditions can also be switched and displayed by operating the console.

さらに図148の例では、画像表示領域上に表示されるワークの全体を階調変換した低階調距離画像を表示させるのでなく、設定された検査対象領域の領域内でのみ、階調変換された低階調距離画像のイメージを表示させている。言い換えると、検査対象領域以外の画像は、元の距離画像をそのまま表示させている。これにより、階調変換が入力画像の全体で行われているのでなく、その一部である検査対象領域内でのみ実行されていることを、ユーザに対して視覚的に示すことができる。このようにして階調変換条件の設定が終了すると、ステップS14604に進む。 Furthermore, in the example of FIG. 148, instead of displaying a low gradation distance image obtained by performing gradation conversion on the entire workpiece displayed on the image display area, the gradation conversion is performed only within the set inspection target area. The image of the low gradation distance image is displayed. In other words, the original distance image is displayed as it is for the image other than the inspection target area. Thereby, it is possible to visually indicate to the user that the gradation conversion is not performed on the entire input image, but is performed only within a part of the inspection target area. When the setting of the gradation conversion conditions is completed in this way, the process advances to step S14604.

一方、階調変換を要しない検査処理の場合は、ステップS14603を経ることなくステップS14604にジャンプする。この場合は、検査処理の設定画面において階調変換条件設定手段は表示されない。例えば、「高さ計測」処理ユニットで高さ検査処理を行う場合は、図46等に示すように、検査処理設定手段である設定項目ボタン領域112には、階調変換条件設定手段43である「高さ抽出」ボタンが表示されない。これによってユーザは、高さ検査処理に不要な階調変換に関する条件設定を行う必要がないことを認識できる。あるいは、この検査処理に関しては階調変換条件の設定を行うことができないようにすることで、無用な設定に起因する混乱を回避することができる。 On the other hand, in the case of inspection processing that does not require tone conversion, the process jumps to step S14604 without going through step S14603. In this case, the gradation conversion condition setting means is not displayed on the inspection processing setting screen. For example, when height inspection processing is performed by the "height measurement" processing unit, as shown in FIG. "Extract height" button is not displayed. This allows the user to recognize that there is no need to set conditions related to gradation conversion that are unnecessary for height inspection processing. Alternatively, by making it impossible to set tone conversion conditions for this inspection process, it is possible to avoid confusion caused by unnecessary settings.

そしてステップS14604において、検査処理の設定を行う。最後にステップS14605において、すべての検査処理の設定が終了したか否かを判定し、未だの場合はステップS14601に戻って検査処理の選択から繰り返し、終了した場合は、処理を完了する。 Then, in step S14604, inspection processing is set. Finally, in step S14605, it is determined whether or not the setting of all inspection processes has been completed. If not, the process returns to step S14601 and repeats from the inspection process selection, and if completed, the process is completed.

一方、運転時の手順を、図149のフローチャートに基づいて説明する。まずステップS14901において、入力画像として距離画像を入力する。次にステップS14902において、初期化を行う。ここではnに1を設定する。さらにステップS14903において、n番目の検査処理を実行する。さらにステップS14904において、n<N(Nは設定された検査処理の数)か否かを判定し、YESの場合はステップS14905においてnを1インクリメントした上で、ステップS14903に戻り、次の検査処理を実行する処理を繰り返す。一方、n<Nでない場合は、すべての検査処理を終了したとして、処理を完了する。このようにして、すべての検査処理を順次実行していく。 On the other hand, the procedure during operation will be described based on the flowchart of FIG. First, in step S14901, a distance image is input as an input image. Next, in step S14902, initialization is performed. Here, 1 is set to n. Furthermore, in step S14903, the n-th inspection process is executed. Further, in step S14904, it is determined whether or not n<N (N is the number of set inspection processes).If YES, n is incremented by 1 in step S14905, and the process returns to step S14903 to perform the next inspection process. Repeat the process of executing On the other hand, if not n<N, the process is completed assuming that all inspection processes have been completed. In this way, all inspection processes are executed sequentially.

ここでステップS14903の検査処理の実行について詳述すると、まず検査処理で階調変換を要する場合は、図150のフローチャートに示すように、先にステップS15001において、距離画像の内、検査対象領域に対して、階調変換する。その上で、ステップS15002にて、階調変換後の低階調距離画像に対して、検査処理を実行する。一方、階調変換を行わない検査処理の場合は、図151のフローチャートに示すように、階調変換を経ることなく、高階調の距離画像のまま、検査対象領域内の検査処理を実行する(ステップS15101)。
(画像選択の非表示機能)
Here, the execution of the inspection process in step S14903 will be described in detail. First, if the inspection process requires tone conversion, as shown in the flowchart of FIG. In contrast, gradation conversion is performed. After that, in step S15002, inspection processing is executed for the low tone distance image after tone conversion. On the other hand, in the case of inspection processing that does not perform gradation conversion, as shown in the flowchart of FIG. step S15101).
(Hide function for image selection)

また、設定時においては、検査処理の種別に応じて、検査処理の設定を行う対象となる画像の選択に制限をかけることもできる。すなわち、検査処理選択手段で選択された検査処理が、距離画像又は輝度画像のいずれに対しても実行可能な場合は、これら距離画像又は輝度画像を登録画像として呼び出すことが可能である。その一方で、検査処理が距離画像に対しては実行可能であるものの、輝度画像に対して実行不可能なものがある。例えば高さ計測処理は、高精度な高さ情報を有する距離画像に対して実行されるものである。高さ情報を有しない通常の輝度画像に対しては、行うことができない。そこで、高さ計測処理のような、高さ情報を有する画像、すなわち距離画像に対してのみ実行可能な検査処理は、設定時に登録画像を呼び出す時点において、距離画像のみを選択可能とし、逆に輝度画像については選択できないようにする。これによって、誤って輝度画像に対して高さ計測処理に関する設定を行うような、本来不可能な設定作業を禁止又は排除し、設定の無駄を省き、ユーザの操作性を向上させることができる。 Also, at the time of setting, it is possible to restrict the selection of images for which inspection processing is to be set according to the type of inspection processing. That is, if the inspection process selected by the inspection process selection means can be performed on either the distance image or the luminance image, it is possible to call these distance images or luminance images as registered images. On the other hand, there are inspection processes that can be performed on range images but not on luminance images. For example, height measurement processing is performed on a distance image having highly accurate height information. This cannot be done for normal luminance images that do not have height information. Therefore, inspection processing that can be performed only on an image having height information, that is, a distance image, such as height measurement processing, can select only the distance image at the time of calling the registered image at the time of setting, and conversely, Intensity images are made unselectable. As a result, it is possible to prohibit or eliminate setting work that is originally impossible, such as erroneously setting the height measurement process for the luminance image, eliminate wasteful settings, and improve user operability.

以下、検査処理条件を設定する手順を、図152のフローチャートに基づいて説明する。まず、ステップS15201において、検査処理を選択する。次にステップS15202において、ステップS15201で選択した検査処理が、距離画像と輝度画像のいずれかを指定可能な検査処理か、あるいは距離画像のみを指定可能な検査処理かを判定する。ここで距離画像と輝度画像のいずれかを指定可能な検査処理の場合は、ステップS15203に進み、距離画像又は輝度画像のいずれかを選択する。 The procedure for setting inspection processing conditions will be described below with reference to the flowchart of FIG. First, in step S15201, an inspection process is selected. Next, in step S15202, it is determined whether the inspection process selected in step S15201 is an inspection process capable of designating either a range image or a luminance image, or an inspection process capable of designating only a range image. Here, in the case of inspection processing in which either the distance image or the luminance image can be specified, the flow advances to step S15203 to select either the distance image or the luminance image.

例えば、図61に示すように、検査処理として「エリア」処理ユニットを選択した場合を考える。この場合は、距離画像、輝度画像のいずれでも指定可能である。そこで、「エリア」処理ユニットでの検査処理設定項目として、例えば図62において「画像設定」ボタン114を押下して、図153に示す画像設定画面380を表示させる場合は、操作欄122から画像を選択できる。ここでは、画像選択欄382に設けられた「表示画像」選択欄124で、第二画像表示領域121に表示される画像を選択できる。また画像設定欄384では、入力画像と登録画像を選択できる。この画像設定欄384から、入力画像を画像変数で指定できる。ここでは、「入力画像」選択欄386を選択すると、図154の画像変数選択画面390が表示され、選択可能な画像の一覧が表示される。画像変数選択画面390では、三次元画像処理装置に接続されている複数の撮像手段(カメラ)で撮像された画像のいずれかを選択できる。ここでは、撮像手段毎に異なる画像変数が付与されており、撮像手段と画像変数とが関連付けられている。例えばカメラ1で撮像した距離画像には画像変数「&Cam1Img」が、カメラ2の距離画像には画像変数「&Cam2Img」が、カメラ3の距離画像には画像変数「&Cam3Img」が、カメラ4の距離画像には画像変数「&Cam4Img」が、それぞれ付与されている。さらにカメラ1で撮像した輝度画像には画像変数「&Cam1GrayImg」が付与されている。ユーザは画像変数選択画面390中から、所望の画像を選択する。このように、「エリア」処理ユニットでは距離画像と輝度画像のいずれでも指定可能であるため、距離画像のみならず輝度画像も、選択肢の候補に含めて表示させている。 For example, as shown in FIG. 61, consider the case where the "area" processing unit is selected as inspection processing. In this case, either the distance image or the luminance image can be specified. Therefore, as an inspection processing setting item in the "area" processing unit, for example, when the "image setting" button 114 in FIG. 62 is pressed to display the image setting screen 380 shown in FIG. You can choose. Here, an image to be displayed in the second image display area 121 can be selected in the “display image” selection field 124 provided in the image selection field 382 . Also, in the image setting field 384, an input image and a registered image can be selected. From this image setting column 384, an input image can be specified by an image variable. Here, when the "input image" selection field 386 is selected, the image variable selection screen 390 of FIG. 154 is displayed, and a list of selectable images is displayed. On the image variable selection screen 390, one of images captured by a plurality of imaging means (cameras) connected to the 3D image processing apparatus can be selected. Here, a different image variable is assigned to each imaging means, and the imaging means and the image variables are associated with each other. For example, the image variable "&Cam1Img" for the range image captured by camera 1, the image variable "&Cam2Img" for the range image captured by camera 2, the image variable "&Cam3Img" for the range image captured by camera 3, and the image variable "&Cam3Img" for the range image captured by camera 4. is assigned an image variable "&Cam4Img". Furthermore, an image variable “&Cam1GrayImg” is assigned to the luminance image captured by camera 1 . The user selects a desired image from the image variable selection screen 390 . In this way, since the "area" processing unit can specify either the distance image or the luminance image, not only the distance image but also the luminance image are included in the options and displayed.

さらに必要に応じて、画像変数選択画面390で一覧表示される画像変数を、ソートして表示することもでき、ユーザが所望の画像を選択し易いようにしている。 Furthermore, if necessary, the image variables listed on the image variable selection screen 390 can be sorted and displayed so that the user can easily select a desired image.

一方、検査処理が距離画像のみを指定可能な処理の場合は、ステップS15204に進み、距離画像を選択する。すなわち、輝度画像の選択ができないようにする。例えば、図45に示すように、検査処理として「高さ計測」処理ユニット266を選択した場合は、距離画像のみを選択できる。よって、図46に示すように、「高さ計測」処理ユニットにおける検査処理設定項目として、「画像設定」ボタン114を選択すると、同様に画像設定画面380が表示され、画像を選択できるようになる。ここで、同様に「入力画像」選択欄386を選択すると、図155の画像変数選択画面390が表示され、選択可能な画像の一覧が表示される。この画像変数選択画面390では、図154と異なり、輝度画像が選択肢に表示されず、距離画像のみが選択肢として表示される。この構成によって、ユーザは高さ計測に際して、誤って高さ情報を有さない輝度画像を選択する事態を回避でき、混乱の少ない操作環境が提供される。 On the other hand, if the inspection process can specify only the distance image, the process advances to step S15204 to select the distance image. That is, the selection of the luminance image is disabled. For example, as shown in FIG. 45, when the "height measurement" processing unit 266 is selected as inspection processing, only the distance image can be selected. Therefore, as shown in FIG. 46, when the "image setting" button 114 is selected as an inspection processing setting item in the "height measurement" processing unit, an image setting screen 380 is similarly displayed, and an image can be selected. . Here, if the "input image" selection field 386 is similarly selected, the image variable selection screen 390 of FIG. 155 is displayed, and a list of selectable images is displayed. In this image variable selection screen 390, unlike FIG. 154, the luminance image is not displayed as an option, and only the distance image is displayed as an option. With this configuration, the user can avoid erroneously selecting a luminance image that does not have height information when measuring the height, and provides an operating environment with little confusion.

このようにして、画像が選択されると、ステップS15205に進み、選択された画像に対して、検査処理条件を設定する。このように検査処理毎に、距離画像と輝度画像のいずれかを指定可能な検査処理か、あるいは距離画像のみを指定可能な検査処理かが決まっていることを利用して、検査処理毎に、選択可能な画像の種別を規定することで、設定ミスを回避し、ユーザの利便性に資する。
(検査処理の非表示機能)
After the image is selected in this manner, the flow advances to step S15205 to set inspection processing conditions for the selected image. In this way, for each inspection process, it is determined whether the inspection process can specify either the range image or the luminance image, or the inspection process can specify only the range image. Prescribing the types of selectable images avoids setting errors and contributes to user convenience.
(Hiding function for inspection processing)

以上は、先に検査処理をユーザに選択させた上で、選択された検査処理の種別に応じて、検査処理の設定を行う対象となる画像の選択に際して、選択可能な画像に制限をかける例について説明した。逆に、先に画像を選択させた上で、この画像に対して実行可能な検査処理の種別に制限をかけることもできる。すなわち、まず画像選択手段で距離画像又は輝度画像を選択させ、次に検査処理選択手段でもって、検査実行手段で実行した検査処理を一以上選択する際に、選択された画像が距離画像か輝度画像かに応じて、各画像に対して実行可能な検査処理のみを選択可能とする。この構成であれば、選択された画像に対して、誤って設定不可能な検査処理を選択したり、この検査処理に関する検査処理条件を設定してしまう事態を回避できる。 The above is an example in which the user selects an inspection process first, and then restricts the selectable images when selecting an image for which the inspection process is to be set according to the type of the selected inspection process. explained. Conversely, after selecting an image first, it is also possible to restrict the types of inspection processes that can be performed on this image. That is, first, the image selection means selects a distance image or a luminance image, and then the inspection process selection means selects one or more inspection processes executed by the inspection execution means. Only inspection processing that can be executed for each image can be selected according to the type of image. With this configuration, it is possible to avoid a situation in which an unsettable inspection process is erroneously selected for a selected image or an inspection process condition related to this inspection process is set.

以下、この方法で検査処理条件を設定する手順を、図156のフローチャートに基づいて説明する。まず、ステップS15601において、画像を選択する。ここでは、距離画像か輝度画像かを選択する。次にステップS15602において、ステップS15601で選択した画像が、距離画像と輝度画像のいずれかであるかを判定する。距離画像の場合はステップS15603に進み、距離画像に対して実行可能な検査処理を、検査処理選択手段でもってユーザに選択させる。一方輝度画像の場合はステップS15604に進み、輝度画像に対して実行可能な検査処理を、検査処理選択手段でもってユーザに選択させる。このようにして検査処理が選択されると、ステップS15605に進み、選択された検査処理に対する検査処理条件を検査処理条件設定手段から設定する。 The procedure for setting inspection processing conditions by this method will be described below with reference to the flowchart of FIG. First, in step S15601, an image is selected. Here, either the distance image or the luminance image is selected. Next, in step S15602, it is determined whether the image selected in step S15601 is a distance image or a luminance image. In the case of the distance image, the process advances to step S15603 to allow the user to select an inspection process executable for the distance image using the inspection process selection means. On the other hand, in the case of a luminance image, the process advances to step S15604 to allow the user to select an inspection process executable for the luminance image using the inspection process selection means. When the inspection process is selected in this manner, the flow advances to step S15605 to set inspection process conditions for the selected inspection process from the inspection process condition setting means.

例えば、図157に示すように、ワークに対して輝度画像と距離画像を取得する場合を考える。上述の通り、画像登録を行うと輝度画像と距離画像とが同時に登録される。ユーザは、この内いずれかの画像を選択して、次に選択した画像に対する検査処理を選択し、さらにその検査処理条件の設定を行う。例えば輝度画像を選択した場合は、図158に示すように、輝度画像に対して行う検査処理に対応するツールを追加する。ここでは、上述した図44、図56等と同様に、画像を選択して表示されるサブメニューから追加を選択すると、輝度画像に対して実行可能な検査処理の一覧が表示される。例えば「計測」処理として、「エリア」処理ユニットや「傷」処理ユニット、「ブロブ」処理ユニット267が選択肢として表示される。この段階で、輝度画像に対して実行できない検査処理、例えば「高さ計測」処理ユニットは表示されない。これによって、ユーザが誤って輝度画像に設定できない検査処理を選択してしまう事態を回避できる。なお、すべての計測処理を一覧表示させつつ、グレーアウトさせる等して選択不能とすることもできる。検査処理が選択されると、処理ユニットが確定され、次にこの検査処理に対して必要な検査処理条件の設定を検査処理条件設定手段から行う。 For example, as shown in FIG. 157, consider the case of obtaining a luminance image and a distance image for a work. As described above, when image registration is performed, a luminance image and a distance image are registered at the same time. The user selects one of these images, selects inspection processing for the next selected image, and sets the inspection processing conditions. For example, when a luminance image is selected, a tool corresponding to inspection processing performed on the luminance image is added as shown in FIG. Here, as in FIGS. 44 and 56 described above, when an image is selected and Add is selected from the displayed submenu, a list of inspection processes that can be performed on the luminance image is displayed. For example, as the "measurement" processing, an "area" processing unit, a "blemish" processing unit, and a "blob" processing unit 267 are displayed as options. At this stage, inspection processes that cannot be performed on luminance images, such as the "height measurement" processing unit, are not displayed. This prevents the user from accidentally selecting an inspection process that cannot be set to the luminance image. It should be noted that while displaying a list of all the measurement processes, it is also possible to make them unselectable by, for example, graying them out. When the inspection process is selected, the processing unit is determined, and then the inspection process conditions necessary for this inspection process are set by the inspection process condition setting means.

また、距離画像を選択した場合は、図159に示すように距離画像に対して実行可能な検査処理に対応するツールを追加する。ここでも、距離画像を選択して表示されるサブメニューから追加を選択すると、輝度画像に対して実行可能な検査処理の一覧が表示される。例えば「計測」処理として、「エリア」処理ユニットや「傷」処理ユニット、「ブロブ」処理ユニット267に加えて、「高さ計測」処理ユニットも選択肢として表示される。ユーザは所望の検査処理を選択すると、処理ユニットが確定されて、この検査処理に対して必要な検査処理条件の設定を検査処理条件設定手段から行う。 Also, when a distance image is selected, tools corresponding to inspection processing that can be executed on the distance image are added as shown in FIG. Here too, when the range image is selected and Add is selected from the displayed submenu, a list of inspection processes that can be performed on the luminance image is displayed. For example, as the "measurement" processing, in addition to the "area" processing unit, the "blemish" processing unit, and the "blob" processing unit 267, the "height measurement" processing unit is also displayed as an option. When the user selects a desired inspection process, the processing unit is determined, and the inspection process conditions required for this inspection process are set by the inspection process condition setting means.

このように、画像に対して検査処理ツールを紐付けることで、選択不可能な画像と検査処理との組み合わせを物理的に排除し、ユーザによる設定ミスを容易に回避できる。 By associating an inspection processing tool with an image in this way, it is possible to physically eliminate combinations of images and inspection processing that cannot be selected, and easily avoid setting errors by the user.

本発明の三次元画像処理装置及び三次元画像処理方法は、三角測距の原理を利用した検査装置等に利用できる。 INDUSTRIAL APPLICABILITY The three-dimensional image processing apparatus and the three-dimensional image processing method of the present invention can be used for inspection apparatuses and the like that utilize the principle of triangulation.

100、100’、200、300、400…三次元画像処理装置
1、1B、1C、1D…ヘッド部
2、2’…コントローラ部
3…入力手段
4…表示手段
10、10A、10B…撮像手段
20…投光手段;20A…第一プロジェクタ;20B…第二プロジェクタ
21…測定光源
22…パターン生成部
23、24、25…レンズ
30…ヘッド側制御部
31…ヘッド側演算部
32…距離画像生成手段
34…フィルタ処理部
36…ヘッド側通信手段;36A…コントローラ接続用インターフェース;36B…PC接続用インターフェース
38…記憶手段;38a…距離画像記憶部;38b…輝度画像記憶部
41…コントローラ側設定手段
42…コントローラ側通信手段
43…階調変換条件設定手段
44…基準面設定手段
45…空間コード化切替手段
46…階調変換手段
47…間隔均等化処理設定手段
48…投光切替手段
49…シャッタースピード設定手段
50…検査実行手段
51…主制御部
52…コントローラ側接続部
53…操作入力部
54…表示制御部
55…通信部
56…RAM
57…コントローラ側記憶手段
58…補助記憶手段
59…出力部
60…画像処理部
62…異常点ハイライト手段
64…画像サーチ手段
66…リアルタイム更新手段
70…PLC
110…三次元画像処理プログラムGUI画面
111…第一画像表示領域
112…設定項目ボタン領域
113…「画像登録」ボタン
114…「画像設定」ボタン
115…「領域設定」ボタン
116…「高さ抽出」ボタン
117…「前処理」ボタン
118…「検出条件」ボタン
119…「詳細設定」ボタン
120…検査対象領域設定画面
121…第二画像表示領域
122…操作領域
124…「表示画像」選択欄
126…「計測領域」設定欄
128…「編集」ボタン
130…計測領域編集画面
140…高さ抽出選択画面
142…抽出方法選択手段
144…「抽出」ボタン
145…「抽出領域」指定欄
146…点状ポインタ
147…「抽出領域」ボタン
148…抽出領域設定ダイヤログ
149…抽出領域選択欄
150…一点指定画面
152…「Z高さ」表示欄
154…強調方法設定欄
156…ゲイン調整欄
158…「詳細設定」ボタン
160…強調方法詳細設定画面
162…「抽出高さ」設定欄
164…ノイズ除去設定欄
166…無効画素指定欄
170…三点指定画面
172…高さ抽出表示欄
174…三点指定「詳細設定」ボタン
180…三点指定詳細設定画面
182…「抽出高さ」設定欄
190…高さ動的抽出設定画面
192…「計算方法」選択欄
194…「マスク領域」ボタン
196…「詳細設定」ボタン
210…平均高さ基準設定画面
220…マスク領域設定画面
222…「詳細設定」ボタン
230…平均高さ基準詳細設定画面
240…平面基準詳細設定画面
250…自由曲面基準設定画面
252…「抽出サイズ」指定欄
260…初期画面
261…フロー表示領域
262…第三画像表示領域
263…「撮像」処理ユニット
264…「Shapetrax2」処理ユニット
265…「位置補正」処理ユニット
266…「高さ計測」処理ユニット;266B…第二「高さ計測」処理ユニット
267…「ブロブ」処理ユニット;267B…「色検査」処理ユニット
268…「編集」ボタン
269…撮像設定メニュー
270…画像登録画面
271…「カメラ選択」欄
272…「登録」ボタン
280…撮像設定画面
282…「詳細設定」ボタン
284…「撮像設定」ボタン
290…三次元計測設定画面
292…「連続更新で表示する」欄
294…シャッタースピード設定欄
295…数値表示欄
296…濃淡レンジ設定欄
310…前処理設定欄
312…計測不能基準設定欄
314…均等間隔処理設定欄
316…空間コード設定欄
318…プロジェクタ選択設定欄
322…「表示画像」選択欄
324…「編集」ボタン
326…抽出領域編集ダイヤログ
330…マスク領域設定欄
332…「編集」ボタン
334…マスク領域編集ダイヤログ
340…フィルタ処理設定画面
350…二値化レベル設定画面
360…判定条件設定画面
370…第一サブメニュー
372…第二サブメニュー
373…「計測」メニュー
380…画像設定画面
382…画像選択欄
384…画像設定欄
386…「入力画像」選択欄
390…画像変数選択画面
460…高さ計測設定画面
620…エリア設定画面
630…自由曲面基準設定画面
632…「抽出方向」指定欄
640…詳細設定画面
WK、WK7、WK8、WK9、WK10、WK11、WK12、WK13、WK14…ワーク
PC…パーソナルコンピュータ
SA…サーチ対象領域
SI…スポイト状アイコン
ROI…計測領域
BC…ベルトコンベア
DE…打痕
100, 100', 200, 300, 400... three-dimensional image processing apparatus 1, 1B, 1C, 1D... head section 2, 2'... controller section 3... input means 4... display means 10, 10A, 10B... imaging means 20 20A First projector 20B Second projector 21 Measurement light source 22 Pattern generation unit 23, 24, 25 Lens 30 Head side control unit 31 Head side calculation unit 32 Distance image generation means 34 Filter processing section 36 Head-side communication means 36A Controller connection interface 36B PC connection interface 38 Storage means 38a Distance image storage section 38b Luminance image storage section 41 Controller-side setting means 42 Controller-side communication means 43 Gradation conversion condition setting means 44 Reference plane setting means 45 Spatial coding switching means 46 Gradation conversion means 47 Interval equalization processing setting means 48 Light projection switching means 49 Shutter speed Setting means 50 Inspection execution means 51 Main control unit 52 Controller side connection unit 53 Operation input unit 54 Display control unit 55 Communication unit 56 RAM
57 Controller-side storage means 58 Auxiliary storage means 59 Output section 60 Image processing section 62 Abnormal point highlight means 64 Image search means 66 Real-time update means 70 PLC
110... Three-dimensional image processing program GUI screen 111... First image display area 112... Setting item button area 113... "Image registration" button 114... "Image setting" button 115... "Area setting" button 116... "Extract height" Button 117 -- "Preprocessing" button 118 -- "Detection condition" button 119 -- "Detailed setting" button 120 -- Inspection target area setting screen 121 -- Second image display area 122 -- Operation area 124 -- "Display image" selection field 126 -- "Measurement area" setting field 128 --- "Edit" button 130 --- Measurement area editing screen 140 --- Height extraction selection screen 142 --- Extraction method selection means 144 --- "Extraction" button 145 --- "Extraction region" designation field 146 --- Point pointer 147..."Extraction area" button 148...Extraction area setting dialog 149...Extraction area selection field 150...One point designation screen 152..."Z height" display field 154...Enhancement method setting field 156...Gain adjustment field 158..."Detailed setting '' button 160...Enhancement method detail setting screen 162..."Extraction height" setting field 164...Noise removal setting field 166...Invalid pixel designation field 170...Three-point designation screen 172...Height extraction display field 174...Three-point designation "Details Setting" button 180 --- Three-point specification detailed setting screen 182 --- "Extraction height" setting field 190 --- Height dynamic extraction setting screen 192 --- "Calculation method" selection field 194 --- "Mask area" button 196 --- "Detailed setting" Button 210 Average height reference setting screen 220 Mask area setting screen 222 "Detailed setting" button 230 Average height reference detailed setting screen 240 Plane reference detailed setting screen 250 Free curved surface reference setting screen 252 Extraction size Designation field 260... Initial screen 261... Flow display area 262... Third image display area 263... ``Imaging'' processing unit 264... ``Shapetrax2'' processing unit 265... ``Position correction'' processing unit 266... ``Height measurement'' processing unit 266B...second "height measurement" processing unit 267..."blob" processing unit; 267B..."color inspection" processing unit 268..."edit" button 269...imaging setting menu 270...image registration screen 271..."camera selection" Column 272 --- "Register" button 280 --- Imaging setting screen 282 --- "Detailed setting" button 284 --- "Imaging setting" button 290 --- Three-dimensional measurement setting screen 292 --- "Display by continuous update" column 294 --- Shutter speed setting column 295 Numeric value display field 296 Gradation range setting field 310 Preprocessing setting field 312 Unmeasurable standard setting field 314 Equal interval processing setting field 316 Spatial code setting field 318 Projector selection setting field 322 --- "Display image" selection field 324 --- "Edit" button 326 ---Extraction region edit dialog 330 --- Mask region setting field 332 --- "Edit" button 334 --- Mask region edit dialog 340 --- Filter processing setting screen 350 Binary level setting screen 360 Judgment condition setting screen 370 First submenu 372 Second submenu 373 "Measurement" menu 380 Image setting screen 382 Image selection field 384 Image setting field 386 " Input image" selection field 390 Image variable selection screen 460 Height measurement setting screen 620 Area setting screen 630 Free curved surface reference setting screen 632 Extraction direction designation field 640 Detailed setting screen WK, WK7, WK8, WK9 , WK10, WK11, WK12, WK13, WK14 Work PC Personal computer SA Search target area SI Syringe icon ROI Measurement area BC Belt conveyor DE Hit marks

Claims (11)

検査対象物の高さ情報を含む距離画像を取得すると共に、該距離画像に基づいて画像処理を行うことが可能な三次元画像処理装置であって、
検査対象物の画像を撮像する撮像手段と、
前記撮像手段で撮像された画像に基づいて、距離画像を生成可能な距離画像生成手段と、
前記距離画像生成手段で生成された距離画像を、該距離画像の階調数よりも低い階調数の距離画像に階調変換する際の基準となる基準面を設定するための基準面設定手段と、
前記基準面設定手段で設定された基準面の高さを基準として、前記距離画像を、該距離画像の階調数よりも低い階調数の、該距離画像が有する高さ情報を画像の濃淡値に置き換えた低階調距離画像に階調変換するための階調変換手段と、
前記階調変換手段による階調変換に際して、局所的な形状変化を抽出する方向を指定するための抽出方向入力手段と、
前記階調変換手段で階調変換された低階調距離画像に対して、所定の検査処理を実行するための検査実行手段と、
を備え、
前記基準面設定手段は、前記距離画像生成手段により生成された距離画像から、高周波成分を除いた曲面を演算し、該演算された曲面を基準面として設定するよう構成され
前記抽出方向入力手段が、局所的な形状変化を抽出する方向として、距離画像のX方向、Y方向、又はXY方向のいずれかを指定可能としてなる三次元画像処理装置。
A three-dimensional image processing apparatus capable of acquiring a distance image including height information of an inspection object and performing image processing based on the distance image,
an imaging means for imaging an image of an inspection object;
distance image generation means capable of generating a distance image based on the image captured by the imaging means;
Reference plane setting means for setting a reference plane that serves as a reference when tone-converting the distance image generated by the distance image generation means into a distance image having a lower tone number than the distance image. When,
Using the height of the reference plane set by the reference plane setting means as a reference, the distance image has height information of a lower gradation number than the gradation number of the distance image. gradation conversion means for performing gradation conversion to a low gradation distance image replaced with a value;
extraction direction input means for designating a direction for extracting a local shape change when the tone conversion is performed by the tone conversion means;
inspection execution means for performing a predetermined inspection process on the low gradation distance image gradation-converted by the gradation conversion means;
with
The reference plane setting means is configured to calculate a curved surface from which high-frequency components are removed from the distance image generated by the distance image generating means, and to set the calculated curved surface as a reference plane ,
A three-dimensional image processing apparatus in which the extraction direction input means can designate any of the X direction, Y direction, or XY direction of the range image as the direction for extracting the local shape change .
請求項1に記載の三次元画像処理装置であって、
前記距離画像生成手段は、前記三次元画像処理装置で三次元画像処理を行う運用時に、前記撮像手段により撮像された検査対象物の入力画像に基づいて検査対象物の距離画像を逐次生成し、前記基準面設定手段が、逐次生成された距離画像の高さ情報に基づいて基準面を再設定することにより、検査対象物の高さに応じて基準面を変更するように構成されている三次元画像処理装置。
The three-dimensional image processing device according to claim 1,
The distance image generation means sequentially generates a distance image of the inspection object based on the input image of the inspection object captured by the imaging means during operation of performing three-dimensional image processing in the three-dimensional image processing device, The reference plane setting means is configured to change the reference plane according to the height of the object to be inspected by resetting the reference plane based on the height information of the distance images that are sequentially generated. Original image processing device.
請求項に記載の三次元画像処理装置であって、
前記階調変換手段が、階調変換に際して、距離画像を一旦縮小し、フィルタ処理を行った後拡大して自由曲面画像を作成し、該自由曲面画像と距離画像との差分を取ることで、距離画像の形状変化を抽出するものであり、
該距離画像の縮小に際して、前記抽出方向入力手段で指定された方向に対してのみ縮小を行う三次元画像処理装置。
The three-dimensional image processing device according to claim 1 ,
When the gradation conversion means performs gradation conversion, the distance image is once reduced, filtered and then enlarged to create a free-form surface image, and the difference between the free-form surface image and the distance image is obtained. It extracts the shape change of the distance image,
A three-dimensional image processing apparatus for reducing the distance image only in the direction specified by the extraction direction input means when reducing the distance image.
請求項1~のいずれか一項に記載の三次元画像処理装置であって、さらに
検査対象物に対して光切断法で投光するための投光手段を備えており、
前記撮像手段は、前記投光手段で投光された画像を撮像し、前記距離画像生成手段は光切断法で得られたプロファイルを合成して距離画像を生成するよう構成してなる三次元画像処理装置。
The three-dimensional image processing apparatus according to any one of claims 1 to 3 , further comprising a light projecting means for projecting light onto the inspection object by a light section method,
The three-dimensional image is configured such that the image capturing means captures an image projected by the light projecting means, and the distance image generating means generates a distance image by synthesizing profiles obtained by a light section method. processing equipment.
請求項1~のいずれか一項に記載の三次元画像処理装置であって、さらに
前記撮像手段の光軸に対して斜め方向から入射光を所定の投影パターンの構造化照明として投光するための投光手段を備えており、
前記撮像手段は、前記投光手段で投光され、検査対象物で反射された反射光を取得して複数のパターン投影画像を撮像し、
前記距離画像生成手段は、前記撮像手段で撮像された複数のパターン投影画像に基づいて、距離画像を生成するよう構成してなる三次元画像処理装置。
The three-dimensional image processing apparatus according to any one of claims 1 to 3 , further comprising
a light projecting means for projecting incident light from an oblique direction with respect to the optical axis of the imaging means as structured illumination having a predetermined projection pattern;
the imaging means captures a plurality of pattern projection images by acquiring reflected light projected by the light projecting means and reflected by the inspection object;
The three-dimensional image processing apparatus according to claim 1, wherein the distance image generating means generates a distance image based on a plurality of pattern projection images captured by the imaging means.
請求項1~5のいずれか一項に記載の三次元画像処理装置であって、さらに The three-dimensional image processing device according to any one of claims 1 to 5, further comprising
前記階調変換手段による階調変換に際して、前記基準面に基づいて抽出すべき高さ情報を指定するための抽出高さ設定手段を備えており、 extraction height setting means for designating height information to be extracted based on the reference plane when the gradation conversion is performed by the gradation conversion means;
前記抽出高さ設定手段は、前記抽出すべき高さ情報として、前記基準面よりも高い側、低い側、又は高低両方のいずれかを指定可能とし、 The extraction height setting means can specify, as the height information to be extracted, a higher side, a lower side, or both higher and lower than the reference plane,
前記高い側が指定された場合、前記階調変換手段は、前記基準面が前記低階調距離画像の距離レンジの下限となるように階調変換し、 when the higher side is specified, the tone conversion means performs tone conversion so that the reference plane becomes the lower limit of the distance range of the low tone distance image;
前記低い側が指定された場合、前記階調変換手段は、前記基準面が前記低階調距離画像の距離レンジの上限となるように階調変換し、 when the lower side is specified, the tone conversion means performs tone conversion so that the reference plane becomes the upper limit of the distance range of the low tone distance image;
前記高低両方が指定された場合、前記階調変換手段は、前記基準面が前記低階調距離画像の距離レンジの中間となるように階調変換する三次元画像処理装置。 The three-dimensional image processing device according to claim 1, wherein, when both the high and low are specified, the tone conversion means performs tone conversion so that the reference plane is in the middle of the distance range of the low tone distance image.
検査対象物の高さ情報を含む距離画像を取得すると共に、該距離画像に基づいて画像処理を行う三次元画像処理方法であって、
撮像手段の光軸に対して斜め方向から入射光を所定の投影パターンの構造化照明として投光手段で投光する工程と、
前記投光手段で投光され、検査対象物で反射された反射光を取得して複数のパターン投影画像を撮像手段で撮像する工程と、
前記撮像手段で撮像された複数のパターン投影画像に基づいて、距離画像を距離画像生成手段で生成する工程と、
前記距離画像生成手段で生成された距離画像を、該距離画像の階調数よりも低い階調数の距離画像に階調変換する際の階調変換条件を構成する階調変換パラメータとして、該階調変換を行う基準となる基準面を設定する工程と、
前記設定された基準面の高さを基準として、前記距離画像を、該距離画像の階調数よりも低い階調数の、該距離画像が有する高さ情報を画像の濃淡値に置き換えた低階調距離画像に階調変換する工程と、
前記基準面の設定に際して、局所的な形状変化を抽出する方向として、距離画像のX方向、Y方向、又はXY方向のいずれかを指定するよう促す工程と、
前記階調変換された低階調距離画像に対して、所定の検査処理を実行する工程と
を含み、
前記階調変換に際して、距離画像から高周波成分を除いた曲面を演算し、該演算された曲面を基準面として低階調距離画像に階調変換する三次元画像処理方法。
A three-dimensional image processing method for acquiring a distance image containing height information of an inspection object and performing image processing based on the distance image,
a step of projecting incident light from an oblique direction with respect to the optical axis of the imaging means as structured illumination of a predetermined projection pattern by the projection means;
a step of capturing a plurality of pattern projection images by capturing the light projected by the light projecting means and reflected by the object to be inspected;
a step of generating a distance image by a distance image generating means based on the plurality of pattern projection images captured by the imaging means;
As a gradation conversion parameter constituting a gradation conversion condition for gradation conversion of the distance image generated by the distance image generating means into a distance image having a lower gradation number than the distance image, setting a reference plane as a reference for tone conversion;
Using the height of the set reference plane as a reference, the distance image has a number of gradations lower than the number of gradations of the distance image. a step of tone conversion to a tone distance image;
a step of prompting to specify any one of the X direction, Y direction, or XY direction of the range image as a direction for extracting local shape changes when setting the reference plane;
and executing a predetermined inspection process on the tone-converted low tone distance image,
A three-dimensional image processing method for calculating a curved surface from which high-frequency components are removed from a range image, and using the calculated curved surface as a reference plane for tone conversion into a low-level range image.
請求項7記載の三次元画像処理方法であって、
前記階調変換に際して、距離画像を一旦縮小し、フィルタ処理を行い、拡大して自由曲面画像を作成し、該自由曲面画像と距離画像との差分を取ることで、距離画像の形状変化を抽出しするものであり、
該距離画像の縮小に際して、前記階調変換において局所的な形状変化を抽出する方向を指定するための抽出方向入力手段で指定された方向に対してのみ縮小を行う三次元画像処理方法。
The three-dimensional image processing method according to claim 7 ,
During the tone conversion, the distance image is first reduced, filtered, enlarged to create a free-form surface image, and the difference between the free-form surface image and the distance image is taken to extract the shape change of the distance image. and
A three-dimensional image processing method for reducing the distance image only in a direction designated by an extraction direction input means for designating a direction for extracting a local shape change in the gradation conversion when reducing the distance image.
請求項7又は8に記載の三次元画像処理方法であって、さらに The three-dimensional image processing method according to claim 7 or 8, further comprising
前記階調変換に際して、前記基準面に基づいて抽出すべき高さ情報として、前記基準面よりも高い側、低い側、又は高低両方のいずれかを指定するよう促す工程を備えており、 a step of prompting the user to specify any one of a higher side, a lower side, or both higher and lower than the reference plane as height information to be extracted based on the reference plane when converting the gradation;
前記高い側が指定された場合、前記基準面が、前記低階調距離画像の距離レンジの下限となるように階調変換し、 when the high side is specified, tone conversion is performed so that the reference plane is the lower limit of the distance range of the low tone distance image;
前記低い側が指定された場合、前記基準面が、前記低階調距離画像の距離レンジの上限となるように階調変換し、 when the lower side is specified, tone conversion is performed so that the reference plane becomes the upper limit of the distance range of the low tone distance image;
前記高低両方が指定された場合、前記基準面が、前記低階調距離画像の距離レンジの中間となるように階調変換する三次元画像処理方法。 A three-dimensional image processing method for tone-converting such that when both the height and the low are specified, the reference plane is in the middle of the distance range of the low-tone distance image.
検査対象物の高さ情報を含む距離画像を取得すると共に、該距離画像に基づいて画像処理を行うことが可能な三次元画像処理装置であって、 A three-dimensional image processing apparatus capable of acquiring a distance image including height information of an inspection object and performing image processing based on the distance image,
検査対象物の画像を撮像する撮像手段と、 an imaging means for imaging an image of an inspection object;
前記撮像手段で撮像された画像に基づいて、距離画像を生成可能な距離画像生成手段と、 distance image generation means capable of generating a distance image based on the image captured by the imaging means;
前記距離画像生成手段で生成された距離画像を、該距離画像の階調数よりも低い階調数の距離画像に階調変換する際の基準となる基準面を設定するための基準面設定手段と、 Reference plane setting means for setting a reference plane that serves as a reference when tone-converting the distance image generated by the distance image generation means into a distance image having a lower tone number than the distance image. When,
前記基準面設定手段で設定された基準面の高さを基準として、前記距離画像を、該距離画像の階調数よりも低い階調数の、該距離画像が有する高さ情報を画像の濃淡値に置き換えた低階調距離画像に階調変換するための階調変換手段と、 Using the height of the reference plane set by the reference plane setting means as a reference, the distance image has height information of a lower gradation number than the gradation number of the distance image. gradation conversion means for performing gradation conversion to a low gradation distance image replaced with a value;
前記階調変換手段による階調変換に際して、前記基準面に基づいて抽出すべき高さ情報を指定するための抽出高さ設定手段と、 extraction height setting means for designating height information to be extracted based on the reference plane when the gradation conversion is performed by the gradation conversion means;
前記階調変換手段で階調変換された低階調距離画像に対して、所定の検査処理を実行するための検査実行手段と、 inspection execution means for performing a predetermined inspection process on the low gradation distance image gradation-converted by the gradation conversion means;
を備え、with
前記基準面設定手段は、前記距離画像生成手段により生成された距離画像から、高周波成分を除いた曲面を演算し、該演算された曲面を基準面として設定するよう構成され、 The reference plane setting means is configured to calculate a curved surface from which high-frequency components are removed from the distance image generated by the distance image generating means, and to set the calculated curved surface as a reference plane,
前記抽出高さ設定手段は、前記抽出すべき高さ情報として、前記基準面よりも高い側、低い側、又は高低両方のいずれかを指定可能とし、 The extraction height setting means can specify, as the height information to be extracted, a higher side, a lower side, or both higher and lower than the reference plane,
前記高い側が指定された場合、前記抽出高さ設定手段は、前記基準面が前記低階調距離画像の距離レンジの下限となるように階調変換し、 When the high side is specified, the extraction height setting means performs tone conversion so that the reference plane becomes the lower limit of the distance range of the low tone distance image,
前記低い側が指定された場合、前記抽出高さ設定手段は、前記基準面が前記低階調距離画像の距離レンジの上限となるように階調変換し、 When the lower side is specified, the extraction height setting means performs tone conversion so that the reference plane becomes the upper limit of the distance range of the low tone distance image,
前記高低両方が指定された場合、前記抽出高さ設定手段は、前記基準面が前記低階調距離画像の距離レンジの中間となるように階調変換する三次元画像処理装置。 In the three-dimensional image processing device, when both the high and low are specified, the extraction height setting means carries out tone conversion so that the reference plane is in the middle of the distance range of the low tone distance image.
検査対象物の高さ情報を含む距離画像を取得すると共に、該距離画像に基づいて画像処理を行う三次元画像処理方法であって、 A three-dimensional image processing method for acquiring a distance image containing height information of an inspection object and performing image processing based on the distance image,
撮像手段の光軸に対して斜め方向から入射光を所定の投影パターンの構造化照明として投光手段で投光する工程と、 a step of projecting incident light from an oblique direction with respect to the optical axis of the imaging means as structured illumination of a predetermined projection pattern by the projection means;
前記投光手段で投光され、検査対象物で反射された反射光を取得して複数のパターン投影画像を撮像手段で撮像する工程と、 a step of capturing a plurality of pattern projection images by capturing the light projected by the light projecting means and reflected by the object to be inspected;
前記撮像手段で撮像された複数のパターン投影画像に基づいて、距離画像を距離画像生成手段で生成する工程と、 a step of generating a distance image by a distance image generating means based on the plurality of pattern projection images captured by the imaging means;
前記距離画像生成手段で生成された距離画像を、該距離画像の階調数よりも低い階調数の距離画像に階調変換する際の階調変換条件を構成する階調変換パラメータとして、該階調変換を行う基準となる基準面を設定する工程と、 As a gradation conversion parameter constituting a gradation conversion condition for gradation conversion of the distance image generated by the distance image generating means into a distance image having a lower gradation number than the distance image, setting a reference plane as a reference for tone conversion;
前記設定された基準面の高さを基準として、前記距離画像を、該距離画像の階調数よりも低い階調数の、該距離画像が有する高さ情報を画像の濃淡値に置き換えた低階調距離画像に階調変換する工程と、 Using the height of the set reference plane as a reference, the distance image has a number of gradations lower than the number of gradations of the distance image. a step of tone conversion to a tone distance image;
前記階調変換に際して、前記基準面に基づいて抽出すべき高さ情報として、前記基準面よりも高い側、低い側、又は高低両方のいずれかを指定するよう促す工程と、 a step of prompting the user to specify any one of a higher side, a lower side, or both higher and lower than the reference plane as height information to be extracted based on the reference plane when performing the tone conversion;
前記階調変換された低階調距離画像に対して、所定の検査処理を実行する工程と a step of performing a predetermined inspection process on the tone-converted low tone distance image;
を含み、including
前記階調変換に際して、距離画像から高周波成分を除いた曲面を演算し、該演算された曲面を基準面として低階調距離画像に階調変換し、 During the tone conversion, a curved surface is calculated by removing high-frequency components from the distance image, and the calculated curved surface is used as a reference surface for tone conversion into a low-tone distance image,
前記高い側が指定された場合、前記基準面が、前記低階調距離画像の距離レンジの下限となるように階調変換し、 when the high side is specified, tone conversion is performed so that the reference plane is the lower limit of the distance range of the low tone distance image;
前記低い側が指定された場合、前記基準面が、前記低階調距離画像の距離レンジの上限となるように階調変換し、 when the lower side is specified, tone conversion is performed so that the reference plane becomes the upper limit of the distance range of the low tone distance image;
前記高低両方が指定された場合、前記基準面が、前記低階調距離画像の距離レンジの中間となるように階調変換する三次元画像処理方法。 A three-dimensional image processing method for tone-converting such that when both the height and the low are specified, the reference surface is in the middle of the distance range of the low-tone distance image.
JP2021115017A 2013-07-16 2021-07-12 3D image processing device and 3D image processing method Active JP7150105B2 (en)

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP2013148063 2013-07-16
JP2013148063 2013-07-16
JP2019070254A JP6913705B2 (en) 2013-07-16 2019-04-01 3D image processing equipment, 3D image processing methods and 3D image processing programs, computer-readable recording media and recording equipment

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2019070254A Division JP6913705B2 (en) 2013-07-16 2019-04-01 3D image processing equipment, 3D image processing methods and 3D image processing programs, computer-readable recording media and recording equipment

Publications (2)

Publication Number Publication Date
JP2021177186A JP2021177186A (en) 2021-11-11
JP7150105B2 true JP7150105B2 (en) 2022-10-07

Family

ID=52631615

Family Applications (3)

Application Number Title Priority Date Filing Date
JP2014075429A Active JP6506914B2 (en) 2013-07-16 2014-04-01 Three-dimensional image processing apparatus, three-dimensional image processing method, three-dimensional image processing program, computer readable recording medium, and recorded apparatus
JP2019070254A Active JP6913705B2 (en) 2013-07-16 2019-04-01 3D image processing equipment, 3D image processing methods and 3D image processing programs, computer-readable recording media and recording equipment
JP2021115017A Active JP7150105B2 (en) 2013-07-16 2021-07-12 3D image processing device and 3D image processing method

Family Applications Before (2)

Application Number Title Priority Date Filing Date
JP2014075429A Active JP6506914B2 (en) 2013-07-16 2014-04-01 Three-dimensional image processing apparatus, three-dimensional image processing method, three-dimensional image processing program, computer readable recording medium, and recorded apparatus
JP2019070254A Active JP6913705B2 (en) 2013-07-16 2019-04-01 3D image processing equipment, 3D image processing methods and 3D image processing programs, computer-readable recording media and recording equipment

Country Status (1)

Country Link
JP (3) JP6506914B2 (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6611576B2 (en) * 2015-11-30 2019-11-27 キヤノン株式会社 Image processing apparatus and image processing method
JP6540557B2 (en) * 2016-03-07 2019-07-10 オムロン株式会社 Image measurement system and controller
KR101802812B1 (en) * 2016-04-20 2017-11-29 주식회사 고영테크놀러지 Inspecting apparatus for product appearance and inspection method for product appearance using the same
JP6745173B2 (en) * 2016-09-06 2020-08-26 株式会社キーエンス Image inspection apparatus, image inspection method, image inspection program, computer-readable recording medium, and recorded device
JP6946659B2 (en) * 2017-02-22 2021-10-06 オムロン株式会社 Optical displacement sensor and system with it
JP6917780B2 (en) * 2017-05-31 2021-08-11 株式会社キーエンス Image inspection equipment
CN107607548A (en) * 2017-09-29 2018-01-19 青海黄河上游水电开发有限责任公司光伏产业技术分公司 The hidden method for splitting defect of photovoltaic module is detected by 3-D view
JP6802225B2 (en) * 2018-08-31 2020-12-16 ファナック株式会社 Information processing device and information processing method
TWI670467B (en) * 2018-10-15 2019-09-01 立普思股份有限公司 Processing method using depth image detection
JP7378934B2 (en) * 2019-01-29 2023-11-14 キヤノン株式会社 Information processing device, information processing method and system
JP7401648B2 (en) * 2020-03-05 2023-12-19 ファナック株式会社 3D measurement device and 3D measurement method
JP7402745B2 (en) 2020-05-22 2023-12-21 株式会社キーエンス Imaging device and image inspection system
JP7157112B2 (en) * 2020-10-07 2022-10-19 Ckd株式会社 Solder print inspection device
CN112837327B (en) * 2021-01-28 2023-04-28 北京淳中科技股份有限公司 Image processing method and device, electronic equipment and storage medium
KR102650432B1 (en) * 2021-05-13 2024-03-25 (주)피아이이 3-Dimension image defect measurement system and method
WO2023100734A1 (en) * 2021-11-30 2023-06-08 コニカミノルタ株式会社 Image forming system, image forming method, and program

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007206797A (en) 2006-01-31 2007-08-16 Omron Corp Image processing method and image processor
WO2011070914A1 (en) 2009-12-11 2011-06-16 第一実業ビスウィル株式会社 Appearance inspection device
JP2012021909A (en) 2010-07-15 2012-02-02 Keyence Corp Image processing device and visual inspection method

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000333210A (en) * 1999-05-21 2000-11-30 Asahi Optical Co Ltd Three-dimensional image input device and recording medium
JP2000341720A (en) * 1999-05-31 2000-12-08 Asahi Optical Co Ltd Three-dimensional image input device and recording medium
JP4753711B2 (en) * 2005-12-22 2011-08-24 株式会社キーエンス 3D image display device, 3D image display device operation method, 3D image display program, computer-readable recording medium, and recorded device
JP5147650B2 (en) * 2007-12-10 2013-02-20 富士フイルム株式会社 Distance image processing apparatus and method, distance image reproduction apparatus and method, and program
US20090148038A1 (en) * 2007-12-10 2009-06-11 Youichi Sawachi Distance image processing apparatus and method
JP4998956B2 (en) * 2007-12-10 2012-08-15 富士フイルム株式会社 Distance image processing apparatus and method, distance image reproduction apparatus and method, and program
JP2009163717A (en) * 2007-12-10 2009-07-23 Fujifilm Corp Distance image processing apparatus and method, distance image reproducing apparatus and method, and program
JP5218177B2 (en) * 2009-03-13 2013-06-26 オムロン株式会社 Image processing apparatus and method
US9013469B2 (en) * 2011-03-04 2015-04-21 General Electric Company Method and device for displaying a three-dimensional view of the surface of a viewed object

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007206797A (en) 2006-01-31 2007-08-16 Omron Corp Image processing method and image processor
WO2011070914A1 (en) 2009-12-11 2011-06-16 第一実業ビスウィル株式会社 Appearance inspection device
JP2012021909A (en) 2010-07-15 2012-02-02 Keyence Corp Image processing device and visual inspection method

Also Published As

Publication number Publication date
JP2021177186A (en) 2021-11-11
JP6506914B2 (en) 2019-04-24
JP6913705B2 (en) 2021-08-04
JP2015038466A (en) 2015-02-26
JP2019105657A (en) 2019-06-27

Similar Documents

Publication Publication Date Title
JP7150105B2 (en) 3D image processing device and 3D image processing method
JP6270361B2 (en) 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP6242098B2 (en) 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP5564349B2 (en) Image processing apparatus and appearance inspection method
JP6745173B2 (en) Image inspection apparatus, image inspection method, image inspection program, computer-readable recording medium, and recorded device
JP5564348B2 (en) Image processing apparatus and appearance inspection method
JP6184289B2 (en) 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP6246513B2 (en) 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
US20150356727A1 (en) Defect inspection method and defect inspection device
JP2015021759A (en) Three-dimensional image processor, head unit for the three-dimensional image processor, and three-dimensional image processing method
JP6256249B2 (en) Measuring device, substrate inspection device, and control method thereof
JP6571831B2 (en) Appearance inspection device
JP6791631B2 (en) Image generation method and inspection equipment
JP2015021763A (en) Three-dimensional image processor, three-dimensional image processing method, three-dimensional image processing program, and computer-readable recording medium
JP6571830B2 (en) Appearance inspection device
JP6334861B2 (en) Appearance inspection apparatus, appearance inspection method, appearance inspection program, and computer-readable recording medium
JP6207270B2 (en) 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP6557319B2 (en) 3D image processing apparatus, 3D image processing apparatus head unit, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
TWI427263B (en) Method and apparatus of measuring height of projections, and program therefor
JP6266244B2 (en) 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP6266243B2 (en) 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP2007033126A (en) Substrate inspection device, parameter adjusting method thereof and parameter adjusting device
JP5033077B2 (en) Method and apparatus for inspecting appearance of molded product
JP2006189294A (en) Inspection method and device of irregular defect
JP7003786B2 (en) Particle size measuring device and particle size measuring method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20210713

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20220420

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20220510

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20220623

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20220927

R150 Certificate of patent or registration of utility model

Ref document number: 7150105

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150