Shape inspection device, height image processing method, and height image processing program

The shape inspection apparatus uses a light sectioning method with correction units to align profile data based on feature points, effectively reducing vibration components and ensuring accurate shape representation of moving objects.

JP2026076243APending Publication Date: 2026-05-11KEYENCE CORP
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
KEYENCE CORP
Filing Date
2026-01-21
Publication Date
2026-05-11

AI Technical Summary

Technical Problem

Existing optical displacement meters struggle to accurately generate height images of moving objects due to vibrations in the height and lateral directions, leading to inaccurate shape representation.

Method used

A shape inspection apparatus using a light sectioning method with a light projection unit, light receiving unit, profile data generation, height image generation, and correction units to set correction reference areas, extract feature points, and offset profile data based on these points to align them accurately, thereby reducing vibration components in the height and lateral directions.

Benefits of technology

Generates a height image that accurately reflects the shape of the object by correcting positional deviations caused by vibrations, ensuring precise representation of the object's shape despite movements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026076243000001_ABST
    Figure 2026076243000001_ABST
Patent Text Reader

Abstract

This invention provides a shape inspection device, a processing device, a height image processing method, and a height image processing program that can accurately inspect objects to be measured. [Solution] As the object to be measured S moves relative to the Y-axis, the profile data generation unit 201 sequentially generates multiple profile data. The height image generation unit 202 extracts feature points from each of the profile data and moves each of the profile data in a plane intersecting the Y-axis so that the extracted feature points are aligned in a line in the direction corresponding to the Y-axis. The height image generation unit 202 then corrects the height image by arranging the moved profile data Pd in ​​the direction corresponding to the Y-axis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a technique for detecting the displacement of a measurement object by a triangulation method, and particularly relates to a shape inspection apparatus, a processing apparatus, a height image processing method, and a height image processing program for inspecting the shape of a measurement object based on generated profile data.

Background Art

[0002] As an apparatus for measuring the profile of a measurement object, an optical displacement meter using the optical sectioning method is known. In a general optical displacement meter using the optical sectioning method, light is irradiated onto a moving measurement object, and profile data indicating the three-dimensional shape of the measurement object can be generated based on a light reception signal indicating the amount of received light of the reflected light reflected from the surface of the measurement object. By arranging a plurality of generated profile data in the moving direction of the measurement object, a height image of the measurement object can be obtained.

[0003] For example, when measuring the profile of a measurement object moving in the horizontal direction with an optical displacement meter, the measurement object may vibrate in the height direction or the lateral direction (width direction). If the measurement object vibrates in the height direction during measurement, the vibration component in the height direction is added to the profile data of the measurement object, and if the measurement object vibrates in the lateral direction during measurement, the vibration component in the lateral direction is added to the profile data of the measurement object. Due to the addition of this vibration component, the above height image may not accurately reflect the shape of the measurement object.

[0004] Therefore, as disclosed in Patent Documents 1 and 2 for example, an inspection method for suppressing the influence of the above vibration component by estimating and removing the above vibration component by image processing is known.

Prior Art Documents

Patent Documents

[0005]

Patent Document 1

[0006] In the optical displacement meter described in the above-mentioned patent documents, the vibration components are estimated by image processing. Since the estimation of vibration components by image processing is based on the periodicity of the displacement in the height direction of the object being measured, it is possible to estimate the vibration components in the height direction, but it is difficult to estimate the vibration components in the lateral direction. Furthermore, since the estimated vibration components in the height direction are based on the periodicity of the displacement in the height direction, there is a risk that some of the shape of the object being measured included in the height image may be mistakenly estimated as vibration components. For this reason, with the optical displacement meter described in the above-mentioned patent documents 1 and 2, it may be difficult to generate a height image that accurately reflects the shape of the object being measured when it is moving.

[0007] The object of the present invention is to provide a shape inspection device, an processing device, a height image processing method, and a height image processing program that can generate a height image that accurately reflects the shape of an object to be measured, even when vibrations in the height direction or lateral direction occur in the profile data of the object to be measured. [Means for solving the problem]

[0008] To achieve the above objective, the first disclosure of the present invention provides a shape inspection apparatus using a light sectioning method, comprising: a light projection unit that irradiates a slit light having an extension in the X-axis direction or a spot light scanned in the X-axis direction onto a measurement target that is moving relative to it in the Y-axis direction intersecting the X-axis; a light receiving unit that receives reflected light from each position in the X-axis direction and outputs a light receiving signal indicating the amount of light received; a profile data generation unit that generates profile data of the measurement target in a plane intersecting in the Y-axis direction based on the light receiving signal; a height image generation unit that acquires the profile data sequentially generated by the profile data generation unit as the measurement target moves relative to it in the Y-axis direction and generates a height image of the measurement target; a display control unit that displays the height image generated by the height image generation unit on a display unit; a setting unit that accepts the setting of a correction reference area for correcting each of the profile data generated by the profile data generation unit on the height image displayed on the display unit; and an inspection unit that inspects the shape of the measurement target based on the profile data generated by the profile data generation unit.

[0009] Here, the height image generation unit may further extract feature points included in the correction reference region for each of the profile data generated by the profile data generation unit, and correct the height image by moving each of the profile data in a plane that intersects in the direction corresponding to the Y axis based on the position of the extracted feature points.

[0010] In this configuration, when setting up the shape inspection device, a two-dimensional region extending in the direction corresponding to the Y-axis is set as the correction reference region in the setting unit. Subsequently, for each profile data obtained by the profile data generation unit during the operation of the shape inspection device, the height image generation unit extracts feature points included in the correction reference region. The height image generation unit then calculates the offset amount (movement amount) in the X-axis direction or the Z-axis direction (height direction) necessary for the extracted feature points to be aligned in a line in the direction corresponding to the Y-axis, for each profile data. The calculated offset amount represents the positional deviation of each profile data from its ideal location. The height image generation unit then offsets (moves) each profile data in a plane intersecting the Y-axis (a plane defined by the X-axis and Z-axis directions) according to the calculated offset amount. In other words, by offsetting each profile data based on the offset amount, which is the difference between the ideal location of the profile data and its actual location, the positional deviation from the ideal location is corrected. The height image generation unit then generates an inspection height image that accurately reflects the shape of the object being measured by arranging profile data, from which positional deviations from the ideal location have been removed, in a direction corresponding to the Y-axis.

[0011] In this way, the height image generation unit calculates a displacement amount for each profile data to reduce the positional misalignment between profile data, and offsets each profile data based on the calculated displacement amount (offset amount). Therefore, it is possible to generate a height image that reduces the vibration components generated in the profile data obtained by measuring the object, without changing the shape of the profile data, and regardless of the periodicity of vibrations occurring in the object being measured.

[0012] In another disclosure of the present invention, the height image generation unit may calculate a reference height based on the heights of multiple feature points extracted from each of the profile data. That is, a reference height that serves as the alignment standard for each profile data is calculated based on the heights of feature points extracted from multiple profile data with different positions in the direction corresponding to the Y axis.

[0013] With this configuration, the height image generation unit corrects the profile data so that the vibration component in the height direction (Z-axis direction) that occurs in the profile data obtained by measuring the object to be measured is reduced. In other words, each feature point of the profile data can be offset in the Z-axis direction so that each feature point of the profile data is in its ideal position, and a height image for inspection that accurately reflects the shape of the object to be measured can be generated.

[0014] In another disclosure of the present invention, the height image generation unit may calculate a reference X position based on the X positions of a plurality of feature points extracted from each of the profile data. That is, a reference X position that serves as the alignment reference for each profile data can be calculated based on the X positions of feature points extracted from a plurality of profile data with different positions in the direction corresponding to the Y axis.

[0015] With this configuration, the height image generation unit can remove the lateral (X-axis) vibration component that occurs in the profile data obtained by measuring the object to be measured. In other words, each feature point of the profile data can be offset in the X-axis direction so that each feature point is in its ideal position, thereby generating a height image for inspection that accurately reflects the shape of the object to be measured.

[0016] In another disclosure of the present invention, the setting unit accepts the setting of an X-correction reference region in a fixed coordinate system and a Z-correction reference region in a relative coordinate system based on the object to be measured, as correction reference regions. The height image generation unit then extracts feature points in the X-axis direction from the X-correction reference region for each of the profile data. The height image generation unit also calculates a reference X position based on the X positions of the multiple feature points calculated from the X-correction reference region. The height image generation unit then offsets each of the profile data in the X-axis direction according to the difference between the X positions of the feature points calculated from the X-correction reference region and the reference X position. That is, the profile data is offset so that the positional shift in the X direction is corrected between multiple profile data where the positions in the direction corresponding to the Y-axis are different. Subsequently, the height image generation unit generates an X-corrected height image from which the positional shift in the X direction has been removed by arranging the offset profile data in the direction corresponding to the Y-axis.

[0017] Next, the height image generation unit sets a Z-correction reference region based on the position of the object to be measured included in the X-corrected height image. That is, the Z-correction reference region is set in a relative coordinate system based on the object to be measured, rather than a fixed coordinate system with respect to the X-corrected height image. The height image generation unit then extracts feature points in the Z-axis direction from the Z-correction reference region for each of the profile data. The height image generation unit also calculates a reference height based on the heights of multiple feature points calculated from the Z-correction reference region. The height image generation unit then offsets each of the profile data in the Z-axis direction according to the difference between the height of the feature points calculated from the Z-correction reference region and the reference height. That is, the profile data is offset so that positional displacement in the Z-direction is removed between multiple profile data with different positions in the direction corresponding to the Y-axis. Subsequently, the height image generation unit generates an inspection height image with reduced positional displacement in the X-axis and Z-axis directions by arranging the offset profile data in the direction corresponding to the Y-axis.

[0018] With this configuration, even when multiple correction reference regions are set, the height image generation unit can more accurately correct the vibration components generated in the profile data obtained by measuring the object to be measured. In other words, without having to precisely determine the position where the object to be measured is to be measured, an appropriate correction reference region can be set according to the measured position of the object to be measured, and vibration components generated in the profile data can be corrected more accurately.

[0019] In another disclosure of the present invention, the setting unit accepts the setting of a Z-correction reference region in a fixed coordinate system and an X-correction reference region in a relative coordinate system based on the height of the object to be measured, as correction reference regions. The height image generation unit then extracts feature points in the Z-axis direction from the Z-correction reference region for each of the profile data. The height image generation unit also calculates a reference height based on the heights of multiple feature points calculated from the Z-correction reference region. The height image generation unit then offsets each of the profile data in the Z-axis direction according to the difference between the height of the feature points calculated from the Z-correction reference region and the reference height. That is, the profile data is offset so that the Z-direction positional displacement is reduced between multiple profile data where the positions in the direction corresponding to the Y-axis are different. Subsequently, the height image generation unit generates a Z-corrected height image from which the Z-direction positional displacement has been removed by arranging the offset profile data in the direction corresponding to the Y-axis.

[0020] Next, the height image generation unit sets an X correction reference region based on the reference height. That is, the X correction reference region is set in a relative coordinate system based on the reference height, rather than a fixed coordinate system with respect to the Z correction height image. Then, for each of the profile data, the height image generation unit extracts feature points in the X-axis direction from the X correction reference region. Also, the height image generation unit calculates a reference X position based on the X positions of a plurality of feature points calculated from the X correction reference region. And the height image generation unit offsets each of the profile data in the X-axis direction according to the difference between the X position of the feature point calculated from the X correction reference region and the reference X position. That is, the profile data is offset so that the positional deviation in the X direction is reduced among a plurality of profile data having different positions in the direction corresponding to the Y axis. Thereafter, the height image generation unit generates a height image for inspection in which the positional deviations in the Z direction and the X-axis direction are removed by arranging the offset profile data in the direction corresponding to the Y axis.

[0021] According to this configuration, even when a plurality of correction reference regions are set, the height image generation unit can more accurately correct the vibration generated in the profile data obtained by measuring the measurement object. That is, without accurately determining the position for measuring the measurement object, an appropriate correction reference region can be set according to the measured position of the measurement object, and the vibration component generated in the profile data can be more accurately corrected.

[0022] Note that the present invention can also be realized as a height image processing method and a height image processing program used for an optical cutting displacement meter. Also, a computer-readable storage medium storing the height image processing program is included in the present invention.

Effects of the Invention

[0023] As described above, even when vibrations in the height direction and lateral vibrations occur with respect to the measurement object, a height image accurately reflecting the shape of the measurement object can be generated.

Brief Description of the Drawings

[0024] [Figure 1] It is a block diagram showing the configuration of the shape inspection device according to the first embodiment of the present invention. [Figure 2] It is an external perspective view of the imaging head and the measurement object. [Figure 3] It is a diagram showing the relationship between the light irradiation position on the surface of the measurement object and the light incident position on the light receiving part. [Figure 4] It is a diagram showing the light reception amount distribution on the light receiving surface of the light receiving part. [Figure 5] It is a diagram showing the light reception amount distribution in the pixel column in the X2 direction. [Figure 6] It is a diagram showing the detected peak position and peak luminance value. [Figure 7] It is a diagram showing three-dimensional data and luminance image data. [Figure 8] It is a block diagram showing the configuration of the processing device in FIG. 1. [Figure 9] It is an ideal height image of the measurement object. [Figure 10] It is a height image when an aperiodic vibration is applied. [Figure 11] It is a diagram for explaining the correction of profile data. [Figure 12] It is a diagram for explaining the correction of profile data. [Figure 13A] It is a diagram exemplifying the user interface. [Figure 13B] It is a diagram exemplifying the user interface. [Figure 14A] It is a flowchart showing the processing by the control unit. [Figure 14B] It is a flowchart showing the processing by the control unit. [Figure 14C] It is a flowchart showing the processing by the control unit. [Figure 15A] It is a diagram exemplifying the user interface. [Figure 15B] It is a diagram exemplifying the user interface. [Figure 16]This flowchart shows the processing performed by the control unit. [Figure 17] This diagram illustrates the correction parameters. [Figure 18] This diagram shows the set correction reference area. [Figure 19] This is a diagram illustrating a user interface. [Figure 20A] This flowchart shows the processing performed by the control unit. [Figure 20B] This flowchart shows the processing performed by the control unit. [Figure 21] This is a diagram showing tilt correction. [Figure 22A] This is a diagram illustrating a user interface. [Figure 22B] This is a diagram illustrating a user interface. [Figure 23A] This flowchart shows the processing performed by the control unit. [Figure 23B] This flowchart shows the processing performed by the control unit. [Figure 24A] This flowchart shows the processing performed by the control unit. [Figure 24B] This flowchart shows the processing performed by the control unit. [Figure 25A] This flowchart shows the processing performed by the control unit. [Figure 25B] This flowchart shows the processing performed by the control unit. [Figure 26] This diagram explains tilt correction. [Figure 27] This is a diagram explaining the estimation of the reference plane. [Figure 28] This diagram illustrates the case where multiple correction reference regions are set. [Figure 29] This is a block diagram showing the configuration of the processing apparatus in the second embodiment of the present invention. [Modes for carrying out the invention]

[0025] Embodiments of the present invention will be described in detail below with reference to the drawings. The following description of preferred embodiments is essentially illustrative and is not intended to limit the present invention, its applications, or its uses.

[0026] [1] First embodiment (1) Configuration of the shape inspection device Hereinafter, a shape inspection apparatus, processing apparatus, height image processing method, and height image processing program according to embodiments of the present invention will be described with reference to the drawings. Figure 1 is a block diagram showing the configuration of a shape inspection apparatus 500 according to a first embodiment of the present invention. The shape inspection apparatus 500 is used to measure the three-dimensional shape of an object to be measured S that is moved at a constant speed by, for example, a belt conveyor, and to inspect the measured three-dimensional shape of the object to be measured S. In Figure 1, the direction of movement A of the object to be measured S is indicated by a white arrow. The direction of movement A of the object to be measured S can also be called the transport direction.

[0027] As shown in Figure 1, the shape inspection device 500 comprises an imaging head 100, a processing unit 200, an input unit 300, and a display unit 400. The imaging head 100 includes a light-emitting unit 110 and an imaging unit 120. The light-emitting unit 110 and the imaging unit 120 constitute an optical displacement meter using the light-section method. This optical displacement meter may also include a processing unit 200. The imaging unit 120 includes a light-receiving unit 121 and a light-receiving lens 122. Furthermore, the processing unit 200 includes a storage unit 210 and a control unit 220.

[0028] Figure 2 is an external perspective view of the imaging head 100 and the object to be measured S. As shown in Figure 2, the imaging head 100 is installed so that the Y1 direction is approximately parallel to the movement direction A of the object to be measured S. The imaging head 100 is used in a fixed state, attached to, for example, a mounting base, support column, bracket, etc., although not shown. The direction perpendicular to the Y1 direction in the plane containing the movement direction A is the X1 direction. The direction perpendicular to both the X1 and Y1 directions is the Z1 direction. The X1, Y1, and Z1 directions are examples of the X-axis, Y-axis, and Z-axis directions, respectively.

[0029] The light-emitting unit 110 includes a light source and is configured to emit a band-shaped light spreading in the X1 direction or a spot light scanned in the X1 direction in the Z1 direction, as shown in Figure 2. The light source can be, for example, an LD (laser diode), but the embodiment is not limited to this. The light source may also be, for example, an LED (light-emitting diode), or an SLD (superluminescent diode), etc. The band-shaped light and the spot light can also be called measurement light.

[0030] Figure 3 shows the relationship between the light irradiation position on the surface of the object S to be measured and the light incidence position on the light receiving unit 121. As shown in Figure 3, light emitted from the light emitting unit 110 and reflected at various positions in the X1 direction of the object S to be measured enters the light receiving unit 121 through the light receiving lens 122. The light receiving unit 121 includes, for example, a CMOS (complementary metal-oxide-semiconductor) sensor or a CCD (charge-coupled device) sensor and has a light-receiving surface in which multiple pixels are arranged in two dimensions. Two mutually orthogonal directions on the light-receiving surface of the light receiving unit 121 are called the X2 direction as the X-axis direction and the Z2 direction as the Z-axis direction. In addition, the direction that is orthogonal to the X2 direction and the Z2 direction and corresponds to the time axis is called the Y2 direction. The Y2 direction is an example of a direction corresponding to the Y axis. A light-receiving signal indicating the amount of light received by the light receiving unit 121 is generated by the light receiving unit 121, and the generated light-receiving signal is output by the light receiving unit 121 to the processing unit 200.

[0031] The storage unit 210 shown in Figure 1 includes RAM (Random Access Memory), ROM (Read-Only Memory), a hard disk, or semiconductor memory, and stores the height image processing program. The height image processing program may be provided in a form stored on a computer-readable storage medium and installed in the storage unit 210. Alternatively, if the processing unit 200 is connected to a network such as the Internet, the height image processing program may be installed in the storage unit 210 from a server on the network (including a cloud server).

[0032] The control unit 220 is composed of a computer or the like capable of executing the height image processing program, and includes, for example, a CPU (Central Processing Unit), and controls the operation of the imaging head 100 based on the height image processing program. The control unit 220 is also configured to generate profile data, three-dimensional data, or luminance image data of the object to be measured S. The profile data shows the profile of the object to be measured S in a plane defined by the X2 direction, which is the X-axis direction, and the Z2 direction, which is the Z-axis direction. The three-dimensional data shows the three-dimensional shape of the object to be measured S. The luminance image data shows the surface image (texture image) of the object to be measured S. Details of the processing unit 200 will be described later.

[0033] The input unit 300 consists of input devices and operating devices such as a keyboard or pointing device, and can be operated by the user. By operating the input unit 300, the user can make predetermined specifications to the processing unit 200, input predetermined information, or perform predetermined installations.

[0034] The display unit 400 is composed of, for example, a liquid crystal display panel or an organic EL (electroluminescent) panel. The display unit 400 can display profile data, three-dimensional data, or luminance image data of the object to be measured S based on profile data, three-dimensional data, or luminance image data generated by the processing unit 200.

[0035] (2) Profile data, height image and brightness image In the example shown in Figure 2, the object to be measured S has a trapezoidal groove on its surface that extends in the Y1 direction. The imaging head 100 irradiates the surface of the object to be measured S, which is moving in the movement direction A, with a band of light along the X1 direction. Hereinafter, the linear region on the surface of the object to be measured S at a certain position in the Y1 direction where the band of light is irradiated will be called the irradiation region T.

[0036] As shown in Figure 3, light reflected from the illumination region T enters the light-receiving unit 121 through the light-receiving lens 122. In this case, if the reflection position of the light in the illumination region T differs in the Z1 direction, the incident position of the reflected light to the light-receiving unit 121 differs in the Z2 direction. Also, if the reflection position of the light in the illumination region T differs in the X1 direction, the incident position of the reflected light to the light-receiving unit 121 differs in the X2 direction. Thus, the incident position of the light in the Z2 direction of the light-receiving unit 121 represents the position of the illumination region T in the Z1 direction, and the incident position of the light in the X2 direction of the light-receiving unit 121 represents the position of the illumination region T in the X1 direction.

[0037] Figure 4 shows the distribution of light received on the light-receiving surface of the light-receiving unit 121. The light-receiving distribution is generated based on the amount of light received by each pixel p of the light-receiving unit 121 in Figure 4. As described above, the multiple pixels p of the light-receiving unit 121 are arranged in two dimensions along the X2 and Z2 directions. Each of the rows of multiple pixels p along the Z2 direction is called a pixel row SS. Multiple pixel rows SS are arranged on the light-receiving surface of the light-receiving unit 121 in the X2 direction.

[0038] Light reflected from the illumination region T in Figure 2 enters the light-receiving region R shown in Figure 4. As a result, the amount of light received in the light-receiving region R increases in the received signal. FIG. 5A in Figure 5 shows the distribution of the amount of light received in the pixel row SS at one position u1 in the X2 direction. FIG. 5B in Figure 5 shows the distribution of the amount of light received in the pixel row SS at another position u2 in the X2 direction. FIG. 5C in Figure 5 shows the distribution of the amount of light received in the pixel row SS at yet another position u3 in the X2 direction. In FIGs 5A to 5C, the horizontal axis represents the position in the Z2 direction, and the vertical axis represents the amount of light received.

[0039] As shown in FIGs 5A to 5C, a peak P (maximum value) corresponding to the light-receiving region R in Figure 4 appears in the light-receiving amount distribution of each pixel row SS. The position of peak P in the Z2 direction is called the peak position, and the brightness value (light-receiving amount) at the peak position is called the peak brightness value. In the pixel row SS at position u1, the peak position is v1 and the peak brightness value is I1. In the pixel row SS at position u2, the peak position is v2 and the peak brightness value is I2. In the pixel row SS at position u3, the peak position is v3 and the peak brightness value is I3. The peak position indicates the surface (reflective surface) of the object S being measured in the irradiated region T.

[0040] In each of the multiple light-receiving distributions corresponding to multiple pixel sequences SS, one peak position and peak brightness value are detected. Note that multiple peaks may appear in the light-receiving distribution of a pixel sequence SS due to multiple reflections or diffuse reflection. In this case, after processing to exclude false peaks that do not represent the surface of the object S in the illuminated area T, one peak position and the corresponding peak brightness value are detected. The detected peak brightness value indicates the surface state of the object S in the illuminated area T and is used to generate a brightness image.

[0041] Based on the peak position detected for each pixel row SS, profile data is generated that shows the profile of the object S being measured (shape of the irradiated area T). In the light reception distribution in Figure 5, the detected peak positions are arranged in the X2 direction and shown as a continuous line, thereby generating profile data that shows the profile of the object S being measured.

[0042] As the object to be measured S moves relative to the movement direction A, light from the light-emitting unit 110 is sequentially irradiated onto multiple positions in the Y1 direction of the object to be measured S. Therefore, as the object to be measured S moves relative to the movement direction A, light reflected from multiple illumination areas T at multiple positions in the Y1 direction of the object to be measured S is sequentially incident on the light-receiving unit 121. As a result, for each position in the Y2 direction corresponding to the Y1 direction, the peak position and peak brightness value of the pixel array SS at multiple positions in the X2 direction are detected.

[0043] Figure 6 shows the relationship between the detected peak position and the peak brightness value. As shown in Figure 6, for a point defined by the position xi in the X2 direction and the position yj in the Y2 direction (which is the time axis direction) (where i and j are integers of 1 or more), the peak position zij and the peak brightness value Iij are detected in association. As a result, the position xi, position yj, peak position zij, and peak brightness value Iij are stored in the storage unit 210 in Figure 1 in this associated state.

[0044] Figure 7A shows a height image Hi representing the three-dimensional shape of the object S being measured. As shown in Figure 7A, three-dimensional data is generated by arranging peak positions zij, which are associated with each point defined by positions xi and yj. That is, a height image Hi representing the three-dimensional shape of the object S is generated by arranging profile data generated in the Y2 direction, corresponding to multiple positions yj.

[0045] Figure 7B shows the luminance image data. As shown in Figure 7B, luminance image data is generated by arranging the peak luminance values ​​Iij associated with each point defined by positions xi and yj. In other words, luminance image data is generated by arranging the peak luminance values ​​detected in relation to the profile data of multiple positions yj in the Y2 direction.

[0046] In this way, three-dimensional data and luminance image data of the surface of the object to be measured S are generated by moving the object to be measured S relative to the imaging head 100. In this embodiment, the object to be measured S is moved, but the embodiment is not limited to this. The object to be measured S only needs to be moved relative to the imaging head 100. Therefore, the imaging head 100 may be moved without the object to be measured S moving, or both the object to be measured S and the imaging head 100 may be moved. In these cases as well, three-dimensional data and luminance image data of the object to be measured S can be generated.

[0047] (3) Control Unit Figure 8 is a block diagram detailing the configuration of the processing unit 200 shown in Figure 1. As shown in Figure 8, the control unit 220 of the processing unit 200 includes a profile data generation unit 201, a height image generation unit 202, an inspection unit 203, a communication unit 204, a display control unit 205, a setting unit 206, and a light transmission / reception control unit 211. The control unit 220 may execute a height image processing program to realize the functions of the profile data generation unit 201, the height image generation unit 202, the inspection unit 203, the communication unit 204, the display control unit 205, and the setting unit 206, or any two or more of these functions may be integrated and provided as a single processing unit.

[0048] The light transmission and reception control unit 211 controls the light transmission unit 110 to emit light in the Z1 direction at a predetermined period, and controls the light reception unit 121 to receive light that has passed through the light reception lens 122. In the example shown in Figure 8, the light transmission and reception control unit 211 controls the light transmission unit 110 so that light is periodically irradiated onto the object S being measured, which is moving relative to the object in the direction of movement A. In addition, the light reception unit 121 repeatedly receives the reflected light from the object S being measured, and a light reception signal indicating the amount of light received is output sequentially.

[0049] The profile data generation unit 201 generates profile data Pd corresponding to each position in the Y2 direction of the moving object S based on the light-receiving signal output by the light-receiving unit 121. The profile data generation unit 201 also outputs the generated profile data Pd to the height image generation unit 202, the display control unit 205, and the setting unit 206.

[0050] The height image generation unit 202 is responsible for arranging multiple profile data Pd generated by the profile data generation unit 201 in the Y2 direction to generate a height image Hi that shows the three-dimensional shape of the object S to be measured. The height image generation unit 202 is also responsible for outputting the generated height image Hi to the inspection unit 203, the display control unit 205, and the setting unit 206.

[0051] The inspection unit 203 is the part that inspects the object to be measured S based on the height image Hi generated by the height image generation unit 202, and includes a measurement unit 203a and a determination unit 203b. The measurement unit 203a performs predetermined measurements on the height image Hi of the object to be measured S. The determination unit 203b inspects the object to be measured S based on the measurement results measured by the measurement unit 203a. For example, the measurement unit 203a measures the length, angle, etc., of predetermined parts of the object to be measured S. Then, based on these measurement results and a preset threshold, etc., the determination unit 203b determines whether the object to be measured S is a good product or not. The inspection unit 203 is also the part that outputs the inspection results of the object to be measured S to the communication unit 204 and the display control unit 205.

[0052] Furthermore, the inspection unit 203 may perform the inspection based on multiple profile data with different positions in the Y2 direction, generated by the profile data generation unit 201. That is, the inspection unit 203 may inspect the object to be measured S using a height image Hi composed of multiple profile data Pd, rather than using a single profile data Pd. When inspecting using a height image Hi composed of multiple profile data Pd, the positions of each profile data Pd can be offset so as to reduce the positional misalignment between the multiple profile data Pd that constitute the height image Hi, as will be described later.

[0053] The communication unit 204 is the part that outputs the inspection results from the inspection unit 203 to an external control device 600 such as a PLC. The communication unit 204 can also receive signals from the control device 600. In this case, the light transmission / reception control unit 211 may control the light transmission unit 110 and the light reception unit 121 based on the signal received from the control device 600 as an external trigger.

[0054] The display control unit 205 is responsible for displaying the profile data Pd generated by the profile data generation unit 201 and the setting height image Hi generated by the height image generation unit 202 on the display unit 400. "Setting" refers to operations performed by the user before operating the shape inspection device 500, and is executed by the setting unit 206. The height image Hi is an image displayed on the display unit 400 when various settings are made for the shape inspection device 500 as shown in Figure 1, and can therefore also be called a setting image.

[0055] The setting unit 206 detects when the input unit 300 is operated by the user and accepts various settings related to the control unit 220. This setting unit 206 includes an inspection setting unit 206a and a correction setting unit 206b. The inspection setting unit 206a sets the inspection parameters used by the inspection unit 203. Based on the profile data Pd or height image Hi of the object to be measured S displayed on the display unit 400, the inspection setting unit 206a sets the inspection area and the tolerance range of the object to be measured S. Based on the profile data Pd or height image Hi displayed on the display unit 400, the correction setting unit 206b sets the method for positioning (aligning) the profile data Pd generated by the profile data generation unit 201. Details of the correction setting unit 206b will be described later.

[0056] (4) Correction of height image Hi When the object to be measured S moves relative to the imaging head 100, vibrations such as lateral or vertical shaking may occur in at least one of the object to be measured S or the imaging head 100. Due to the addition of vibration components, the shape of the object to be measured included in the height image Hi generated by the height image generation unit 202 will be different from the actual shape of the object to be measured S.

[0057] On the other hand, the profile data generation unit 201 generates profile data Pd at each position in the Y1 direction of the moving object S, receiving light spreading in the X1 direction. Therefore, the shape of the profile data Pd generated at each position in the Y1 direction accurately represents the shape of the object S at each position in the Y1 direction. In other words, in the range where there is no influence of vibration components, the height image Hi obtained by arranging the profile data Pd generated at each position in the Y1 direction in the Y2 direction represents the shape of the object S relatively accurately. However, if there is an influence of vibration components, the height image generation unit 202 arranges the profile data Pd that has shifted from its original position due to the vibration of the object S during movement in the Y2 direction, so it is conceivable that it may generate a height image Hi that differs from the actual shape of the object S.

[0058] Therefore, the height image generation unit 202 calculates the amount of positional displacement that occurs in the profile data Pd due to the vibration of the object S being measured. Then, the height image generation unit 202 offsets (moves) the profile data Pd generated at each position in the Y1 direction by the amount of positional displacement in at least one of the Z2 direction and the X2 direction. As a result, the height image generation unit 202 can generate a height image Hi that is closer to the shape of the object S being measured.

[0059] When the height image generation unit 202 offsets the profile data Pd generated by the profile data generation unit 201 in at least one of the Z2 and X2 directions, the shape of the individual profile data Pd generated at each position in the Y1 direction is preserved. Therefore, the height image generation unit 202 can correct the height image Hi without distorting the shape of the object S included in the height image Hi. The concept of correcting the height image Hi will be explained below.

[0060] (Concept of height image correction) As shown in Figure 2, the object to be measured S moves relative to the imaging head 100. In this case, positional shifts occur between the profile data Pd sequentially generated by the profile data generation unit 201 due to vibrations in the belt conveyor C and vibrations in the object to be measured S during transport. These positional shifts include an X shift due to the object to be measured S vibrating in the X1 direction (lateral direction) and a Z shift due to the object to be measured S vibrating in the Z1 direction (height direction). Furthermore, when the object to be measured S vibrates in the X1 direction, a shift in the X2 direction occurs in the profile data Pd generated by the profile data generation unit 201. Also, when the object to be measured S vibrates in the Z1 direction, a shift in the Z2 direction occurs in the profile data Pd generated by the profile data generation unit 201.

[0061] Figures 9 and 10 illustrate the ideal height image and the height image including vibration components.

[0062] Figure 9 shows an ideal height image Hi of the object S being measured. Here, "ideal height image" refers to the height image Hi obtained when there is no vibration from the conveyor belt C transporting the object S, the object S itself, or the surrounding environment, and the object S is moved in a straight line relative to the imaging head 100.

[0063] The height image Hi of the object S shown in Figure 9 is divided into five regions R1 to R5. Here, the height of the object S is represented by the density of the color. Regions with high density, such as R1 and R5, indicate that the height is relatively high relative to the reference plane, while regions with low density, such as R3, indicate that the height is relatively low relative to the reference plane. Thus, the height image Hi of the object S is composed of rectangles with uniform height in each of the regions R1 to R5.

[0064] Next, we will explain the case where vibration occurs in the Z1 direction of the object to be measured S, that is, when the object to be measured S is vibrating vertically relative to the imaging head 100, using FIG. 10A in Figure 10. When vibration occurs in the Z1 direction of the object to be measured S, a height image Hi is obtained in which vibration is applied to the light receiving unit 121 in the Z2 direction. An example of this height image Hi is FIG. 10A in Figure 10. Each of the multiple profile data Pd that constitute the height image Hi is shifted in the Z2 direction, and there are regions R1 to R5 in which the height differs from the ideal height image shown in Figure 9.

[0065] Figure 10B shows the case where the object to be measured S vibrates in the X1 direction, that is, when the object to be measured S is swaying laterally relative to the imaging head 100. When the object to be measured S vibrates in the X1 direction, a height image Hi is obtained in which vibration is applied to the light receiving unit 121 in the X2 direction. An example of this height image Hi is shown in Figure 10B. Each of the multiple profile data Pd that make up the height image Hi is shifted in the X2 direction, and each of the regions R1 to R5 has a shape that has been deformed from a rectangular shape to a shape that has been deformed laterally.

[0066] When conventional frequency analysis-based correction is applied to the height image Hi shown in FIG. 10A of Figure 10, periodic vibration components can be removed, but non-periodic vibration components are difficult to remove accurately. In other words, conventional vibration correction assumes that vibration components are "periodic" and removes the periodic components considered to be vibration components from the height image Hi. Therefore, as shown in FIG. 10A of Figure 10, when there are regions with different height levels in only a part of the Y2 direction, or when there are regions with different height levels non-periodically, it is difficult to generate a height image Hi from which vibration components have been accurately removed. In such cases, in each of the regions R1 to R5, vibration components cannot be completely removed, resulting in residual regions or overcorrected regions due to erroneous overcorrection. The occurrence of such residual regions and overcorrected regions is due to the non-periodic generation of vibration components. Thus, conventional vibration correction has made it difficult to generate a height image Hi from which non-periodic vibration components have been accurately removed.

[0067] Furthermore, conventional vibration correction methods perform frequency analysis in the height direction, and therefore could not correct for the positional displacement in the X2 direction shown in FIG. 10B of Figure 10. The object S being measured, moving on the belt conveyor C, experiences non-periodic vibrations (positional displacement) in the height direction, periodic vibrations (positional displacement) in the X direction, and non-periodic vibrations (positional displacement) in the X direction. However, conventional vibration correction methods cannot address these vibrations (positional displacement), making it difficult to accurately inspect the object S being measured.

[0068] When the profile alignment (vibration correction) according to this embodiment is applied to a height image Hi with vibration components in the Z2 (height) direction added, as shown in FIG. 10A of Figure 10, or to a height image Hi with vibration components in the X2 (lateral) direction added, as shown in FIG. 10B of Figure 10, a height image similar to the ideal height image Hi shown in Figure 9 is obtained. In other words, a height image Hi with vibration components in the Z2 direction and X2 direction corrected is obtained.

[0069] As described above, in the profile alignment (vibration correction) according to this embodiment, each of the profile data is offset to reduce the positional misalignment between the profile data. Therefore, regardless of the periodicity of the vibration, vibrations (positional misalignment) occurring in the object to be measured S can be corrected, and the object to be measured S can be inspected more accurately. In other words, the height image generation unit 202 can generate a height image Hi with reduced vibration components by suppressing the positional misalignment between profile data Pd having non-periodic vibrations.

[0070] Furthermore, if the object S being measured has positional displacement in the Z1 direction and positional displacement in the X1 direction, profile alignment (vibration correction) may be performed in both the Z2 and X2 directions. In other words, it is sufficient to perform profile alignment (vibration correction) in at least one of the Z2 and X2 directions.

[0071] (Overview of Z-axis shift correction) Figures 11A and 11B in Figure 11 are diagrams that explain the Z-shift correction in more detail. Figures 11A in Figure 11 show Pd1, Pd2, Pd3, Pd4, and Pd5, which represent multiple profile data Pd with different positions in the Y2 direction, generated by the profile data generation unit 201. The direction of movement of the object to be measured S is indicated by a dotted arrow.

[0072] If the object S being measured is transported on the belt conveyor C without vibration, the Z heights of each profile data Pd1 to Pd5 will align on this arrow, where the height in the Z2 direction is the reference Z height Zr. However, in the example of FIG. 11A in Figure 11, the profile data Pd is shifted upward or downward from the reference Z height Zr.

[0073] Therefore, the height image generation unit 202 calculates the Z position shift amount, which is the difference between the reference Z height Zr and the actual Z height, for each of the profile data Pd. Then, the height image generation unit 202 offsets (moves) the profile data Pd in ​​the Z2 direction according to the Z position shift amount. In other words, the height image generation unit 202 calculates the offset amount (movement amount) for each profile data Pd so that the positional shift between the profile data Pd is minimized. Then, the height image generation unit 202 offsets the profile data Pd according to the offset amount calculated for each profile data.

[0074] As a result, as shown in FIG. 11B of Figure 11, a profile data Pdz can be obtained by aligning multiple profile data Pd with different positions in the Y2 direction so that their heights in the Z2 direction are equal. In other words, the height image generation unit 202 can reduce the positional displacement between profile data Pd regardless of the periodicity of the positional displacement of the profile data Pd, and the obtained profile data Pdz is aligned in a straight line along the reference height Zr. The height image generation unit 202 then arranges the profile data Pdz, which have been offset (moved) in the Z2 direction, in the Y2 direction and generates a height image Hi that shows the three-dimensional shape of the object to be measured S.

[0075] This height image Hi has been corrected for Z-position shifts between multiple profile data Pd that are located at different positions in the Y2 direction. Since the inspection unit 203 performs inspections using this height image Hi from which the Z-position shifts have been removed, this height image Hi can be referred to as an inspection height image.

[0076] (Outline of X-shift correction) Figures 12A and 12B in Figure 12 are diagrams that provide a more detailed explanation of the X-axis displacement correction described above.

[0077] If the object S being measured is transported on the belt conveyor C without vibration, the X positions of each profile data Pd11 to Pd15 will align on this arrow, where the position in the X2 direction is the reference X position Xr. However, in the example of FIG. 12A in Figure 12, the profile data Pd is shifted to the right or left from the reference X position.

[0078] Therefore, the height image generation unit 202 calculates the X position shift amount, which is the difference between the reference X position Xr and the actual X position, for each of the profile data Pd. Then, the height image generation unit 202 offsets (moves) the profile data Pd in ​​the X2 direction according to the X position shift amount.

[0079] As a result, as shown in FIG. 12B of Figure 12, the height image generation unit 202 can reduce the positional displacement between profile data Pd regardless of the periodicity of the positional displacement of the profile data Pd, and obtain profile data Pdx in which multiple profile data Pd with different positions in the Y2 direction are aligned so that their X positions in the X2 direction are equal. The height image generation unit 202 then arranges the profile data Pdx offset in the X2 direction in the Y2 direction and generates a height image Hi that shows the three-dimensional shape of the object to be measured S.

[0080] This height image Hi has been corrected for X-position shifts between multiple profile data Pd that are located at different positions in the Y2 direction. Since the inspection unit 203 performs inspections using this height image Hi from which the X-position shifts have been removed, this height image Hi can be called an inspection height image.

[0081] The following sections will provide a detailed explanation of Z-axis shift correction and X-axis shift correction, including the user interface displayed on the display unit 400.

[0082] 1. Z-axis shift correction (User interface for Z-axis shift correction settings) Figure 13A shows an example of the user interface of the alignment setting screen 1000 displayed on the display unit 400. This alignment setting screen 1000 allows users to set the alignment of Z-shift. The alignment setting screen 1000 includes a pre-alignment image display area 1001a, a post-alignment image display area 1001b, and a parameter setting area 1010. The pre-alignment image display area 1001a displays the pre-alignment image 1002a. In addition, the Z-correction reference area Arz is displayed superimposed on the pre-alignment image 1002a as the correction reference area Ar. The post-alignment image display area 1001b displays the post-alignment image 1002b. The parameter setting area 1010 displays an add button 1011, a delete button 1012 for deleting setting items, up buttons 1013 and down buttons 1014 for changing the order of setting items, and a Z-correction setting area 1100 for setting Z-shift correction.

[0083] The Z correction setting area 1100 displays a checkbox CB801 to toggle whether or not to perform Z correction, an advanced settings button 1101 for making detailed settings for Z correction, and a height type selection field 1102 for selecting the method of calculating the height that serves as the basis for Z correction.

[0084] When the display control unit 205 detects that the detailed setting button 1101 has been selected by the input unit 300, the display control unit 205 displays the Z correction detailed setting area 1110 on the alignment setting screen 1000 of the display unit 400. An example of the Z correction detailed setting area 1110 is shown in Figure 13B.

[0085] This Z-correction detailed setting area 1110 displays a correction area selection field 1111 for selecting the shape of the Z-correction reference area Arz, a checkbox CB802 for switching whether or not to set a second Z-correction reference area Arz as the correction reference area Ar, a correction area selection field 1111 for selecting the shape of the second Z-correction reference area ARz, a moving average selection field 1112 for setting a moving average in the X2 direction, and a mask upper limit setting field 1113 and a mask lower limit setting field 1114 for setting a mask for profile data above or below a certain level.

[0086] (Correction setting procedure and generation of height image for inspection) The method for generating inspection height images based on the alignment settings set on the alignment setting screen 1000 will be explained according to the flowcharts in Figures 14A, 14B, and 14C.

[0087] Figure 14A shows the alignment setting procedure for Z-shift correction. After starting, the light emission control unit 211 first controls the imaging head 100 to periodically emit light with the light emission unit 110 and receive light with the light receiving unit 121, and repeatedly images the object to be measured S (step S2001).

[0088] Next, the profile data generation unit 201 generates multiple profile data Pd based on the light-receiving signals repeatedly output by imaging in step S2001 (step S2002).

[0089] Next, the height image generation unit 202 generates a height image Hi showing the three-dimensional shape of the object to be measured S based on the multiple profile data Pd generated in step S2002 (step S2003).

[0090] Subsequently, the height image generation unit 202 outputs the height image Hi generated in S2003 to the display control unit 205 (step S2004).

[0091] Then, in step S2004, the display control unit 205 displays the height image Hi output from the height image generation unit 202 on the display unit 400 (step S2005).

[0092] Next, the display control unit 205 detects the user's operation of the input unit 300 and displays the Z correction reference region Arz, which extends in the Y2 direction, as the correction reference region Ar on the display unit 400 (step S2006).

[0093] Next, the correction setting unit 206b obtains the Z correction reference region Arz extending in the Y2 direction, which was set in S2006, from the display control unit 205 (step S2007).

[0094] Furthermore, the correction setting unit 206b accepts the user's setting of correction parameters (step S2008). The correction parameters set here may include whether or not Z correction is set in checkbox CB801, the height type selected in height type selection field 1102, the shape of the Z correction reference area Arz selected in correction area selection field 1111, whether or not a second Z correction reference area Arz is set in checkbox CB, the number of moving averages in the X direction selected in moving average selection field 1112, the mask upper limit value set in mask upper limit setting field 1113, and the mask lower limit value set in mask lower limit setting field 1114. In the following, Z correction reference area Arz refers to at least one of the Z correction reference area Arz and the second Z correction reference area Arz.

[0095] Next, the correction setting unit 206b stores the correction parameters set in S2008 (step S2009). The storage of correction parameters will be described later using Figure 17.

[0096] Note that displaying the Z-correction reference area Arz on the display unit 400 is not mandatory. For example, the correction setting unit 206b may accept input of two coordinates and set the area where the accepted coordinates are the diagonals of a rectangle as the Z-correction reference area Arz.

[0097] The alignment settings are completed by performing the above steps S2001 to S2008.

[0098] Next, we will explain how to generate a height image for inspection, following the flowchart in Figure 14B.

[0099] First, the height image generation unit 202 obtains the Z correction reference region Arz and the correction parameters set in the correction setting unit 206b from the correction setting unit 206b (step S2011).

[0100] Next, the light-emitting and light-receiving control unit 211 controls the imaging head 100 to periodically emit light with the light-emitting unit 110 and receive light with the light-receiving unit 121, thereby repeatedly imaging the object S to be measured (step S2012).

[0101] Next, the profile data generation unit 201 generates multiple profile data Pd based on the light-receiving signals repeatedly output by imaging in step S2012 (step S2013).

[0102] Next, the height image generation unit 202 offsets (moves) the profile data Pd acquired in S2013 in the Z2 direction to reduce the positional misalignment between the profile data Pd, according to the correction reference region Ar and correction parameters acquired in S2011. This performs profile alignment, which is a correction of the positional misalignment of the profile data Pd (step S2014). Details of the profile alignment in S2014 are explained in Figure 14C.

[0103] Next, the height image generation unit 202 arranges the profile data Pd aligned in S2014 in the Y2 direction and joins them together. This generates a height image for inspection in which the positional misalignment in the Z2 direction between multiple profile data with different positions in the Y2 direction is reduced (step S2015).

[0104] The height image is corrected through the processing steps S2011 to S2015 described above.

[0105] Next, we will explain the profile alignment of S2014 in detail, following the flowchart in Figure 14C.

[0106] First, the height image generation unit 202 identifies the profile data present in Arz within the Z correction reference region for each of the multiple profile data Pd obtained from the profile data generation unit 201 (step S2021).

[0107] Next, the height image generation unit 202 extracts feature points from each of the multiple profile data Pd within the Z correction reference region Arz identified in S2021 (step S2022).

[0108] Next, the height image generation unit 202 calculates a reference Z height Zr based on the Z heights of the feature points calculated from each of the multiple profile data Pd (step S2023). For example, the average value of the Z heights of multiple feature points can be used as the reference Z height Zr. Alternatively, the Z height of the feature point extracted from the first line of profile data Pd within the Z correction reference region Arz may be used as the reference Z height Zr.

[0109] Next, the height image generation unit 202 calculates the difference between the reference Z height Zr and the Z height of a feature point extracted from one of the profile data for each of the multiple profile data Pd (step S2024). The difference calculated here corresponds to the offset amount of one of the profile data during profile alignment. The difference, which is the offset amount, is calculated in such a way as to minimize the positional misalignment between the multiple profile data Pd.

[0110] Next, the height image generation unit 202 offsets each of the multiple profile data Pd in ​​the Z2 direction by the difference, which is the offset amount calculated in S2024 (step S2025).

[0111] Through the processing described in S2021 to S2025, the profiles are aligned, and non-periodic misalignments are reduced regardless of the misalignment period (vibration period) of the multiple profile data Pd.

[0112] (Relationship between correction parameters and correction content) The relationship between the correction parameters set in Figures 13A and 13B and the alignment of the profile data Pd will be explained.

[0113] (Z correction reference area Arz) The Z-correction reference region Arz is set as a two-dimensional region extending in the Y2 direction. That is, in the X2-Y2 plane, a two-dimensional region with the Y2 direction as its longitudinal direction is set as the Z-correction reference region Arz. By setting the Z-correction reference region Arz extending in the Y2 direction in this way, a reference Z height Zr can be set along the Y2 direction. The height image generation unit 202 then arranges multiple profile data Pd generated at each position in the Y2 direction according to the reference Z height Zr set along the Y2 direction. In other words, the profile data Pd are aligned by the height image generation unit 202 to reduce positional misalignment between profile data Pd at different positions in the Y2 direction.

[0114] The height image generation unit 202 calculates an offset amount to correct the positional misalignment that occurs between profile data Pd with different positions in the Y2 direction, and offsets the profile data Pd. In order to correct the positional misalignment that occurs between profile data with different positions in the Y2 direction, a reference Z height is calculated along the Y2 direction. For the calculation of the reference Z height along the Y2 direction, a Z correction reference region Arz is specified, which corresponds to the Y1 direction, the direction of movement of the object S being measured, and extends in the Y2 direction, which is the time axis direction, rather than the X2 direction.

[0115] (Height type selection field 1102) The height type selection field 1102 shown in Figure 13A is a selection field for selecting a method for extracting feature points from each of the multiple profile data Pd extending in the Y2 direction. The height type selection field 1102 may be a dropdown system with pre-defined options such as "peak," "bottom," and "average." For example, the correction setting unit 206b accepts the setting of "peak" as one of the correction parameters, the height type, when the display control unit 205 detects that "peak" has been selected in the height type selection field 1102. When the height image generation unit 202 detects that "peak" has been set as the height type, it performs Z-shift correction corresponding to the height type "peak" for each of the multiple profile data Pd acquired from the profile data generation unit 201.

[0116] Specifically, the height image generation unit 202 extracts a feature point where the height of each of the multiple profile data Pd obtained from the profile data generation unit 201 is at its peak. Then, based on the multiple feature points extracted during setup, the height image generation unit 202 calculates a reference Z height Zr, which serves as the alignment reference for the profile data Pd. Next, during operation, the height image generation unit 202 extracts a feature point where the height of each of the multiple profile data Pd obtained from the profile data generation unit 201 is at its peak. Then, the height image generation unit 202 offsets the profile data Pd in ​​the Z2 direction so that the Z height of the extracted feature point becomes the reference Z height Zr. In other words, by aligning each of the profile data Pd using the reference Z height Zr as the alignment reference, the height image generation unit 202 can reduce the positional misalignment that occurs between profile data Pd with different positions in the Y2 direction.

[0117] If "Bottom" is selected in the height type selection field 1102, the height image generation unit 202 extracts the point where the height of the profile data Pd is the bottom, instead of the position where the height of the profile data Pd is the peak, as a feature point. Except for the method of extracting feature points, the process is the same as in the case of "Peak" described above.

[0118] If "Average" is selected in the height type selection field 1102, the height image generation unit 202 can use the average value of the Z height of the profile data Pd present in the Z correction reference region Arz as the Z height of the feature points.

[0119] (Correction area selection field 1111) The correction area selection field 1111 shown in Figure 13B is used to select the shape of the Z correction reference area Arz. For example, the correction area selection field 1111 may be a dropdown menu with pre-defined options such as "rectangle" and "follow".

[0120] When the display control unit 205 detects that "rectangle" has been selected in the correction area selection field 1111, it displays the Z correction reference area Arz in the pre-alignment image display area 1001a. The correction setting unit 206b may also accept movement of any side of the Z correction reference area Arz and change the area of ​​the Z correction reference area Arz accordingly. Furthermore, in addition to, or instead of, the correction area selection field 1111, the correction setting unit 206b may accept input of coordinates of at least two points from the user and set a rectangle with those two points as diagonal corners as the Z correction reference area Arz.

[0121] Then, when the correction setting unit 206b detects that "Rectangle" has been selected in the correction area selection field 1111, it sets "Rectangle" as the correction area, which is one of the correction parameters. Furthermore, the correction setting unit 206b obtains the Z correction reference area Arz from the display control unit 205 and accepts it as the setting for the Z correction reference area Arz.

[0122] Furthermore, when the correction setting unit 206b detects that "Follow" has been selected in the correction area selection field 1111, it accepts the setting of "Follow" as one of the correction parameters, which is the correction area. Note that "Follow" is suitable when the Z correction reference area Arz is shaped along an arbitrary edge. When "Follow" is selected in the correction area selection field 1111, the height image generation unit 202 extracts feature points from each of the multiple profile data Pd obtained from the profile data generation unit 201 at the time of setting. Then, based on these feature points, the offset amount from the feature points set in advance in the correction setting unit 206b, and the width of the Z correction reference area Arz, the height image generation unit 202 calculates the Z correction reference area Arz. The height image generation unit 202 sets the Z correction reference area Arz calculated in this way in the correction setting unit 206b.

[0123] Furthermore, the profile alignment when a second Z-correction reference region Arz is set in addition to the Z-correction reference region Arz will be discussed later.

[0124] (Mask upper limit setting field 1113 and mask lower limit setting field 1114) The mask upper limit setting field 1113 shown in Figure 13B is a setting field for setting a mask for profile data Pd that has a Z height above a certain level. The mask lower limit setting field 1114 is a setting field for setting a mask for profile data Pd that has a Z height below a certain level.

[0125] For example, the mask upper limit setting field 1113 and the mask lower limit setting field 1114 may accept arbitrary values ​​in response to user operation of the input unit 300. For example, when an object to be measured S is transported on a belt conveyor C, it may be difficult to predict in advance where the object to be measured S will appear in the width direction of the belt conveyor C. In such cases, the Z correction reference area Arz may be set to a wide range, and a mask may be set to the Z height range of the profile data Pd used for feature point extraction.

[0126] If an upper limit value is entered in the mask upper limit setting field 1113, the correction setting unit 206b accepts the upper limit value entered in the mask upper limit setting field 1113 as one of the correction parameters, namely the mask upper limit value. In this case, the height image generation unit 202 obtains the mask upper limit value from the correction setting unit 206b and extracts feature points from the profile data Pd in ​​the range below the mask upper limit value.

[0127] If a lower limit value is entered in the mask lower limit setting field 1114, the correction setting unit 206b accepts the lower limit value entered in the mask lower limit setting field 1846 as one of the correction parameters. In this case, the height image generation unit 202 obtains the mask lower limit value from the correction setting unit 206b and extracts feature points from the profile data Pd in ​​the range greater than or equal to the mask lower limit value.

[0128] When upper and lower limits are entered in the mask upper limit setting field 1113 and the mask lower limit setting field 1114, the correction setting unit 206b accepts the settings of the upper limit entered in the mask upper limit setting field 1113 and the lower limit entered in the mask lower limit setting field 1114 as the mask upper limit and mask lower limit, which are one of the correction parameters. In this case, the height image generation unit 202 obtains the mask upper limit and mask lower limit from the correction setting unit 206b and extracts feature points from the profile data Pd in ​​the range that is greater than or equal to the mask lower limit and less than or equal to the mask upper limit.

[0129] 2. X-axis shift correction (User interface for X-shift correction settings) Figures 15A and 15B illustrate the alignment setting screen 1000, where X-shift alignment settings are performed. This alignment setting screen 1000 allows for X-shift alignment settings. This explanation focuses on the differences from Figure 13A. On the alignment setting screen 1000, the X-correction reference area Arx is displayed superimposed on the pre-alignment image 1002a as the correction reference area Ar. Additionally, the parameter setting area 1010 displays the X-correction setting area 1200, where X-shift correction settings are performed.

[0130] The X-correction setting area 1200 displays a checkbox CB803 to toggle whether or not to perform X-correction, an advanced setting button 1201 for making detailed settings for X-correction, an edge selection field 1202 for selecting the edge to be detected, an edge level setting field 1203 for setting the edge level, and an automatic setting button 1204 for automatically setting the edge level.

[0131] When the display control unit 205 detects that the detailed setting button 1201 has been selected by the input unit 300, the display control unit 205 displays the X correction detailed setting area 1210 on the alignment setting screen 1000 of the display unit 400. An example of the X correction detailed setting area 1210 is shown in Figure 15B. This X correction detailed setting area 1210 displays an edit button 1211 for setting the X correction reference area Arx, an edge level setting field 1203 for setting the edge level, an automatic setting button 1204 for automatically setting the edge level, an edge direction selection field 1212 for setting the edge direction, a detection direction selection field 1213 for selecting the edge detection direction, and a detection label setting field 1214 for setting the detection label. Furthermore, a checkbox CB804 for selecting whether or not to use the second X correction reference area Arx may also be displayed. When the correction setting unit 206b detects that the checkbox CB804 is checked, it accepts the setting of the second X correction reference area Arx as the correction reference area Ar. Details are omitted as they are the same as those for setting the X correction reference area Arx.

[0132] (Correction setting procedure and generation of height image for inspection) This section explains how to generate an inspection height image based on the alignment settings configured on the alignment settings screen 1000.

[0133] First, alignment settings and a height image Hi for inspection are generated according to the flowcharts in Figures 14A and 14B. This explanation will focus on the differences from the flowcharts in Figures 14A and 14B. The X-correction reference region Arx is used as the correction reference region Ar.

[0134] Furthermore, the correction parameters set in S2008 may include various parameters set in Figures 15A and 15B, such as whether or not X correction is performed as set in the checkbox CB803 shown in Figure 15A, the X correction reference area Arx, the type of edge selected in the edge selection field 1202, the edge level set in the edge level setting field 1203, the edge direction selected in the edge direction selection field 1212, the detection direction set in the detection direction selection field 1213, and the detection label set in the detection label setting field 1214. In the following, the X correction reference area Arx refers to at least one of the X correction reference area Arx and the second Z correction reference area Arx.

[0135] Furthermore, in S2014, the height image generation unit 202 offsets the profile data Pd acquired in S2013 in the X2 direction. This performs profile alignment, which is a correction of the positional misalignment of the profile data Pd. Details of profile alignment are explained in Figure 16.

[0136] Next, we will explain the profile alignment of S2014 according to the flowchart in Figure 16.

[0137] First, the height image generation unit 202 identifies the profile data Pd that exists within the X correction reference region Arx for each of the multiple profile data Pd acquired from the profile data generation unit 201 (step S2221).

[0138] Next, for each of the multiple profile data, the height image generation unit 202 extracts feature points, which are edge points, from the profile data Pd within the X correction reference region Arx extracted in S2221 (step S2222).

[0139] Next, the height image generation unit 202 calculates a reference X position Xr based on the X positions of feature points calculated from each of the multiple profile data Pd (step S2223). For example, the average value of the X positions of multiple feature points can be used as the reference X position Xr. Alternatively, the X position of a feature point extracted from the first line of profile data Pd within the X correction reference region Arx may be used as the reference X position Xr.

[0140] Next, for each of the multiple profile data Pd, the height image generation unit 202 calculates the difference between the reference X position Xr and the X position of a feature point extracted from one of the profile data Pd (step S2224). The difference calculated here corresponds to the offset amount of one of the profile data Pd during profile alignment. The difference, which is the offset amount, is calculated in such a way as to minimize the positional misalignment between the multiple profile data Pd.

[0141] Next, the height image generation unit 202 offsets each of the multiple profile data Pd in ​​the X2 direction by the difference, which is the offset amount calculated in S2244 (step S2225).

[0142] Through the processing described in S2221 to S2225, the profiles are aligned, and non-periodic misalignments are corrected regardless of the misalignment period (vibration period) of the multiple profile data Pd.

[0143] (Relationship between correction parameters and correction content) The relationship between the correction parameters set in Figure 16 and the profile alignment will be explained below.

[0144] (X correction reference area Arx) The X-correction reference region Arx is set as a two-dimensional region extending in the Y2 direction. That is, in the X2-Y2 plane, a two-dimensional region with the Y2 direction as its longitudinal direction is set as the X-correction reference region Arx. By setting the X-correction reference region Arx extending in the Y2 direction in this way, a reference X position Xr, which is the reference for the X position, can be set along the Y2 direction. The height image generation unit 202 then arranges multiple profile data Pd generated at each position in the Y2 direction according to the reference X position Xr set along the Y2 direction. That is, the height image generation unit 202 corrects the profile data Pd to reduce the positional misalignment that occurs between profile data Pd at different positions in the Y2 direction. In the X-correction reference region Arx, the Y2 direction represents the range to which profile correction is applied, and the X2 direction represents the range for which the correction amount is calculated.

[0145] (Edge selection field 1202) The edge selection field 1202 shown in Figure 15A is a selection field for selecting an image to extract feature points, which are edge points. For example, the edge selection field 1202 may allow selection from a height image Hi and a luminance image Ii. The case of profile alignment using the luminance image Ii will be described later.

[0146] (Edge level setting field 1203) The edge level setting field 1203 shown in Figure 15A is a setting field for detecting edge points, which are feature points of the profile data Pd, that exist within the X correction reference region Arx. The height image generation unit 202 detects the points where the profile data Pd crosses the edge level set in the edge level setting field 1203 as feature points, which are edge points.

[0147] The correction setting unit 206b acquires the edge level entered in the edge level setting field 1203 and accepts the edge level setting entered in the edge level setting field 1203 as one of the correction parameters. Furthermore, when the correction setting unit 206b detects that the automatic setting button 1204 has been clicked, it outputs an instruction to the height image generation unit 202 to set the edge level. Upon receiving the instruction to set the edge level, the height image generation unit 202 automatically sets the edge level and sets that edge level in the correction setting unit 206b. As the edge level, for example, the average value of the profile data contained within the X correction reference area Arx may be used.

[0148] (Edge direction selection field 1212) The edge direction selection field 1212 shown in Figure 15B is a setting field for setting the direction of profile change when detecting edge points, which are feature points. The edge direction selection field 1212 may be a dropdown system with pre-defined options such as "both directions," "rising edge," and "falling edge." For example, when the correction setting unit 206b detects that "rising edge" has been selected in the edge direction selection field 1212, it accepts the setting of "rising edge" as one of the correction parameters for the edge direction. If 1 mm is set as the edge level in the edge level setting field 1203, and "rising edge" is set as the edge direction in the edge direction selection field 1212, the height image generation unit 202 extracts the point where the profile data crosses the reference plane, which is offset by 1 mm from the reference plane, from bottom to top, as an edge point, which is a feature point. If "falling edge" is selected as the edge direction, the height image generation unit 202 extracts the point where the profile data crosses the reference plane from top to bottom as a feature point. Furthermore, if "both directions" is selected as the edge direction, the height image generation unit 202 extracts points that cross the reference plane as feature points within the X correction reference region Arx, regardless of the direction in which the points cross the reference plane.

[0149] (Detection direction selection field 1213) The detection direction selection field 1213 shown in Figure 15B is a setting field for setting the direction in which feature points, or edge points, are detected. The detection direction selection field 1213 may be a dropdown system with pre-defined options representing directions such as "right to left (←)" and "left to right (→)". For example, when the correction setting unit 206b detects that the option to detect edges from right to left has been selected in the detection direction setting field 2045, it accepts the setting of "right to left" as the detection direction, which is one of the correction parameters. In this case, the height image generation unit 202 sequentially extracts feature points, or edge points, from the profile data Pd in ​​the direction from right to left.

[0150] Based on the correction parameters set as described above—the X correction reference area Arx, edge level, edge direction, and detection direction—the height image generation unit 202 extracts edge points, which are feature points, for each of the multiple profile data Pd. Note that it is not necessary to use all of the above correction parameters when extracting feature points. At least the X correction reference area Arx should be set as a correction parameter.

[0151] Further explanation will be provided regarding X-shift correction of profile data Pd and generation of height images for inspection.

[0152] The height image generation unit 202 extracts edge points as feature points from each of the multiple profile data Pd obtained from the profile data generation unit 201 during setup. For example, the height image generation unit 202 calculates the average of the feature points extracted for each of the profile data Pd, and this average value can be used as the reference X position Xr, which is the correction standard for the profile data. Then, during operation, the height image generation unit 202 extracts edge points, which are feature points of the profile data Pd, from each of the multiple profile data Pd obtained from the profile data generation unit 201. The height image generation unit 202 then offsets the profile data Pd in ​​the X2 direction so that the X position of the extracted feature points is the reference X position Xr. In this way, it is possible to obtain profile data Pd that has been corrected so that the X positions of the feature points are aligned on the reference X position Xr. Then, the height image generation unit 202 generates a height image for inspection by arranging the profile data Pd offset in the X2 direction in the Y2 direction and joining them together.

[0153] (How to store correction parameters) Using Figure 17, we will explain how to store the correction parameters for Z correction set in Figures 13A and 13B, and the correction parameters for X correction set in Figures 15A and 15B.

[0154] Each correction parameter is set in the correction setting unit 206b for each correction method. For Z correction, the presence or absence of Z correction selected in checkbox CB801, the Z correction reference area Arz, the mask upper limit, and the mask lower limit are set. Here, the Z correction reference area may store the coordinates of two points located on the diagonal of the Z correction reference area Arz displayed on the display unit 22, as shown in Figure 17. For X correction, the presence or absence of X correction selected in checkbox 803, the X correction reference area Arx, the edge level, the edge direction, and the detection direction are set.

[0155] In other words, the correction setting unit 206b has a hierarchical structure classified into a higher hierarchy that stores correction methods and a lower hierarchy that stores correction parameters corresponding to the correction methods. Each set correction parameter is stored in the correction setting unit 206b in a manner subordinate to the correction method, which is the higher hierarchy. By setting correction parameters in this hierarchical manner, it is easy to identify which correction method each correction parameter relates to, and correction processing can be realized efficiently.

[0156] (Method for calculating the offset amount) Based on Figure 18, the method for calculating the offset amount will be explained.

[0157] Figure 18A in Figure 18 illustrates the case where one region is specified as the correction reference region Ar. In this example, the height image is composed of eight profile data Pd21-28, which are located at different positions in the Y2 direction. Of the eight profile data Pd21-28, Pd22-26 are located in the internal region Ri within the correction reference region Ar, while three profile data Pd, Pd21, Pd27, and Pd28, are located in the external region Ro outside the correction reference region Ar.

[0158] Furthermore, it is not always possible to calculate the offset amount for all of the profile data Pd22 to Pd26 present in the internal region Ri. For example, there may be cases where the height image generation unit 202 cannot extract feature points, such as when there are no edges that exceed the edge level set as a correction parameter, and as a result, the offset amount cannot be calculated. For example, suppose the height image generation unit 202 could not calculate the offset amount for the profile data of Pd23. The method for calculating the offset amount in such cases will be explained below.

[0159] First, the offset amount of profile data Pd21 in the outer region Ro is calculated using the offset amount of profile data Pd22 in the inner region Ri. Similarly, the offset amounts of profile data Pd27 and Pd28 in the outer region Ro are calculated using the offset amount of profile data Pd26 in the inner region Ri. In other words, the offset amount of profile data Pd in ​​the outer region Ro is calculated based on the offset amount of profile data Pd in ​​the inner region Ri. For example, the offset amount of profile data Pd in ​​the outer region Ro may be calculated using the offset amount of the outermost profile data Pd in ​​the inner region Ri, or it may be calculated using the average of the offset amounts of multiple profile data Pd starting from the outside of the inner region Ri. Furthermore, the offset amount of profile data Pd in ​​the outer region Ro may be calculated to gradually decrease as it moves away from the inner region Ri.

[0160] Next, for the internal region Ri, the offset amounts for profile data Pd22, Pd24-Pd26 can be used as they are, since the offset amount has already been calculated for each profile data Pd.

[0161] Then, the offset amount of profile data Pd23, which exists in the internal region Ri but for which the offset amount calculation failed, is calculated based on the offset amounts of the preceding and succeeding profile data Pd22 and Pd24. For example, the offset amount of Pd23 may be calculated by dividing the offset amounts of Pd22 and Pd24, or the average value of the offset amounts of Pd22 and Pd24 may be calculated as the offset amount of Pd23.

[0162] Figure 18B in Figure 18 illustrates a case where a first correction reference region Ar1 and a second correction reference region Ar2 are specified as the correction reference region Ar, and where the first correction reference region Ar1 and the second correction reference region Ar2 do not overlap in the Y2 direction. Figure 18B in Figure 18 will mainly explain the differences from Figure 18A in Figure 18.

[0163] In the example of FIG. 18B in Figure 18, two non-overlapping correction reference regions Ar are specified in the Y2 direction, and an intermediate region Rm exists enclosed by an internal region Ri. The offset amounts of profile data Pd34 and Pd35 in the intermediate region Rm can be calculated based on the offset amounts of profile data Pd33 and Pd36 in the internal region Ri. For example, the offset amounts of profile data Pd34 and Pd35 in the intermediate region Rm may be calculated by dividing the offset amounts of Pd33 and Pd36, or by averaging the offset amounts of Pd33 and Pd36. That is, the offset amount of profile data Pd in ​​the intermediate region Rm that is not included in the correction reference region Ar is calculated based on the offset amount of profile data included in the first correction reference region Ar1 and the offset amount of profile data included in the second correction reference region Ar2.

[0164] Figure 18C in Figure 18 illustrates the case where a first correction reference region Ar1 and a second correction reference region Ar2 are specified as correction reference regions Ar, and these correction reference regions Ar1 and Ar2 overlap in the Y2 direction. This section will focus on the differences from Figures 18A and 18B in Figure 18.

[0165] In the example of FIG. 18C in Figure 18, two overlapping correction reference regions Ar1 and Ar2 are specified in the Y2 direction, so there is an overlapping region Rd specified by the two correction reference regions Ar1 and Ar2. The offset amount of profile data Pd43 and Pd44 in the overlapping region Rd can be calculated using the average of the offset amount calculated for profile data Pd in ​​the first correction reference region Ar1 and the offset amount calculated for profile data Pd in ​​the second correction reference region Ar2. Alternatively, the offset amount of profile data Pd in ​​the overlapping region Rd can be determined not only based on the above average value, but also based on the change from the preceding and succeeding profile data Pd. Furthermore, the height image generation unit 202 determines whether the difference between the offset amount calculated for the profile data Pd located in the first correction reference area Ar1 and the offset amount calculated for the profile data Pd located in the second correction reference area Ar2 is within a predetermined threshold. If it is determined to be within the threshold, the average value of the offset amount calculated for the profile data Pd located in the first correction reference area Ar1 and the offset amount calculated for the profile data Pd located in the second correction reference area Ar2 is used as the offset amount for the profile data Pd located in the overlapping area Rd. Alternatively, if the height image generation unit 202 determines that it is not within the threshold, the offset amount for the profile data Pd located in the overlapping area Rd can also be determined based on the change from the preceding and succeeding profile data Pd.

[0166] If a part of the object S being measured has defects such as cracks or scratches, the profile data Pd corresponding to the defects will differ from the original profile data Pd of the object S being measured. Even in such cases, the validity of each offset amount can be determined by comparing the offset amount for the profile data Pd located within the first correction reference region Ar1 calculated by the height image generation unit 202 with the offset amount for the profile data Pd located within the second correction reference region Ar1. If each offset amount is within the threshold, i.e., the offset amounts are close, the height image generation unit 202 determines that no defects have occurred in the object being measured and that both offset amounts are valid. If the respective offset amounts deviate by more than the threshold, the height image generation unit 202 determines that defects have occurred in the object being measured and that the validity of one of the offset amounts is low.

[0167] This section describes a method for determining the offset amount of profile data Pd in ​​the overlapping region Rd based on the change in the offset amount from the preceding and succeeding profile data Pd.

[0168] As an example, suppose the offset amount of profile data Pd43 calculated from the first correction reference region Ar1 is 10, and the offset amount of profile data Pd43 calculated from the second correction reference region Ar2 is 100. Also, suppose the offset amount of profile data Pd44 calculated from the first correction reference region Ar1 is 8, and the offset amount of profile data Pd44 calculated from the second correction reference region Ar2 is 150.

[0169] In this case, the offset amount of profile data Pd44 calculated from the first correction reference region Ar1 is 2 units different from the offset amount of the immediately preceding profile data Pd43 calculated from the first correction reference region Ar1. On the other hand, the offset amount of profile data Pd44 calculated from the second correction reference region Ar2 is 50 units different from the offset amount of the immediately preceding profile data Pd43 calculated from the second correction reference region Ar2. Since the change in the offset amount of the immediately preceding profile data Pd is smaller for the offset amount calculated from the first correction reference region Ar1 than for the offset amount calculated from the second correction reference region Ar2, the offset amount of 8 calculated from the first correction reference region Ar1 can be used as the offset amount of profile data Pd44.

[0170] In other words, the offset amount of one profile data Pd located in the overlapping region Rd can be determined by comparing it with the offset amounts of at least one profile data Pd before or after that one.

[0171] Specifically, the height image generation unit 202 compares the offset amount calculated from the first correction reference region Ar1 with the offset amount of one profile data Pd and the offset amounts of reference profile data Pd that exist before and after the said profile data Pd, and calculates the difference.

[0172] Furthermore, the height image generation unit 202 compares the offset amount calculated from the second correction reference region Ar2 with the offset amount of one profile data Pd and the offset amounts of reference profile data Pd that exist before and after the said profile data Pd, and calculates the difference. Then, the height image generation unit 202 compares the difference calculated from the first correction reference region Ar1 with the difference calculated from the second correction reference region Ar2, and can determine the one with the smaller difference as the offset amount of the one profile data Pd. In this way, by calculating the offset amount of profile data Pd based on the amount of change from the preceding and succeeding profile data Pd in ​​the first correction reference region Ar1 and the second correction reference region Ar2, a gradual change estimated as an oscillation component can be used as the offset amount.

[0173] (Another embodiment of X-shift correction) Up to this point, we have explained how to perform X-shift correction based on the extracted feature points, or edge points. Next, we will describe another embodiment of X-shift correction using Figures 19, 20A, and 20B.

[0174] (User interface) Figure 19 shows an example of the alignment settings screen 1000 for setting X-axis displacement correction. Here, we will explain how to perform X-axis displacement correction.

[0175] When the display control unit 205 detects that the detailed setting button 1201 shown in Figure 15A has been selected by the input unit 300, the display control unit 205 displays the X correction detailed setting area 1210 on the alignment setting screen 1000 of the display unit 400. In this X correction detailed setting area 1210, a first X correction reference area Arx1 and a second X correction reference area Arx2 can be set. In addition, corresponding to the first X correction reference area Arx1 and the second X correction reference area Arx2, an edit button 1211 for setting the X correction reference area Arx, an edge level setting field 1203 for setting the edge level, an automatic setting button 1204 for automatic setting of the edge level, an edge direction selection field 1212 for setting the edge direction, a detection direction selection field 1213 for selecting the edge detection direction, and a detection label setting field 1214 for setting the detection label may be displayed. Furthermore, the second X-correction reference region, Arx2, may be selected for use in X-shift correction depending on the selection status of checkbox CB804.

[0176] (Correction setting procedure and generation of height image for inspection) The method for generating inspection height images based on the alignment settings set on the alignment setting screen 1000 will be explained according to the flowcharts in Figures 20A and 20B.

[0177] Figure 20A shows the alignment setting procedure for X-axis misalignment. This section will focus on explaining the differences from the flowchart shown in Figure 14A.

[0178] In step S2606, the display control unit 205 detects the user's operation of the input unit 300 and displays a first X correction reference area Arx1 and a second X correction reference area Arx2 extending in the Y2 direction on the display unit 400.

[0179] Next, in step S2607, the correction setting unit 206b obtains from the display control unit 205 the first X correction reference region Arx1 and the second X correction reference region Arx2, which extend in the Y2 direction and were set in S2606.

[0180] Furthermore, in step S2608, the correction setting unit 206b accepts the user's setting of correction parameters. The correction parameters set here further include the X correction reference region Arx, which consists of a first X correction reference region Arx1 and a second Z correction reference region Arx2.

[0181] Next, a height image for inspection is generated using the same procedure as in Figure 14B.

[0182] Next, following the flowchart in Figure 20B, we will explain the profile alignment shown in S2014 of Figure 14B.

[0183] First, the height image generation unit 202 identifies the profile data Pd that exists within the first X correction reference region Arx1 and the second X correction reference region Arx2 for each of the multiple profile data Pd acquired from the profile data generation unit 201 (step S2621).

[0184] Next, the height image generation unit 202 extracts an edge point, which is the first feature point, from the profile data Pd within the first X correction reference region Arx1 identified in S2621, for each of the multiple profile data Pd (step S2622). This edge point, which is the first feature point, is the first auxiliary feature point for calculating the feature point.

[0185] Next, the height image generation unit 202 extracts edge points, which are second feature points, from the profile data Pd within the second X correction reference region Arx2 identified in S2621 for each of the multiple profile data Pd (step S2623). These edge points, which are second feature points, are second auxiliary feature points for calculating feature points.

[0186] Next, the height image generation unit 202 calculates feature points for each of the multiple profile data Pd based on the first feature point, which is an auxiliary feature point extracted in S2622, and the second feature point, which is an auxiliary feature point extracted in S2623 (step S2624). In calculating the feature points, for example, the average value of the first feature point and the second feature point may be used, or a weighted average value may be used.

[0187] Next, the height image generation unit 202 calculates a reference X position Xr based on the X positions of feature points calculated from each of the multiple profile data Pd (step S2625). For example, the average value of the X positions of multiple feature points can be used as the reference X position Xr. Alternatively, the X position of a feature point extracted from the first line of profile data Pd within the X correction reference region Arx may be used as the reference X position Xr.

[0188] Next, the height image generation unit 202 calculates the difference between the reference X position Xr and the X position of a feature point extracted from one of the profile data for each of the multiple profile data Pd (step S2626). The difference calculated here corresponds to the offset amount of one of the profile data Pd during profile alignment.

[0189] Next, the height image generation unit 202 offsets each of the multiple profile data Pd in ​​the X2 direction by the offset amount calculated in S2626 (step S2627).

[0190] Through the processing described in S2621 to S2627, the profile data is aligned. In this way, by calculating feature points based on multiple auxiliary feature points, even points that do not exist on a single profile data can be treated as feature points. Therefore, vibration components generated in the profile data Pd can be corrected regardless of the shape of the object being measured.

[0191] 3. Tilt correction (Overview of tilt correction) Figures 21A and 21B in Figure 21 illustrate tilt correction. Figures 21A in Figure 21 show Pd61, Pd62, Pd63, Pd64, and Pd65, which represent multiple profile data Pd with different positions in the Y2 direction, generated by the profile data generation unit 201. The direction of movement of the object S being measured is indicated by a dotted arrow.

[0192] If the object S being measured is transported on the belt conveyor C without vibration, the slopes of each profile data Pd61 to Pd65 will be constant. However, if the slope of profile data Pd61 is taken as the correction reference angle θr, then profiles Pd62 and Pd65 have a positive slope with respect to the correction reference angle θr. Also, profiles Pd63 and Pd64 have a negative slope with respect to the correction reference angle θr. Note that a counterclockwise rotation from the correction reference angle θr is referred to as a positive slope, and a clockwise rotation as a negative slope, but this is for illustrative purposes only and is not limited to these two cases.

[0193] Thus, the object being measured, S, vibrates in the rotational direction with the direction of movement as the axis of rotation. As a result, rotational vibration occurs in each profile data Pd, and the inclination is not constant.

[0194] Therefore, the height image generation unit 202 calculates the correction reference angle θr and the tilt deviation amount Diθ, which is the difference between the actual tilt and the correction reference angle θr, for each of the profile data Pd. Then, according to the calculated tilt deviation amount Diθ, the profile data is offset in the rotational direction. In this way, as shown in FIG.21B of Figure 21, multiple profile data Pd with different positions in the Y2 direction are aligned so that their tilts are equal in the Y2 direction.

[0195] The height image generation unit 202 generates a height image Hi showing the three-dimensional shape of the object S by arranging the profile data Pd, which is offset in the rotational direction, in the Y2 direction.

[0196] The alignment of the profile data Pd shown in this embodiment focuses on each individual profile data Pd. Each profile data Pd is defined within the X2-Z2 plane. Therefore, if the correction reference angle θr within the X2-Z2 plane and the inclination of each profile data Pd are known, the height image generation unit 202 can correct the inclination of each profile data Pd to the correction reference angle θr. Furthermore, this process offsets each profile data Pd in ​​the rotational direction.

[0197] The following section will provide a detailed explanation of tilt correction, including examples from the user interface.

[0198] (User interface for tilt correction settings) Figure 22A illustrates the user interface of the alignment setting screen 1000 displayed on the display unit 400. This alignment setting screen 1000 allows users to set the tilt alignment. This explanation will focus on the differences from Figure 13A.

[0199] The pre-alignment image 1002a is superimposed with the tilt correction reference area Arθ. In addition, the parameter setting area 1010 displays the tilt correction setting area 1300 where the tilt correction settings are made.

[0200] The tilt correction setting area 1300 displays a checkbox CB805 to toggle whether or not to perform tilt correction, an advanced setting button 1301 for making detailed settings for tilt correction, a correction standard selection field 1302 for selecting a correction standard, and a correction standard angle setting field 1303 for setting the correction standard angle.

[0201] The correction criterion selection field 1302 may be a dropdown system with pre-defined options for "specified angle" and "follow the first line." "Specified angle" means that the correction setting unit 206b detects the angle entered in the correction criterion angle setting field 1303 and sets that angle as the correction criterion angle θr. "Follow the first line" means that the height image generation unit 202 identifies the tilt of the first line profile detected within the tilt correction criterion area and sets that tilt as the correction criterion angle θr.

[0202] Furthermore, when the display control unit 205 detects that the detailed setting button 1301 has been selected by the input unit 300, the display control unit 205 displays the tilt correction detailed setting area 1310 on the alignment setting screen 1000 of the display unit 400.

[0203] Figure 22B shows an example of the tilt correction detailed setting area 1310. This tilt correction detailed setting area 1310 displays a correction mode selection field 1311 for selecting a tilt correction mode, a tilt correction reference area selection field 1312 for selecting the shape of the tilt correction reference area Arθ, which is the correction reference area Ar, an edit button 1313 for editing the tilt correction reference area Arθ, a calculation criterion selection field 1314 for selecting the calculation criterion for feature points, a moving average setting field 1315 for setting the moving average in the X2 direction, a correction criterion selection field 1302 for selecting a correction criterion, and a correction criterion angle setting field 1303 for setting the correction criterion angle. Note that it may be possible to set a first tilt correction reference area Arθ1 and a second tilt correction reference area Arθ2 as the tilt correction reference area Arθ.

[0204] When the correction setting unit 206b detects that the detailed setting button 1301 has been clicked, it accepts the settings for correction parameters, including the correction mode, the tilt correction reference area Arθ, the feature point calculation criterion, the moving average, and the correction criterion.

[0205] (Correction setting procedure and generation of height image for inspection) Figures 23A and 23B are flowcharts showing the profile alignment procedure for tilt correction. Figure 23A shows the profile alignment procedure when "Specified angle" is selected in the correction criterion selection field 1302, and Figure 23B shows the profile alignment procedure when "Follow the first line" is selected in the correction criterion selection field 1302. Note that the alignment settings are the same as in Figure 14A, and the generation of the height image for inspection is the same as in Figure 14B, so they are omitted here.

[0206] First, we will explain the case where profile data Pd is aligned to the correction reference angle θr set in the correction reference angle setting field 1303, following the flowchart in Figure 23A.

[0207] The height image generation unit 202 obtains the correction reference angle θr from the correction setting unit 206b (step S2901A).

[0208] Next, the height image generation unit 202 identifies the profile data Pd that exists within the tilt correction reference region Arθ for each of the multiple profile data Pd acquired from the profile data generation unit 201 (step S2902A).

[0209] Next, for each of the multiple profile data Pd, the height image generation unit 202 calculates the respective tilt value of the profile data Pd within the tilt correction reference region Arθ identified in S2902A (step S2903A).

[0210] Next, for each of the multiple profile data Pd, the height image generation unit 202 calculates the difference between the slope value of the profile data Pd and the correction reference angle θr obtained in S2901A as the slope correction amount Diθ (step S2904A).

[0211] Next, for each of the multiple profile data Pd, the height image generation unit 202 offsets the profile data Pd in ​​the rotational direction by a tilt correction amount Diθ so that the tilt of one profile data Pd becomes the correction reference angle θr (step S2905A).

[0212] Through the processing described in S2901A to S2905A, the profile data Pd is offset in the rotational direction, thereby aligning the tilt deviation in the rotational direction.

[0213] Next, we will explain the case where each of the profile data Pd's slopes is aligned to the slope of the first line within the slope correction reference region Arθ, following the flowchart in Figure 23B.

[0214] The height image generation unit 202 identifies the profile data that exists within the tilt correction reference region Arθ for each of the multiple profile data Pd acquired from the profile data generation unit 201 (step S2901B).

[0215] Next, the height image generation unit 202 identifies the first line of profile data Pd located within the tilt correction reference region Arθ and calculates the tilt value of the profile data Pd (step S2902B). Then, the height image generation unit 202 sets the tilt value acquired in S2902B as the correction reference angle θr in the correction setting unit 206b (step S2903B).

[0216] Next, for each of the multiple profile data Pd, the height image generation unit 202 calculates the tilt value of the profile data Pd within the tilt correction reference region Arθ extracted in S2901B (step S2904B).

[0217] Next, for each of the multiple profile data Pd, the height image generation unit 202 calculates the difference between the slope value of one profile data Pd and the correction reference angle θr obtained in S2903B as the slope correction amount Diθ (step S2905B).

[0218] Next, for each of the multiple profile data Pd, the height image generation unit 202 offsets the profile data Pd in ​​the rotational direction by a tilt correction amount Diθ so that the tilt of one profile data Pd becomes the correction reference angle θr (step S2906B).

[0219] Through the processing described in S2901B to S2906B, the profile data Pd is offset in the rotational direction, and the tilt deviation in the rotational direction is aligned.

[0220] Thus, when aligning the tilt of each profile data Pd to the tilt of the first line within the tilt correction reference region Arθ, the correction reference angle θr differs for each object being measured. In such cases, the height image generation unit 202 can dynamically change the correction reference angle θr for each object being measured S according to the tilt of one of the profile data Pd of the object being measured S.

[0221] (Offset in the direction of rotation) This section describes the rotational offset of profile data Pd. For the sake of explanation, the correction reference angle θr is assumed to be set to 0 degrees. That is, each profile data Pd is assumed to be aligned in such a way that the tilt that has occurred in each profile data Pd is removed.

[0222] The case where "High Speed" is selected in the correction mode selection field 1311 of Figure 22B is explained below. In this case, in order to achieve high-speed offset processing of the profile data Pd, the height image generation unit 202 corrects the position in the Z2 direction without correcting the position in the X2 direction of each profile data Pd. That is, the height image generation unit 202 obtains the corrected profile data by projecting the position in the Z2 direction of the pre-correction profile data, which has been rotated by Diθ in the positive direction from the correction reference angle θr, onto a straight line having an inclination of the correction reference angle θr. This correction of the inclination deviation by projecting the position in the Z2 direction onto a straight line of the correction reference angle θr is called offset in the rotation direction in high-speed mode.

[0223] Next, we will explain the case where "High Precision" is selected in the correction mode selection field 1311 in Figure 22B. In this case, in order to achieve high precision in offsetting the profile data Pd, each point in the profile data Pdb is rotated according to the tilt correction amount Diθ. That is, the corrected profile data is obtained by rotating the position of each point in the pre-correction profile data, which has been rotated in the positive direction by Diθ from the correction reference angle θr, in the negative direction by Diθ. This process of rotating the profile according to the tilt correction amount Diθ to correct the tilt deviation is called the offset in the rotational direction in high precision mode.

[0224] 4. Variations (Estimation of feature points) Here, as an example, we will explain a method for estimating feature points from profile data Pd obtained by imaging an object S having a V-shaped groove using the imaging head 100. As explained in the Z-shift correction and X-shift correction sections, the correction setting unit 206b accepts the setting of a correction reference region Ar that includes the V-shaped groove portion, and the height image generation unit 202 can extract the bottom point within the correction reference region Ar as a feature point.

[0225] However, there are cases where it is difficult for the imaging head 100 to measure the groove portion, such as when the V-shaped groove portion is welded or soldered. Even in such cases, by using the feature point estimation function described in this embodiment, the height image generation unit 202 can offset the profile data Pd so that the V-shaped groove portion is aligned in a straight line in the Y2 direction.

[0226] First, let's explain the alignment settings. The correction setting unit 206b accepts the settings for a first correction reference region Ar1 extending in the Y2 direction and a second correction reference region Ar2 extending in the Y2 direction, as correction reference regions Ar, on the height image Hi displayed on the display unit 400. Furthermore, the correction setting unit 206b accepts the setting of the feature point extraction method. As a feature point extraction method, the correction setting unit 206b can accept, for example, the selection of the intersection of two lines or the intersection of a circle and a line. Below, we will explain the case where the correction setting unit 206b extracts the intersection of two lines as a feature point.

[0227] Next, the estimation of feature points will be explained. For each of the profile data Pd generated by the profile data generation unit 201, the height image generation unit 202 identifies the profile data Pd in ​​the first correction reference region Ar1 and the profile data Pd in ​​the second correction reference region Ar2. The height image generation unit 202 then calculates an approximate curve for the profile data Pd present in the first correction reference region Ar1 using a known approximation method such as the least squares method. Similarly, the height image generation unit 202 calculates an approximate straight line for the profile data Pd present in the second correction reference region Ar2. Furthermore, the height image generation unit 202 calculates the intersection point of the approximate straight line calculated from the first correction reference region Ar1 and the approximate straight line calculated from the second correction reference region Ar2, and designates this intersection point as a feature point.

[0228] For each of the multiple profile data Pd with different positions in the Y2 direction, the height image generation unit 202 applies Z-shift correction and X-shift correction to the calculated feature points. That is, the height image generation unit 202 calculates at least one of a reference Z height Zr and a reference X position Xr from the multiple feature points, and offsets the profile data Pd according to at least one of the Z position shift amount, which is the difference between the feature points of the profile data Pd and the reference Z height Zr, and the X position shift amount, which is the difference between the feature points of the profile data Pd and the reference X position Xr. As a result, position shifts in at least one of the Z2 direction and the X2 direction are removed, and profile data Pd with feature points aligned in a line in the Y2 direction is obtained.

[0229] (Eccentricity correction) When the object S being measured is rotating on a turntable, eccentricity occurs in each profile data Pd. The alignment of the profile data Pd described above can correct this eccentricity.

[0230] If the object to be measured S is placed on the turntable with a misalignment between its center and the rotation center of the turntable, the object to be measured S will appear to vibrate in the X2 direction relative to the imaging head 100 as the turntable rotates. Therefore, even if the height image generation unit 202 connects the profile data Pd generated by the profile data generation unit 201 in the Y2 direction, the profile data Pd will not be aligned in a straight line in the Y2 direction. In such applications, the above-mentioned Z-shift correction and X-shift correction can still be applied.

[0231] Similar to the Z-shift and X-shift corrections described above, the correction setting unit 206b accepts the setting of the correction reference region Ar, which extends in the Y2 direction, on the height image displayed on the display unit 400. The correction parameters are the same as those for the Z-shift and X-shift corrections, so they are omitted here.

[0232] Next, the height image generation unit 202 calculates feature points from the profile data Pd within the correction reference region Ar extending in the Y2 direction, according to the preset correction parameters.

[0233] The height image generation unit 202 then applies Z-shift correction and X-shift correction to the feature points calculated for each of the multiple profile data Pd, each with a different position in the Y2 direction. That is, the height image generation unit 202 calculates at least one of a reference Z height Zr and a reference X position Xr from the multiple feature points. Then, according to at least one of the Z position shift amount, which is the difference between the Z height of a feature point in one of the profile data Pd and the reference Z height Zr, and the X position shift amount, which is the difference between the X position of a feature point in one of the profile data Pd and the reference X position Xr, the height image generation unit 202 offsets the profile data Pd. This corrects the position shift in at least one of the Z2 direction and the X2 direction.

[0234] (Template fitting) Next, we will explain how to align each profile data Pd with a pre-registered template.

[0235] As an example, suppose the object to be measured, S, has an outer edge formed by a combination of arcs and straight lines. In this case, even if the profile data Pd is offset so that the Z height of the feature points extracted from each profile data Pd becomes the reference Z height Zr, or the X position of the feature points becomes the reference X position Xr, it is difficult to obtain height image data Hi that accurately represents the shape of the object to be measured, S.

[0236] Therefore, the correction setting unit 206b accepts the setting of correction criteria based on a pre-registered template. Then, the height image generation unit 202 offsets the profile data Pd so that the feature points extracted from the profile data Pd become the correction criteria set based on the template. In this way, even if the feature points of the object to be measured S are not aligned in a straight line, the height image generation unit 202 can generate a height image Hi from which the vibration and positional displacement of the object to be measured S have been removed.

[0237] (Template fitting correction settings) In this embodiment, when aligning the profile, the correction setting unit 206b accepts the registration of a template in advance as a correction standard. The method for registering a template will be described below.

[0238] (Template registration using height image) For template registration, for example, the height image Hi generated during setup by the height image generation unit is used. This case will be explained according to the flowchart in Figure 24A. Note that this explanation will focus on the differences from the flowchart in Figure 14A.

[0239] In step S3506, the display control unit 205 detects the user's operation of the input unit 300 and displays a correction reference area Ar extending in the Y2 direction on the display unit 400, and sets the correction reference area Ar set by the user in the correction setting unit 206b. Note that displaying the correction reference area Ar on the display unit 400 is not mandatory. For example, two coordinate inputs may be accepted, and a correction reference area Ar may be set with the accepted coordinates as the diagonals of a rectangle.

[0240] Next, in step S3507, the height image generation unit 202 identifies the profile data Pd included within the correction reference region Ar set in the setting unit, and extracts feature points for each of the multiple profile data Pd.

[0241] Then, in step S3508, the height image generation unit 202 sets each of the feature points extracted by the height image generation unit 202 in S3507 as an ideal feature point, which is the correction criterion, in the correction setting unit 206b. The height image generation unit 202 may also set the ideal feature point, which is the correction criterion, in association with the position of the profile data Pd from which the feature points were extracted. That is, for each of a plurality of profile data Pd with different positions in the Y2 direction, the height image generation unit 202 may set the X position / Z height of the ideal feature point of one profile data Pd in ​​association with the X position / Z height of the ideal feature point of that profile data Pd in ​​association with the Y position of one profile data Pd. The Y position of the profile data Pd may be stored as a line number indicating which profile data Pd it is, from the profile data generation unit 201.

[0242] The alignment setup is completed by the processes S3501 to S3508 described above. Note that during the alignment setup, the object to be measured S may be precisely positioned using a jig or the like to prevent vibration from being applied to it.

[0243] (Template registration using CAD models) The flowchart in Figure 24A shows the procedure for registering a template using height image data Hi of the object S that was actually measured. However, templates can also be registered using a CAD model. An example of this is described below.

[0244] The display control unit 205 displays a CAD model selected by the operation of the input unit 300 on the display unit 400. Processing S3506 to S3508 in Figure 24A is executed on the CAD model displayed on the display unit 400. That is, the height image generation unit 202 extracts feature points from the CAD model. The height image generation unit 202 can then set each of the extracted feature points as an ideal feature point, which is the correction standard, in the correction setting unit 206b.

[0245] The above explanation mainly described the case where profile data Pd is aligned based on the X position of edge points extracted as feature points from height image Hi or CAD data. However, the height image generation unit 202 may also align profile data Pd based on the Z height instead of the X position of the feature points, or in addition to the X position of the feature points.

[0246] The case in which the height image generation unit 202 offsets the profile data Pd based on the Z height of the feature points will be explained. In S3507 of Figure 24A, the height image generation unit 202 identifies the profile data Pd included within the correction reference region Ar. The height image generation unit 202 then extracts feature points for each of the multiple profile data Pd according to the correction parameters set in advance. Then, in S3508, the height image generation unit 202 sets each of the Z heights of the feature points extracted in S3507 as a correction reference in the correction setting unit 206b.

[0247] Next, a height image for inspection is generated according to the flowchart in Figure 14B.

[0248] Next, following the flowchart in Figure 24B, we will explain the profile alignment shown in S2014 of Figure 14B.

[0249] First, the height image generation unit 202 identifies the profile data Pd that exists within the correction reference region Ar for each of the multiple profile data Pd acquired from the profile data generation unit 201 (step S3521).

[0250] Next, the height image generation unit 202 extracts feature points from the profile data Pd within the correction reference region Ar extracted in S3521 for each of the multiple profile data Pd, and calculates at least one of the X position and Z height of the feature point (step S3522).

[0251] Subsequently, for each of the plurality of profile data Pd, the height image generation unit 202 calculates the difference between the X position / Z height of the feature points calculated from one profile data Pd and the ideal feature points that are the correction reference corresponding to the one profile data Pd (step S3523). The height image generation unit 202 may identify the ideal feature points that are the correction reference corresponding to one profile data Pd based on the line number of the profile data Pd at the time of setting and the line number of the profile data Pd at the time of operation. That is, for the profile data Pd obtained first during operation, the height image generation unit 202 can use the correction reference with a line number of 1 stored in the correction setting unit 206b.

[0252] Then, the height image generation unit 202 offsets each of the plurality of profile data Pd by the offset amount calculated in S3523 in at least one of the X2 direction and the Z2 direction (step S3524).

[0253] (Correction amount memory function) In the above description, for each of the profile data Pd during operation, the difference between the feature points of the profile data Pd and the reference X position Xr, the reference Z height Zr, and the correction reference is calculated, and the case where the profile data Pd is offset according to the calculated difference is described. Here, the case where each of the profile data Pd is corrected by a predetermined offset amount when the offset amount (correction amount) is determined in advance is described.

[0254] When a robot connected to a control device such as a robot controller or a PLC grips the measurement object S and transports the measurement object S, or when the robot grips the imaging head 100 and moves the measurement object S, there may be reproducibility in the vibration components added to each of the individual profile data Pd. In such a case, by using the correction amount memory function, the height image generation unit 202 can realize the alignment process of the profile data Pd at high speed.

[0255] <00...The height image generation unit 202 pre-calculates an offset amount (correction amount) for each of the multiple profile data Pd. The height image generation unit 202 can then apply the pre-calculated offset amount as the offset amount for the profile data Pd during operation.

[0256] The method for setting the profile alignment will be explained according to the flowchart in Figure 25A. Steps S3601 to S3607 are the same as steps S2001 to S2007 in Figure 14A and will therefore be omitted.

[0257] The height image generation unit 202 identifies the profile data Pd included within the correction reference region Ar set in S3607 (step S3608).

[0258] Then, the height image generation unit 202 extracts feature points of the profile data Pd within the correction reference region Ar identified in S3608 for each of the multiple profile data Pd with different positions in the Y2 direction (step S3609).

[0259] Next, the height image generation unit 202 calculates a correction criterion from the multiple feature points extracted in S3609 (step S3610). For calculating the correction criterion, methods such as averaging the multiple feature points or the least squares method may be used.

[0260] Next, for each of the multiple profile data Pd with different positions in the Y2 direction, the height image generation unit 202 calculates the difference between the feature points extracted in S3609 and the correction criterion calculated in S3610 as an offset amount (step S3611).

[0261] Then, for each of the multiple profile data Pd with different positions in the Y2 direction, the height image generation unit 202 stores the offset amount calculated in S3611 in the correction setting unit 206b, corresponding to the position of the profile data Pd in ​​the Y2 direction (step S3612). The position of the profile data Pd in ​​the Y2 direction may also be stored as a line number indicating which profile data Pd was generated by the profile data generation unit 201.

[0262] Next, a height image for inspection is generated according to the flowchart in Figure 14B.

[0263] Next, following the flowchart in Figure 25B, we will explain the alignment method for the profile shown in S2014 of Figure 14B.

[0264] First, the height image generation unit 202 identifies a profile data Pd obtained from the profile data generation unit 201 that exists within the correction reference region Ar (step S3631).

[0265] Next, the height image generation unit 202 identifies the position in the Y2 direction of the profile data Pd within the correction reference region Ar extracted in S3631 (step S3632). The height image generation unit 202 may also identify the position in the Y2 direction of the profile data Pd using the line number of the profile data Pd at the time of setup and the line number of the profile data Pd during operation.

[0266] Next, the height image generation unit 202 obtains the offset amount corresponding to the Y2 direction position identified in S3632 from the correction setting unit 206b (step S3633). When the height image generation unit 202 identifies the Y2 direction position of the profile data Pd by line number, the offset amount of the first profile data Pd obtained during operation can be the offset amount of the profile data Pd with line number 1 stored in the correction setting unit 206b.

[0267] Then, the height image generation unit 202 offsets one profile data Pd by the offset amount obtained in S3633 (step S3634).

[0268] The height image generation unit 202 then determines whether the next profile data Pd exists within the correction reference region Ar (step S3635). If it does, it repeats the process from S3631 to S3634. If the next profile data does not exist, that is, if the offset of all profile data Pd within the correction reference region Ar has been completed, the profile alignment is terminated.

[0269] The profile is aligned through the processes described in S3631 to S3635 above.

[0270] (Tilt maintenance function) In the above explanation, the calculation of the reference X position Xr and reference Z height Zr mainly focused on the case where the average value of multiple feature points is used, but this embodiment is not limited to this. As an example, the case in which the object to be measured S is scanned at an angle with respect to the imaging head 100 will be explained using Figure 26. Furthermore, the height image generation unit 202 is assumed to extract edge points as feature points. In this case, the X position of the edge points extracted as feature points by the height image generation unit 202 changes to the positive direction of the X2 direction as the object to be measured S is scanned in the positive direction of the Y2 direction.

[0271] (Tilt maintenance function in X-axis displacement correction) The height image generation unit 202 extracts edge points as feature points from multiple profile data Pd within the correction reference region Ar. Then, the height image generation unit 202 calculates an approximate straight line of edge points from the extracted multiple edge points using a known approximation method such as the least squares method. By using the calculated approximate curve as the reference X position Xr, the height image generation unit 202 can perform profile alignment while maintaining the inclination of the object S being measured. In this case, the edge points are aligned along the straight line Lθ shown in Figure 26.

[0272] It is also possible to perform profile alignment without using the tilt maintenance function. In this case, a straight line with a tilt of 0 in the Y2 direction may be calculated from the plurality of extracted edge points. In this case, a straight line L0 with a tilt of 0 in the Y2 direction can be used as the reference X position Xr.

[0273] (Tilt maintenance function in Z deviation correction) The height image generation unit 202 extracts feature points based on the height type set in advance as a correction parameter from the plurality of profile data Pd in the correction reference region Ar. Here, "bottom" is selected as one of the correction parameters, and the height image generation unit 202 extracts the bottom point as the feature point. The height image generation unit 202 calculates an approximate straight line of the bottom points by a known approximation method such as the least squares method from the plurality of extracted feature points. By using the approximate curve calculated here as the reference Z height Zr, profile alignment can be performed while maintaining the tilt of the measurement object S.

[0274] It is also possible to perform profile alignment without using the tilt maintenance function. In this case, a straight line with a tilt of 0 in the Y2 direction may be calculated from the plurality of extracted bottom points. The straight line with a tilt of 0 in the Y2 direction calculated here can be used as the reference Z height Zr.

[0275] (Abnormal point removal function) In the above description, the differences between the reference X position Xr, the reference Z height Zr, and the feature points are used as the offset amounts, but the present embodiment is not limited to this. As an example, when the offset amount calculated by the height image generation unit 202 for a certain feature point deviates from a predetermined threshold value, the height image generation unit 202 may regard the certain feature point as an abnormal point and interpolate the offset amount from the offset amounts of the preceding and succeeding feature points.

[0276] To implement the anomaly removal function, for example, a threshold value for determining whether or not a point is an anomaly may be pre-set in the correction setting unit 206b as a correction parameter. In the case of X-shift correction, this threshold value is the threshold value in the X2 direction, and in the case of Z-shift correction, this threshold value is the threshold value in the Z2 direction. When both X-shift correction and Z-shift correction are performed, both the threshold value in the X2 direction and the threshold value in the Z2 direction may be set.

[0277] When the height image generation unit 202 detects that a threshold has been set in the correction setting unit 206b, it determines whether the offset amount calculated for a feature point deviates by more than the threshold set in the correction setting unit 206b. If the height image generation unit 202 detects a deviation exceeding the threshold, it interpolates the offset amount of the feature point based on the offset amounts of the feature points before and after that feature point. In this case, the height image generation unit 202 can calculate an interpolated offset amount based on the offset amounts of one feature point before and one feature point after that feature point. Furthermore, the height image generation unit 202 can calculate an interpolated offset amount using mathematical methods such as averaging, internal division, or external division of the offset amounts of multiple feature points.

[0278] Furthermore, if there are multiple feature points with offset amounts exceeding a threshold and they form a cluster, the height image generation unit 202 may offset the profile data Pd based on the offset amounts exceeding the threshold, without considering the feature points included in the cluster as abnormal points.

[0279] Furthermore, a threshold for the rotational direction may be set as one of the above thresholds. In this case, the amount of correction for the tilt correction described above can be limited.

[0280] (Reference surface estimation) In the above description, the reference X position Xr and reference Z height Zr were calculated from a correction reference region Ar set on the height image, but this embodiment is not limited to this. As an example, a case in which the object to be measured S moves on a reference surface RS on which a regular three-dimensional pattern is provided will be described. In this case, at least one of the reference X position Xr and reference Z height Zr may be calculated based on the regularity of the three-dimensional pattern.

[0281] Figure 27A in Figure 27 shows a reference surface RS with a regular three-dimensional pattern, viewed from the X2 direction. The reference surface RS is formed by repeating units Ru aligned in the Y2 direction.

[0282] Figure 27B in Figure 27 shows the object to be measured S moving in direction A on the reference plane RS. The object to be measured S is not moving on repeating units Ru1 and Ru2, and is moving behind repeating unit Ru3. The direction of movement of the object to be measured is the positive direction of Y2, as indicated by arrow A.

[0283] The height image generation unit 202 detects a reference plane RS having regularity in the repeating unit Ru based on multiple profile data of the reference plane RS. The height image generation unit 202 then sets the height Rh of the reference plane RS as the reference height Zr in the correction setting unit 206b. Subsequently, the height image generation unit 202 offsets the profile data Pd in ​​the Z2 direction based on the offset amount, which is the difference between the Z height of a feature point extracted from one profile data and the reference Z height. The height image generation unit 202 then arranges the profile data Pd offset in the Z direction in the Y2 direction to obtain a height image Hi that shows the shape of the object to be measured S.

[0284] (Combination of multiple corrections) The above description mainly focused on cases where the profile data Pd is offset with respect to the Z2 direction and cases where the profile data Pd is offset with respect to the X2 direction, but this embodiment is not limited to these. The height image generation unit 202 may offset the profile data Pd with respect to the Z2 direction and the X2 direction, and may also offset the profile data Pd in ​​the rotation direction.

[0285] Thus, when offsetting profile data Pd in ​​multiple directions, the correction reference region Ar2 in the second direction can follow the correction reference calculated from the correction reference region Ar1 in the first direction. That is, the correction reference region Ar1 in the first direction is set in a fixed coordinate system with respect to the height image Hi, while the correction reference region Ar2 in the second direction can be set in a relative coordinate system with respect to the object being measured.

[0286] The upper part of Figure 28 shows the case where X-shift correction and Z-shift correction are applied sequentially to the height image before alignment. Furthermore, the correction reference region Ar1 in the first direction corresponds to the X-correction reference region Arx, and the correction reference region Ar2 in the second direction corresponds to the Z-correction reference region Arz. That is, the height image generation unit 202 obtains the X-correction reference region Arx from the correction setting unit 206b and extracts edge points, which are feature points, from the height image before alignment. From these extracted feature points, the height image generation unit 202 calculates the reference X position Xr. Then, the height image generation unit 202 offsets the profile data Pd in ​​the X2 direction so that the X positions of the feature points are aligned in a straight line in the Y2 direction and generates an X-corrected height image.

[0287] Next, the height image generation unit 202 obtains the Z correction reference region Arz from the correction setting unit 206b and extracts feature points from the X-corrected height image in which the profile data Pd has been offset in the X2 direction. The feature points here are extracted according to pre-set correction parameters such as peak points and bottom points. Then, the height image generation unit 202 calculates the Z correction reference Zr from these extracted feature points. After that, the height image generation unit 202 offsets the profile data Pd in ​​the Z2 direction so that the Z heights of the feature points are aligned in a straight line in the Y2 direction and generates a height image for inspection.

[0288] The middle section of Figure 28 shows the case where the object to be measured S is positioned differently in the X2 direction than in the case shown in the upper section of Figure 28, and is captured by the imaging head 100.

[0289] In this case, the X-correction reference region Arx is set in a fixed coordinate system with respect to the height image Hi, but it is set over a relatively wide area with respect to the object S being measured. Therefore, the height image generation unit 202 can perform the extraction of feature points which are edge points, the offset of profile data in the X2 direction based on the edge points, and the generation of the X-corrected height image in the same way as shown in the upper part of Figure 28.

[0290] On the other hand, the Z-correction reference region Arz is also set in a fixed coordinate system relative to the height image Hi. In this case, as shown in the height image Hi22 in the middle of Figure 28, the relative position of the Z-correction reference region Arz with respect to the object S changes due to the change in the position of the object S, and moves away from the object S. As a result, the height image generation unit 202 extracts incorrect feature points from the Z-correction reference region Arz. Then, as shown in the height image Hi23 in the middle of Figure 28, the height image generation unit 202 generates a height image with a position shift in the Z2 direction remaining. Note that here, for explanatory purposes, we have illustrated the case where the Z-correction reference region Arz is away from the object, but at least if there is a change from the case shown in the upper part of Figure 28, incorrect feature points may be extracted.

[0291] Thus, to prevent the generation of height images with positional misalignment, the Z-correction reference region Arz, which is the correction reference region Ar in the second direction, can be made to follow the X-correction reference region Arx, which is the correction reference region Ar1 in the first direction. In other words, the correction reference region Ar2 in the second direction can be set in a relative coordinate system with respect to the object being measured S. The case where the correction reference region Ar2 in the second direction is set in a relative coordinate system with respect to the object being measured S is shown in the lower part of Figure 28.

[0292] The lower part of Figure 28 shows the object S being measured, which has undergone a positional change in the X2 direction, similar to the middle part of Figure 28. As in the case of the middle part of Figure 28, the height image generation unit 202 extracts feature points which are edge points, calculates a reference X position Xr based on the edge points, offsets the profile data in the X2 direction, and generates an X-corrected height image.

[0293] Next, the height image generation unit 202 sets the Z correction reference region Arz, which is the correction reference region Ar2 in the second direction, following the reference X position Xr. That is, at the time of setting, the correction setting unit 206b accepts the setting of the Z correction reference region Arz in a relative coordinate system with respect to the object to be measured S. In the case of the lower part of Figure 28, the correction setting unit 206b can accept a range from +rx1 to +rx2 with respect to the reference X position Xr as the range of the Z correction reference region Arz in the X2 direction. Alternatively, the correction setting unit 206b can accept the setting of the Z correction reference region Arz as a relative position to the object to be measured S, based on the position of the object to be measured S included in the X-corrected height image. As a result, even if the position of the object to be measured S in the X2 direction changes and is captured by the imaging head 100, the relative position of the Z correction reference region Arz with respect to the object to be measured S is kept constant. As a result, the height image generation unit 202 can align the profile data Pd more accurately.

[0294] The alignment result when the correction reference region Arz in the second direction is set to follow the correction reference calculated from the correction reference region Ar1 in the first direction or the object S being measured is shown in the lower height image Hi33 of Figure 28. Similar to the upper height image Hi13 of Figure 28, the positional misalignment in the X2 and Z2 directions has been removed in the lower height image Hi33 of Figure 28.

[0295] In the above explanation, X-shift correction was applied first, followed by Z-shift correction. However, the height image generation unit 202 can also combine rotation correction or change the alignment order to perform alignment of the profile data Pd. Alternatively, the alignment order may be changed, and Z-shift correction may be applied first, followed by X-shift correction.

[0296] For example, when a cylindrical cable with the same shape extending in a certain direction is used as the object to be measured, Z-shift correction and X-shift correction can be applied in that order. In this case, the correction reference region Ar1 in the first direction corresponds to the Z-correction reference region Arz, and the correction reference region Ar2 in the second direction corresponds to the X-correction reference region Arx. Furthermore, the correction reference calculated from the correction reference region Ar1 in the first direction corresponds to the reference Z height Zr, and the height image obtained by offsetting the profile data Pd in ​​the first direction, Z2, becomes the Z-corrected height image.

[0297] First, the height image generation unit 202 extracts feature points from a pre-set Z-correction reference region Arz. In this example, peak points are extracted as feature points. The height image generation unit 202 then calculates a reference Z height Zr from the multiple peak points extracted as feature points. Subsequently, the height image generation unit 202 offsets the profile data Pd in ​​the Z2 direction so that the Z heights of the feature points are aligned in a straight line in the Y2 direction, and generates a Z-corrected height image.

[0298] Next, the height image generation unit 202 sets an X correction reference region Arx in a predetermined height region relative to the Z reference height Zr, such as a height region of -rz relative to the Z reference height Zr, and extracts edge points in the X correction reference region Arx. That is, the X correction reference region Arx may be set based on the Z reference height Zr as a relative position to the object to be measured S. Then, the height image generation unit 202 calculates the reference X position Xr of the profile data Pd based on the extracted edge points. Subsequently, the height image generation unit 202 offsets the profile data Pd in ​​the X2 direction according to the difference between the X position of the edge point and the reference X position Xr. This ensures that appropriate edge points are extracted regardless of the height at which the cable, which is the object to be measured, is imaged by the imaging head 100.

[0299] (Following of the correction reference region Ar) In the above explanation, it was described that the correction reference region Ar is set relative to the object to be measured S on the height image generated by the height image generation unit 202. This correction reference region Ar can be set in relation to the object to be measured S.

[0300] Specifically, the correction setting unit 206b accepts the specification of a correction reference region Ar as a relative position to the object S to be measured.

[0301] Then, the height image generation unit 202 acquires the correction reference region Ar set in the correction setting unit 206b.

[0302] Next, the height image generation unit 202 identifies the position of the object to be measured S from the height image Hi obtained during operation. The position of the object to be measured S can be identified by, for example, pattern analysis of the height image Hi, contour information, grayscale variation information, etc.

[0303] Then, the height image generation unit 202 sets a correction reference region Ar based on the position of the identified object S to be measured.

[0304] This allows for the accurate setting of a correction reference area Ar for objects S flowing on a conveyor belt C in various orientations, without having to adjust the orientation of the object S beforehand.

[0305] (Automatic alignment function) The above explanation describes the case where the correction reference area Ar is set in advance, but this step can be omitted. The following describes the case where profile alignment is performed automatically without setting the correction reference area Ar.

[0306] The height image generation unit 202 offsets each of the multiple profile data Pd so that the difference between the multiple profile data Pd generated by the profile data generation unit 201 is reduced.

[0307] Specifically, the height image generation unit 202 moves the profile data multiple times, compares the reference profile data that is the target of correction amount calculation with the reference profile data used to calculate the correction amount, and calculates the difference.

[0308] First, the height image generation unit 202 moves the reference profile data by a first amount in the X2 direction. In this state, the height image generation unit 202 calculates the difference between the reference profile data and the reference profile data for each X coordinate of the reference profile data. Then, the height image generation unit 202 calculates the average or sum of the differences calculated for each X coordinate.

[0309] Next, the height image generation unit 202 moves the reference profile data by a second amount in the X2 direction. In this state as well, the height image generation unit 202 calculates the difference between the reference profile data and the reference profile data for each X coordinate, and calculates the average or sum of the differences calculated for each X coordinate.

[0310] The height image generation unit 202 calculates multiple average or total values ​​by repeatedly moving the reference profile data. The height image generation unit 202 can then calculate the amount of movement that reduces the calculated value as a correction amount in the X2 direction.

[0311] Furthermore, the reference profile data can be the profile data immediately preceding or following the reference profile data. In other words, for each profile data, a correction amount is calculated so that the positional shift between the preceding and succeeding profile data is reduced.

[0312] Here, we have explained a method for calculating the correction amount by moving the profile data multiple times in the X2 direction, but the height image generation unit 202 can similarly calculate the offset amount in the Z2 direction and the correction amount in the rotation direction.

[0313] In other words, the height image generation unit 202 determines the degree of agreement with the reference profile data by moving the reference profile data. The height image generation unit 202 then calculates a correction amount that increases the degree of agreement between the reference profile data and the reference profile data, and moves the reference profile data based on this correction amount.

[0314] This eliminates the need for prior user configuration, and furthermore, it enables alignment between multiple profile data Pd by correcting each of them to minimize the differences between profile data.

[0315] [2] Second embodiment The differences between the optical displacement measurement system 500 according to the second embodiment of the present invention and the optical displacement measurement system 500 according to the first embodiment will be explained below. Figure 29 is a block diagram showing the configuration of the control unit 220 of the optical displacement measurement system 500 according to the second embodiment. As shown in Figure 29, the control unit 220 further includes a luminance image generation unit 207 as a functional unit, in addition to the functional unit included in the first embodiment. The control unit 220 accepts the profile alignment setting in the second embodiment. The profile alignment setting in the second embodiment will be explained below.

[0316] The profile data generation unit 201 generates profile data Pd corresponding to each position in the Y2 direction of the moving object S based on the light received signal output by the light receiving unit 121. The profile data generation unit 201 can also output the generated profile data Pd to the luminance image generation unit 207.

[0317] The luminance image generation unit 207 generates a luminance image Ii of the object to be measured S by arranging multiple profile data Pd generated by the profile data generation unit 201 in the Y2 direction. The luminance image Ii is explained in detail in Figures 6 and 7, so the details are omitted here, but it is generated by arranging peak luminance values ​​Iij, which are associated with each point defined by positions xi and yj, in the Y2 direction.

[0318] In the profile alignment of the second embodiment, the correction setting unit 206b accepts the setting of the correction reference area Ar on the luminance image Ii instead of the height image Hi. This alignment setting using the luminance image Ii can be used when inspecting measurement targets S with different color tones. The alignment setting using the luminance image Ii will be explained with reference to Figures 15A and 15B.

[0319] In alignment settings using height image Hi, the correction setting unit 206b accepts the height as the edge level, which is one of the correction parameters. In alignment settings using luminance image Ii, the correction setting unit 206b accepts the selection of a luminance image as the target for edge extraction in the edge selection field 1202. In addition, the correction setting unit 206b accepts the specification of a luminance value instead of height as the edge level in the edge level setting field 1203.

[0320] The height image generation unit 202 obtains the luminance value set as the edge level from the correction setting unit 206b. The height image generation unit 202 also obtains the luminance image Ii generated by the luminance image generation unit 207. Then, the height image generation unit 202 extracts feature points from the luminance image Ii based on the luminance value obtained from the correction setting unit 206b. Once the height image generation unit 202 has extracted feature points from the multiple profile data Pd that constitute the luminance image Ii, the height image generation unit 202 calculates a reference X position Xr, which is a correction criterion, based on the multiple feature points. Then, according to the offset amount, which is the difference between the reference X position Xr and the X position of the feature point, the height image generation unit 202 offsets each of the profile data Pd. Then, by arranging the profile data Pd in ​​the Y2 direction, the height image generation unit 202 generates an inspection height image in which the positional misalignment between multiple profile data Pd with different positions in the Y2 direction is reduced.

[0321] The embodiments described above are merely illustrative in all respects and should not be interpreted restrictively. Furthermore, any modifications or changes that fall within the equivalent scope of the claims are all within the scope of the present invention. [Industrial applicability]

[0322] As described above, the present invention can be used, for example, to inspect the shape of an object to be measured that is moved at a constant speed by a belt conveyor or the like. [Explanation of symbols]

[0323] 100…Imaging head, 110…Light emitter, 120…Imaging unit, 121…Light receiving unit, 122…Light receiving lens, 200…Processing device, 201…Profile data generation unit, 202…Height image generation unit, 203…Inspection unit, 204…Communication unit, 205…Display control unit, 206…Setting unit, 210…Storage unit, 220…Control unit, 300…Input unit, 400…Display unit, 500…Shape inspection device, p…Pixel, P…Peak, R…Light receiving area, S…Measurement target, SS…Pixel row, T…Irradiation area

Claims

1. A shape inspection apparatus comprising: a light projection unit that irradiates a slit light having an extension in the X-axis direction, or a spot light scanned in the X-axis direction, onto a measurement target that moves relative to it in the Y-axis direction intersecting the X-axis; a light receiving unit that receives reflected light from each position in the X-axis direction and outputs a light receiving signal indicating the amount of light received; a profile data generation unit that generates profile data of the measurement target in a plane intersecting the Y-axis direction based on the light receiving signal; and an inspection unit that inspects the shape of the measurement target based on the profile data generated by the profile data generation unit, A height image generation unit sequentially acquires profile data of the object to be measured that moves relative to it in the Y-axis direction, and generates a height image of the object to be measured based on the sequentially acquired plurality of profile data, The system includes a setting unit that accepts the setting of a region from which feature points based on the shape of the profile data are extracted, which will serve as the alignment standard, from each of the profile data generated by the profile data generation unit, The height image generation unit further, For each of the profile data generated by the profile data generation unit, Apply at least one extraction method of peak, bottom, mean, or edge to the profile data included in the region from which feature points set in the setting unit are extracted, and extract feature points that will serve as alignment criteria from the profile data included in the region from which feature points set in the setting unit are extracted. An offset amount is calculated to correct the relative positional misalignment between each profile data so that the extracted feature points are aligned in a line in the direction corresponding to the Y-axis. According to the calculated offset amount, while maintaining the overall shape of the profile data, the entire profile data is integrally offset in the X-axis direction or Z-axis direction within a plane intersecting the Y-axis. A shape inspection device characterized by correcting the height image by arranging the offset profile data in a direction corresponding to the Y-axis.

2. A shape inspection apparatus according to claim 1, The height image generation unit, The positions of the feature points are aligned in the direction corresponding to the Y-axis, and each of the profile data is moved in such a way that the positional misalignment between each of the profile data generated by the profile data generation unit is reduced. A shape inspection device characterized by correcting the height image by arranging the moved profile data in a direction corresponding to the Y-axis.

3. A shape inspection apparatus according to claim 1 or 2, The height image generation unit, Based on the height of the feature points extracted from each of the aforementioned profile data, a reference height is calculated. A shape inspection apparatus characterized by moving each of the aforementioned profile data in the Z-axis direction that intersects the X-axis direction and the Y-axis direction according to the difference between the height of the feature point and the reference height, and arranging the moved profile data in the direction corresponding to the Y-axis, thereby correcting the height image so that the heights of each feature point extracted from each of the aforementioned profile data are aligned in the direction corresponding to the Y-axis.

4. A shape inspection apparatus according to any one of claims 1 to 3, The height image generation unit, Based on the X positions of the feature points extracted from each of the aforementioned profile data, a reference X position is calculated. A shape inspection apparatus characterized by moving each of the aforementioned profile data in the X-axis direction according to the difference between the X position of the feature point and the reference X position, and arranging the moved profile data in the direction corresponding to the Y axis, thereby correcting the height image so that the X positions of each feature point extracted from each of the aforementioned profile data are aligned in a line in the direction corresponding to the Y axis.

5. A shape inspection apparatus according to claim 4, The setting unit accepts the setting of a first region and a second region as regions from which the feature points are extracted. The height image generation unit, with respect to each of the profile data, The extraction method is applied to the profile data contained in the first region to extract a first auxiliary feature point from the profile data contained in the first region, and the extraction method is applied to the profile data contained in the second region to extract a second auxiliary feature point from the profile data contained in the second region. Based on the first auxiliary feature point and the second auxiliary feature point, the feature point is calculated. Based on the X positions of the multiple feature points calculated from each of the aforementioned profile data, a reference X position is calculated. A shape inspection apparatus characterized by moving each of the aforementioned profile data in the X-axis direction according to the difference between the X position of the feature point and the reference X position, and arranging the moved profile data in the direction corresponding to the Y axis, thereby correcting the height image so that the X positions of the feature points are aligned in a line in the direction corresponding to the Y axis.

6. A shape inspection apparatus according to any one of claims 1 to 4, The setting unit accepts the settings for the first region and the second region. The height image generation unit, with respect to each of the profile data, The approximate straight line of the profile data in the first region and the approximate straight line of the profile data in the second region are calculated. A shape inspection apparatus characterized by calculating the intersection points of the approximate straight line of the profile data in the first region and the approximate straight line of the profile data in the second region as feature points.

7. A shape inspection apparatus according to claim 1 or 2, The setting unit accepts the setting of an X-correction reference region in a fixed coordinate system and a Z-correction reference region in a relative coordinate system based on the object to be measured, as the regions from which the feature points are extracted. The height image generation unit, For each of the profile data generated by the profile data generation unit, feature points in the X-axis direction are extracted from the X-correction reference region. Based on the X positions of the multiple feature points in the X-axis direction extracted from each of the aforementioned profile data, a reference X position is calculated. Each of the aforementioned profile data is moved in the X-axis direction according to the difference between the X position of the feature point in the X-axis direction and the reference X position, and the moved profile data is arranged in the direction corresponding to the Y-axis to generate an X-corrected height image in which the X positions of the feature points in the X-axis direction are aligned in a line in the direction corresponding to the Y-axis. For the X-corrected height image, the Z-correction reference region is set based on the position of the object to be measured included in the X-corrected height image. For each of the aforementioned profile data, feature points in the Z-axis direction that intersect the X-axis direction and the Y-axis direction are extracted from the Z-correction reference region. Based on the multiple feature points in the Z-axis direction extracted from each of the aforementioned profile data, the reference height is calculated. A shape inspection apparatus characterized by moving each of the aforementioned profile data in the Z-axis direction according to the difference between the height of the feature point in the Z-axis direction and the reference height, and arranging the moved profile data in the direction corresponding to the Y-axis, thereby generating a height image in which the heights of the feature points in the Z-axis direction are aligned in a line in the direction corresponding to the Y-axis.

8. A shape inspection apparatus according to claim 1 or 2, The setting unit accepts the setting of a Z-correction reference region in a fixed coordinate system and an X-correction reference region in a relative coordinate system based on the object to be measured, as the regions from which the feature points are extracted. The height image generation unit, For each of the profile data generated by the profile data generation unit, feature points in the Z-axis direction that intersect the X-axis direction and the Y-axis direction are extracted from the Z-correction reference region. Based on the heights of the multiple feature points in the Z-axis direction extracted from each of the aforementioned profile data, a reference height is calculated. Each of the aforementioned profile data is moved in the Z-axis direction according to the difference between the height of the feature point in the Z-axis direction and the reference height, and the moved profile data is arranged in the direction corresponding to the Y-axis to generate a Z-corrected height image in which the heights of the feature points in the Z-axis direction are aligned in a line in the Y-axis direction. For the Z-corrected height image, the X-correction reference region is set based on the reference height. For each of the aforementioned profile data, feature points in the X-axis direction are extracted from the X-correction reference region. Based on the multiple feature points in the X-axis direction extracted from each of the aforementioned profile data, the reference X position is calculated. A shape inspection apparatus characterized by moving each of the aforementioned profile data in the X-axis direction according to the difference between the X position of the feature point in the X-axis direction and the reference X position, and arranging the moved profile data in a direction corresponding to the Y-axis, thereby generating a height image in which the X positions of the feature points in the X-axis direction are aligned in a line in the direction corresponding to the Y-axis.

9. A shape inspection apparatus comprising: a light projection unit that irradiates a slit light having an extension in the X-axis direction, or a spot light scanned in the X-axis direction, onto a measurement target that moves relative to it in the Y-axis direction intersecting the X-axis; a light receiving unit that receives reflected light from each position in the X-axis direction and outputs a light receiving signal indicating the amount of light received; a profile data generation unit that generates profile data of the measurement target in a plane intersecting the Y-axis direction based on the light receiving signal; and an inspection unit that inspects the shape of the measurement target based on the profile data generated by the profile data generation unit, A height image generation unit sequentially acquires profile data of the object to be measured that moves relative to it in the Y-axis direction, and generates a height image of the object to be measured based on the sequentially acquired plurality of profile data, A display control unit that displays the height image for setting, generated by the height image generation unit, on the display unit, The display unit includes a setting unit that accepts the setting of a two-dimensional region extending in the direction corresponding to the Y-axis as a correction reference region on the height image for setting that is displayed on the display unit, The height image generation unit further, For each of the profile data generated by the profile data generation unit, the profile data included in the correction reference region is identified, and the slope value of the profile data is calculated. A shape inspection device characterized by correcting a height image by moving each of the profile data in a rotational direction within a plane intersecting the direction corresponding to the Y-axis, based on the difference between the calculated inclination value and a predetermined correction reference angle.

10. A shape inspection apparatus comprising: a light projection unit that irradiates a slit light having an extension in the X-axis direction, or a spot light scanned in the X-axis direction, onto a measurement target that moves relative to it in the Y-axis direction intersecting the X-axis; a light receiving unit that receives reflected light from each position in the X-axis direction and outputs a light receiving signal indicating the amount of light received; a profile data generation unit that generates profile data of the measurement target in a plane intersecting the Y-axis direction based on the light receiving signal; and an inspection unit that inspects the shape of the measurement target based on the profile data generated by the profile data generation unit, A height image generation unit sequentially acquires profile data of the object to be measured that moves relative to it in the Y-axis direction, and generates a height image of the object to be measured based on the sequentially acquired plurality of profile data, The system includes a setting unit that accepts the setting of a region from which feature points based on the shape of the profile data are extracted, which will serve as the alignment standard, from each of the profile data generated by the profile data generation unit, The height image generation unit further, For each of the profile data generated by the profile data generation unit, Applying at least one extraction method—peak, bottom, average, or edge—to the profile data included in the region from which feature points are extracted as set in the setting unit, and extracting feature points that serve as alignment criteria as ideal feature points from the profile data included in the region from which feature points are extracted as set in the setting unit, An offset amount is calculated to correct the relative positional misalignment between each profile data so that the ideal feature points are aligned in a line in the direction corresponding to the Y-axis. According to the calculated offset amount, while maintaining the overall shape of the profile data, the entire profile data is integrally offset in the X-axis direction or Z-axis direction within a plane intersecting the Y-axis. A shape inspection device characterized by correcting the height image by arranging the offset profile data in a direction corresponding to the Y-axis.

11. A height image processing method used when irradiating an object to be measured that is moving relative to the X-axis in a Y-axis direction intersecting the X-axis with a slit beam having an extension in the X-axis direction, or a spot beam scanned in the X-axis direction, sequentially generating profile data of the object to be measured in a plane intersecting the Y-axis direction based on a light reception signal indicating the amount of reflected light received from each position in the X-axis direction, and generating a height image of the object to be measured based on the sequentially generated profile data, wherein From each of the sequentially generated profile data mentioned above, the system accepts the setting of regions that will serve as alignment criteria and from which feature points based on the shape of the profile data will be extracted. For each of the sequentially generated profile data, Apply at least one extraction method of peak, bottom, mean, or edge to extract alignment criterion feature points from the profile data included in the region from which the set feature points are extracted. An offset amount is calculated to correct the relative positional misalignment between each profile data so that the extracted feature points are aligned in a line in the direction corresponding to the Y-axis. According to the calculated offset amount, while maintaining the overall shape of the profile data, the entire profile data is integrally offset in the X-axis direction or Z-axis direction within a plane intersecting the Y-axis. A height image processing method that corrects the height image by arranging the offset profile data in a direction corresponding to the Y-axis.

12. A height image processing program for use in an optical displacement meter, comprising: a light projection unit that irradiates a slit light having an extension in the X-axis direction, or a spot light scanned in the X-axis direction, onto a measurement target that is moving relative to it in the Y-axis direction intersecting the X-axis; a light receiving unit that receives reflected light from each position in the X-axis direction and outputs a light receiving signal indicating the amount of light received; and a profile data generation unit that sequentially generates profile data of the measurement target in a plane intersecting the Y-axis direction based on the light receiving signal, From each of the sequentially generated profile data mentioned above, a process is performed to accept the setting of regions that will serve as alignment criteria and from which feature points based on the shape of the profile data will be extracted. For each of the sequentially generated profile data, The process involves applying at least one extraction method of peak, bottom, mean, or edge to extract alignment-based feature points from profile data included in the region from which the set feature points are extracted, and A process to calculate an offset amount to correct the relative positional misalignment between each profile data so that the extracted feature points are aligned in a line in the direction corresponding to the Y-axis, A process to offset the entire profile data integrally in the X-axis direction or Z-axis direction within a plane intersecting the Y-axis, while maintaining the overall shape of the profile data, according to the calculated offset amount, A process to correct the height image by arranging the offset profile data in the direction corresponding to the Y-axis, A height image processing program that causes the optical displacement sensor to perform the following operation.