Dimensional measuring devices, dimensional measuring methods and programs for a dimensional measuring device
The device uses depth-extended images to automate focus adjustment and edge extraction, addressing the complexity and time issues in measuring workpieces with steps, ensuring accurate and efficient dimensional measurement.
Patent Information
- Authority / Receiving Office
- DE · DE
- Patent Type
- Patents
- Current Assignee / Owner
- KEYENCE CORP
- Filing Date
- 2012-01-31
- Publication Date
- 2026-07-02
AI Technical Summary
Conventional dimensional measuring devices face challenges in accurately measuring workpieces with steps exceeding the depth of field, requiring manual adjustment of the Z-axis position for focus, leading to complex and time-consuming setups.
The device employs depth extension on multiple workpiece images at different Z-direction positions to generate a depth-extended image, which is used as a reference to define measurement positions and procedures, allowing for automated focus adjustment and edge extraction without manual stage positioning.
This approach enables high-accuracy dimensional measurement with simplified setup procedures and reduced time, capturing the entire workpiece image even with steps exceeding the depth of field.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
BACKGROUND OF THE INVENTION 1. Field of the invention The present invention relates to dimensional measuring devices, dimensional measuring methods, and programs for a dimensional measuring device. More specifically, the present invention relates to improvements in a dimensional measuring device that measures a dimension of a workpiece on a movable stage that is movable in the Z-direction, based on an edge of a workpiece image obtained by photographing the workpiece. 2. Description of related prior art In general, a dimensional measuring device is a device for measuring a dimension of a workpiece based on the edge of a workpiece image obtained by photographing the workpiece and can be called an image measuring device (e.g., unexamined Japanese patent publication no. JP 2009-300124A, unexamined Japanese patent publication no. JP 2009-300125A, unexamined Japanese patent publication no. JP 2010-19667A). Typically, a workpiece is placed on a movable stage that is movable in the X, Y, and Z axes. The movable stage is moved in the Z-axis direction to adjust the focus of the workpiece image and is moved in the X and Y axes to position the workpiece within a field of view. The workpiece image exhibits an extremely close resemblance to the shape of the workpiece itself, regardless of the position of the moving stage in the Z-axis direction. Therefore, determining a distance and an angle on the image allows for the detection of a given dimension on the workpiece. When measuring the workpiece's dimensions using such a dimensional measuring device, increasing the photographic magnification can improve measurement accuracy. However, the depth of field decreases with increasing photographic magnification, and thus, in the case of a workpiece with a step exceeding the depth of field, only a portion of the workpiece is in focus. Consequently, capturing a complete image of the workpiece is difficult, and the measurement setup is not straightforward.Especially when multiple positions with different Z-axis heights are set as objects to be measured on the workpiece, it has been necessary to manually adjust the Z-axis position of the moving stage to achieve focus adjustment. This has resulted in a complicated and time-consuming operating procedure for setting up the measurement. From DE 10 2005 039 249 A1, a method and a device for optically scanning a sample are known, wherein focused areas are identified with a Z-component detected by a sensor, so that a step image is initially obtained. From this, the actual height image of the sample can then be deduced by interpolation methods. In addition, the image of the sample is stored as a sample reference image in the control system. SUMMARY OF THE INVENTION The present invention has been made in view of the above circumstances and an object of the above invention is to provide a dimensional measuring device that is capable of measuring a dimension of a workpiece with high accuracy, while easily setting a position as an object to be measured, even if the workpiece is one which has a step which exceeds a depth of field. In particular, one objective is to provide a dimensional measuring device capable of improving measurement accuracy while easily setting up multiple positions with different Z-axis envelopes as the objects to be measured. Furthermore, one objective is to provide a dimensional measuring device capable of simplifying the operating procedure for measurement setup while reducing the time required for setting up and measuring the dimensions of the workpiece. Furthermore, it is an object of the present invention to provide a dimensional measurement method that is capable of measuring a dimension of a workpiece with high accuracy, while simplifying an operating procedure for measurement setup, and is also capable of reducing the time required for measurement setup and dimensional measurement of the workpiece. Furthermore, it is an object of the present invention to provide a program for a dimension measuring device that forms an end-device function as a dimension measuring device as described above. A dimensional measuring device according to a first embodiment is a dimensional measuring device that measures a dimension of a workpiece on a movable stage, which is movable in a Z-direction, based on an edge of a workpiece image obtained by photographing the workpiece. The dimensional measuring device is configured to include: an imaging section that photographs a workpiece on the movable stage to generate a workpiece image; a depth extension section that performs depth extension on two or more of the workpiece images at different Z-direction positions on the movable stage to generate a depth-extended image; a reference image display section that displays the depth-extended image obtained by photographing a reference workpiece as a reference image on the screen.a measurement position information generation section, which specifies a position to be measured and a measurement procedure with respect to the reference image in order to generate measurement position information; an edge extraction section, which extracts an edge of the position to be measured from the depth-extended image obtained by photographing the workpiece, based on the measurement position information; and a dimension value calculation section, which obtains a dimension value of the position to be measured based on the extracted edge. In such a configuration, since the depth-extended image obtained from photographing the reference workpiece is used as the reference image to define a position to be measured and a measurement procedure, it is possible to easily capture the entire workpiece image, provided the workpiece has the same shape as the reference workpiece, even if the workpiece has a step that exceeds the depth of field of the imaging section. This can facilitate setting multiple positions with different Z-axis heights within the workpiece as a single object to be measured. Furthermore, since an edge is extracted from the depth-extended image obtained by photographing the workpiece relative to the position to be measured and repositioned to calculate a dimensional value, it is possible to obtain a desired dimension without manually adjusting the Z-axis position of the moving stage at the time of the dimensional measurement of the workpiece.This means the user can set the position to be measured and perform the actual dimensional measurement without having to pay attention to the step in the workpiece. It is therefore possible to improve measurement accuracy while simplifying the operating procedure for dimensional measurement and also reducing the time required for dimensional measurement. A dimensional measuring device according to a second embodiment is a dimensional measuring device that measures a dimension of a workpiece on a movable stage, which is movable in a Z-direction, based on an edge of a workpiece image obtained by photographing the workpiece. The dimensional measuring device is configured to include: an imaging section that photographs a reference workpiece on the movable stage to produce a photographed image; a depth extension section that performs depth extension on two or more of the workpiece images at different Z-direction positions on the movable stage to produce a depth-extended image; and a reference image display section that displays the depth-extended image as a reference image on a screen.a measurement position information generation section that specifies a position to be measured and a measurement procedure with respect to the reference image to generate measurement position information; a focus-on-measurement-position adjustment section that moves the movable stage to a Z-direction position corresponding to the position to be measured for focus adjustment at the position to be measured; an edge extraction section that extracts an edge of the position to be measured from the workpiece image, which is subject to focus adjustment based on the measurement position information; and a dimension value calculation section that obtains a dimension value of the position to be measured based on the extracted edge. With this configuration, because the depth-extended image obtained by photographing the reference workpiece is used as the reference image to define a position to be measured and a measurement procedure, it is possible to easily capture the entire image of the workpiece, provided the workpiece has the same shape as the reference workpiece, even if the workpiece has a step exceeding the depth of field of the imaging section. This can facilitate setting multiple positions with different Z-axis heights on the workpiece as the object to be measured. Furthermore, the movable stage is moved to a Z-axis position corresponding to the position to be measured, as set in this way, for focus adjustment in order to obtain the workpiece image.Since an edge is extracted from the workpiece image to calculate a dimensional value for the position to be measured, it is possible to obtain a desired dimension even without manually adjusting the Z-axis position of the moving stage at the time of the dimensional measurement. This means the user can set the position to be measured and perform the actual dimensional measurement without having to pay attention to the step in the workpiece. Therefore, it is possible to improve measurement accuracy while simplifying the operational procedure for dimensional measurement and also reducing the time required for dimensional measurement. In addition to the above configuration, a dimensional measuring device according to a third present embodiment is configured such that, in the case of two or more positions to be measured at different heights with respect to the same workpiece, the movable stage is moved sequentially to the Z-direction positions corresponding to these positions to be measured. With such a configuration, since the movable stage is moved sequentially for focus adjustment, it is possible, even in the case of a multiple of positions to be measured with different heights in relation to the same workpiece, to automatically transfer these positions to be measured sequentially to focus positions in order to obtain the dimensional values of the positions to be measured. In addition to the above configuration, a dimensional measuring device according to a fourth present embodiment is configured to include: an epi-illumination light source that applies illumination light from the same side as the imaging section onto the workpiece on the movable stage; and a photographic image display section that moves the movable stage to a Z-direction position corresponding to the position to be measured at the time of designation of the position to be measured with respect to the reference image, for focus adjustment, in order to obtain and display a photographed image of the reference workpiece after focus adjustment, wherein the device is configured such that the measurement position information generation section specifies a position to be measured and a measurement procedure with respect to the photographed image of the reference workpiece after focus adjustment in order to generate the measurement position information. In such a configuration, when a position to be measured is designated for the reference image, the movable stage is moved to a corresponding Z-direction position for focus adjustment, thus obtaining a photograph of the reference workpiece. Since a position to be measured and a measurement procedure are selected with respect to this photographed image, conditions for edge extraction or the like can be set in detail using an actual image, without having to pay attention to the height of the position to be measured. In addition to the above configuration, a dimensional measuring device according to a fifth present embodiment is configured to include: a feature quantity information generation section that generates feature quantity information formed from a test pattern image based on the photographed image of the reference workpiece; and a workpiece detecting section that specifies a location and position of the workpiece on the moving stage based on the feature quantity information, wherein the device is configured such that the edge extraction section performs an edge extraction at the position to be measured, based on specific location and position and the measurement position information. With this configuration, the workpiece image obtained by photographing the workpiece on the moving stage is checked against the reference image to allow for precise specification of the workpiece's location and position, ensuring it has the same shape as the reference workpiece. Furthermore, since edge extraction is performed at the position to be measured, based on the specific location and position, even if the workpiece is positioned anywhere on the moving stage, a desired dimension can be measured with high accuracy, provided the workpiece is within the photographed field of view. In addition to the above configuration, a dimensional measuring device is configured according to a sixth aspect such that the feature quantity information generation section generates feature quantity information based on the depth-enhanced image obtained by photographing the reference workpiece, and the workpiece detection section checks the depth-enhanced image obtained by photographing the workpiece against the reference image to specify the location and position of the workpiece. With such a configuration, since a test pattern image obtained from a depth-extended image with a deeper field than that of the image section is checked against the depth-extended image of the workpiece to specify a location and position, it is possible to improve the accuracy in positioning the workpiece. A dimensional measurement method according to a seventh embodiment is a dimensional measurement method for measuring a dimension of a workpiece on a movable stage that is movable in a Z-direction, based on an edge of a workpiece image obtained by photographing the workpiece. The dimensional measurement method is configured to include: an imaging step for photographing a workpiece on the movable stage to generate a workpiece image; a depth-extension step for performing depth extension on two or more of the workpiece images at different Z-direction positions on the movable stage to generate a depth-extended image; and a reference image display step for displaying a reference image of the depth-extended image obtained by photographing a reference workpiece.a measurement position information generation step for determining a position to be measured and a measurement procedure with respect to the reference image in order to generate measurement position information; an edge extraction step for extracting an edge of the position to be measured from the depth-extended image obtained by photographing a workpiece, based on the measurement position information; and a dimension value calculation step for obtaining a dimension value of the position to be measured, based on the extracted edge. A dimensional measurement method according to an eighth present embodiment is a dimensional measurement method for measuring a dimension of a workpiece on a movable stage that is movable in a Z-direction, based on an edge of a workpiece image obtained by photographing the workpiece. The dimensional measurement method is configured to include: an imaging step for photographing a reference workpiece on the movable stage to produce a photographed image; a depth-extension step for performing depth extension on two or more of the photographed images at different Z-direction positions on the movable stage to produce a depth-extended image; and a reference image display step for displaying the depth-extended image on a screen as a reference image.a measurement position information generation step for determining a position to be measured and a measurement procedure with respect to the reference image in order to generate measurement position information; a focus-on-measurement-position adjustment step for moving the movable stage to a Z-direction position corresponding to a position to be measured, for focus adjustment at the position to be measured; an edge extraction step for extracting an edge of the position to be measured from the workpiece image, which is subject to focus adjustment, based on the measurement position information; and a dimension value calculation step for obtaining a dimension value of the position to be measured, based on the extracted edge. A dimensional measurement method according to a ninth embodiment is a dimensional measurement program for a dimensional measuring device for measuring a dimension of a workpiece on a movable stage that is movable in a Z-direction, based on an edge of a workpiece image obtained by photographing a workpiece. The program is configured to include: an imaging procedure for photographing a workpiece on the movable stage to generate a workpiece image; a depth-extension procedure for performing depth extension on two or more of the workpiece images at different Z-direction positions on the movable stage to generate a depth-extension image; and a reference image display procedure for displaying, as a reference image, the depth-extension image obtained by photographing a reference workpiece.A measurement position information generation procedure for determining a position to be measured and a measurement method with respect to the reference image to generate measurement position information; an edge extraction procedure for extracting an edge of the position to be measured from the depth-extended image obtained by photographing a workpiece, based on the measurement position information; and a dimension value calculation procedure for obtaining a dimension value of the position to be measured, based on the extracted edge. A dimensional measurement method according to a tenth embodiment is a dimensional measurement program for a dimensional measuring device for measuring a dimension of a workpiece on a movable stage that is movable in a Z-direction, based on an edge of a workpiece image obtained by photographing the workpiece. The program is configured to include: an imaging procedure for photographing a reference workpiece on the movable stage to produce a photographed image; a depth-extension procedure for performing depth extension on two or more of the photographed images at different Z-direction positions on the movable stage to produce a depth-extended image; and a reference image display procedure for displaying the depth-extended image on the screen as a reference image.A measurement position information generation procedure for determining a position to be measured and a measurement method with respect to the reference image to generate measurement position information; a focus-on-measurement-position adjustment procedure for moving the movable stage to a Z-direction position corresponding to a position to be measured, for focus adjustment at the position to be measured; an edge extraction procedure for extracting an edge of the position to be measured from the workpiece image, which is subject to focus adjustment, based on the measured position information; and a dimension value calculation procedure for obtaining a dimension value of the position to be measured, based on the extracted edge. In the dimension measuring device according to the present invention, it is possible to measure a dimension of a workpiece with high accuracy while easily setting a position as an object to be measured, even if a workpiece is one that has a step exceeding a depth of field. Furthermore, in the dimensional measurement method according to the present invention it is possible to measure a dimension of a workpiece with high accuracy, while simplifying the operating procedure for measurement setup and also reducing the time required for measurement setup and dimensional measurement of the workpiece. Furthermore, in the program for a dimension measuring device according to the present invention, it is possible to make a terminal function a dimension measuring device as described above. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a perspective view showing a structural example of a dimensional measuring device 1 according to embodiment 1 of the present invention; Fig. 2 is an illustrative view of an assembly example of the interior of the measuring unit 10 of Fig. 1, showing a sectioned surface in the event of cutting the measuring unit 10 along its vertical plane; Fig. 3 is a view showing an assembly view of a ring illumination unit 130 of Fig. 2; Fig. 4 is a flowchart showing an operating example in the dimensional measuring device 1 of Fig. 1; Fig. 5 is a flowchart showing an example of the operations in the dimensional measuring device 1 of Fig. 1 at the time of generating measurement setting data; Figs. 6A and 6B are views showing an example of each of the workpiece images W1 to W3, which are obtained by photographing a workpiece W having steps, using the dimensional measuring device 1 of Fig. 1; Fig.Figures 7A and 7B are views showing an example of the operations in the dimensional measuring device 1 of Figure 1 at the time of setting a measuring position, showing a reference image M1 and a measuring setting screen 2; Figure 8 is a view showing an example of operations in the dimensional measuring device 1 of Figure 1 at the time of setting a measuring position, showing the switching state between the reference image M1 and an actual image; Figure 9 is a flowchart showing an example of operations in the dimensional measuring device 1 of Figure 1 at the time of setting a measuring position; Figures 10A and 10B are views showing an example of operations in the dimensional measuring device 1 of Figure 1, showing a reference image M1 at the time of measuring setting and a workpiece image W1 at the time of workpiece measurement; FigureFigure 11 is a flowchart showing another example of the operations in the dimensional measuring device 1 of Figure 1 at the time of measuring a workpiece; Figure 12 is a block diagram showing an example of the assembly of the control unit 20 of Figure 1, showing an example of a functional configuration within the control unit 20; Figure 13 is a view showing an example of a detail setting screen 3 displayed by operating a setting knob 23 within a measurement setting screen 2 of Figure 7; Figure 14 is a view showing an example of the detail setting screen 3 displayed by operating the setting knob 23 within the measurement setting screen 2 of Figure 7, showing the case of selecting an edge direction; Figure 15 is a view showing an example of the detail setting screen 3 displayed by operating the setting knob 23 within the measurement setting screen 2 of Figure 7.Figure 7 is displayed, and shows a case of selecting the threshold value of the edge thickness; Figure 16 is a flowchart showing an example of operations in the dimensional measuring device 1 at the time of measuring a workpiece according to embodiment 2 of the present invention; and Figure 17 is a block diagram showing an example of the assembly of the control unit 20 in the dimensional measuring device 1 of Figure 16. DETAILED DESCRIPTION OF THE PREFERRED EXECUTION FORMS Design 1 <Abmessungsmessvorrichtung 1> Fig. 1 is a perspective view showing an example of the assembly of a dimensional measuring device 1 according to embodiment 1 of the present invention. This dimensional measuring device 1 is an image measuring device that photographs a workpiece arranged on a movable stage 12 and analyzes the photographed image to measure a dimension of the workpiece. The dimensional measuring device 1 is configured by a measuring unit 10, a control unit 20, a keyboard 31, and a mouse 32. The workpiece is an object to be measured, whose shape and dimensions are to be measured. The measuring unit 10 is an optical system unit that applies illumination light to the workpiece and receives light transmitted through the workpiece or reflected from the workpiece to produce a photographed image. The measuring unit 10 is equipped with a display 11, a movable stage 12, an XY position adjustment knob 14a, a Z position adjustment knob 14b, a power switch 15, and a measuring button 16. Display 11 shows the photographed image, a measurement result, and measurement condition settings. The movable stage 12 is a mounting platform for a workpiece as the object to be measured and is equipped with a detection area 13 through which illumination is transmitted within a substantially horizontal and flat mounting surface. The detection area 13 is a circular surface made of transparent glass. This movable stage 12 can be moved in a Z-axis direction, which is parallel to the photography axis, and in both an X-axis and a Y-axis direction, which are perpendicular to the photography axis. The XY position adjustment knob 14a is a control element for moving the movable stage 12 in the X-axis and Y-axis directions. The Z-position adjustment knob 14b is a control element for moving the movable stage 12 in the Z-axis direction. The power switch 15 is a control element for switching the power supply to the measuring unit 10 and the control unit 20 on and off, and the measurement start button 16 is a control element for starting the dimensional measurement. The control unit 20 is a control device that controls the display 11 and the movable stage 12 of the measuring unit 10 and analyzes a workpiece image photographed by the measuring unit 10 in order to calculate the workpiece dimensions. The keyboard 31 and the mouse 32 are connected to the control unit 20. After switching on the power supply, appropriate positioning of a workpiece within the detection area 13 and pressing the measurement start button 16 result in an automatic measurement of the workpiece. <Messeinheit 10> Fig. 2 is an illustrative view of an example assembly of the interior of the measuring unit 10 of Fig. 10, and shows a sectioned surface in the case of cutting the measuring unit 10 along its vertical plane. This measuring unit 10 includes the display 11, the movable stage 12, a stage drive unit 110, a fluoroscopy unit 120, a ring illumination unit 130, a coaxial epi-illumination light source 141, a light-receiving lens unit 150, and imaging elements 155 and 158. The display 11 and the movable stage 12 are arranged outside a housing 10a. The stage drive unit 110, the fluoroscopy unit 120, the ring illumination unit 130, the coaxial epiluminescence light source 141, the light-receiving lenses 150, and the imaging elements 155 and 158 are housed inside the housing 10a. Furthermore, the stage drive unit 110 and the fluoroscopy unit 120 are arranged below the movable stage 12. The ring illumination unit 130, the coaxial epiluminescence light source 141, the light-receiving lens unit 150, and the imaging elements 158 are arranged above the movable stage 12. The measuring unit 10 directs illumination light onto the workpiece located within the detection area 13 of the movable stage 12 and receives the transmitted or reflected light to allow the imaging elements 155 and 158 to form an image, thus capturing an image of the workpiece. This image is analyzed to measure the workpiece's dimensions, enabling the display of a measurement result on the display 11. The workpiece on the movable stage 12 can be photographed at various magnifications. For example, it is possible to select between low-magnification photography, where the photographed area has a diameter on the order of 25 mm, and high-magnification photography, where the photographed area has a diameter on the order of 6 mm. A low-magnification image obtained by photographing the workpiece at a low magnification and a high-magnification image obtained by photographing the workpiece at a high magnification can be switched electrically and displayed on the display 11. The stage drive unit 110 is a drive unit that moves the movable stage 12 based on a control signal from the control unit 20 and consists of a Z-drive section 111 and an XY-drive section 112. The Z-drive section 111 is a Z-position adjustment section that moves the movable stage 12 in the Z-axis direction within a predetermined range to set the position of the workpiece in the photographic axis direction. The XY-drive section 112 is an XY-position adjustment section that moves the movable stage 12 in the X-axis and Y-axis directions within a predetermined range to set the position of the workpiece in the photographic axis direction. The X-ray unit 120 is an illumination device for applying illumination light from below onto a workpiece arranged within a detection area 13 of the movable stage 12 and consists of an illumination light source 120, a mirror 122, and an optical lens 123. The illumination light emitted from the illumination light source 121 is reflected by the mirror 122 and directed via the optical lens 123. The illumination light is transmitted through the movable stage 12, and a portion of the transmitted light is blocked by the workpiece, while the remainder is incident on the light-receiving lens unit 150. This X-ray imaging is suitable for measuring the external shape of a workpiece and the internal diameter of a through-hole. The ring illumination unit 130 is an epi-illumination device for applying illumination light to the workpiece of the movable stage 12 from above, and is formed from a ring-shaped light source surrounding a light-receiving section of the light-receiving lens unit 150. This ring illumination unit 130 is a lighting device capable of performing separate illumination, and the entire circumference of the unit, or only a part thereof, can be illuminated. The coaxial epi-illumination light source 141 is a light source for applying illumination light, which has essentially the same output light axis as the photography axis, to the workpiece on the movable stage 12 from above. A half-mirror 142 is arranged within the light-receiving lens unit 150 for diverting the illumination light into an output light axis and the photography axis. The epi-illumination is suitable for measuring the dimensions of a workpiece at different levels. In particular, coaxial epi-illumination using the coaxial epi-illumination light source 141 is preferably used to measure a workpiece that has a number of regular reflection components present in the reflected light, since illumination light is hardly diffusely reflected on a workpiece surface, such as a metal surface subjected to mirror polishing. The workpiece illumination method can be selected as transmission illumination, ring illumination, or coaxial epi-illumination. In particular, the position to be measured and the illumination method can be automatically switched for each workpiece to perform dimensional measurements. The light-receiving lens unit 150 is an optical system consisting of a light-receiving lens 151, the half-mirror 152, diaphragm plates 153 and 156, and image-forming lenses 154 and 157. The light-receiving lens unit 150 receives transmitted illumination light and light reflected from the workpiece, allowing the imaging elements 155 and 158 to form an image. The light-receiving lens 151 is an objective lens positioned opposite the movable stage 12 and is split when used for high-magnification and low-magnification photography. This light-receiving lens 151 has the property of maintaining the size of an image even when the position of a workpiece changes in the Z-axis direction. The light-receiving lens 151 is referred to as a telecentric lens. The diaphragm plate 153 and the image-forming lens 154 form a low-magnification-side image-forming lens section and are arranged on the same axis as the light-receiving lens 151. The image-forming lens 154 is an optical lens located opposite the imaging element 155. On the other hand, the diaphragm plate 156 and the image-forming lens 157 form a high-magnification-side image-forming lens section, and a high-magnification photography axis is branched off from the low-magnification photography axis by the half-mirror 152. The image-forming lens 157 is an optical lens that is arranged opposite the imaging element 158. The imaging element 155 is a low-magnification image sensor that, at low magnification, photographs a workpiece within a low-magnification field of view formed by the light-receiving lens unit 150 to produce a low-magnification image. The imaging element 158 is a high-magnification image sensor that, at high magnification, photographs a workpiece within a high-magnification field of view formed by the light-receiving lens unit 150 to produce a high-magnification image. The high-magnification field of view is a narrower photographed field than the low-magnification field of view and is formed within a low-magnification field of view. The imaging elements 155 and 158 both consist of a semiconductor element, such as CCD (Charge Coupled Devices) or CMOS (Complementary Metal Oxide Semiconductor). In this dimensional measuring device 1, wherever and in whatever position the workpiece is arranged, the workpiece is detected as long as it is located within the detection area 13 of the movable stage 12 and the low-magnification image is then analyzed to move the movable stage 12 in the X-axis direction or Y-axis direction, thereby automatically transferring the workpiece to the high-magnification viewing field. Fig. 3 is a partial view of the ring illumination unit 130 from Fig. 2. The ring illumination unit 130 consists of four light-emitting blocks 131 arranged on a circumference and can be illuminated by any selection of the light-emitting blocks 131. The measured position information can specify which light-emitting block 131 is to be illuminated at the time of dimensional measurement. In particular, when measuring multiple positions for the same workpiece W, the light-emitting block 131 to be illuminated for each of these positions can be specified. <Betrieb der Abmessungsmessvorrichtung 1> Steps S101 to S103 of Fig. 4 are a flowchart showing an example of operations of the dimensional measuring device 1 of Fig. 1. In this dimensional measuring device 1, operation consists of three processes: generating measurement setting data (step S101), performing the measurement (step S102), and displaying a measurement result (step S103). The measurement setup data is information required to perform the measurement and consists of feature set information, which specifies a feature set; measured position information, which specifies a position to be measured and a measurement type; and design value information, which specifies a design value and a tolerance with respect to each position to be measured. Feature set information is positioning information used to analyze a workpiece image to detect the position and orientation of the workpiece. Feature set information is configured based on predetermined reference data. It should be noted that if the feature set information and the measurement position information are configured based on a high-magnification image, discriminative information indicative of such configurations is obtained as measurement setup data. The measurement setting data is generated in the control unit 20. Alternatively, a configuration is possible in which measurement setting data generated in an information processing terminal device, such as a PC (Personal Computer), is transferred to the control unit 20 and then used. The measurement processing is performed based on this measurement setting data. The dimensional values obtained through measurement and a quality determination result are then displayed on the display 11 to perform display processing of the measurement result. <Erzeugung von Messeinstelldaten> Steps S201 to S204 of Fig. 5 are a flowchart showing an example of the operations in the dimensional measuring device 1 of Fig. 1 at the time of generating measurement setting data. This figure shows the case of generating measurement setting data in the control unit 20. The measurement data generation process consists of five processing procedures, shown below. First, design data is entered (step S201). During this entry, reference data is captured for use in feature quantity setting and form comparison. The reference data is generated from a photograph of a reference workpiece, from CAD (Computer-Aided Design) data, or from a CAD image created using CAD software. An example of using a reference image obtained by photographing a reference workpiece as reference data is described here. Next, a feature set is configured (step S202). The feature set information and a measurement range are set based on the reference image to define the feature set. Next, a position to be measured and a measurement type are specified (step S203). Specifically, this is done by specifying a position to be measured, an edge detection range, and a measurement method in relation to the reference image displayed on screen 11. The edge detection area is an image processing area used to analyze changes in brightness within image data in order to extract a curve. When selecting the measurement type, a measurement method is chosen that specifies what is being measured and how. Once the position to be measured and the measurement type have been selected, a dimensional measurement is performed on the reference image. That is, an edge of the position to be measured is extracted relative to the reference image to calculate a dimensional value for the position using the selected measurement method. The resulting dimensional value is then displayed on the reference image. Next, a design value and a tolerance are set (step S204). When setting the design value and tolerance, the displayed dimension value is changed as needed for each position to be measured and set to a design value. A tolerance is then set in association with the design value. The measurement setting data generated in this way is written to a memory within the control unit 20. <Fotografiertes Bild von Werkstück W mit Stufen> Figures 6A and 6B are views showing an example of each of the workpiece images W1 to W3, which are obtained by photographing a workpiece W with steps using the dimensional measuring device 1 of Figure 1. The figures illustrate the case of photography using epi-illumination. Figure 6A shows a perspective view of the workpiece B with steps, and Figure 6B shows the workpiece images W1 to W3, which are obtained by photographing while the movable stage 12 is moved in the Z-direction. This workpiece W consists of an upper block, which is the tallest, a middle block, which is of medium height, and a bottom block, which is the shortest in the Z-direction. It features a step between the upper surface of the upper block and the upper surface of the middle block, and another step between the upper surface of the middle block and the upper surface of the bottom block. The workpiece images W1 to W3 are photographs obtained by photographing the workpiece image W, which is positioned on the movable stage 12. These images consist, for example, of low-magnification images obtained by photographing the workpiece image W within the low-magnification field of view. If the preceding stages of the workpiece W are greater than the depth of field at the time of the low-magnification photograph, a complete image of the workpiece W cannot be captured in the workpiece images W1 to W3, since only one position within the depth of field is in focus. That is, workpiece image W1 is photographed at the lowest Z-directional position of the moving stage 12 among the three workpiece images W1 to W3, and only the upper surface of the top block is in focus. Workpiece image W2 is photographed at the moderately high Z-directional position of the moving stage 12, and only the upper surface of the middle block is in focus. Workpiece image W3 is photographed at the highest Z-directional position of the moving stage 12, and only the upper surface of the bottom block is in focus. In the case where a plurality of positions with different Z-direction heights are set with respect to such a workpiece W in order to designate each of these positions as the object to be measured, it was necessary with conventional dimensional measuring devices to manually adjust the Z-direction position of the movable stage 12 for focus setting. In contrast, the dimensional measuring device 1 according to the present embodiment uses a depth-extended image, which is obtained by performing depth extension on a plurality of photographed images. These images are obtained by photographing the same reference workpiece as the reference image for defining a position to be measured and a measuring procedure. Therefore, it can easily capture a complete image of the workpiece W, as long as the workpiece W has the same shape as the reference workpiece, even if the workpiece W has steps that exceed the depth of field. For this reason, several positions with different Z-direction heights can be easily set as objects to be measured without manually adjusting the Z-direction positions of the movable stage 12. <Referenzbild M1 und Messeinstellbildschirm 2> Figures 7A and 7B are views showing an example of the operations in the dimensional measuring device 1 of Figure 1 at the time of setting a position to be measured. Figure 7A shows a reference image M1, which is obtained by performing a depth extension on a plurality of photographed images obtained by photographing the reference workpiece, and Figure 7B shows a measuring setting screen 2 for setting a position to be measured using the reference image M1. The reference image M1 is a depth-extended image obtained by performing depth extension on a plurality of photographs taken of the same reference workpiece, while the Z-direction positions of the movable stage 12 are located differently at regular intervals, and depth extension is performed on the resulting plurality of photographs. The reference workpiece is a reference object that has the same shape as the workpiece W, which is the object to be measured. The depth-extended image is a multi-focus image obtained by synthesizing multiple photographed images with different focus positions to temporarily increase the depth of field. Such a depth-extended image can be generated as a single image, for example, by analyzing the brightness in each photographed image to obtain edge strength with respect to each pixel, and then combining pixel values from the photographed images in focus based on this edge strength. Each photographed image used for depth extension is associated with position information showing the Z-direction position of the moving stage 12, and each pixel of the depth-extended image is associated with the position information of the corresponding photographed image. Accordingly, identifying a pixel in the reference image M1 allows the identification of the Z-direction position of the moving stage 12 at the time the corresponding photographed image was taken. That is, measurement position information set using the reference image M1 is associated with the Z-direction position information of the moving stage 12. Although a photographed image acquired for depth extension can be either a low-magnification image or a high-magnification image, it is assumed that the low-magnification image is used here. In this reference image, the corresponding upper surfaces in the upper block, middle block, and lower block are in focus, and a complete image of the workpiece W can be easily identified. The area within which the movable stage 12 is moved in the Z-direction for depth extension can be defined as needed. For example, an upper and lower limit of the movement range can be changed as required. Furthermore, the interval (distance) at which the movable stage 12 moves and the number of images taken for use in depth extension can be freely selected and adjusted accordingly. The measurement setting screen 2 is an input screen for setting a position to be measured and a measurement procedure, and is displayed on the screen 11. This measurement setting screen 2 contains a display area 21 for showing a reference image M1 and a number of setting buttons 22 and 23. Setting button 22 is a control icon for setting a measurement type, a lighting procedure, and the like. Setting button 23 is a control icon for setting conditions for edge extraction at the time of extracting an edge of the position to be measured. The measurement position information and the measurement type are specified within the display area 21 with respect to the reference image M1 to generate measurement position information. For example, an edge detection area A1 is specified by designating a surrounding boundary portion of an edge of the reference workpiece. When a position to be measured and its measurement type are selected, a dimensional measurement is performed on the reference image M1, and the dimensional value of the position to be measured is displayed on the reference image M1. The user can specify a design value and a tolerance with reference to the measurement result. <Umschalten zwischen tiefenerweitertem Bild und tatsächlichem Bild> Fig. 8 is a view showing an example of the operations in the dimensional measuring device 1 of Fig. 1 at the time of setting a measuring position, and illustrates the switching process between the reference image M1 and an actual image obtained by photographing the reference workpiece. When the measuring setting is performed on the measuring setting screen 2, a predetermined switching operation is used to switch between the reference image M1 obtained by performing the depth extension and the actual image obtained by photographing the reference workpiece on the movable stage 12 with respect to the position to be measured. For example, in the reference image M1 displayed within the display area 21, a portion of an edge is selected by a mouse pointer or similar, and a switch command is entered by a click operation performed by the mouse 32, so that the image within the display area 21 can be switched to the actual image. This actual image is a photograph obtained by photographing the reference workpiece on the movable stage 12, and at the time of switching to the actual image, the movable stage 12 is automatically moved to the Z-direction position according to the position specified by the mouse pointer or similar. It is therefore possible to confirm the designated position in a state where it is in focus using the actual image. The image is switched to the actual image as appropriate to allow the setting of edge extraction conditions with respect to a specific position on the reference workpiece at the time of extracting an edge from the depth-enhanced image or the photographed image, such as a scan direction or an edge direction, and also to allow the actual dimensional measurement to be carried out at the set edge extraction condition to confirm the operation. <Einstellen der Messposition> Steps S301 to S311 of Fig. 9 are a flowchart illustrating an example of the operations in the dimensional measuring device 1 of Fig. 1 during the setting of a measuring position. When a predetermined reference workpiece is positioned on the movable stage 12 and a setting start for the position to be measured is selected by a predetermined operator, the movable stage 12 is first moved to a starting position for depth extension, and the reference workpiece on the movable stage 12 is photographed to capture a photographic image (step S301). The movable stage 12 is then moved a fixed distance in the Z direction to recapture a photographed image. This recapture of the photographed image is repeated until the movable stage 12 reaches an end position, and when the Z-direction scanning is completed by the movable stage 12 reaching the end position, the majority of the photographed images obtained are subjected to depth extension (step S302) and the reference image M1 obtained by the depth extension is displayed on the measurement setting screen 2 (step S303). Next, when a position to be measured is designated relative to the reference image M1 by a predetermined operation, a measurement type and an edge detection area A1 are set (steps S304 and S305). Next, a focus position is set (step S306). When setting the focus position, a height (Z-direction position) of the movable stage 12 is designated for focus adjustment relative to the position to be measured, whose measurement type and edge detection area A1 were set in step S305, and its position information is maintained in association with the position to be measured. The focus position information is associated with each position to be measured. Next, when a detail setting is designated by operating the setting button 23, an image within the display area 21 is switched to the actual image (steps S307 and S308). The movable stage 12 is then moved to the Z-direction position corresponding to the position indicated on the reference image M1 in order to display a predetermined detail setting screen (steps S309 and S310). The processing procedure from step S304 to S310 is repeated until the measurement position is set (step S311). <Spezifikation von Ort und Stellung des Werkstücks W> Figures 10A and 10B are views showing an example of the operations in the dimensional measuring device 1 of Figure 1. Figure 10A shows a reference image M1, which is used at the time of setting a measuring position, and Figure 10B shows a workpiece image W10, which is obtained by photographing at the time of actually measuring a dimension of the workpiece W. If the workpiece W is appropriately positioned as the object to be measured within the photographed field of view on the movable stage 12, the workpiece W is located in a different position and orientation in the workpiece image W10 compared to the reference image M1. Therefore, in the dimensional measuring device 1 according to the present embodiment, the test pattern image, which was previously generated from the reference image M1 or the like, is compared with the workpiece image W10 in order to specify the location and orientation of the workpiece W within the workpiece image W10. The test pattern image can be either the reference image M1 obtained by performing depth extension on a plurality of photographed images or a photographic image obtained by photographing the reference workpiece in the state in which the movable stage 12 is in a specific Z-direction position, and here the reference image M1 is used. Based on the detection result in such an arranged state, a position to be measured is specified within the workpiece image W10 to perform edge extraction, thereby allowing for the precise calculation of a dimensional value for the position to be measured. The measurement result, such as the dimensional value, can be displayed on the workpiece image W10. In this example, a dimensional value and a dimensional line are arranged on the workpiece image W10 in association with the position to be measured. <messprozessierung> Steps S401 to S409 of Fig. 11 form a flowchart illustrating an example of the operations in the dimensional measuring device 1 of Fig. 1 at the time of measurement. When the workpiece W, the object to be measured, is positioned on the movable stage 12 and the measurement operation is selected by pressing the measurement start button 16 or the like, the workpiece W is first moved on the movable stage 12 to a starting position for depth extension and photographed on the movable stage 12 to capture an image of the workpiece (steps S401 and S402). The movable stage 12 is then moved only in the Z-direction by a fixed distance to re-capture a workpiece image. This re-capture of the workpiece image is repeated until the movable stage 12 reaches an end position, and when the Z-directional scanning is completed by the movable stage 12 reaching the end position, the majority of workpiece images obtained are subjected to depth extension (steps S403 and S404). Next, the depth-enhanced image obtained through depth extension is checked against a previously registered pattern image as feature set information to specify an ordered state of the workpiece W, such as its location and position (step S405). Specifically, a position to be measured is defined, and an edge is extracted based on the workpiece W's arrangement state and previously recorded measured position information (step S406). Then, a dimensional value for the position to be measured is calculated based on the extracted edge of the position to be measured (step S407). Furthermore, an error is obtained from a difference between the calculated dimension value and a previously registered design value as design value information, and the error is then compared with a tolerance in relation to it in order to perform a quality determination at each position to be measured and quality determination on the workpiece W (steps S408 and S409). Fig. 12 is a block diagram showing an example of the configuration of the control unit 20 from Fig. 1 and an example of a functional configuration within the control unit 20. The control unit 20 consists of a photography control section 201, a depth extension section 202, a depth-extended image storage section 203, a reference image display section 204, a feature quantity information generation section 205, a measurement position information generation section 206, a measurement setting data storage section 207, a workpiece detection section 208, an edge detection section 209, a dimension value calculation section 210, a quality determination section 211, a measurement result display section 212, and an actual image display section 213. The photography control section 201 is a control section for controlling the photography of the reference workpiece and the workpiece W, based on operator inputs from the measuring unit 10, the keyboard 31, and the mouse 32. The photography control section 201 generates an imaging control signal and a stage control signal and outputs the generated signals to the measuring unit 10. The imaging control signal consists of control commands for controlling the imaging elements 155 and 158 within the measuring unit 10, the measuring units 120 and 130, and the Epi illumination light source 141. The stage control signal consists of a control command for controlling the stage drive unit 110. The depth extension section 202 performs depth extension on a plurality of photographed images that are captured while the Z-direction position of the moving stage 12 has been varied, thereby producing a depth-extended image, and stores the produced image in the depth-extended image storage section 203. At the time the measuring position is set, a reference workpiece arranged on the movable stage 12 is photographed to generate a depth-extended image (reference image M1). The reference image display section 204 generates screen data for displaying reference image M1 based on a depth-extended image within the depth-extended image storage section 203 and outputs the generated data to the measuring unit 10. Conversely, at the time of the dimensional measurement of workpiece W, the workpiece W arranged on the movable stage 12 is photographed to generate a depth-extended image. The feature set information generation section 205 generates feature set information for detecting the workpiece W, based on the depth-extended image within the depth-extended image storage section 203, and stores the generated information as measurement setting data in the measurement setting data storage section 207. This feature set information consists of a test pattern image and is generated based on the reference image M1. The measurement position information generation section 206 generates measurement position information, which is formed from a position to be measured and a measurement procedure based on operator inputs, and stores the generated data as measurement setting data within the measurement setting data storage section 207. The measurement position information is generated by specifying a position to be measured, a measurement type and an illumination procedure with respect to the reference image M1. The measurement setup data storage section 207 holds the feature quantity information, the measurement position information, and the design value information as the measurement setup data. The feature quantity information is quantity information for verification, used to detect an ordered state, such as the location and position of the workpiece W within the workpiece image, and consists of a pattern image for pattern matching, geometric shape information for geometric shape-correlated search, and feature point information showing a feature point of the workpiece W. The design value information is formed from a design value set with respect to each position to be measured and a tolerance associated with the design value. The workpiece detection section 208 specifies the location and position of the workpiece W in the workpiece image, based on the feature set information. Specifically, the depth-enhanced image of the workpiece W is compared with the inspection pattern image to determine the location and position of the workpiece W, and a determination result is output to the edge detection section 209. Edge detection section 209 specifies the position to be measured in the depth-extended image of the workpiece W, whose arranged state has been specified by workpiece detection section 208, from the arranged state and the measured position information of the same, and extracts an edge of the position to be measured from the workpiece image. Edge extraction is performed by changing the brightness value between adjacent pixels in image data within an edge detection area A1, which is specified in the measurement position information. The dimension value calculation section 210 calculates a dimension value for the position to be measured, based on the edge extracted by the edge extraction section 209, and outputs the calculated value to the quality determination section 211. Specifically, a plurality of edge points obtained by edge extraction are matched with a geometric shape, such as a straight line or an arc, using a statistical technique such as the least squares method, to specify an edge of the workpiece W. For example, if two parallel linear segments of the edge of the workpiece W are designated at the positions to be measured, the distance between these straight lines is calculated as the dimension value. Furthermore, if a linear segment and a feature point are designated, the distance between the straight line and the feature point is calculated as the dimension value.Furthermore, if two linear segments with different inclinations are specified, the angle between these straight lines is calculated as the dimension value. Additionally, if a portion of a circle (arc) or an entire circle is specified as the position to be measured, the diameter, radius, or central coordinate of the circle is calculated as the dimension value. Quality Determination Section 211 receives an error from a difference between the dimensional value calculated by Dimension Value Calculation Section 210 and a corresponding design value. This error is then compared to a corresponding tolerance to perform a quality determination of the dimensional value with respect to each position to be measured, as well as a quality determination of the workpiece W. The quality determination of the workpiece W is performed by determining whether the difference (error) between the dimensional value and the design value is within a tolerance range. Furthermore, the quality determination of the workpiece W is performed based on the result of the quality determination of the dimensional value with respect to each position to be measured. The measurement result display section 212 generates display data for showing the dimensional value and a result of the quality determination on the data-enhanced image of the workpiece W and outputs the generated data to the measuring unit 10. The actual image display section 213 generates screen data for displaying the actual image obtained by photographing the reference workpiece, based on the operator input, and outputs the generated data to the measuring unit 10. <Detaileinstellbildschirm 3> Fig. 13 is a view showing an example of a detail setting screen 3 displayed on the display 11 by operating the setting button 23 within the measurement setting screen 2 of Fig. 7. This figure illustrates the case of setting the edge extraction condition using an actual high-magnification image obtained by photographing the reference workpiece at high magnification within a high-magnification field of view. The measurement setting screen 3 is an input screen for setting detailed conditions for edge extraction at the time of extracting an edge from the depth-enhanced image. For example, a position to be measured is designated relative to the reference image M1 to switch the screen to the actual image, and then the setting button 23 is pressed to display the measurement setting screen 3. This measurement setup screen 3 contains a display area 301 for showing the reference image M1 and the actual image of the reference workpiece, input fields 302 and 303 for specifying edge extraction parameters, and an input field 304 for defining a threshold value for edge extraction. Input field 302 is used to specify a scanning direction as the edge extraction parameter. The scanning direction is the direction of a pixel array at the time of analyzing a change in brightness between adjacent pixels with respect to image data within the edge detection area A. Specifically, in the case of extracting a circle as the edge, either a direction from a center outwards or a direction from outside to the center can be selected as the scanning direction. In this example, the direction from the center outwards is selected as the scanning direction. Input field 303 is an input area for specifying an edge direction as an edge extraction parameter. The edge direction is a positive or negative value corresponding to the thickness of the edge relative to the object to be extracted at the time of edge extraction, with the scanning direction specified in input field 302 being the normal direction. Specifically, a positive polarity, where the brightness changes from darkness to brightness, a negative polarity, where the brightness changes from brightness to darkness, and an unselected polarity can be selected as the edge direction. Input field 304 is used to specify an upper and lower limit for edge thickness as thresholds for narrowing down the selection of edge points of the objects to be extracted. An edge thickness distribution, which relates to the scanning direction, is obtained from the image data within the edge detection area A1, and the edge point is then extracted based on this edge thickness distribution. In this example, an actual image of the reference workpiece, formed with a step at the periphery of a circular through-hole, is displayed within the display area 301. The edge detection area A1, with concentric circles A11 and A12 at its outer edge and an inner edge respectively, is selected relative to the actual image to detect an edge point within the edge detection area A1, and a circle B1, matching a large number of detected edge points, is output as the edge of the object to be measured. In this actual image, the influence of a thick inner edge of the through-hole prevents the outer edge of the object being measured from being accurately detected, resulting in a large error that is reflected in the dimensional value. The diameter of circle B1 is 2.8064 mm. It should be noted that in this example, a distribution diagram C1 for the edge thickness is displayed on the actual image. The distribution diagram C1 is generated by analyzing the image data within the edge detection area A1 in the scanning direction and is displayed based on a predefined operation that designates a position within the edge detection area A1. In this distribution diagram C1, in addition to a peak B12 of the edge thickness, which corresponds to the edge as the object being measured, a noise component B11 is detected on the outside of the edge, and a peak B13 corresponding to an edge inside the through-hole is detected on the inside of the through-hole. Fig. 14 is a view showing an example of the detail setting screen 3, which is displayed by pressing the setting button 23 within the measurement setting screen 2 of Fig. 7, and shows the case of specifying an edge direction as the condition for edge extraction. In this measurement setting screen 3, the direction in which the brightness changes from dark to bright is selected as the edge direction. For this reason, the edge point where the brightness changes from light to dark with respect to the scan direction is not extracted, thus making it possible to suppress the influence of the edge within the through-hole. In this case, a measured diameter of circle B1 is 2.8544 mm, and the error in the dimensional value is small. Fig. 15 is a view showing an example of the detail setting screen 3, which is displayed by pressing the setting button 23 within the measurement setting screen 2 of Fig. 7, and shows a case where a threshold value for edge thickness is defined as the condition for edge extraction. In this detail setting screen 3, an upper and a lower limit for edge thickness are defined as the threshold for narrowing down edge points as the objects to be extracted. Based on the edge thickness distribution with respect to the scanning direction, those edge points are narrowed down at the time of edge point extraction to edge points within a range C2 of edge thickness that is not larger than the upper limit and not smaller than the lower limit in order to perform edge extraction. For this reason, an edge point with an edge thickness outside the area C2 and noise are not extracted, thus enabling the suppression of the edge's influence within the through-hole. In this case, the measured value of the diameter of circle B1 is 2.8537 mm, and the error in the dimensional value is small. According to the present embodiment, a depth-extended image obtained by photographing a reference workpiece is used as the reference image M1 to select a position to be measured and a measurement method. This makes it easy to capture a complete image of the workpiece W, as long as the workpiece W has the same shape as the reference workpiece, even if the workpiece W has a step exceeding the depth of field of the imaging section. This can simplify the setting of multiple positions at different Z-direction heights in the workpiece W, the object to be measured.Furthermore, since an edge is extracted from the depth-extended image obtained by photographing the workpiece W with respect to the position to be measured, as set in such a way as to calculate the dimension value, it is possible to obtain a desired dimension without manually adjusting a Z-direction position of the movable stage 12 at the time of the dimension measurement for the workpiece W. Furthermore, when a position to be measured is designated for the reference image M1, the movable stage 12 is moved to a corresponding Z-direction position for focus adjustment, so that a photographic image of the reference workpiece is obtained. Since a position to be measured and a measurement procedure are specified with respect to this actual image, conditions for edge extraction or the like can be set in detail using the actual image without having to pay attention to the height of the position to be measured. Furthermore, the workpiece image obtained by photographing the workpiece W on the movable stage 12 is checked against the reference image to allow for a precise specification of the location and position of the workpiece W with the same shape as the reference workpiece. Moreover, since edge extraction is performed at the position to be measured, based on the specified location and position, even if the workpiece W is in any position on the movable stage 12, a desired dimension can be measured with high accuracy as long as the workpiece W is within the photographed field of view. Additionally, an example of the case in the present embodiment has been described in which the test pattern image is generated from the reference image M1 obtained by performing depth extension of a plurality of photographed images, and the depth-extended image of the workpiece W is compared with the test pattern image to specify the location and position of the workpiece W in the depth-extended image. However, the present invention does not limit the workpiece detection method to this. For example, the test pattern image is generated from the photograph obtained by photographing the reference workpiece in a state in which the movable stage 12 is located in a specific Z-direction position.At the time of positioning the workpiece W for dimensional measurement, it can be configured so that the workpiece W is photographed while the movable stage 12 is moved to the specific position and the obtained workpiece image is compared with the reference image to determine the location and position of the workpiece within the photographic field of view. Design 2 In embodiment 1, an exemplary case was described in which the edge, as the position to be measured, is extracted from the depth-extended image obtained by photographing the workpiece W in order to calculate a dimensional value. In contrast, the present embodiment describes a case in which the movable stage 12 is moved in a Z-direction position corresponding to the position to be measured, for focusing on the position to be measured, and an edge of the position to be measured is extracted from the workpiece image subjected to focus adjustment in order to calculate a dimensional value. Steps S501 to S510 of Fig. 16 form a flowchart illustrating an example of the operations in the dimensional measuring device 1 according to Section 2 of the present invention at the time of measuring a workpiece. When the workpiece W, as the object to be measured, is arranged on the movable stage 12 and the measurement is initiated by pressing the measurement start button 16 or the like, the workpiece W is first moved on the movable stage 12 to a Z-direction position in which the test pattern image has been photographed, and the workpiece W is photographed on the movable stage 12 to capture a workpiece image (steps S501 and S502). Next, the obtained workpiece image is checked against a previously registered sample image as feature set information to specify an arranged state of the workpiece W, such as its position and orientation within the photographed field of view (step S503). Next, the movable stage 12 is moved to a Z-direction position corresponding to the position to be measured, and the workpiece W on the movable stage 12 is photographed to re-capture a workpiece image (steps S504 and S505). Then, a position to be measured is specified, and an edge is extracted based on the arranged state of the workpiece W and the previously recorded measurement position information (step S506). Finally, a dimensional value of the position to be measured is calculated based on the extracted edge (step S507). Furthermore, an error from a difference between the calculated dimension value and a previously registered design value is obtained as design value information, and the error is then compared with a corresponding tolerance to perform a quality determination at each position to be measured and a quality determination on the workpiece W (steps S508 and S509). The processing procedures of steps S504 to S509 are repeated when a different position to be measured has been set, until a dimensional value is obtained with respect to each position to be measured (step S510). Fig. 17 is a block diagram showing an example of the configuration of the control unit 20 in the dimension measuring device 1 of Fig. 16. This control unit 20 differs from the control unit 20 of Fig. 12 in the provision of a measuring position focus adjustment section 214. In this control unit 20, a test pattern image is generated from a photograph obtained by photographing the reference workpiece. That is, the feature quantity information generation section 205 places the photographed reference workpiece in a state where the movable stage 12 is located in a specific Z-direction position and generates feature quantity information from the test pattern image, based on the obtained photograph. The position of the movable stage 12 at the time the feature quantity information is set can be specified directly or can be specified by selecting a position to be measured within the reference image M1. Alternatively, any of the depth-expansion photographs acquired to generate the reference image M1 can be used to set the feature quantity information. The measuring position focus adjustment section 214 moves the movable stage 12 to a Z-direction position corresponding to the test pattern image, based on an operator input, to specify the arranged state of the workpiece W within the photographed field of view. The workpiece detection section 208 compares the workpiece image captured at that time with the test pattern image to determine the position and orientation of the workpiece W within the photographed field of view. Furthermore, in the control unit 20, the movable stage 12 is moved to a Z-direction position corresponding to the position to be measured, and an edge of the position to be measured is extracted from the photographed workpiece image to calculate a dimensional value. That is, the measuring position focus adjustment section 214 moves the movable stage 12 to a Z-direction position corresponding to the position to be measured, in order to focus on the position to be measured. The edge detection section 209 extracts an edge of the position to be measured from the workpiece image subjected to focus adjustment, based on measurement position information. In the case of multiple positions to be measured with different heights relative to the same workpiece W, the focus-on-measurement-position adjustment section 214 sequentially moves the movable stage 12 to Z-direction positions corresponding to these positions to be measured. According to the present embodiment, the movable stage 12 is moved to a Z-direction position corresponding to the position to be measured, which has been set using the reference image M1 for focus adjustment in order to capture a workpiece image. Since an edge is extracted from this workpiece image to calculate a dimensional value of the position to be measured, it is possible to obtain a desired dimension even without manually adjusting the Z-direction position of the movable stage 12 at the time of the dimensional measurement of the workpiece W. Furthermore, since the movable stage 12 is moved sequentially to focus setting, it is possible, even in the case of a multiple of positions to be measured with different heights in relation to the same workpiece, to automatically transfer these positions to be measured sequentially to focus positions in order to obtain the dimensional values of the positions to be measured. Additionally, although an example of a case has been described in embodiments 1 and 2 in which low-magnification and high-magnification photography are switched electrically, the present invention does not limit the method for switching the photographic magnification to this. For example, the present invention includes a device that mechanically switches the light-receiving lenses (objective lenses) on the side of the movable stage 12, which is called a turret type.That is, an objective lens unit, consisting of a light-receiving lens for low-magnification photography and a light-receiving lens for high-magnification photography, is rotated in relation to a set of an image training unit made of a diaphragm plate, an imaging lens and an image capture element, in order to switch between low-magnification photography and high-magnification photography.< / messprozessierung>
Claims
Dimensional measuring device (1) that measures a dimension of a workpiece (W) on a movable stage (12) which is movable in a Z-direction, based on an edge of a workpiece image obtained by photographing the workpiece (W), the dimensional measuring device comprising: an imaging section that photographs a workpiece (W) on the movable stage (12) to produce a workpiece image; a depth extension section (202) that performs depth extension on two or more of the workpiece images in different Z-direction positions in the movable stage (12) to produce a depth-extended image; a reference image display section (204) that displays the depth-extended image obtained by photographing a reference workpiece as a reference image on the screen;a measurement position information generation section (206) which specifies a position to be measured and a measurement procedure with respect to the reference image in order to generate measurement position information; an edge extraction section (209) which extracts an edge of the position to be measured from the depth-extended image obtained by photographing the workpiece (W) based on the measurement position information; and a dimension value calculation section (210) which obtains a dimension value of the position to be measured based on the extracted edge. Dimensional measuring device that measures a dimension of a workpiece (W) on a movable stage (12) which is movable in a Z-direction, based on an edge of a workpiece image obtained by photographing the workpiece (W), wherein the dimensional measuring device comprises: an imaging section that photographs a reference workpiece on the movable stage to produce a photographed image; a depth extension section (202) that performs depth extension on two or more of the workpiece images at different Z-direction positions in the movable stage (12) to produce a depth-extended image; a reference image display section (204) that displays the depth-extended image as a reference image on a screen; a measurement position information generation section (206) that specifies a position to be measured and a measurement procedure with respect to the reference image to generate measurement position information;a focus-on-measurement-position adjustment section (214) that moves the movable stage (12) to a Z-direction position corresponding to the position to be measured, for focus adjustment at the position to be measured; an edge extraction section (209) that extracts an edge of the position to be measured from the workpiece image, which is subject to focus adjustment based on the measurement position information; and a dimension value calculation section (210) that obtains a dimension value of the position to be measured based on the extracted edge. Dimensional measuring device according to claim 2, wherein, in the case of two or more positions to be measured at different heights with respect to the same workpiece, the movable stage (12) is moved sequentially to Z-direction positions corresponding to these positions to be measured. Dimensional measuring device according to claim 1, comprising: an epi-illumination light source (141) that applies illumination light from the same side as the imaging section onto the workpiece on the movable stage (12); and a photographic image display section that moves the movable stage (12) to a Z-direction position corresponding to the position to be measured at the time of designation of the position to be measured with respect to the reference image, for focus adjustment, in order to obtain and display a photographed image of the reference workpiece after focus adjustment, wherein the device is configured such that the measurement position information generation section specifies a position to be measured and a measurement method with respect to the photographed image of the reference workpiece after focus adjustment in order to generate the measurement position information. Dimensional measuring device according to claim 1, comprising: a feature quantity information generation section (205) that generates feature quantity information formed from a test pattern image based on the photographed image of the reference workpiece; and a workpiece detecting section (208) that specifies a location and position of the workpiece on the movable stage (12) based on the feature quantity information, wherein the edge extraction section performs an edge extraction at the position to be measured based on specific location and position and the measurement position information. Dimensional measuring device according to claim 5, wherein the feature quantity information generation section generates feature quantity information based on the depth-enhanced image obtained by photographing the reference workpiece, and the workpiece detection section checks the depth-enhanced image obtained by photographing the workpiece with the reference image to specify the location and position of the workpiece. A dimensional measurement method for measuring a dimension of a workpiece on a movable stage (12) which is movable in a Z-direction, based on an edge of a workpiece image obtained by photographing the workpiece, the method comprising: an imaging step for photographing a workpiece on the movable stage to generate a workpiece image; a depth-extension step for performing depth extension on two or more of the workpiece images in different Z-direction positions on the movable stage to generate a depth-extension image; a reference image display step for displaying a reference image of the depth-extension image obtained by photographing a reference workpiece; a measurement position information generation step for selecting a position to be measured and a measurement procedure with respect to the reference image to generate measurement position information;an edge extraction step to extract an edge of the position to be measured from the depth-extended image obtained by photographing a workpiece, based on the measurement position information; and a dimension value calculation step to obtain a dimension value of the position to be measured, based on the extracted edge. A dimensional measurement method for measuring a dimension of a workpiece on a movable stage (12) which is movable in a Z-direction, based on an edge of a workpiece image obtained by photographing the workpiece, the method comprising: an imaging step for photographing a reference workpiece on the movable stage to produce a photographed image; a depth-extension step for performing a depth extension on two or more of the photographed images in different Z-direction positions on the movable stage to produce a depth-extended image; a reference image display step for displaying the depth-extended image on a screen as a reference image; a measurement position information generation step for selecting a position to be measured and a measurement procedure with respect to the reference image to generate measurement position information;a focus-on-measurement-position adjustment step to move the movable stage to a Z-direction position corresponding to a position to be measured, for focus adjustment at the position to be measured; an edge extraction step to extract an edge of the position to be measured from the workpiece image, which is subject to focus adjustment, based on the measurement position information; and a dimension value calculation step to obtain a dimension value of the position to be measured, based on the extracted edge. Program for a dimensional measuring device for measuring a dimension of a workpiece on a movable stage that is movable in a Z-direction, based on an edge of a workpiece image obtained by photographing a workpiece, for performing at least the following procedures when the program is executed on a control unit (20) of the dimensional measuring device (1): an imaging procedure for photographing a workpiece on the movable stage to generate a workpiece image; a depth-extension procedure for performing depth extension on two or more of the workpiece images in different Z-direction positions on the movable stage to generate a depth-extension image; a reference image display procedure for displaying on the screen, as a reference image, the depth-extension image obtained by photographing a reference workpiece;a measurement position information generation procedure for determining a position to be measured and a measurement method with respect to the reference image to generate measurement position information; an edge extraction procedure for extracting an edge of the position to be measured from the depth-extended image obtained by photographing a workpiece, based on the measurement position information; and a dimension value calculation procedure for obtaining a dimension value of the position to be measured, based on the extracted edge. Program for a dimensional measuring device for measuring a dimension of a workpiece on a movable stage that is movable in a Z-direction, based on an edge of a workpiece image obtained by photographing a workpiece, for performing at least the following procedures when the program is executed on a control unit (20) of the dimensional measuring device (1): an imaging procedure for photographing a reference workpiece on the movable stage to produce a photographed image; a depth-extension procedure for performing depth extension on two or more of the photographed images in different Z-direction positions on the movable stage to produce a depth-extension image; a reference image display procedure for displaying the depth-extension image on the screen as a reference image;a measurement position information generation procedure for determining a position to be measured and a measurement method with respect to the reference image to generate measurement position information; a focus-on-measurement-position adjustment procedure for moving the movable stage to a Z-direction position corresponding to a position to be measured, for focus adjustment at the position to be measured; an edge extraction procedure for extracting an edge of the position to be measured from the workpiece image, which is subject to focus adjustment, based on the measured position information; and a dimension value calculation procedure for obtaining a dimension value of the position to be measured, based on the extracted edge.