Method of size measurement and related apparatus
By acquiring a coarse positioning coordinate system, adjusting the light source, and using an image measurement device with a sub-pixel algorithm, the problems of labor costs and accuracy caused by manual intervention in image measurement devices are solved, and fully automated high-precision dimensional measurement is achieved.
Patent Information
- Application Number
- CN202410850277.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2044-06-27
AI Technical Summary
Existing image measurement devices require manual intervention during product size measurement, leading to increased labor costs and reduced measurement accuracy.
By controlling the second camera device to acquire the coarse positioning coordinate system of the workpiece to be measured, adjusting the brightness and position of the light source, analyzing the image using computer-aided design software, and performing image processing using a sub-pixel algorithm, fully automated dimensional measurement is achieved.
It enables high-precision dimensional measurement without manual intervention, reduces operational difficulty, and improves measurement accuracy and workpiece quality consistency.
Smart Images

Figure CN118640796B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of measurement technology, and in particular relates to a size measurement method and related equipment. Background Technology
[0002] In the industrial manufacturing sector, product dimensions need to be measured to ensure production efficiency and yield. Currently, image measurement devices (also known as machine vision systems) are commonly used to obtain product dimensional data by capturing images of the product. However, the product dimension measurement process using image measurement devices still requires manual intervention, such as manual point selection and manual output of dimensional data. This increases the labor costs of product dimension measurement. Furthermore, manual operation relies heavily on the operator's experience, which can easily lead to errors and reduce measurement accuracy. Summary of the Invention
[0003] In view of this, embodiments of this application provide a size measurement method and related equipment to solve the problem that the product size measurement process of the image measuring device requires manual intervention, which leads to increased labor costs and reduced measurement accuracy.
[0004] In a first aspect, embodiments of this application provide a size measurement method, the size measurement method comprising: controlling a first complete image of a workpiece to be measured on a measuring platform of a second camera device; obtaining a coarse positioning coordinate system of the workpiece to be measured based on the first complete image; adjusting the positions of a first light source and a second light source according to the coarse positioning coordinate system; adjusting the brightness of the first light source according to a first calibrated brightness; adjusting the brightness of the second light source according to a second calibrated brightness; capturing images of multiple areas of the workpiece to be measured based on the first complete image of the workpiece to be measured and the shooting range of the first camera device, obtaining multiple area images of the workpiece to be measured, and generating a second complete image of the workpiece to be measured based on the multiple area images; and obtaining size data of the workpiece to be measured based on the second complete image.
[0005] In one possible implementation, obtaining the coarse positioning coordinate system of the workpiece to be tested based on the first complete image includes: matching and positioning the contour of the first complete image with the contour of the workpiece to be tested to obtain the coarse positioning coordinate system of the workpiece to be tested.
[0006] In one possible implementation, adjusting the positions of the first light source and the second light source according to the coarse positioning coordinate system includes: obtaining the coordinate range of a specified contour on the workpiece under test in the coarse positioning coordinate system, and moving the first light source and the second light source from their current coordinate ranges to the coordinate range of the specified contour, respectively.
[0007] In one possible implementation, the step of capturing images of multiple regions of the workpiece under test based on the first complete image of the workpiece under test and the shooting range of the first camera device includes: setting the shooting range of the first camera device; dividing the first complete image of the workpiece under test into multiple regions according to the shooting range of the first camera device; controlling the measurement platform to move to move the workpiece under test, so that the multiple regions of the workpiece under test enter the shooting range of the first camera device one by one; controlling the first camera device to capture images of the corresponding regions that enter the shooting range, thereby obtaining multiple region images of the workpiece under test.
[0008] In one possible implementation, generating a second complete image of the workpiece under test based on the plurality of region images includes: using a first complete image of the workpiece under test as a template, stitching together the plurality of region images of the workpiece under test to generate a second complete image of the workpiece under test, wherein the resolution of the second complete image is greater than the resolution of the first complete image.
[0009] In one possible implementation, obtaining the dimensional data of the workpiece to be tested based on the second complete image includes: analyzing the position and dimension to be tested of the workpiece to be tested using computer-aided design software based on the second complete image and the design drawing of the workpiece to be tested; analyzing the position and dimension to be tested using the element generation tool of the computer-aided design software to determine the measurement elements of the workpiece to be tested; and determining the dimensional data of the workpiece to be tested based on the measurement elements.
[0010] In one possible implementation, the step of using the element generation tool of the computer-aided design software to analyze the position to be measured and the size to be measured to determine the measurement elements of the workpiece to be measured includes: the element generation tool employs a sub-pixel algorithm to perform edge finding on the second complete image based on the position to be measured and the size to be measured to determine the measurement elements of the workpiece to be measured.
[0011] In one possible implementation, the element generation tool employs a sub-pixel algorithm to perform edge finding on the second complete image based on the position to be measured and the size to be measured, thereby determining the measurement elements of the workpiece to be measured. This includes: performing grayscale processing on the second complete image; performing filtering processing on the grayscale-processed second complete image; using an edge detection algorithm to identify edge regions in the second complete image; using a sub-pixel algorithm to perform sub-pixel edge localization on the edge regions in the second complete image, determining the sub-pixel positions of the edges, with each sub-pixel position being an edge point; and connecting adjacent edge points through a tracking algorithm to form continuous edge lines, using the edge lines as the measurement elements of the workpiece to be measured.
[0012] In one possible implementation, determining the size data of the workpiece to be measured based on the measurement elements includes: determining the coordinate data of each edge point on the edge line based on the coordinate data of any position within the measurement area of the measurement platform, and calculating the size data of the workpiece to be measured based on the coordinate data of each edge point on the edge line.
[0013] In one possible implementation, the method further includes: generating a measurement program based on the dimensional data of the workpiece to be measured; and performing batch measurements on the dimensional data of multiple workpieces to be measured based on the measurement program.
[0014] In one possible implementation, the method further includes: calibrating the measurement platform of the measuring device to determine the coordinate data of any position within the measurement area of the measuring platform.
[0015] In one possible implementation, calibrating the measurement platform of the measuring device to determine the coordinate data of any position within the measurement area of the measuring platform includes: controlling the first camera device to capture an image of a calibration board within the measurement area; calculating the vertex coordinates of all squares on the calibration board based on the image of the calibration board and the parameters of the first camera device, and generating a first coordinate matrix based on all vertex coordinates; obtaining preset coordinates of all square vertices on the calibration board, and generating a second coordinate matrix based on all square vertices; performing a difference operation on the first coordinate matrix and the second coordinate matrix to obtain a difference operation result, and obtaining the coordinate data of any position within the measurement area based on the difference operation result.
[0016] In one possible implementation, the method further includes: calibrating the brightness of the first light source and the second light source to determine a first calibrated brightness of the first light source and a second calibrated brightness of the second light source.
[0017] In one possible implementation, calibrating the brightness of the first light source and determining a first calibrated brightness of the first light source includes: controlling the first light source to turn on; controlling the first camera device to capture images of the calibration component on the measurement platform under different first light source brightness levels, obtaining multiple first images corresponding to the calibration component; extracting the circular contours from each first image, fitting the multiple circular contours of the multiple first images to obtain a first fitted circle, and determining the radius of the first fitted circle; determining the first fitted circle that is closest to a preset radius, determining the brightness of the first light source corresponding to the first fitted circle, and determining the brightness of the first light source as the first calibrated brightness of the first light source.
[0018] Secondly, embodiments of this application provide a measuring device, which includes a processor and a memory. The memory is used to store instructions, and the processor is used to call the instructions in the memory to cause the measuring device to perform the above-described size measurement method.
[0019] Thirdly, embodiments of this application provide a computer-readable storage medium including computer instructions that, when executed on a measuring device, cause the measuring device to perform the dimensional measurement method described above.
[0020] The dimensional measurement method, measuring device, and storage medium provided in this application embodiment do not require manual adjustment of the light source during the dimensional measurement of the workpiece. They can intelligently and automatically illuminate the workpiece to obtain a clear and accurate image, thereby achieving high-precision dimensional measurement. Furthermore, this application embodiment can achieve fully automatic measurement of workpiece dimensions without manual intervention, reducing the operational difficulty of measurement, improving measurement accuracy, and ensuring the consistency of workpiece quality. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0022] Figure 1 This is a structural diagram of a measuring device provided in an embodiment of this application.
[0023] Figure 2 A flowchart of a dimension measurement method provided in an embodiment of this application.
[0024] Figure 3 A first complete image provided for an embodiment of this application.
[0025] Figure 4 This is a design drawing of the workpiece to be tested provided in one embodiment of this application.
[0026] Figure 5 This is a schematic diagram of the edge line of the workpiece to be tested provided in an embodiment of this application.
[0027] Figure 6 A flowchart of a dimension measurement method provided in another embodiment of this application.
[0028] Figure 7 A flowchart of a dimension measurement method provided in another embodiment of this application.
[0029] Figure 8An image of a calibration board provided in one embodiment of this application.
[0030] Figure 9 A schematic diagram of the actual vertices of a calibration board provided in an embodiment of this application.
[0031] Figure 10 This is a schematic diagram of a calibration differential algorithm provided in an embodiment of this application.
[0032] Figure 11 This is a schematic diagram of a calibration component provided in one embodiment of this application.
[0033] Figure 12 A first image of a calibration component provided in an embodiment of this application.
[0034] Figure 13 A second image of a calibration component provided in an embodiment of this application.
[0035] Figure 14 This is a schematic diagram of the hardware structure of a measuring device provided in an embodiment of this application. Detailed Implementation
[0036] To make the objectives, technical solutions, and advantages of this application clearer, the application will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0037] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and drawings of this application are used to distinguish similar objects, not to describe a specific order or sequence.
[0038] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner. Unless otherwise specified, the following embodiments and features described herein can be combined with each other.
[0039] See Figure 1The diagram shown is a structural diagram of a measuring device provided in one embodiment of this application. In one embodiment of this application, the measuring device 1 includes, but is not limited to: a first camera device 10, a lens 20, a second camera device 30, a first light source 40, a second light source 50, and a measuring platform 60. The measuring device 1 is used to measure the dimensions of a workpiece 70 placed on the measuring platform 60. The dimensional data of the workpiece 70 includes, but is not limited to: position, distance, angle, and shape tolerance.
[0040] In one embodiment of this application, the first imaging device 10 may be a CCD (Charge Coupled Device) camera, which uses a CCD image sensor to convert optical signals into digital signals to generate an image. The first imaging device 10 is used to capture images of the workpiece 70.
[0041] Lens 20 can be a zoom lens assembly. The focal length of the zoom lens can be adjusted, and it allows users to adjust the width of the field of view within a certain direction to obtain different magnification or field of view size. It also provides continuous zoom function, allowing users to smoothly adjust the focal length without fixed focal length steps.
[0042] The second camera device 30 is a zoom lens extension assembly, also known as a navigation optical system, which includes a CCD camera and a zoom lens assembly. The second camera device 30 is used to locate and align the workpiece by capturing detailed images of the workpiece, quickly obtaining the workpiece position for rapid measurement. It eliminates the need for manual intervention to move the measuring platform to the corresponding position on the workpiece, achieving fully automatic and intelligent workpiece positioning.
[0043] The first light source 40 is an upper surface light source, which is a multi-ring, multi-zone, and multi-angle illumination light source. By combining different illumination angles, the contrast of the surface position image of the measured part of the workpiece is enhanced, while stray light interference is reduced, thereby obtaining a high-contrast image. This makes the software edge-finding process efficient and reliable, ensuring detection repeatability. It can also highlight the chamfers and edges of the workpiece with high contrast, which is especially effective for detecting workpieces with irregular graphics, patterns, and shapes.
[0044] The second light source 50 is a bottom light source. The bottom light source controls the lighting through 256 brightness levels from 0 to 255, illuminating the boundary of the workpiece, thereby obtaining a clear contrast between light and dark at the workpiece boundary when taking pictures of the workpiece.
[0045] The measuring platform 60 provides a stable support and accurate measurement reference for the workpiece being measured. The measuring platform 60 includes three movement directions: X-axis, Y-axis, and Z-axis. The workpiece is placed on the measuring platform, and the measuring platform moves along the three axes to image the workpiece under the optical lens, so as to measure the overall appearance of the workpiece. The measuring platform can move along the three coordinate axes (X-axis, Y-axis, and Z-axis) to achieve precise positioning of a point in space.
[0046] See Figure 2 The diagram shown is a flowchart of a dimension measurement method provided in an embodiment of this application. The dimension measurement method is applied in... Figure 1 In the measuring device 1 shown, the dimension measurement method includes:
[0047] S201, control the second camera device to capture the first complete image of the workpiece to be measured on the measuring platform, and obtain the coarse positioning coordinate system of the workpiece to be measured based on the first complete image.
[0048] In one embodiment of this application, a robotic arm loads the workpiece to be measured onto a measuring platform, and a second camera device is controlled to capture a first complete image of the workpiece (e.g., ...). Figure 3 As shown in the figure, the workpiece contour is matched and positioned according to the contour of the first complete image to obtain the coarse positioning coordinate system of the workpiece to be tested.
[0049] In one embodiment of this application, a first complete image of the workpiece to be measured is input into CAD (Computer Aided Design) software. The CAD software matches and positions the contour of the first complete image with the pre-stored workpiece contour in the CAD software, outputting a coarse positioning coordinate system for the workpiece to be measured, thereby determining the posture of the workpiece. When the pre-stored workpiece contour in the CAD software coincides with the contour of the first complete image, the CAD software outputs the coordinate system corresponding to the current posture of the pre-stored workpiece contour as the coarse positioning coordinate system for the workpiece to be measured. Thus, the workpiece to be measured can be placed arbitrarily on the measurement platform. The coarse positioning coordinate system of the workpiece to be measured can be determined based on the length direction of the workpiece, the center of the workpiece, or other feature points of the workpiece.
[0050] S202, adjust the positions of the first light source and the second light source according to the coarse positioning coordinate system, adjust the brightness of the first light source according to the first calibrated brightness, and adjust the brightness of the second light source according to the second calibrated brightness.
[0051] In one embodiment of this application, a first light source and a second light source are moved to a position that can illuminate a specified contour on the workpiece, according to a coarse positioning coordinate system. Specifically, the X-axis and Y-axis coordinate ranges of the specified contour on the workpiece in the coarse positioning coordinate system are obtained, and the first and second light sources are moved from their current X-axis and Y-axis coordinate ranges to the X-axis and Y-axis coordinate ranges of the specified contour, respectively. In one embodiment of this application, the specified contour on the workpiece can be a region with boundaries or a region of a specified component.
[0052] In one embodiment of this application, a first light source and a second light source are turned on, and the brightness of the first light source is adjusted to a first calibrated brightness, and the brightness of the second light source is adjusted to a second calibrated brightness.
[0053] S203, based on the first complete image of the workpiece to be tested and the shooting range of the first camera device, multiple areas of the workpiece to be tested are photographed to obtain multiple area images of the workpiece to be tested, and a second complete image of the workpiece to be tested is generated based on the multiple area images.
[0054] In one embodiment of this application, the focal length of the lens is adjusted to set the shooting range of the first camera device. Based on the shooting range of the first camera device, a first complete image of the workpiece under test is divided into multiple regions. The measurement platform is controlled to move, causing the workpiece under test to move so that the multiple regions of the workpiece under test enter the shooting range of the first camera device one by one. Whenever a region enters the shooting range, the first camera device captures an image of the corresponding region, thereby obtaining multiple region images of the workpiece under test. The measurement platform can move the workpiece under test in a zigzag pattern, thus allowing the multiple regions of the workpiece under test to enter the shooting range of the first camera device one by one.
[0055] In one embodiment of this application, a first complete image of the workpiece to be tested is used as a template, and multiple region images of the workpiece are stitched together to generate a second complete image of the workpiece. The resolution of the second complete image is greater than that of the first complete image, resulting in higher clarity and effectively presenting the details of the workpiece.
[0056] S204. Based on the second complete image, obtain the dimensional data of the workpiece to be measured.
[0057] In one embodiment of this application, a second complete image and a design drawing of the workpiece to be measured are input into CAD software. The second complete image is superimposed on the design drawing. The CAD software is used to analyze the position and size of the workpiece to be measured. The element generation tool of the CAD software is used to analyze the position and size to be measured to determine the measurement elements of the workpiece to be measured. The size data of the workpiece to be measured is determined based on the measurement elements.
[0058] In one embodiment of this application, the design drawing of the workpiece to be measured is pre-marked with the location to be measured, and includes the dimensions to be measured. See also... Figure 4 The image shown is a design drawing of a workpiece to be tested according to an embodiment of this application. For example, the position to be tested includes edge line L1, edge line L2, and contours R1 and R2. The dimensions to be tested include the distance between edge lines L1 and L2, the radii of contours R1 and R2, and the distance between contours R1 and R2. The position to be tested and the dimensions to be tested in the design drawing of the workpiece to be tested are determined as the position to be tested and the dimensions to be tested of the workpiece to be tested.
[0059] In one embodiment of this application, the element generation tool is a tool used in CAD software to create design elements, such as lines, circles, arcs, polygons, text, and dimensions. The element generation tool employs a sub-pixel algorithm to find edges in a second complete image based on the position and size to be measured, thereby determining the measurement elements of the workpiece. Measurement elements are tools in CAD software used to annotate dimensions, angles, and other measurement information.
[0060] In one embodiment of this application, the second complete image is subjected to grayscale processing; the grayscale-processed second complete image is then filtered, for example, by smoothing filtering, to reduce image noise and preserve edge information; an edge detection algorithm is used to identify edge regions in the second complete image, such as the Canny edge detection algorithm, the Sobel operator, the Prewitt operator, etc.; a subpixel algorithm is used to perform subpixel edge localization on the edge regions in the second complete image to determine the subpixel positions of the edges, with each subpixel position being an edge point; adjacent edge points are connected by a tracking algorithm to form continuous edge lines, which are then used as measurement elements of the workpiece to be measured.
[0061] In one embodiment of this application, the sub-pixel algorithm includes, but is not limited to, gradient extremum method, fitting method, and least squares method. The gradient extremum method is used to find the point with the largest gradient magnitude along the edge region of the second complete image as the sub-pixel edge position. The fitting method is used to fit the pixels of the edge region in the second complete image into a curve, and the extreme points on the fitted curve are determined as the sub-pixel edge positions. The least squares method is used to fit the pixels on the edge region of the second complete image into multiple straight lines or curves, determine the parameters of the best-fitting straight line or curve, and determine the sub-pixel edge position of the edge region based on the parameters of the best-fitting straight line or curve.
[0062] See Figure 5The diagram shows a schematic representation of the edge line of a workpiece to be measured according to an embodiment of this application. The edge line of the workpiece includes edge line L3, edge line L4, contour line R3, and contour line R4. The dimensions to be measured of the workpiece include the distance between edge line L3 and edge line L4, the radii of contour line R3 and contour line R4, and the distance between contour line R3 and contour line R4. Based on the coordinate data of any position within the measurement area of the measurement platform, the coordinate data of each edge point on the edge line is determined, and the distance between any edge point on edge line L3 and edge line L4 is calculated to obtain the distance between edge line L3 and edge line L4. Contour line R3 and contour line R4 are circular. The distance between the center point of contour line R3 or contour line R4 and any edge point on the contour line is calculated to obtain the radius of contour line R3 or contour line R4. The distance between the leftmost edge point of contour line R3 and the rightmost edge point of contour line R4 is calculated to obtain the distance between contour line R3 and contour line R4.
[0063] For example, calculate the perpendicular distance between the midpoint of edge line L3 and edge line L4, and calculate the perpendicular distance between the midpoint of edge line L4 and edge line L3. Determine the smaller of the two perpendicular distances and set the smaller distance as the distance between edge line L3 and edge line L4.
[0064] See Figure 6 The diagram shown is a flowchart of a dimension measurement method provided in another embodiment of this application. The dimension measurement method is applied in... Figure 1 In the measuring device 1 shown, the dimension measurement method includes:
[0065] S601, control the second camera device to capture the first complete image of the workpiece to be measured on the measuring platform, and obtain the coarse positioning coordinate system of the workpiece to be measured based on the first complete image.
[0066] S602, adjust the positions of the first light source and the second light source according to the coarse positioning coordinate system, adjust the brightness of the first light source according to the first calibrated brightness, and adjust the brightness of the second light source according to the second calibrated brightness.
[0067] S603, based on the first complete image of the workpiece to be tested and the shooting range of the first camera device, multiple areas of the workpiece to be tested are photographed to obtain multiple area images of the workpiece to be tested, and a second complete image of the workpiece to be tested is generated based on the multiple area images.
[0068] S604, based on the second complete image, obtain the dimensional data of the workpiece to be measured.
[0069] S605 generates a measurement program based on the dimensional data of the workpiece to be measured.
[0070] In one embodiment of this application, a measurement program is automatically generated based on the dimensional data output by the CAD software. The measurement program includes, but is not limited to, measurement positions, edge-finding tools, and dimensional data. The generation tools of the CAD software need to be adjusted according to the workpiece dimensions captured by the first camera device; for example, the edge lines and contours of the workpiece require the combination of multiple tools to construct.
[0071] For example, the measurement procedure is as follows:
[0072] Line 1:
[0073] Go(10,20,50) / / Platform movement position: x=10, y=20, z=50
[0074] SETLIGHT(50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) / / Brightness value corresponding to each group of LEDs
[0075] SCANlINE(8|20,12|20,4) / / Tool start coordinates: 8|20; End coordinates: 12|20; Tool width: 4
[0076] Line 2:
[0077] Go(110,120,50)
[0078] SETLIGHT(50,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) / / Brightness value corresponding to each group of LEDs
[0079] SCANlINE(108|40,120|40,4)
[0080] Distance 1: (Line 1, Line 2, 20, 20.001, 0.001, -0.001) / / Distance is constructed from Line 1 and Line 2, 20 (theoretical value), 20.001 (measured value), 0.001 (upper tolerance), -0.001 (lower tolerance)
[0081] Circle 1:
[0082] Go(30,60,50) / / Platform movement position x=10,y=20,z=50
[0083] SCANCIRF(30|60,24,4) / / Coordinates of the center point of the circle tool: 30|60; Tool radius: 24; Tool width: 4
[0084] Radius 1: (Circle 1, 25.5, 25.49, 0.001, -0.001) / / Radius 1 is constructed from Circle 1, 25.5 (theoretical value), 25.49 (measured value), 0.001 (upper tolerance), -0.001 (lower tolerance).
[0085] S606, performs batch measurement of the dimensional data of multiple workpieces to be measured according to the measurement program.
[0086] In one embodiment of this application, the measuring device runs a measuring program to perform cyclic measurements, specifically cyclically from S201 to S204. Each cyclic measurement uses a single-step measurement method, converting the program into a tool, moving to the center position of the tool, automatically adjusting the lighting combination according to the measurement position, performing edge finding and sub-pixel analysis of the workpiece edge (Figure S20), fitting the measurement elements, outputting the workpiece size data, and finally automatically outputting a size list of all measuring programs.
[0087] See Figure 7 The diagram shown is a flowchart of a dimension measurement method provided in another embodiment of this application. The dimension measurement method is applied in... Figure 1 In the measuring device 1 shown, the dimension measurement method includes:
[0088] S701, calibrate the measuring platform of the measuring device to determine the coordinate data of any position within the measuring area of the measuring platform.
[0089] In one embodiment of this application, under a first light source, a first camera device is controlled to capture an image of a calibration plate within a measurement area. See also... Figure 8 The image shown is an image of a calibration plate provided in an embodiment of this application. The calibration plate includes multiple rectangular squares of the same side length and alternating black and white. The calibration plate is pre-placed within the measurement area of the measurement platform and covers the measurement range of the measurement platform.
[0090] In one embodiment of this application, the vertex coordinates of all squares on the calibration board are calculated based on the image of the calibration board and the parameters of the first camera device, and a first coordinate matrix K1 is generated based on all vertex coordinates. The parameters of the first camera device include extrinsic and intrinsic parameters. Specifically, feature recognition is first performed on the image of the calibration board to determine the vertices of all squares; the pixel coordinates of each square vertex on the calibration board are obtained based on the image of the calibration board and converted into image coordinates; the image coordinates of each square vertex are converted into camera coordinates based on the intrinsic parameters of the first camera device; and the camera coordinates of each square vertex are converted into world coordinates based on the extrinsic parameters of the first camera device, thereby obtaining the coordinates of each square vertex, and the coordinates of all square vertices are combined to form the first coordinate matrix K1.
[0091] Among them, according to the internal parameters of the first camera device The conversion formula used to convert the image coordinates (u,v) of each grid vertex to camera coordinates (x,y) is as follows:
[0092]
[0093] Among them, according to the external parameters of the first camera device The conversion formula used to convert the camera coordinates (x, y) of each grid vertex to world coordinates (Xw, Yw, Zw) is as follows:
[0094]
[0095] In the extrinsic parameters of the first camera device, R is the rotation matrix and T is the translation matrix.
[0096] See Figure 9 The diagram shown is a schematic representation of the actual vertices of a calibration board provided in an embodiment of this application. Preset coordinates of all grid vertices on the calibration board are obtained; these preset coordinates are the actual coordinates of the vertices. A second coordinate matrix K2 is formed based on the preset coordinates of all grid vertices. The measuring device 1 can pre-store the preset coordinates of all grid vertices on the calibration board, and it can also receive or transmit the preset coordinates of all grid vertices on the calibration board.
[0097] In one embodiment of this application, a difference operation is performed on the first coordinate matrix K1 and the second coordinate matrix K2 to obtain the difference operation result. The coordinate data of any position within the measurement area is then obtained based on the difference operation result. A difference operation is performed on the first coordinate matrix K1 and the second coordinate matrix K2 to obtain a difference matrix D. The calculated coordinates of any position within the measurement area are multiplied by the difference matrix D to obtain the coordinate data of any position within the measurement area. The calculated coordinates of any position within the measurement area are determined based on the memory and external parameters of the first camera device. For example, see [reference needed]. Figure 10 The diagram shown is a schematic of a calibration difference algorithm provided in an embodiment of this application. The coordinate data of point pt is obtained by calculating the difference between the measured coordinates of the vertex and the preset coordinates, and then calibrating the difference according to the aspect ratio of the squares on the calibration board.
[0098] In another embodiment of this application, each square in the calibration board has a preset length and a preset width. An image of the calibration board is captured by a first camera device, the vertices of each square in the calibration board are identified, the pixel coordinates of the square vertices are determined, the pixel coordinates of the square vertices are converted to world coordinates, and the operational length and operational width of the square are calculated based on the world coordinates of the square vertices. A first ratio between the operational length and the preset length and a second ratio between the operational width and the preset width are determined. The operational coordinates of any position within the measurement area are calibrated according to the first and second ratios to obtain coordinate data for any position within the measurement area. For example, the abscissa of the coordinate data of point pt within the measurement area is the product of the abscissa in the operational coordinates and the first ratio, the ordinate of the coordinate data of point pt is the product of the ordinate in the operational coordinates and the second ratio, and the operational coordinates of point pt are the world coordinates obtained by converting the pixel coordinates of point pt.
[0099] S702, calibrate the brightness of the first light source and the second light source, and determine the first calibrated brightness of the first light source and the second calibrated brightness of the second light source.
[0100] In one embodiment of this application, a calibration element (such as...) is placed on the measurement platform. Figure 11 As shown), the calibration component has a circular outline and a preset size, such as a preset radius. The first light source is turned on; the first camera device is controlled to capture images of the calibration component on the measurement platform under different brightness levels of the first light source, resulting in multiple first images of the calibration component (e.g., ...). Figure 12 As shown, circular contours are extracted from each first image, and multiple circular contours from multiple first images are fitted to obtain a first fitted circle. The radius of the first fitted circle is determined, and the first fitted circle closest to a preset radius is determined. The brightness of the first light source corresponding to the first fitted circle is determined, and this brightness is determined as the first calibrated brightness of the first light source. Specifically, the radius of each first fitted circle can be subtracted from the preset radius to obtain the difference between the radius of each first fitted circle and the preset radius. The first fitted circle with the smallest difference is determined as the first fitted circle whose radius is closest to the preset radius. In another embodiment of this application, the brightness range of the first light source corresponding to the brightness of the first light source is determined as the first calibrated brightness of the first light source. For example, the brightness range of the first light source is the brightness of the first light source ±10.
[0101] In one embodiment of this application, the second light source is turned on, and the first camera device is controlled to capture images of the calibration component on the measurement platform under different brightness levels of the second light source, thereby obtaining multiple second images (e.g., ...) corresponding to the calibration component. Figure 13As shown, the circular contours in each second image are extracted, and multiple circular contours from multiple second images are fitted to obtain a second fitted circle. The radius of the second fitted circle is determined, and the second fitted circle closest to the preset radius is determined. The brightness of the second light source corresponding to the second fitted circle is determined, and this brightness of the second light source is determined as the second calibrated brightness of the second light source. In another embodiment of this application, the brightness range of the second light source corresponding to the brightness of the second light source is determined as the second calibrated brightness of the second light source. For example, the brightness range of the second light source is the second light source brightness ±10.
[0102] In one embodiment of this application, both the first light source and the second light source include 256 brightness levels from 0 to 255.
[0103] S703, control the second camera device to capture the first complete image of the workpiece to be measured on the measuring platform, and obtain the coarse positioning coordinate system of the workpiece to be measured based on the first complete image.
[0104] S704, adjust the positions of the first light source and the second light source according to the coarse positioning coordinate system, adjust the brightness of the first light source according to the first calibrated brightness, and adjust the brightness of the second light source according to the second calibrated brightness.
[0105] S705, based on the first complete image of the workpiece to be tested and the shooting range of the first camera device, multiple areas of the workpiece to be tested are photographed to obtain multiple area images of the workpiece to be tested, and a second complete image of the workpiece to be tested is generated based on the multiple area images.
[0106] S706, based on the second complete image, obtain the dimensional data of the workpiece to be measured.
[0107] In one embodiment of this application, the method further includes: detecting the first light source and the second light source to ensure that the LEDs in the first and second light sources are working normally and their brightness has not decreased. Each LED in the light source is turned on one by one, and the brightness of each LED is set to a calibrated brightness. An image of the light is captured by a first camera device, and the grayscale value of the light image is calculated. The difference between the grayscale value of the light image and a preset grayscale value is calculated. If the absolute value of the difference is less than or equal to a preset grayscale value threshold, it is determined that the LED is working normally; if the absolute value of the difference is greater than the preset grayscale value threshold, it is determined that the brightness of the LED has decreased. The preset grayscale value is the grayscale value corresponding to the light image of the LED when calibrating the brightness of the light source. For example, the preset grayscale value threshold is 5, 8, 10, or other values.
[0108] See Figure 14 The diagram shown is a hardware structure schematic of a measuring device provided in an embodiment of this application. The dimension measurement method provided in this embodiment is applied to a measuring device 1, which includes, but is not limited to, a processor 110 and a memory 120 connected via a communication bus 130. Figure 14 This is merely an example of a measuring device and does not constitute a limitation thereof. In other embodiments, the measuring device may include more components than those shown in the figure.
[0109] The memory 120 may include one or more random access memory (RAM) and one or more non-volatile memory (NVM). The RAM can be directly read and written by the processor 110 and can be used to store executable programs (e.g., machine instructions) of the operating system or other running programs, as well as user and application data. The RAM may include static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), etc.
[0110] Non-volatile memory can also store executable programs and user and application data, and can be pre-loaded into random access memory for direct reading and writing by the processor 110. Non-volatile memory can include disk storage devices and flash memory.
[0111] The memory 120 is used to store one or more computer programs. The one or more computer programs are configured to be executed by the processor 110. The one or more computer programs include multiple instructions that, when executed by the processor 110, enable a dimensional measurement method to be performed on the measuring device 1.
[0112] In other embodiments, the measuring device 1 further includes an external memory interface for connecting to an external memory to expand the storage capacity of the measuring device 1.
[0113] Processor 110 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.
[0114] The processor 110 provides computing and control capabilities, for example, the processor 110 is used to execute computer programs stored in the memory 120 to implement the above-described dimensional measurement method.
[0115] The communication bus 130 is used to provide a channel for communication between the memory 120 and the processor 110 in the measuring device 1.
[0116] It is understood that the structure illustrated in the embodiments of this application does not constitute a specific limitation on the measuring device 1. In other embodiments of this application, the measuring device 1 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0117] This application also provides a computer-readable storage medium storing a computer program, the computer program including program instructions, and the method implemented when the program instructions are executed can refer to the methods in the above embodiments of this application.
[0118] The computer-readable storage medium can be the internal memory of the measuring device described in the above embodiments, such as the hard disk or memory of the measuring device. Alternatively, the computer-readable storage medium can be an external storage device of the measuring device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the measuring device.
[0119] In one embodiment of this application, the computer-readable storage medium may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function, etc.; and the data storage area may store data created based on the use of the measuring device, etc.
[0120] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0121] Those skilled in the art will recognize that the units and algorithms of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0122] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0123] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0124] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method of size measurement, characterized by, The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises:
2. The size measuring method of claim 1, wherein, The size measurement method comprises: The size measurement method comprises:
3. The size measuring method of claim 1, wherein, The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises:
4. The size measuring method of claim 1, wherein, The size measurement method comprises: The size measurement method comprises:
5. The method of claim 1, wherein, The size measurement method comprises: The size measurement method comprises: The size measurement method comprises:
6. The size measuring method of claim 5, wherein, The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size measurement method comprises: The size 7. The size measuring method of claim 6, wherein, The element generation tool adopts a sub-pixel algorithm to edge-detect the second complete image according to the to-be-measured position and the to-be-measured size, and determines the measurement elements of the to-be-measured workpiece, including: performing gray processing on the second complete image; performing filtering processing on the second complete image after the gray processing; adopting an edge detection algorithm to identify the edge region in the second complete image; adopting a sub-pixel algorithm to perform sub-pixel edge positioning on the edge region in the second complete image, to determine the sub-pixel positions of the edges, each of which is an edge point; connecting adjacent edge points through a tracking algorithm to form continuous edge lines, and taking the edge lines as the measurement elements of the to-be-measured workpiece.
8. The size measuring method of claim 7, wherein, The method further includes: determining the coordinate data of each edge point on the edge lines according to the coordinate data of any position in the measurement region of the measurement platform, and calculating the size data of the to-be-measured workpiece according to the coordinate data of each edge point on the edge lines.
9. The method of claim 1, wherein, The method further includes: generating a measurement program according to the size data of the to-be-measured workpiece; performing batch measurement on the size data of multiple to-be-measured workpieces according to the measurement program.
10. The method of claim 1, wherein, The method further includes: calibrating the measurement platform to determine the coordinate data of any position in the measurement region of the measurement platform.
11. The size measuring method of claim 10, wherein, The method further includes: controlling the first camera to capture an image of a calibration board in the measurement region; calculating the vertex coordinates of all the squares on the calibration board according to the image of the calibration board and the parameters of the first camera, and generating a first coordinate matrix according to all the vertex coordinates; obtaining the preset coordinates of all the square vertices on the calibration board, and generating a second coordinate matrix according to the preset coordinates of all the square vertices; performing difference operation on the first coordinate matrix and the second coordinate matrix to obtain a difference operation result, and obtaining the coordinate data of any position in the measurement region according to the difference operation result.
12. The method of claim 1, wherein, The method further includes: calibrating the brightness of the first light source and the second light source to determine the first calibration brightness of the first light source and the second calibration brightness of the second light source.
13. The size measuring method of claim 12, wherein, The method further includes: controlling the first light source to be turned on; controlling the first camera to capture images of a calibration piece on the measurement platform under different brightness of the first light source, to obtain multiple first images corresponding to the calibration piece; extracting the circular contour in each first image, fitting multiple circular contours of the multiple first images to obtain a first fitting circle, and determining the radius of the first fitting circle; determining the first fitting circle closest to the preset radius, determining the first light source brightness corresponding to the first fitting circle, and taking the first light source brightness as the first calibration brightness of the first light source.
14. A measuring device, characterized by The measurement device comprises a processor and a memory for storing instructions, the processor being configured to invoke the instructions in the memory to cause the measurement device to perform the method of any of claims 1 to 13.
15. A computer-readable storage medium, characterized in that, Computer instructions are included which, when executed on a measurement device, cause the measurement device to perform the method of any of claims 1 to 13.
Citation Information
Patent Citations
Object size measuring method, apparatus and system
CN108240793A
Image measuring instrument capable of automatically adjusting position of to-be-measured sample and measuring method
CN111623709A