Method for generating a measuring program for a three-dimensional model-based video measuring machine

By importing a 3D CAD model to determine the shooting direction and coordinate system, and generating a measurement program file, the problem of low efficiency and low accuracy of image measuring instruments when measuring complex parts in batches is solved, and high efficiency and high accuracy of fully automatic measurement are achieved.

CN121048491BActive Publication Date: 2026-07-21CHOTEST TECH INC

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHOTEST TECH INC
Filing Date
2025-05-19
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing image measuring instruments suffer from low measurement efficiency and low accuracy when measuring complex parts in batches. In particular, errors are prone to occur when programming with solid workpiece templates, and CAD drawings cannot be programmed for different shooting directions.

Method used

By importing the 3D CAD model of the part, determining the shooting direction and coordinate system, generating a measurement program file, establishing a second coordinate system for measurement, and achieving fully automatic measurement.

Benefits of technology

It improves measurement efficiency and accuracy, ensures the accuracy of the measurement procedure, and adapts to measurement needs from different shooting directions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121048491B_ABST
    Figure CN121048491B_ABST
Patent Text Reader

Abstract

The application relates to a full-automatic measurement method of an image measuring instrument based on a space three-dimensional CAD model, which comprises the following steps: importing a three-dimensional image of a part, wherein the three-dimensional image comprises a space three-dimensional CAD model; determining a shooting direction based on part features in the three-dimensional image as a first direction, determining a first origin of a first coordinate axis in a first coordinate system according to the part features in the three-dimensional image, determining origins of other coordinate axes based on part features or other part features in the three-dimensional image, and fitting each coordinate axis of the first coordinate system based on the first direction and the second direction; determining the origins of each coordinate axis of each first coordinate system based on part features in the three-dimensional image; and generating a measurement program file based on the first coordinate system. The method can improve the processing efficiency while ensuring the measurement accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of application number 2025106399583 (invention title: fully automatic measurement method of image measuring instrument based on spatial three-dimensional CAD model, application date: May 19, 2025). Technical Field

[0002] This application relates to the field of intelligent manufacturing equipment industry, and in particular to a method for generating measurement programs for image measuring instruments based on three-dimensional models. Background Technology

[0003] Vision measuring instruments can perform precise measurements of the surface dimensions, contours, angles and positions, and geometric tolerances of various complex parts. Specifically, they can extract the geometric features of parts (such as planes, lines, and points) and calculate length or angle information, thereby determining whether the machining accuracy of the parts meets design requirements. However, when measuring complex parts in batches, a large number of repetitive operations are required, which is not conducive to improving measurement efficiency.

[0004] In traditional technology, in order to improve measurement efficiency, template programming can be performed based on the design requirements of the parts before batch measurement begins, and a matching measurement program can be customized. During the subsequent measurement process, the image measuring instrument can run the measurement program to automatically measure the workpiece according to the planned measurement steps.

[0005] However, currently, using physical workpieces for template programming in image measuring instruments presents the following problems: the dimensional accuracy of the physical workpiece itself may not be standard; and blurry images may result from improper focusing when photographing the workpiece. These issues can easily lead to errors in subsequent automatic measurements. Some image measuring instruments can use CAD drawings for template programming; however, CAD drawings only have one measurement plane and cannot be used for template programming based on different shooting directions.

[0006] In summary, there is an urgent need for a method that can ensure measurement accuracy while improving processing efficiency. Summary of the Invention

[0007] Therefore, it is necessary to provide a fully automatic measurement method for an image measuring instrument based on a spatial three-dimensional CAD model that can ensure measurement accuracy while improving processing efficiency, in order to address the above-mentioned technical problems.

[0008] In a first aspect, this application provides a fully automated measurement method for an image measuring instrument based on a spatial three-dimensional CAD model, the method comprising:

[0009] Import a 3D image of the part, which includes a spatial 3D CAD model;

[0010] The shooting direction determined based on the part features in the three-dimensional image is taken as the first direction, and the second direction is determined based on the part features in the three-dimensional image. The coordinate axes of the first coordinate system are obtained by fitting the first direction and the second direction.

[0011] The first origin of the first coordinate axis in the first coordinate system is determined based on the part features in the three-dimensional image, and the origin of other coordinate axes is determined based on the part features that determined the first origin or other part features in the three-dimensional image.

[0012] Generate a measurement program file based on the first coordinate system;

[0013] Acquire the captured image to be processed, and establish a second coordinate system based on the image to be processed;

[0014] The parts in the image to be processed are measured based on the measurement program and the second coordinate system.

[0015] In one embodiment, using the shooting direction determined based on the part features in the three-dimensional image as the first direction includes at least one of the following methods:

[0016] The shooting direction is determined based on the straight line selected in the three-dimensional image, and the shooting direction is taken as the first direction;

[0017] Determining the shooting direction based on a first plane selected in the three-dimensional image, and using the shooting direction as the first direction, includes: determining at least three non-collinear points among the parts selected in the three-dimensional image; generating a first plane based on the at least three non-collinear points; and determining the normal vector direction of the first plane as the shooting direction.

[0018] In one embodiment, determining the second direction based on the part features in the three-dimensional image includes at least one of the following methods:

[0019] A first straight line is obtained by fitting at least two points selected in the three-dimensional image, and the direction of the first straight line is determined as the second direction;

[0020] The straight line selected in the three-dimensional image is taken as the first straight line, and the direction of the first straight line is determined as the second direction.

[0021] In one embodiment, determining the first origin of the first coordinate axis in the first coordinate system based on part features in the three-dimensional image, and determining the origin of other coordinate axes based on the part features used to determine the first origin or other part features in the three-dimensional image, includes:

[0022] The origin of the X-axis of the first coordinate system is obtained by projecting the first selected point in the three-dimensional image onto the X-axis of the first coordinate system.

[0023] Generate a first option corresponding to the first selected point and a first option corresponding to the first straight line, and determine the origin of the Y-axis of the first coordinate system based on the first selection result of the first option corresponding to the first selected point and the first option corresponding to the first straight line. Specifically, if the first selection result is the first option corresponding to the first selected point, the origin of the Y-axis of the first coordinate system is obtained by projecting the first selected point onto the Y-axis of the first coordinate system; if the first selection result is the first option corresponding to the first straight line, the origin of the Y-axis of the first coordinate system is obtained by projecting the first straight line onto the Y-axis of the first coordinate system.

[0024] Generate a second option corresponding to the first selected point, a second option corresponding to the first straight line, and an option corresponding to the first plane. Based on the second selection results of the second options corresponding to the first selected point, the second options corresponding to the first straight line, and the option corresponding to the first plane, determine the origin of the Z-axis of the first coordinate system. Specifically, if the second selection result is the second option corresponding to the first selected point, the origin of the Z-axis of the first coordinate system is obtained by projecting the first selected point onto the Z-axis of the first coordinate system. If the second selection result is the second option corresponding to the first straight line, the origin of the Z-axis of the first coordinate system is obtained by projecting the first straight line onto the Z-axis of the first coordinate system. If the second selection result is the option corresponding to the first plane, the origin of the Z-axis of the first coordinate system is obtained by projecting the first plane onto the Z-axis of the first coordinate system.

[0025] In one embodiment, generating the measurement program file based on the first coordinate system includes:

[0026] Based on the first coordinate system and the three-dimensional image, the method for extracting target features in the part is determined, including: performing a simulation based on the first coordinate system and the three-dimensional image to obtain a simulation image taken along the shooting direction; and determining the method for extracting target features in the part based on the simulation image and the three-dimensional image.

[0027] Determine the measurement method for the target features in the part in the three-dimensional image;

[0028] A measurement program file is generated based on the extraction method of the target features, the measurement method of the target features, and the first coordinate system.

[0029] In one embodiment, the target feature extraction method includes at least one of feature point extraction, feature line extraction, feature circle extraction, and feature plane extraction.

[0030] The feature point extraction method includes at least one of a method based on manual selection to determine feature points and a method based on scanning to determine feature points. The method based on scanning to determine feature points includes determining two first candidate points selected in the three-dimensional image and scanning the boundary between the two first candidate points to obtain each feature point.

[0031] The feature line extraction method includes: determining at least two second candidate points selected in the three-dimensional image, displaying a first point selection area in the simulation image based on the at least two second candidate points, and fitting each feature point selected in the first point selection area to obtain a feature line;

[0032] The feature circle extraction method includes: determining a selected feature circle in the three-dimensional image, obtaining a target feature circle based on the selected feature circle, including any of the following methods: generating a second sampling region based on the feature circle, fitting a feature circle based on the identified feature points in the second sampling region, wherein the second sampling region is a fan-shaped sampling region or an annular sampling region; identifying a set of points at the intersection based on multiple selected points near the feature circle, and fitting a target feature circle based on the set of points; and obtaining a set number of scan lines, generating each scan line passing through the feature circle in the simulation image, generating each feature point based on the scan lines, and fitting a target feature circle based on the generated feature points.

[0033] The feature plane extraction method includes: determining a selected plane in the three-dimensional image as the feature plane.

[0034] In one embodiment, the measurement method for determining the target feature in the part in the three-dimensional image includes:

[0035] Determine at least one of the target feature length measurement method, angle measurement method, and height measurement method in the part in the three-dimensional image;

[0036] The length measurement method described herein is used to measure the length of the target feature;

[0037] The angle measurement method is used to measure the angle of the target feature;

[0038] The height measurement method includes measuring the height corresponding to the target feature based on a laser rangefinder or measuring the height of the target feature based on a camera. The height measurement of the target feature based on a camera includes: moving the camera above the target feature and moving the camera along the Z-axis. When the quality of the image captured by the camera meets the image quality requirements, the height of the camera is taken as the height of the target feature.

[0039] In one embodiment, the extraction method based on the target features, the measurement method of the target features, and the measurement procedure for generating the first coordinate system include:

[0040] When the image measuring instrument can only shoot along one shooting direction, a measurement program is generated based on the target feature extraction method, the target feature measurement method, and the first coordinate system for different measurement surfaces.

[0041] When the image measuring instrument includes multiple shooting directions, the extraction method of the target features corresponding to each different measurement surface, the measurement method of the target features, and the first coordinate system are stored in a measurement program.

[0042] In one embodiment, the measurement program stores the overall contour of the part in the shooting direction during storage; the step of establishing a second coordinate system based on the image to be processed includes:

[0043] The pose of the parts in the image to be processed is identified based on the overall contour.

[0044] Based on the posture recognition result and the first coordinate system corresponding to the shooting direction, a second coordinate system is generated.

[0045] In one embodiment, establishing a second coordinate system based on the image to be processed includes:

[0046] The fourth and fifth directions are determined based on the features of the parts in the image to be processed, and the sixth direction is determined based on the shooting direction. The coordinate axes of the second coordinate system are then fitted based on the fourth, fifth, and sixth directions.

[0047] The origin of each coordinate axis of the second coordinate system is determined based on the part features in the image to be processed;

[0048] The second coordinate system is determined based on each coordinate axis of the second coordinate system and the origin of each coordinate axis of the second coordinate system.

[0049] The fully automatic measurement using the image measuring instrument based on the aforementioned spatial 3D CAD model involves importing a 3D image of the part, which includes the spatial 3D CAD model; using the shooting direction determined based on the part features in the 3D image as the first direction, and determining a second direction based on the part features in the 3D image; fitting the first and second directions to obtain the coordinate axes of a first coordinate system; determining the first origin of one of the coordinate axes of the first coordinate system based on the part features in the 3D image, and determining the origins of other coordinate axes based on the first origin or the part features in the 3D image; generating a measurement program based on the first coordinate system, acquiring the captured image to be processed, and establishing a second coordinate system based on the image to be processed; and measuring the part in the image to be processed based on the measurement program and the second coordinate system. Direct template programming within the 3D image allows for template programming based on different shooting directions, improving efficiency. Furthermore, programming directly based on the 3D image file of the part results in higher accuracy. Establishing the first coordinate system based on this 3D image ensures the accuracy of the first coordinate system, laying the foundation for the measurement accuracy of subsequent measurement processes. Attached Figure Description

[0050] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0051] Figure 1 This is an application environment diagram of an image measuring instrument measurement program generation method based on a spatial three-dimensional CAD model in one embodiment;

[0052] Figure 2 This is a flowchart illustrating a method for generating a measurement program for an image measuring instrument based on a spatial 3D CAD model, as shown in one embodiment.

[0053] Figure 3 This is a flowchart of the first direction determination step in one embodiment;

[0054] Figure 4 This is a flowchart illustrating a fully automated measurement method for an image measuring instrument based on a spatial 3D CAD model in one embodiment.

[0055] Figure 5 This is a flowchart illustrating a fully automated measurement method for an image measuring instrument based on a spatial 3D CAD model, as described in another embodiment.

[0056] Figure 6This is a structural block diagram of an image measuring instrument measurement program generation device based on a spatial three-dimensional CAD model in one embodiment;

[0057] Figure 7 This is a structural block diagram of a fully automatic measuring device for an image measuring instrument based on a spatial 3D CAD model, as shown in one embodiment.

[0058] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0059] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0060] The fully automatic measurement method of the image measuring instrument based on a spatial 3D CAD model of this application may include: a measurement program generation method for the image measuring instrument based on a spatial 3D CAD model and an automatic measurement method for the image measuring instrument based on a spatial 3D CAD model. Before batch measurement, the measurement program generation method for the image measuring instrument based on a spatial 3D CAD model is executed, including: template programming for a 3D image of the part, such as a spatial 3D CAD model of the part, and defining a corresponding first coordinate system during template programming, and customizing a measurement program based on the first coordinate system. Subsequently, the automatic measurement method for the image measuring instrument based on the spatial 3D CAD model is executed. That is, during the measurement process, the image measuring instrument can run the measurement program to automatically measure the part according to the planned measurement steps. In this way, template programming is performed directly in the 3D image, and template programming can be performed based on different shooting directions, which improves efficiency. Moreover, programming is performed directly based on the 3D image file of the part, which results in higher accuracy. Furthermore, the establishment of the first coordinate system based on the 3D image ensures the accuracy of the first coordinate system, laying the foundation for the measurement accuracy of the subsequent measurement process.

[0061] The image measurement program generation method based on a spatial three-dimensional CAD model provided in this application can be applied to, for example... Figure 1The application environment shown is illustrated. The image measuring instrument may include a platform, a camera, and a controller. In some embodiments, the image measuring instrument may also include an electric fixture with moving or rotating parts, or the platform may be capable of moving or rotating parts. In other embodiments, the image measuring instrument may include multiple cameras with multiple shooting angles. The controller may store measurement programs obtained through template programming. The platform includes a precision linear guide rail and a servo control system to ensure system accuracy; it also features fully automatic three-axis programmable detection, enabling batch detection of complex features. The camera has a high-resolution lens and a wide field of view, balancing measurement efficiency and accuracy; it supports segmented programmable control of surface light, transmitted light, and coaxial light; it automatically identifies the measurement location, ensuring consistent and stable measurement results each time.

[0062] The template programming can be performed on a terminal or similar device. The imported 3D image, which can be a spatial 3D CAD model of the part, is opened on the terminal. The 3D image can be displayed in an interface, allowing the user to rotate, move, or select features on the part. Template programming is then performed to obtain the measurement program. Subsequently, the measurement program is imported into the controller of the image measuring instrument, enabling the controller to execute the measurement method described in this application based on the measurement program, thereby achieving the measurement of the part.

[0063] In some optional embodiments, the image measuring instrument of this application can be used in fields such as machinery, electronics, molds, injection molding, hardware, rubber, low-voltage electrical appliances, magnetic materials, precision stamping, connectors, terminals, mobile phones, home appliances, printed circuit boards, medical devices, watches, cutting tools, and metrology and testing.

[0064] In some optional embodiments, the image measuring instrument of this application can achieve precise measurement of the surface dimensions, contours, angles and positions, geometric tolerances, etc. of various complex parts.

[0065] In one exemplary embodiment, such as Figure 2 As shown, a method for generating measurement programs for image measuring instruments based on spatial three-dimensional CAD models is provided, which can be applied to... Figure 1 Taking the terminal in the example, the explanation includes the following steps S202 to S208. Wherein:

[0066] S202: Import 3D images of the parts, including spatial 3D CAD models.

[0067] The 3D image is a three-dimensional image of the part, which may include a spatial 3D CAD model. After importing the 3D image of the part, it can be displayed in the interface, allowing the user to rotate, move, or select part features. In other words, the terminal can receive instructions to rotate, move, or select part features based on the 3D image, and then rotate, move, or select the part features accordingly.

[0068] S204: The shooting direction determined based on the part features in the three-dimensional image is taken as the first direction, and the second direction is determined based on the part features in the three-dimensional image. The coordinate axes of the first coordinate system are obtained by fitting the first direction and the second direction.

[0069] S206: Determine the first origin of the first coordinate axis in the first coordinate system based on the part features in the three-dimensional image, and determine the origin of other coordinate axes based on the part features that determined the first origin or other part features in the three-dimensional image.

[0070] The origin of each coordinate axis in the first coordinate system is determined based on the part features in the 3D image. However, in order to improve the user experience, when defining the origin of each coordinate axis, the origin of other coordinate axes can be determined based on the part features corresponding to the already determined origin, or other part features. Other part features include part features defined when determining each coordinate axis or newly defined part features, without specific limitations here.

[0071] The first coordinate system includes coordinate axes and the origin of each coordinate axis. Each coordinate axis corresponds to a direction. In this application, each direction is determined based on the part features in the 3D image, and the coordinate axes of the first coordinate system are obtained by fitting each direction. Furthermore, the origin of each coordinate axis can be determined based on the part features in the 3D image.

[0072] The part features in the 3D image can be selected by the user. This means the terminal can receive part feature selection instructions through the 3D image, then determine each part feature based on these instructions, and finally determine the origin of each direction or coordinate axis based on the selected part features. Specifically, when determining the origin of each coordinate axis, the first origin of the first coordinate axis in the first coordinate system can be determined first based on the part features in the 3D image. Then, the origins of other coordinate axes can be determined based on the part features that determined the first origin or other part features in the 3D image. In other words, the determination of the origin of subsequent coordinate axes can use the part features corresponding to the already determined origin, or new part features reselected by the user. This allows the user to choose existing part features as a reference, without needing to redefine part features in the 3D image.

[0073] Optionally, the part features may include points, lines, and surfaces, etc., without specific limitations.

[0074] Users can determine the location of the main features to be measured by rotating the 3D image, and then determine the first and second directions based on the location of these main features.

[0075] In this application, the shooting direction can be determined based on the location of the main features. For example, the main features in the part features can be selected, and then the shooting direction can be determined based on the main features. For example, if the shooting direction is directly facing these main features, the shooting direction can be taken as the first direction, which is the Z-axis direction or basically consistent with the Z-axis direction.

[0076] In some optional embodiments, when there are multiple main features and the shooting directions corresponding to the multiple main features are inconsistent, multiple first directions can be determined to generate multiple first coordinate systems. Subsequently, a corresponding measurement program is generated based on each first coordinate system. These measurement programs can be stored separately or stored together, without any specific restrictions.

[0077] The second direction can be either the X-axis or the Y-axis. For convenience, this application uses the X-axis as the second direction. Users can select some features from the main features and determine the second direction based on these features.

[0078] After determining the first direction (Z-axis) and the second direction (X-axis), the third direction perpendicular to the first and second directions (corresponding to the Y-axis) can be determined, that is, the XYZ axis directions of the first coordinate system are obtained.

[0079] One point to note is that since this step is done manually, and there may not be vertical line segments in the 3D image, the first direction and the second direction may not be perpendicular. Therefore, the XYZ axes of the obtained first coordinate system are the directions fitted based on the defined first and second directions, and the X-axis may not completely coincide with the original second direction.

[0080] S208: Generate a measurement program file based on the first coordinate system.

[0081] After determining the first coordinate system, the shooting direction is also determined. If there are multiple first coordinate systems, multiple shooting directions are obtained. Subsequently, feature extraction methods and measurement methods are determined based on the first coordinate system to generate corresponding measurement program files.

[0082] In one optional embodiment, the target feature extraction method, the target feature measurement method, and the first coordinate system generation measurement program include: when the image measuring instrument can only shoot along one shooting direction, generating a measurement program based on the target feature extraction method, the target feature measurement method, and the first coordinate system for different measurement surfaces; when the image measuring instrument includes multiple shooting directions, storing the target feature extraction method, the target feature measurement method, and the first coordinate system corresponding to each different measurement surface into a measurement program.

[0083] If the image measuring instrument can only capture images along one shooting direction, different measurement programs can be saved for different measurement surfaces, i.e., different shooting directions. If the image measuring instrument has multiple shooting directions, such as an electric fixture or platform that moves or rotates the workpiece, thus enabling multiple shooting directions, or a camera with multiple shooting angles, then the extraction method of the target features corresponding to each shooting direction, the measurement method of the target features, and the first coordinate system are saved as a measurement program.

[0084] The above-described measurement program generation method involves importing a 3D image of the part; using the shooting direction determined based on the part features in the 3D image as the first direction, and determining a second direction based on the part features in the 3D image; fitting the first and second directions to obtain the coordinate axes of a first coordinate system; determining the origin of each coordinate axis of the first coordinate system based on the part features in the 3D image; and generating a measurement program based on the first coordinate system. This method allows for template programming directly within the 3D image, enabling programming based on different shooting directions, thus improving efficiency. Furthermore, programming directly based on the 3D image file of the part provides higher accuracy. The establishment of the first coordinate system based on this 3D image ensures its accuracy, laying the foundation for the measurement accuracy of subsequent measurement processes.

[0085] In some optional embodiments, the shooting direction determined based on the part features in the three-dimensional image is used as the first direction, including at least one of the following methods: determining the shooting direction based on a straight line selected in the three-dimensional image and using the shooting direction as the first direction; determining the shooting direction based on a first plane selected in the three-dimensional image and using the shooting direction as the first direction.

[0086] The first coordinate system includes three coordinate axes: the X-axis, the Y-axis, and the Z-axis. The first direction is the shooting direction of the camera of the image measuring instrument, which is the Z-axis direction. This allows the main features of the part to be obtained within the field of view of the image measuring instrument, which is convenient for subsequent measurement.

[0087] Optionally, the first direction can be defined by selecting a first plane or a straight line in the 3D image, where the first plane is the plane containing the main feature, or the main feature is near the first plane. The straight line is also determined because the main feature is near the straight line. It should be noted that, compared to selecting a straight line, selecting a plane is more advantageous for subsequently defining the origin of the first direction based on that first plane.

[0088] In some alternative embodiments, combined with Figure 3 As shown, Figure 3 The flowchart of a first direction determination step in one embodiment is provided. The first direction is obtained based on the shooting direction. The shooting direction is determined by selecting a first plane in the three-dimensional image, including: determining at least three non-collinear points among the selected parts in the three-dimensional image; generating a first plane based on the at least three non-collinear points; and determining the normal vector direction of the first plane as the shooting direction.

[0089] In this process, the user can select at least three non-collinear points in the part in the 3D image. This allows the generation of a first plane based on the three non-collinear points. The direction of the normal vector of the first plane is the shooting direction, which is also the first direction mentioned above.

[0090] It should be noted that, theoretically, three non-collinear points can fit an ideal plane. However, in actual measurement, the plane of the solid workpiece is not necessarily an ideal plane. Therefore, selecting at least four points can improve the fitting accuracy of the first plane. That is, in this application, at least four non-collinear points are arbitrarily selected in the three-dimensional image, and then the first plane is fitted based on these at least four non-collinear points. Thus, the direction of the normal vector of the first plane is the shooting direction, which is the first direction mentioned above.

[0091] In the above embodiments, since the user can freely rotate and move the three-dimensional image, the position of the main features of the part can be determined, and then the corresponding part features can be selected based on the position of the main features to determine the first direction of the first coordinate system, that is, the shooting direction, so that the field of view during shooting can include the main features of the part.

[0092] In one alternative embodiment, determining the second direction based on part features in a three-dimensional image includes at least one of the following methods: fitting a first straight line based on at least two points selected in the three-dimensional image and determining the direction of the first straight line as the second direction; or taking a straight line selected in the three-dimensional image as the first straight line and determining the direction of the first straight line as the second direction.

[0093] The second direction corresponds to either the X-axis or the Y-axis; the following explanation will use the second direction corresponding to the X-axis. In other embodiments, the second direction can be the Y-axis, thereby fitting the X-axis direction based on the Z-axis and Y-axis directions to obtain the first coordinate system.

[0094] The second direction can also be determined based on the selected part features, which can include points or lines. For example, the second direction can be defined by clicking multiple points or selecting a straight line.

[0095] The method of selecting multiple points means that at least two points can be selected in a 3D image, and then a first straight line is fitted based on the selected points. The direction of the fitted first straight line is used as the second direction. Since the 3D image can directly select straight line features, the direction of the selected first straight line can be used as the second direction.

[0096] After defining the first direction (corresponding to the Z-axis) and the second direction (corresponding to the X-axis), a third direction perpendicular to the first and second directions (corresponding to the Y-axis) can be defined. At this point, the XYZ axis directions of the first coordinate system can be obtained. It should be noted that since this step is a manual operation, and vertical line segments may not exist in the 3D image, the first and second directions may not be perpendicular. Therefore, after step S22, the XYZ axes of the first coordinate system obtained are directions fitted based on the defined first and second directions, and the X-axis may not completely coincide with the original second direction.

[0097] In the above embodiments, the second direction is determined by selecting points or lines in the three-dimensional image. Since the three-dimensional image can be rotated, moved, and selected arbitrarily, the processing efficiency is improved.

[0098] In one optional embodiment, determining the first origin of a first coordinate axis in a first coordinate system based on part features in a 3D image, and determining the origin of other coordinate axes based on the part features that determined the first origin or other part features in the 3D image, includes: obtaining the origin of the X-axis of the first coordinate system based on the projection of a first selected point in the 3D image onto the X-axis of the first coordinate system; generating a first option corresponding to the first selected point and a first option corresponding to a first straight line, and determining the origin of the Y-axis of the first coordinate system based on a first selection result of the first option corresponding to the first selected point and the first option corresponding to the first straight line, wherein when the first selection result is the first option corresponding to the first selected point, the origin of the Y-axis of the first coordinate system is obtained based on the projection of the first selected point onto the Y-axis of the first coordinate system; when the first selection result is the first option corresponding to the first straight line, the origin of the Y-axis of the first coordinate system is determined based on the projection of the first selected point onto the Y-axis of the first coordinate system; and when the first selection result is the first option corresponding to the first straight line, the origin of the Y-axis of the first coordinate system is determined based on the first straight line. The origin of the Y-axis of the first coordinate system is obtained by projecting the first selection point onto the Y-axis. A second option corresponding to the first selected point, a second option corresponding to the first straight line, and an option corresponding to the first plane are generated. Based on the second selection results of these options, the origin of the Z-axis of the first coordinate system is determined. Specifically, if the second selection result is the second option corresponding to the first selected point, the origin of the Z-axis of the first coordinate system is obtained by projecting the first selected point onto the Z-axis. If the second selection result is the second option corresponding to the first straight line, the origin of the Z-axis of the first coordinate system is obtained by projecting the first straight line onto the Z-axis. If the second selection result is the option corresponding to the first plane, the origin of the Z-axis of the first coordinate system is obtained by projecting the first plane onto the Z-axis.

[0099] The first coordinate system includes coordinate axes and an origin. After determining the direction of each coordinate axis, it is also necessary to determine the origin of each coordinate axis so that the first coordinate system can be used to annotate the coordinates of various features in the part.

[0100] In this application, the origin can be defined based on the part features already selected by the user, without requiring the user to redefine new part features. The part features already selected by the user can be determined when defining the origin of other coordinate axes.

[0101] The origin of the X-axis can be determined based on the projection of the first selected point in the 3D image onto the X-axis of the first coordinate system. For example, the origin of the X-axis can be defined by clicking a selected point, and the selected point clicked in this step can be used as the first selected point. The first selected point serves as the reference for the origin of the X-axis, that is, the projection position of the first selected point on the X-axis is the origin position of the X-axis.

[0102] When determining the origin of the Y-axis, the interface displays the first option corresponding to the first selected point and the first option corresponding to the first straight line. The first straight line is the part feature determined when fitting the directions of each coordinate axis of the first coordinate system. If the directions of each coordinate axis of the first coordinate system are not fitted using the first straight line method, but rather using the first plane method, then the first option corresponding to the first straight line is not displayed. Subsequently, the terminal can receive the first selection results of the first option corresponding to the first selected point and the first option corresponding to the first straight line through the interface, and determine the origin of the Y-axis based on the first selection results. If the option corresponding to the first selected point is selected, the projection position of the first selected point on the Y-axis is the origin of the Y-axis; if the option corresponding to the first straight line is selected, the projection position of the first straight line on the Y-axis is the origin of the Y-axis. Regardless of the selection, a first coordinate system can be obtained, and the user can make selections based on the relative position of the first coordinate system and the part. Here, the first straight line is the first straight line selected when defining the X-axis.

[0103] When determining the origin of the Z-axis, the interface displays the second option corresponding to the first selected point, the second option corresponding to the first straight line, and the selection corresponding to the first plane. The first straight line and the first plane are part features determined when fitting the directions of each axis of the first coordinate system. If the directions of each axis of the first coordinate system are fitted using the first plane instead of the first straight line, the first option corresponding to the first straight line is not displayed. Similarly, if the directions of each axis of the first coordinate system are fitted using the first straight line instead of the first plane, the first option corresponding to the first plane is not displayed. The terminal can then receive the second selection results of the second option corresponding to the first selected point, the second option corresponding to the first straight line, and the selection corresponding to the first plane through the interface, and determine the origin of the Y-axis based on these second selection results. If the second selection result is the second option corresponding to the first selection point, the origin of the Z-axis of the first coordinate system is obtained based on the projection of the first selection point onto the Z-axis of the first coordinate system; if the second selection result is the second option corresponding to the first straight line, the origin of the Z-axis of the first coordinate system is obtained based on the projection of the first straight line onto the Z-axis of the first coordinate system; if the second selection result is the option corresponding to the first plane, the origin of the Z-axis of the first coordinate system is obtained based on the projection of the first plane onto the Z-axis of the first coordinate system.

[0104] Here, the first straight line is the first straight line chosen when defining the second direction. The first plane is the first plane chosen when defining the first direction.

[0105] One point to note is that if the main features are all near the first plane, then the first plane can be chosen as the reference for the origin of the Z-axis.

[0106] In some optional embodiments, generating a measurement program file based on a first coordinate system includes: determining the extraction method of target features in the part based on the first coordinate system and the three-dimensional image; determining the measurement method of target features in the part in the three-dimensional image; and generating a measurement program file based on the extraction method of target features, the measurement method of target features, and the first coordinate system.

[0107] The target feature extraction methods include at least one of the following: feature point extraction method, feature line extraction method, feature circle extraction method, and feature plane extraction method.

[0108] The target feature measurement methods include at least one of the target feature length measurement method, angle measurement method, and height measurement method.

[0109] After determining the method for extracting and measuring the target features, a measurement procedure file can be obtained.

[0110] In some optional embodiments, the order in which the target feature extraction method and the target feature measurement method are determined can be interchanged; that is, the target feature measurement method is selected first, and then the target feature extraction method is determined. No specific limitation is made regarding the order of these two steps.

[0111] In some optional embodiments, the method for extracting target features in a part is determined based on a first coordinate system and a three-dimensional image, including: performing a simulation based on the first coordinate system and the three-dimensional image to obtain a simulated image taken along the shooting direction; and determining the method for extracting target features in a part based on the simulated image and the three-dimensional image.

[0112] Once the first coordinate system is determined, and the Z-axis direction is already set, a simulated image obtained from photographing the actual workpiece can be generated based on the 3D image. This simulated image is a binary image, binarized based on height, which reduces interference information and improves the clarity of the contour information. Therefore, when programming on the 3D image, users can easily know the approximate position of the current selection area or scan line in the image of the actual workpiece.

[0113] In other embodiments, if there are multiple first coordinate systems, simulations can be performed based on each first coordinate system to obtain the simulated images obtained when the actual workpiece is photographed along the Z-axis of the corresponding first coordinate system.

[0114] In one optional embodiment, the target feature extraction method includes at least one of feature point extraction, feature line extraction, feature circle extraction, and feature plane extraction. The feature point extraction method includes at least one of manually selected feature point extraction and scan-based feature point extraction, wherein the scan-based feature point extraction method includes determining two first candidate points selected in the 3D image and scanning the boundary between the two first candidate points to obtain each feature point. The feature line extraction method includes determining at least two second candidate points selected in the 3D image, displaying a first sampling region in the simulation image based on the at least two second candidate points, and fitting each feature point selected in the first sampling region to obtain a feature line. The feature circle extraction method includes determining a feature circle selected in the 3D image and obtaining a target feature circle based on the selected feature circle. The feature plane extraction method includes determining a plane selected in the 3D image as a feature plane.

[0115] To facilitate understanding, the above-mentioned feature point extraction method, feature line extraction method, feature circle extraction method, and feature plane extraction method will be explained respectively.

[0116] Feature point extraction is the basis for other extraction methods. It includes at least one of the following: manually selecting and determining feature points and using feature points determined by scanning.

[0117] The manual selection method for determining feature points is called direct point selection. In other words, the terminal receives the point selection instruction through the 3D image and performs feature point recognition based on the location corresponding to the point selection instruction. Specifically, the user directly clicks to select a point on the 3D image, and the subsequent program will perform feature point recognition at that location.

[0118] The feature point-based method involves identifying two first candidate points in a 3D image and scanning the boundary between them to obtain the feature points. Specifically, the user directly clicks on two selected points in the 3D image, and the subsequent program execution can identify the boundary between the two selected points, thereby identifying the feature points located on the boundary. The boundary identification can be achieved by calculating the contrast at various positions along the line connecting the selected points and selecting the position with the highest contrast as the boundary between the lines.

[0119] The feature line extraction method may include the terminal receiving a selection instruction for second candidate points through a 3D image, then determining at least two second candidate points in the 3D image based on the selection instruction, and subsequently displaying a first sampling region in the simulation image based on the at least two second candidate points. During subsequent program execution, the program identifies multiple feature points within the corresponding first sampling region in the image and fits these multiple feature points to obtain a feature line. In this embodiment, the first sampling region can be a rectangular region, and multiple scan lines perpendicular to the direction of the line connecting the second candidate points can be set within the rectangular region. The boundaries of each scan line are identified, thereby identifying feature points located at the boundaries.

[0120] The feature circle extraction method includes: the terminal receives a feature circle selection instruction through a 3D image, and then obtains the target feature circle based on the selected feature circle. Specifically, it may include at least one of the following methods: fan-shaped point selection, ring-shaped point selection, multi-point point selection, and scan line point selection.

[0121] In some optional embodiments, the target feature circle is obtained based on the selected feature circle, including any of the following methods: generating a second sampling region based on the feature circle, and fitting the feature circle based on the identified feature points in the second sampling region; wherein the second sampling region is a fan-shaped sampling region or an annular sampling region; identifying a set of points at the boundary based on multiple selected points near the feature circle, and fitting the target feature circle based on the set of points; obtaining a set number of scan lines, generating each scan line passing through the feature circle in the simulation image, generating each feature point based on the scan lines, and fitting the target feature circle based on the generated feature points.

[0122] In this process, the fan-shaped sampling point can be formed when the user clicks on the feature circle in the 3D image, that is, the terminal receives the feature circle selection instruction through the 3D image, and then forms a fan-shaped second sampling point area near the feature circle in the simulated image. When the program is executed later, the program will identify the point set at the black and white boundary in the second sampling point area, and obtain the feature circle by fitting the point set, thereby confirming the position of the target feature circle on the part.

[0123] The difference between annular and sector-shaped sampling points lies in the fact that the second sampling area corresponding to an annular sampling point is a ring. The width of the ring can be adjusted, thereby expanding or shrinking the size of the second sampling area. Expanding the ring width prevents the feature circles on the actual part from deviating from their designed positions and failing to be recognized in the image during program execution. Shrinking the ring width improves the accuracy of feature circle recognition during program execution.

[0124] Multi-point selection means that the user clicks on multiple points near the feature circle in the 3D image, that is, receives a selection command. The selection command is used by the terminal to obtain multiple points near the feature circle. Near the feature circle can be understood as the distance between these selection points and the feature circle being within a preset distance range. When the program is executed later, the program will identify the set of points at the black and white boundary near the selection points and obtain the feature circle by fitting the point set.

[0125] The scan line sampling is performed by the user clicking on the feature circle in the 3D image and setting the number of scan lines. The system will generate multiple scan lines in the simulated image. Optionally, these multiple scan lines pass through the center of the feature circle and are centrally symmetrically distributed. When the program is executed subsequently, the program obtains the feature points in each scan line based on the scan line sampling of the feature points extracted above, and then fits a circle based on the feature points in the scan lines.

[0126] The feature plane extraction method includes receiving a plane selection instruction from a 3D image and using the selected plane in the 3D image as the feature plane based on the selection instruction.

[0127] The above embodiments provide the process for determining the extraction method of each target feature. Users can directly operate on the 3D image to determine the extraction method of each target feature, which is more intuitive and improves processing efficiency.

[0128] In one optional embodiment, determining the measurement method of the target feature in the part in the three-dimensional image includes: determining at least one of the target feature length measurement method, angle measurement method, and height measurement method in the three-dimensional image; wherein the length measurement method is used to measure the length of the target feature; the angle measurement method is used to measure the angle of the target feature; the height measurement method includes measuring the height corresponding to the target feature based on a laser rangefinder or measuring the height of the target feature based on a camera, wherein measuring the height of the target feature based on a camera includes: moving the camera above the target feature and moving the camera along the Z-axis, and when the quality of the image acquired by the camera meets the image quality requirements, the height of the camera is taken as the height of the target feature.

[0129] Before or after programming the target feature extraction method, programming can be performed to measure at least one of the target features, including length, angle, and height. For example, a distance measuring tool can be selected, and the distance between the target features can be displayed after selecting the corresponding target features. When the program is executed later, after the program completes the extraction of the target features, it will also perform the same analysis action of at least one of the length, angle, and height, so as to directly determine whether the processing of the part meets the design requirements.

[0130] For height measurement, points can be selected by clicking on a 3D image. The terminal receives the selection instruction and determines the corresponding feature point based on the instruction. During subsequent program execution, the lens of the image measuring instrument can move above the position corresponding to the selected feature point on the part and move the lens along the Z-axis to record the height when the field of view is clearest. When measuring height in this way, the magnification of the lens can be adjusted until the lens has a small depth of field. Therefore, when the lens moves to the vicinity of the height with the clearest field of view, the field of view can quickly become blurry or clear due to the small depth of field of the image measuring instrument lens, thus enabling a more accurate determination of the height.

[0131] In addition, for image measuring instruments equipped with laser rangefinders, the height of the selected feature points in the part can also be directly measured using the laser rangefinder.

[0132] During template programming, multiple tools can be used to identify different target features, and then analysis tools can be used to measure the length, angle and height of different target features, thereby enabling comprehensive inspection of the parts.

[0133] In one exemplary embodiment, such as Figure 4 As shown, a measurement method is provided, which is applied to... Figure 1 Taking the image measuring instrument as an example, the explanation includes the following steps S402 to S406. Wherein:

[0134] S402: Acquire the captured image to be processed.

[0135] In this embodiment, the automatic measurement process is formally initiated. The image testing instrument captures images of the part in real time to obtain an image to be processed, which is then used for feature extraction.

[0136] In some optional embodiments, the image to be processed can be an image captured by an image measuring instrument (e.g., an image under a lighting system such as bottom lighting, coaxial lighting, or ring lighting), or it can be a binary image obtained after processing. This binary image corresponds to the simulation image mentioned above, except that the simulation image is obtained through simulation.

[0137] S404: Establish a second coordinate system based on the image to be processed.

[0138] The second coordinate system is established based on the image to be processed. This second coordinate system can completely coincide with the first coordinate system, or it can not completely coincide with it; no specific limitation is made here. This is because the measurement program can identify various features over a relatively large range, so there is no need to limit the second coordinate system to completely coinciding with the first coordinate system, thereby reducing the difficulty of use for users.

[0139] The second coordinate system can be established in two ways: automatically and manually. Compared with the automatic method, the manual method is more suitable for workpieces with complex shapes or whose posture is difficult to identify directly from the contour.

[0140] In one optional embodiment, an example of an automatic establishment method is given, wherein the measurement program stores the overall contour of the part in the shooting direction during storage; establishing a second coordinate system based on the image to be processed includes: recognizing the posture of the part in the image to be processed based on the overall contour; and generating the second coordinate system based on the posture recognition result and the first coordinate system corresponding to the shooting direction.

[0141] In this embodiment, when saving the automatic measurement program, the approximate overall outline of the 3D image in the shooting direction can be saved. When the program is run subsequently, the workpiece posture in the image to be processed can be identified based on the approximate overall outline, thereby determining the first coordinate system corresponding to the outline with the highest similarity to the image to be processed. Then, a second coordinate system is generated based on the first coordinate system. When automatically generated, the second coordinate system basically coincides with the first coordinate system.

[0142] In one optional embodiment, an example of a manual establishment method is given, wherein the manual establishment method of the second coordinate system is similar to that of the first coordinate system. Specifically, the establishment of the second coordinate system based on the image to be processed includes: determining the fourth and fifth directions based on the part features in the image to be processed, determining the sixth direction based on the shooting direction, fitting the coordinate axes of the second coordinate system based on the fourth, fifth, and sixth directions; determining the origin of each coordinate axis of the second coordinate system based on the part features in the image to be processed; and determining the second coordinate system based on the coordinate axes of the second coordinate system and the origin of each coordinate axis of the second coordinate system.

[0143] The part is placed within the field of view of the image measuring instrument, and an image is captured to obtain the image to be processed. Two directions are defined on the image to be processed: a fourth direction and a fifth direction. The fourth and fifth directions correspond to the X-axis and Y-axis directions of the second coordinate system, respectively. The shooting direction is assumed to be the Z-axis direction of the second coordinate system. Thus, the second coordinate system can be fitted based on the two selected directions and the shooting direction. The origin of the Z-axis can be located on a plane that can be clearly displayed in the image measuring instrument.

[0144] S406: Measure the parts in the image to be processed based on the measurement program and the second coordinate system. The measurement program is generated based on the measurement program generation method in any of the above embodiments.

[0145] After the second coordinate system is established, the subsequent measurement program can identify each feature within a relatively large range and calculate the corresponding dimensions and other information for each feature.

[0146] In one alternative embodiment, combined with Figure 5 As shown, Figure 5 The following is a flowchart of a measurement method in one embodiment. First, a three-dimensional image is imported, which can be displayed in an interface where the user can rotate, move, or select features on the part.

[0147] Secondly, a first coordinate system is defined based on the three-dimensional image. The process of determining the first coordinate system includes: taking the shooting direction determined based on the part features in the three-dimensional image as the first direction, and determining the second direction based on the part features in the three-dimensional image; fitting the first direction and the second direction to obtain each coordinate axis of the first coordinate system; and determining the origin of each coordinate axis of each first coordinate system based on the part features in the three-dimensional image.

[0148] Third, determine the method for extracting target features.

[0149] Fourth, determine the measurement method for the target characteristics.

[0150] Fifth, save the measurement procedure file.

[0151] Sixth, the image measuring instrument photographs the part to obtain the image to be processed.

[0152] Seventh, define the second coordinate system and execute the saved measurement program file.

[0153] In the above measurement method, template programming can be performed directly on the 3D image, which can be based on different shooting directions, thus improving efficiency. Furthermore, programming based directly on the 3D image file of the part results in higher accuracy. Moreover, establishing the first coordinate system based on the 3D image ensures the accuracy of the first coordinate system, laying the foundation for the measurement accuracy of subsequent measurement processes.

[0154] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0155] Based on the same inventive concept, this application also provides a measurement program generation apparatus for implementing the measurement program generation method described above, as well as a measurement apparatus corresponding to the measurement method. The solution provided by this apparatus is similar to the implementation scheme described in the above method. Therefore, the specific limitations of one or more measurement program generation apparatuses and measurement apparatus embodiments provided below can be found in the limitations of the measurement program generation method and the measurement method described above, and will not be repeated here.

[0156] In one exemplary embodiment, such as Figure 6 As shown, a measurement program generation device for an image measuring instrument based on a spatial three-dimensional CAD model is provided, comprising: an import module 601, a first coordinate system generation module 602, and a measurement program generation module 603, wherein:

[0157] Import module 601 is used to import three-dimensional images of parts, including spatial three-dimensional CAD models;

[0158] The first coordinate system generation module 602 is used to take the shooting direction determined based on the part features in the three-dimensional image as the first direction, and determine the second direction based on the part features in the three-dimensional image, and fit the first direction and the second direction to obtain each coordinate axis of the first coordinate system; determine the first origin of the first coordinate axis in the first coordinate system based on the part features in the three-dimensional image, and determine the origin of other coordinate axes based on the part features that determine the first origin or other part features in the three-dimensional image.

[0159] The measurement program generation module 603 is used to generate a measurement program file based on the first coordinate system.

[0160] In one optional embodiment, the first coordinate system generation module 602 is further configured to determine a first direction based on at least one of the following methods: determining the shooting direction based on a straight line selected in the three-dimensional image, and using the shooting direction as the first direction; determining the shooting direction based on a first plane selected in the three-dimensional image, and using the shooting direction as the first direction.

[0161] In one optional embodiment, the first coordinate system generation module 602 is further configured to determine at least three non-collinear points among the parts selected in the three-dimensional image; generate a first plane based on the at least three non-collinear points; and determine the normal vector direction of the first plane as the shooting direction.

[0162] In one optional embodiment, the first coordinate system generation module 602 is further configured to determine the second direction based on at least one of the following methods: fitting a first straight line based on at least two points selected in a three-dimensional image, and determining the direction of the first straight line as the second direction; taking a straight line selected in a three-dimensional image as the first straight line, and determining the direction of the first straight line as the second direction.

[0163] In one optional embodiment, the first coordinate system generation module 602 is further configured to: obtain the origin of the X-axis of the first coordinate system based on the projection of the first selected point in the three-dimensional image onto the X-axis of the first coordinate system; generate a first option corresponding to the first selected point and a first option corresponding to the first straight line, and determine the origin of the Y-axis of the first coordinate system based on the first selection result of the first option corresponding to the first selected point and the first option corresponding to the first straight line, wherein when the first selection result is the first option corresponding to the first selected point, the origin of the Y-axis of the first coordinate system is obtained based on the projection of the first selected point onto the Y-axis of the first coordinate system; when the first selection result is the first option corresponding to the first straight line, the origin of the Y-axis of the first coordinate system is obtained based on the projection of the first straight line onto the Y-axis of the first coordinate system; generate The system generates a second option corresponding to a first selected point, a second option corresponding to a first straight line, and an option corresponding to a first plane. Based on the second selection results of these options, the origin of the Z-axis of the first coordinate system is determined. Specifically, if the second selection result is the second option corresponding to the first selected point, the origin of the Z-axis of the first coordinate system is obtained based on the projection of the first selected point onto the Z-axis of the first coordinate system; if the second selection result is the second option corresponding to the first straight line, the origin of the Z-axis of the first coordinate system is obtained based on the projection of the first straight line onto the Z-axis of the first coordinate system; and if the second selection result is the option corresponding to the first plane, the origin of the Z-axis of the first coordinate system is obtained based on the projection of the first plane onto the Z-axis of the first coordinate system.

[0164] In one optional embodiment, the measurement program generation module 603 is further configured to: determine the extraction method of target features in the part based on the first coordinate system and the three-dimensional image; determine the measurement method of target features in the part in the three-dimensional image; and generate a measurement program file based on the extraction method of target features, the measurement method of target features, and the first coordinate system.

[0165] In one optional embodiment, the measurement program generation module 603 is further configured to: perform simulation based on the first coordinate system and the three-dimensional image to obtain a simulation image when shooting along the shooting direction; and determine the extraction method of target features in the part based on the simulation image and the three-dimensional image.

[0166] In one optional embodiment, the target feature extraction method includes at least one of feature point extraction, feature line extraction, feature circle extraction, and feature plane extraction.

[0167] Feature point extraction methods include at least one of a method based on manual selection to determine feature points and a method based on scanning to determine feature points, wherein the method based on scanning to determine feature points includes determining two first candidate points selected in a three-dimensional image and scanning the boundary between the two first candidate points to obtain each feature point;

[0168] The feature line extraction method includes: determining at least two second candidate points selected in the three-dimensional image, displaying a first point selection area in the simulation image based on the at least two second candidate points, and fitting each feature point selected in the first point selection area to obtain a feature line;

[0169] Feature circle extraction methods include: determining the selected feature circles in the 3D image, and obtaining the target feature circle based on the selected feature circles;

[0170] Feature plane extraction methods include: determining a selected plane in a 3D image as the feature plane.

[0171] In one optional embodiment, the measurement procedure generation module 603 is further configured to determine the target feature circle based on any of the following methods: generating a second sampling region based on the feature circle, and fitting the feature circle based on the identified feature points in the second sampling region; wherein the second sampling region is a fan-shaped sampling region or an annular sampling region; identifying a set of points at the boundary based on multiple selected points near the feature circle, and fitting the target feature circle based on the set of points; obtaining a set number of scan lines, generating each scan line passing through the feature circle in the simulation image, generating each feature point based on the scan lines, and fitting the target feature circle based on the generated feature points.

[0172] In one optional embodiment, the measurement program generation module 603 is further configured to determine at least one of the following: a length measurement method, an angle measurement method, and a height measurement method for a target feature in a three-dimensional image; wherein the length measurement method is used to measure the length of the target feature; the angle measurement method is used to measure the angle of the target feature; and the height measurement method includes measuring the height of the target feature based on a laser rangefinder or measuring the height of the target feature based on a camera, wherein measuring the height of the target feature based on a camera includes: moving the camera above the target feature and moving the camera along the Z-axis, and when the quality of the image acquired by the camera meets the image quality requirements, the height of the camera is taken as the height of the target feature.

[0173] In one optional embodiment, the measurement program generation module 603 is further configured to generate a measurement program based on the target feature extraction method, the target feature measurement method, and the first coordinate system for different measurement surfaces when the image measuring instrument can only shoot along one shooting direction; and to store the target feature extraction method, the target feature measurement method, and the first coordinate system corresponding to each different measurement surface into a measurement program when the image measuring instrument includes multiple shooting directions.

[0174] In one exemplary embodiment, such as Figure 7 As shown, a fully automatic measuring device based on a spatial three-dimensional CAD model image measuring instrument is provided, including: an image acquisition module 701, a second coordinate system generation module 702, and a measurement module 703, wherein:

[0175] Image acquisition module 701 is used to acquire captured images to be processed;

[0176] The second coordinate system generation module 702 is used to establish a second coordinate system based on the image to be processed.

[0177] The measurement module 703 is used to measure the parts in the image to be processed based on the measurement program and the second coordinate system. The measurement program is generated based on the measurement program generation device in any of the above embodiments.

[0178] In one optional embodiment, the measurement program stores the overall contour of the part in the shooting direction during storage; the second coordinate system generation module 702 is further used to identify the posture of the part in the image to be processed based on the overall contour; and to generate a second coordinate system based on the posture identification result and the first coordinate system corresponding to the shooting direction.

[0179] In one optional embodiment, the second coordinate system generation module 702 is further configured to determine a fourth direction and a fifth direction based on the part features in the image to be processed, determine a sixth direction based on the shooting direction, and fit each coordinate axis of the second coordinate system based on the fourth direction, the fifth direction, and the sixth direction; determine the origin of each coordinate axis of the second coordinate system based on the part features in the image to be processed; and determine the second coordinate system based on each coordinate axis of the second coordinate system and the origin of each coordinate axis of the second coordinate system.

[0180] The various modules in the aforementioned measurement program generation device for the image measuring instrument based on a spatial 3D CAD model and the fully automatic measurement device for the image measuring instrument based on a spatial 3D CAD model can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0181] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements a measurement program generation method for an image measuring instrument based on a spatial 3D CAD model, and a fully automatic measurement method for the image measuring instrument based on a spatial 3D CAD model. The display unit of the computer device is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0182] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0183] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0184] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0185] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0186] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0187] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0188] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0189] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A three-dimensional model-based image measurement instrument measurement program generation method, characterized by, The method includes: Import a 3D image of the part, which includes a spatial 3D CAD model; The shooting direction determined based on the part features in the three-dimensional image is taken as the first direction, and the second direction is determined based on the part features in the three-dimensional image. The coordinate axes of the first coordinate system are obtained by fitting the first direction and the second direction. The first origin of the first coordinate axis in the first coordinate system is determined based on the part features in the three-dimensional image, and the origin of other coordinate axes is determined based on the part features that determined the first origin or other part features in the three-dimensional image. Generate a measurement program file based on the first coordinate system; The step of determining the first origin of the first coordinate axis in the first coordinate system based on the part features in the three-dimensional image, and determining the origin of other coordinate axes based on the part features used to determine the first origin or other part features in the three-dimensional image, includes: The origin of the X-axis of the first coordinate system is obtained by projecting the first selected point in the three-dimensional image onto the X-axis of the first coordinate system. Generate a first option corresponding to the first selected point and a first option corresponding to the first straight line, and determine the origin of the Y-axis of the first coordinate system based on the first selection result of the first option corresponding to the first selected point and the first option corresponding to the first straight line. Specifically, if the first selection result is the first option corresponding to the first selected point, the origin of the Y-axis of the first coordinate system is obtained by projecting the first selected point onto the Y-axis of the first coordinate system; if the first selection result is the first option corresponding to the first straight line, the origin of the Y-axis of the first coordinate system is obtained by projecting the first straight line onto the Y-axis of the first coordinate system. Generate a second option corresponding to the first selected point, a second option corresponding to the first straight line, and an option corresponding to the first plane. Based on the second selection results of these options, the origin of the Z-axis of the first coordinate system is determined. Specifically, if the second selection result is the second option corresponding to the first selected point, the origin of the Z-axis of the first coordinate system is obtained by projecting the first selected point onto the Z-axis. If the second selection result is the second option corresponding to the first straight line, the origin of the Z-axis of the first coordinate system is obtained by projecting the first straight line onto the Z-axis. If the second selection result is the option corresponding to the first plane, the origin of the Z-axis of the first coordinate system is obtained by projecting the first plane onto the Z-axis. The shooting direction is determined based on the location of the main feature; the process of fitting the coordinate axes of the first coordinate system based on the first and second directions includes: When the main features include multiple features and the shooting directions corresponding to the multiple main features are inconsistent, multiple first coordinate systems are generated based on the multiple first directions; In the case where the main feature includes one, a first coordinate system is generated based on a first direction; The generation of the measurement program file based on the first coordinate system includes: Generate a corresponding measurement program file based on each first coordinate system; The generation of corresponding measurement program files based on each first coordinate system includes: Based on the first coordinate system and the three-dimensional image, the method for extracting target features in the part is determined; Determine the measurement method for the target features in the part in the three-dimensional image; A measurement program file is generated based on the target feature extraction method, the target feature measurement method, and the first coordinate system; The method for determining the extraction method of target features in the part based on the first coordinate system and the three-dimensional image includes: Based on the Z-axis direction of the first coordinate system and the three-dimensional image, a simulated image of the actual workpiece is obtained, which is a binary image. Contour information determined based on the simulated image; The extraction method for target features in the part is determined based on the contour information.

2. The method according to claim 1, characterized in that, After importing the 3D image of the part, the following is also included: The instructions for rotating, moving, or selecting part features on the part are received through the three-dimensional image. Based on the instructions, rotate, move, or select part features on the part.

3. The method according to claim 2, characterized in that, The features of the part include points, lines, or surfaces.

4. The method according to claim 1, characterized in that, The target feature extraction method includes at least one of the following: feature point extraction method, feature line extraction method, feature circle extraction method, and feature plane extraction method; The feature point extraction method includes at least one of a method based on manual selection to determine feature points and a method based on scanning to determine feature points. The method based on scanning to determine feature points includes determining two first candidate points selected in the three-dimensional image and scanning the boundary between the two first candidate points to obtain each feature point. The feature line extraction method includes: determining at least two second candidate points selected in the three-dimensional image, displaying a first point selection area in the simulation image based on the at least two second candidate points, and fitting each feature point selected in the first point selection area to obtain a feature line; The feature circle extraction method includes: determining a selected feature circle in the three-dimensional image, obtaining a target feature circle based on the selected feature circle, including any of the following methods: generating a second sampling region based on the feature circle, fitting a feature circle based on the identified feature points in the second sampling region, wherein the second sampling region is a fan-shaped sampling region or an annular sampling region; identifying a set of points at the intersection based on multiple selected points near the feature circle, and fitting a target feature circle based on the set of points; and obtaining a set number of scan lines, generating each scan line passing through the feature circle in the simulation image, generating each feature point based on the scan lines, and fitting a target feature circle based on the generated feature points. The feature plane extraction method includes: determining a selected plane in the three-dimensional image as the feature plane.

5. The method according to claim 1, characterized in that, The measurement method for determining the target features in the part in the three-dimensional image includes: Determine at least one of the target feature length measurement method, angle measurement method, and height measurement method in the part in the three-dimensional image; The length measurement method described herein is used to measure the length of the target feature; The angle measurement method is used to measure the angle of the target feature; The height measurement method includes measuring the height corresponding to the target feature based on a laser rangefinder or measuring the height of the target feature based on a camera. The height measurement of the target feature based on a camera includes: moving the camera above the target feature and moving the camera along the Z-axis. When the quality of the image captured by the camera meets the image quality requirements, the height of the camera is taken as the height of the target feature.

6. The method according to claim 1, characterized in that, The method further includes: Acquire the captured image to be processed; A second coordinate system is established based on the image to be processed by means of an automatic establishment method and a manual establishment method. The manual establishment method is suitable for workpieces with complex shapes or whose posture cannot be directly identified from the contour. The parts in the image to be processed are measured based on the measurement program and the second coordinate system.