Dimension measurement method, device, electronic device and medium based on machine vision

Through the multi-camera system, the measurement images of the target object are collected and processed, and coordinate conversion is performed using calibration parameters, which solves the problems of low efficiency and low accuracy of large-size objects, and realizes high-precision dimensional measurement, which is suitable for large-size objects. Measurement.

CN118882485BActive Publication Date: 2025-02-14HANGZHOU BAIZIJIAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411356127.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-02-14
Estimated Expiration
2044-09-27

AI Technical Summary

Technical Problem

The prior art has problems of low measurement efficiency and inaccurate measurement results in the measurement of large-sized objects, and there are strict requirements on the camera installation position.

Method used

By acquiring multiple measurement images collected by multiple cameras on the target object, determining the image coordinate data of the corner points in the measurement image, and performing coordinate space conversion based on the calibration parameter information, obtaining the physical coordinate data of the corner points in the global coordinate system. Then calculate the measurement result of the target object.

Benefits of technology

It realizes high-precision dimension measurement of large-sized objects without high-precision calibration plates, reduces the requirements for camera installation position, and improves the operability, efficiency and accuracy of measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118882485B_ABST
    Figure CN118882485B_ABST
Patent Text Reader

Abstract

The present invention discloses a dimension measurement method, device, electronic device and medium based on machine vision. The method comprises: obtaining multiple measurement images collected by multiple cameras on a target object, wherein any measurement image includes a corner point of the target object and parts of two edges to be measured corresponding to the corner point, and different test images include different corner points of the target object; for any measurement image, determining the image coordinate data of the corner point in the measurement image, performing coordinate space conversion on the image coordinate data of the corner point in the measurement image based on calibration parameter information, and obtaining the physical coordinate data of the corner point in the measurement image in the global coordinate system; determining the distance data between any two corner points based on the physical coordinate data of the multiple corner points corresponding to the target object, and determining the dimension measurement result of the target object based on the distance data. The method realizes the dimension measurement of large-sized objects based on machine vision technology, and improves the operability, accuracy and rapidity of dimension measurement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine vision technology, and in particular to a size measurement method, device, electronic equipment and medium based on machine vision. Background Art

[0002] The measurement of large-sized objects is usually carried out through manual measurement, or calibration is performed using a global checkerboard method using multiple cameras. However, it is impossible to produce a high-precision calibration plate that matches the large-sized objects, and it is impossible to complete the size measurement of large-sized objects. There are related technologies that calculate the size by calibrating the non-overlapping areas between cameras, superimposing the lengths detected in the cameras, and calculating the sum of the lengths of three segments. However, this method cannot determine the problem of material angles in the non-overlapping areas, resulting in unsatisfactory final results.

[0003] When using a camera to measure dimensions, it is often restricted by the camera's installation conditions and the actual operator's level of use, which can easily lead to calibration failures. If the camera's installation location does not meet the requirements, it will greatly affect the accuracy of the measurement results, resulting in problems such as low measurement efficiency and inaccurate measurement results. Summary of the invention

[0004] The present invention provides a dimension measurement method, device, electronic device and medium based on machine vision to solve the problems of low measurement efficiency and inaccurate measurement results, as well as strict requirements on the camera installation position in the prior art.

[0005] According to one aspect of the present invention, a size measurement method based on machine vision is provided, comprising:

[0006] Acquire multiple measurement images of the target object captured by multiple cameras, wherein any measurement image includes a corner point of the target object and parts of two edges to be measured corresponding to the corner point, and different test images include different corner points of the target object;

[0007] For any measurement image, determine the image coordinate data of the corner points in the measurement image, perform coordinate space transformation on the image coordinate data of the corner points in the measurement image based on the calibration parameter information, and obtain the physical coordinate data of the corner points in the measurement image in the global coordinate system;

[0008] The distance data between any two corner points is determined based on the physical coordinate data of the multiple corner points corresponding to the target object, and the size measurement result of the target object is determined based on the distance data.

[0009] Optionally, the calibration parameter information includes single-pixel physical size data corresponding to the image coordinate system where the measured image is located and the starting point position data of the image coordinate system; the image coordinate data of the corner points in the measured image are converted into a coordinate space based on the calibration parameter information, including: determining the physical coordinate data corresponding to the corner points in the measured image based on the image coordinate data of the corner points in the measured image and the corresponding single-pixel physical size data; determining the physical coordinate data of the corner points in the measured image in the global coordinate system based on the physical coordinate data corresponding to the corner points in the measured image and the starting point position data of the image coordinate system corresponding to the measured image.

[0010] Optionally, the image coordinate system corresponding to any camera among the multiple cameras is the reference image coordinate system, and the image coordinate systems corresponding to other cameras among the multiple cameras are set as the image coordinate system to be corrected; determining the starting point position data of the image coordinate system, including: for any image coordinate system to be corrected, determining the distance data between the starting point of the image coordinate system to be corrected and the starting point of the reference image coordinate system, wherein the distance data includes the distance data in the direction of the horizontal coordinate axis and the distance data in the direction of the vertical coordinate axis; determining the starting point position data of the image coordinate system corresponding to the image coordinate system to be corrected based on the distance data and the coordinate data of the starting point of the reference image coordinate system.

[0011] Optionally, determining the distance data between the starting point of the coordinate system of the image to be corrected and the starting point of the reference image coordinate system includes: obtaining multiple test images of the test object captured by multiple pre-installed cameras, wherein the cameras pre-installed in the same direction are on the same horizontal line, and the fields of view of each camera do not overlap, and the test object is an object of standard size; obtaining the actual physical coordinate data and test angle data of the first test corner point in the test image corresponding to the reference image coordinate system; obtaining the standard size data between the first test corner point and the second test corner point in the horizontal axis direction and the vertical axis direction, respectively, wherein the second test corner point is a test corner point in any test image corresponding to the coordinate system of the image to be corrected; determining the offset distance data of the second test corner point relative to the first test corner point based on the standard size data and the test angle data, and determining the coordinate offset data of the second test corner point relative to the starting point of the reference image coordinate system based on the offset distance data and the actual physical coordinate data of the first test corner point; determining the difference between the coordinate offset data of the second test corner point relative to the starting point of the reference image coordinate system and the physical coordinate data of the second test corner point in the coordinate system of the image to be corrected, so as to obtain the distance data between the starting point of the coordinate system of the image to be corrected and the starting point of the reference image coordinate system.

[0012] Optionally, determining the physical coordinate data of the second test corner point in the coordinate system of the image to be corrected includes: obtaining first angle data of the corner point in the measured image corresponding to the reference image coordinate system; in any image coordinate system to be corrected, obtaining second angle data of the corner point in the measured image corresponding to the image coordinate system to be corrected, and determining the angle deviation between the first angle data and the second angle data; determining weight data of the physical coordinate data of the second test corner point in the coordinate system of the image to be corrected based on the angle deviation data, adjusting the physical coordinate data of the second test corner point in the coordinate system of the image to be corrected based on the weight data, and using the adjusted physical coordinate data as the physical coordinate data of the second test corner point in the coordinate system of the image to be corrected.

[0013] Optionally, determining a size measurement result of the target object based on the distance data includes: for any distance data, determining a corresponding adaptive adjustment parameter based on identification information of a measurement image to which two corner points corresponding to the distance data belong, wherein the identification information has a corresponding relationship with the camera; and adjusting the distance data based on the adaptive adjustment parameter to obtain a size measurement result between the two corner points corresponding to the distance data.

[0014] Optionally, the method also includes: obtaining type index data of the target object, and determining a preset standard size threshold range based on the type index data; performing a conformity check on the size measurement results of the target object based on the preset standard size threshold range, if the size measurement results of the target object all meet the preset standard size threshold range, then the target object is determined to be qualified, and if any one of the size measurement results of the target object does not meet the preset standard size threshold range, then the target object is determined to be unqualified.

[0015] According to another aspect of the present invention, there is provided a dimension measuring device based on machine vision, comprising:

[0016] A measurement image acquisition module is used to acquire multiple measurement images of a target object captured by multiple cameras, wherein any measurement image includes a corner point of the target object and parts of two edges to be measured corresponding to the corner point, and different test images include different corner points of the target object;

[0017] A corner point physical coordinate data determination module is used to determine the image coordinate data of the corner points in the measurement image for any measurement image, and to perform coordinate space transformation on the image coordinate data of the corner points in the measurement image based on the calibration parameter information to obtain the physical coordinate data of the corner points in the measurement image in the global coordinate system;

[0018] The size measurement result determination module is used to determine the distance data between any two corner points based on the physical coordinate data of multiple corner points corresponding to the target object, and determine the size measurement result of the target object based on the distance data.

[0019] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0020] at least one processor; and

[0021] a memory communicatively connected to at least one processor; wherein,

[0022] The memory stores a computer program that can be executed by at least one processor. The computer program is executed by at least one processor so that the at least one processor can execute the dimension measurement method based on machine vision according to any embodiment of the present invention.

[0023] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the machine vision-based dimension measurement method of any embodiment of the present invention when executed.

[0024] The technical solution of the embodiment of the present invention is to obtain multiple measurement images of the target object collected by multiple cameras, wherein any measurement image includes a corner point of the target object and parts of two edges to be measured corresponding to the corner point, and different test images include different corner points of the target object; for any measurement image, determine the image coordinate data of the corner point in the measurement image, perform coordinate space transformation on the image coordinate data of the corner point in the measurement image based on calibration parameter information, and obtain physical coordinate data of the corner point in the measurement image in a global coordinate system; determine distance data between any two corner points based on the physical coordinate data of the multiple corner points corresponding to the target object, and determine the size measurement result of the target object based on the distance data, so as to realize processing of multiple measurement images collected by the camera on the target object, perform coordinate space transformation on the image coordinate data of the corner point in each measurement image based on calibration parameter information, obtain physical coordinate data of each corner point in a global coordinate system, and determine distance data based on the physical coordinate data to obtain the size measurement result of the target object, so as to solve the problem that the size measurement cannot be performed without a high-precision calibration plate, and there is no need to strictly require the installation position of the camera, so as to improve the operability, efficiency and accuracy of the size measurement of the target object, especially the size measurement of large-sized target objects.

[0025] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0027] Figure 1 is a flow chart of a dimension measurement method based on machine vision provided in the first embodiment of the present invention;

[0028] Figure 2 is a schematic diagram of an image of a copper-clad laminate photographed by a camera applicable to an embodiment of the present invention;

[0029] Figure 3 is a schematic diagram of an image of a copper-clad laminate photographed by a camera applicable to an embodiment of the present invention;

[0030] Figure 4 is a schematic diagram of an image of a copper-clad laminate photographed by a camera applicable to an embodiment of the present invention;

[0031] Figure 5 is a schematic diagram of an image of a copper-clad laminate photographed by a camera applicable to an embodiment of the present invention;

[0032] Figure 6 It is a dimension measurement result display diagram applicable to the embodiment of the present invention;

[0033] Figure 7 is a flow chart of a size measurement method based on machine vision provided in the second embodiment of the present invention;

[0034] Figure 8 is a schematic diagram showing a test object applicable to an embodiment of the present invention;

[0035] Fig. 9 is a schematic diagram showing an image coordinate system where a test image applicable to an embodiment of the present invention is located;

[0036] Fig.10 is a structural schematic diagram of a dimension measuring device based on machine vision provided in Embodiment 3 of the present invention;

[0037] Fig.11 It is a structural schematic diagram of an electronic device for implementing the dimension measurement method based on machine vision according to an embodiment of the present invention. DETAILED DESCRIPTION

[0038] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0039] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0040] Embodiment 1

[0041] Figure 1 This is a flow chart of a dimension measurement method based on machine vision provided by the first embodiment of the present invention. This embodiment is applicable to the case of measuring the dimensions of objects with regular shapes. The method can be performed by a dimension measurement device based on machine vision. The dimension measurement device based on machine vision can be implemented in the form of hardware and / or software. The dimension measurement device based on machine vision can be configured in electronic devices such as computers and controllers. Figure 1 As shown, the method includes:

[0042] S110, acquiring multiple measurement images of the target object captured by multiple cameras, wherein any measurement image includes a corner point of the target object and parts of two edges to be measured corresponding to the corner point, and different measurement images include different corner points of the target object.

[0043] The target object can be specifically understood as an object to be measured in size. The shape feature of the object to be measured is regular, including at least two corner points, and there is a straight line segment between two adjacent corner points. Multiple cameras are used to collect image data of the target object. The cameras include but are not limited to area array cameras and line array cameras, which can be selected according to actual needs. Preferably, in this embodiment, an area array camera is used for measurement image acquisition. The collected measurement image needs to satisfy the requirement that the image includes a corner point of the target object and the parts of the two edges to be measured corresponding to the corner point, wherein the edge to be measured refers to the edge between two adjacent corner points of the target object, and the corner points in each measurement image are different corner points of the target object.

[0044] Specifically, when an object to be measured is placed in a detection area by a pre-set detection device, multiple cameras are started to capture images of the object, wherein the object entering the detection area is the target object, and the detection area can be understood as an area consisting of the photographable areas of multiple cameras. Multiple cameras are used to capture images of the target object to obtain multiple measurement images, wherein each measurement image includes a corner point of the target object and parts of two edges to be measured corresponding to the corner point. It can be understood that if no corner point is identified in the captured measurement image, the measurement image is invalid image data and is directly deleted.

[0045] It should be noted that before collecting the measurement image through the camera, the camera needs to be calibrated. The camera calibration method includes but is not limited to the Zhang Zhengyou calibration method, the absolute quadratic surface calibration method and the plane orthogonal calibration method. Preferably, the Zhang Zhengyou calibration method is used for camera calibration. The calibration steps are as follows:

[0046] 1. For each camera, place the chessboard in the camera field of view and shoot n groups of chessboard images in different positions. Preferably, n=10.

[0047] 2. Use this set of images to solve the camera intrinsic parameters. The following is the calibration formula for the entire camera model:

[0048]

[0049] The above formula can be expressed as: ;

[0050] Among them, the image coordinates ; Scale factor , internal parameter matrix , external parameter matrix , world coordinates .

[0051] Since the purpose is to perform distortion correction and single-pixel mapping on the image, it is only necessary to save the M matrix solved above to complete the camera calibration processing, where fx and fy in the M matrix represent the physical distance in the x-axis direction and the physical distance in the y-axis direction of a single pixel in the image coordinate system corresponding to the camera, respectively.

[0052] Exemplarily, four high-speed CCD area array cameras are used to capture images of a target object, wherein the target object is a copper-clad laminate material having four corner points. The four corner areas of the copper-clad laminate material are photographed by the area array cameras without overlapping areas between the images, and four measurement images corresponding to the four corner areas are obtained, each measurement image including the corner point of the corresponding corner area and parts of two edges to be measured corresponding to the corner point.

[0053] The above method is used to calibrate the cameras in the camera group. Image acquisition is performed based on the calibration, which can avoid measurement errors caused by camera distortion. At the same time, the mapping relationship between the camera's single pixel and the actual distance is determined, which helps to determine the size data of the edge to be measured and improve the measurement accuracy of the target object's size.

[0054] S120. For any measurement image, determine image coordinate data of corner points in the measurement image, perform coordinate space transformation on the image coordinate data of corner points in the measurement image based on calibration parameter information, and obtain physical coordinate data of corner points in the measurement image in a global coordinate system.

[0055] The image coordinate data refers to the pixel coordinates of the corner points in the measured image in the corresponding camera coordinate system. The measured image can be processed by a custom corner point recognition algorithm to obtain the image coordinate data of the corner points in the measured image in the image coordinate system.

[0056] The calibration parameters can be specifically understood as being used to perform spatial transformation on the image coordinate system corresponding to the measured image so as to unify it into the global coordinate system. The parameters can be set in advance. When coordinate space transformation is required, the corresponding calibration parameters can be directly called. The calibration parameter information includes but is not limited to the single-pixel physical size data corresponding to the image coordinate system where the measured image is located and the starting point position data of the image coordinate system. The single-pixel physical size data represents the actual physical size data corresponding to the single pixel in the camera coordinate system. The image coordinate correction data is used to correct the image coordinate data corresponding to the measured image collected when the camera installation in the same direction does not meet the horizontal requirements. The starting point position data of the image coordinate system specifically represents the starting position of the origin of the image coordinate system in the preset global coordinate system, and is used to complete the coordinate space transformation of the image coordinate data of the corner point in the measured image. The calibration parameters of the corresponding measured image can be matched according to the identification information of the preset calibration parameter information. For any measured image, the identification information of the measured image and the identification information of the corresponding calibration parameter information are identical or have a one-to-one mapping relationship. The identification information can be set according to the device information of the corresponding camera, and the identification information is unique. Among them, the global coordinate system can be specifically set to the plane coordinate system where the reference coordinate system is located, wherein the reference coordinate system can be any one of the image coordinate systems corresponding to multiple cameras. It should be noted that once the reference coordinate system is determined, the reference coordinate system remains unchanged during the process of dimensional measurement with the current multiple cameras. In this way, there is no need to determine the corresponding calibration parameters according to different reference coordinate systems, thereby reducing the amount of calculation.

[0057] The coordinate space conversion specifically transforms the measured image into the global coordinate system to determine the coordinate data of the corner points in each measured image in the global coordinate system, so that the corresponding size data can be directly determined according to the coordinate data of each corner point in the global coordinate system.

[0058] Specifically, after acquiring multiple measurement images, a custom corner point recognition algorithm is called to process the measurement images to obtain image coordinate data of the corner points in each measurement image, and corresponding calibration parameter information is matched from the target storage space according to the identification information of each measurement image. According to the matched calibration parameter information, the image coordinate data of the corner points in the measurement image are spatially transformed to obtain the physical coordinate data of the corner points in the measurement image in the global coordinate system.

[0059] The collected image data is processed to determine the positioning data of the corner points in the image data, and specifically identify the two straight lines on the corner area of ​​the target object on the image data. For the positioning of the straight line, the edges are segmented. For the horizontal edge, the upper and lower local pixel points need to be satisfied:

[0060]

[0061] Among them, Hp represents a set of coordinate points that meet the requirements, i represents one of the coordinate points that meets the horizontal edge, and (x, y) respectively represent the position of the current pixel. are the grayscale values ​​of the current pixel, and T is the set threshold. In the image data, the grayscale values ​​of the pixels in the upper and lower areas of the local pixel meet the requirements of the above formula. We take the current coordinate point as a candidate point and store it in the container. For the vertical edge, the left and right local pixels need to meet the following requirements:

[0062]

[0063] Among them, Vp represents the set of coordinate points that meet the requirements, j represents one of the vertical edges that meets the requirements for calibration. (x, y) respectively represent the position of the current pixel. are the grayscale values ​​of the current pixel, T is the set threshold. In the image data, the grayscale values ​​of the pixels in the left and right fields of the local pixel meet the requirements of the above formula. We take the current coordinate point as a candidate point and store it in the container.

[0064] The least squares algorithm is used to fit the horizontal and vertical straight line candidate points obtained above to find the corresponding straight line. After solving the horizontal and vertical straight lines, the corner points of the target object can be found according to the intersection of the two straight lines. For example, the target object is a copper clad laminate, such as Figures 2 to 5 They are schematic diagrams of images of copper-clad boards taken by a camera and the corner positions of target objects calculated based on algorithms.

[0065] In this embodiment, the image coordinate data of the corner points in the measured image are converted into coordinate space through calibration parameter information to obtain the physical coordinate data of the corner points in the measured image in the global coordinate system, thereby realizing rapid determination of the physical coordinate data of the corner points in the measured image in the global coordinate system, simplifying the process of determining the physical coordinate data of the corner points of the target object, and helping to improve the measurement efficiency and speed of the size measurement data of the target object.

[0066] S130 , determining distance data between any two corner points based on physical coordinate data of multiple corner points corresponding to the target object, and determining a size measurement result of the target object based on the distance data.

[0067] Specifically, when the physical coordinate data of multiple corner points corresponding to the target object are determined, the physical coordinate data of each corner point are traversed, and the distance data between any two corner points is calculated by the coordinate distance calculation formula. If any two corner points are adjacent corner points, then the distance data is the size measurement result of the side to be measured between the two corner points. The distance data between each adjacent corner point is determined in sequence to obtain the size measurement result of each side to be measured of the target object.

[0068] Optionally, determining a size measurement result of the target object based on the distance data includes: for any distance data, determining a corresponding adaptive adjustment parameter based on identification information of a measurement image to which two corner points corresponding to the distance data belong, wherein the identification information has a corresponding relationship with the camera; and adjusting the distance data based on the adaptive adjustment parameter to obtain a size measurement result between the two corner points corresponding to the distance data.

[0069] It can be understood that the line segment between the corner points in the measurement images captured by adjacent cameras corresponds to a side to be measured of the target object, and different sides to be measured correspond to different adaptive adjustment parameters. The identification information of the two measurement images captured by adjacent cameras can be pre-set as the key information of the corresponding adaptive adjustment parameters. The key information and the corresponding adaptive adjustment parameters can be stored in the target storage space, and the adaptive adjustment parameters of the corresponding measurement image are determined by matching the key information, which are used to adjust the distance data between the corner points in the measurement image. It should be noted that the camera and the measurement image are one-to-one corresponding, and the identification information of the measurement image can be set according to the camera information. The camera information includes but is not limited to the camera number, camera name and camera identification number, which are not limited here.

[0070] Specifically, for any distance data, the identification information of the measurement image to which the two corner points corresponding to the distance data belong is obtained, matching is performed from the preset storage space according to the identification information, and the corresponding adaptive adjustment parameters are matched, and the distance data is adjusted according to the matched adaptive adjustment parameters to compensate for the error of the calculated distance data, and the size measurement result between the two corner points corresponding to the distance data is obtained. Accordingly, each distance data is adjusted by the corresponding adaptive adjustment parameter to obtain the size measurement result of the target object.

[0071] In a specific embodiment, the target object is a copper clad laminate. During the actual measurement process, there may be an error between the measured value and the standard value of the target object. The error comes from the authenticity of the calibration value.

[0072]

[0073] In the above formula, is the upper length of the copper clad board measured by the system, is the upper length of the copper clad board measured by the system, is the length of the bottom side of the copper clad board measured by the system, The right side length of the copper clad board measured by the system. are the true calibration value errors respectively. , , and Can get closer , need to calculate , that is, the adaptive adjustment parameter. The calculation method is:

[0074]

[0075]

[0076] in, , c represents the type index value of copper clad laminates of different sizes, cls represents the type of copper clad laminates of different sizes, ,i represents the index value of the number of copper clad boards detected, and num represents the number of all copper clad boards detected. are the average errors of the measured values ​​on each side. Indicates the system detection value of the copper clad board with type index c on the i-th piece. Indicates the system detection value on the left side of the copper clad board with the type index value c. Indicates the system detection value of the copper clad board with type index value c. Indicates the system detection value on the right side of the copper clad board with type index value c. They respectively represent the calibration values ​​of the four edges of the copper clad laminate with type index value c. This is the final deviation value. After the deviation value is obtained, the final measurement result can be determined by the following formula:

[0077]

[0078] in, This is the final copper clad board size measurement result. Figure 6 The following figure shows the dimension measurement results.

[0079] In this embodiment, by adaptively adjusting the distance data, each distance data is adjusted to obtain the size measurement result of the target object, thereby effectively reducing the error of the distance data and improving the accuracy of the size measurement result of the target object.

[0080] Based on the above embodiment, the method also includes: obtaining type index data of the target object, and determining a preset standard size threshold range based on the type index data; performing qualification checks on the size measurement results of the target object based on the preset standard size threshold range, and if the size measurement results of the target object all meet the preset standard size threshold range, then the target object is determined to be qualified; if any one of the size measurement results of the target object does not meet the preset standard size threshold range, then the target object is determined to be unqualified.

[0081] The type index data can be specifically understood as representing the type of the target object to be detected. The corresponding preset standard size threshold range can be set in advance according to the standard size of different types of target objects, and the mapping relationship between the type index data of different types of target objects and the preset standard size threshold range is stored. When measuring the size of the target object, the corresponding preset standard size threshold range is matched according to the type index data of the target object to verify the size measurement result of the target object. The preset standard size threshold range includes the standard size threshold ranges of multiple edges to be measured of the target object.

[0082] Specifically, when determining the size measurement result of the target object, the type index data of the target object is obtained, and the corresponding preset standard size threshold range is matched from the target storage space according to the type index data, and then the size measurement result of the target object is judged with the preset standard size threshold range to determine whether the size measurement results of the target object all meet the corresponding preset standard size threshold range. If the size measurement results of the target object all meet the corresponding preset standard size threshold range, then it is determined that the target object is qualified; if the measurement result of any edge to be measured in the size measurement result of the target object does not meet the corresponding preset standard size threshold range, then it is determined that the target object is unqualified.

[0083] The technical solution of this embodiment is to obtain multiple measurement images of the target object collected by multiple cameras, wherein any measurement image includes a corner point of the target object and parts of two edges to be measured corresponding to the corner point, and different test images include different corner points of the target object; for any measurement image, determine the image coordinate data of the corner point in the measurement image, perform coordinate space transformation on the image coordinate data of the corner point in the measurement image based on calibration parameter information, and obtain physical coordinate data of the corner point in the measurement image in the global coordinate system; determine the distance data between any two corner points based on the physical coordinate data of the multiple corner points corresponding to the target object, and determine the size measurement result of the target object based on the distance data. It realizes processing of multiple measurement images collected by the camera on the target object, performs coordinate space transformation on the image coordinate data of the corner points in each measurement image based on calibration parameter information, obtains the physical coordinate data of each corner point in the global coordinate system, and determines the distance data based on the physical coordinate data to obtain the size measurement result of the target object, solves the problem that the size measurement cannot be performed without a high-precision calibration plate, and does not need to strictly require the installation position of the camera, thereby improving the operability, efficiency and accuracy of the size measurement of the target object, especially the size measurement of large-sized target objects.

[0084] Embodiment 2

[0085] Figure 7This is a flow chart of a dimension measurement method based on machine vision provided in the second embodiment of the present invention. This embodiment is a further optimization of the method corresponding to the above embodiment. Optionally, the physical coordinate data corresponding to the corner point in the measured image is determined based on the image coordinate data of the corner point in the measured image and the corresponding single-pixel physical dimension data; the physical coordinate data of the corner point in the measured image in the global coordinate system is determined based on the physical coordinate data corresponding to the corner point in the measured image and the starting point position data of the image coordinate system corresponding to the measured image. Figure 7 As shown, the method includes:

[0086] S210, acquiring multiple measurement images of the target object captured by multiple cameras, wherein any measurement image includes a corner point of the target object and parts of two edges to be measured corresponding to the corner point, and different measurement images include different corner points of the target object.

[0087] S220 . For any measurement image, determine image coordinate data of corner points in the measurement image.

[0088] S230 , determining physical coordinate data corresponding to the corner point in the measured image based on the image coordinate data of the corner point in the measured image and the corresponding single-pixel physical size data.

[0089] Among them, the single-pixel physical size data represents the actual physical size information of a single pixel in the image coordinate system, which can be matched from the preset database to the corresponding calibration parameter information, including single-pixel size information, and the single-pixel size information includes the single-pixel size information in the horizontal and vertical coordinate axis directions. The calibration parameter information has been determined and stored in the process of calibrating the camera. In the case of size measurement, it is only necessary to retrieve the calibration parameter information of the camera corresponding to each measurement image. Each image coordinate system corresponding to a camera corresponds to a set of calibration parameter information.

[0090] Specifically, obtain the calibration parameter information of the camera corresponding to any measurement image, obtain the single pixel physical size information from the calibration parameter information, calculate the product of the single pixel size information in the horizontal and vertical coordinate axes and the image coordinate data of the corresponding corner point in the measurement image, and obtain the physical coordinate data corresponding to the corner point in the measurement image. Specifically, the following formula is used:

[0091]

[0092] in, is the physical coordinate data corresponding to the corner point in the nth measured image, , are the single-pixel horizontal coordinate physical size data and the single-pixel vertical coordinate physical size data in the image coordinate system corresponding to the nth measured image, respectively. is the image coordinate data of the corner point in the nth measured image.

[0093] S240 : Determine the physical coordinate data of the corner point in the measurement image in the global coordinate system based on the physical coordinate data corresponding to the corner point in the measurement image and the starting point position data of the image coordinate system corresponding to the measurement image.

[0094] Among them, the starting point position data of the image coordinate system can be specifically understood as the position data of the origin of the image coordinate system in the global coordinate system. In the image coordinate system to which the measured image belongs, the origin position data of the image coordinate system is (0, 0). The physical coordinate data of the corner point in the measured image in the global coordinate system can be obtained by determining the starting point position information of the image coordinate system of the measured image in the global coordinate system and adjusting the physical coordinate correction result of the corner point in the corresponding measured image according to the starting point position information.

[0095] Specifically, the sum of the physical coordinate data of the corner point in the measured image in the corresponding image coordinate system and the starting point position data of the corresponding image coordinate system is determined to obtain the physical coordinate data of the corner point in the measured image in the global coordinate system. Specifically, the following formula is used:

[0096]

[0097] in, is the physical coordinate data of the corner point of the image coordinate system where the nth measured image is located in the global coordinate system, is the starting point position information of the nth image coordinate system; Measure the physical coordinate data of the corner points in the image in the corresponding image coordinate system.

[0098] In this embodiment, by acquiring the single-pixel physical size data corresponding to each measurement image and the starting point position data of the image coordinate system, the image coordinate data of the corner points in each measurement image are spatially transformed to obtain the physical coordinate data of the corner points in each measurement image in the global coordinate system, thereby simplifying the online detection process of the physical coordinate data of the corner points of the target object and helping to improve the speed of measuring the size data of the target object.

[0099] Optionally, an image coordinate system corresponding to any camera among the multiple cameras is a reference image coordinate system, and image coordinate systems corresponding to other cameras among the multiple cameras are set as image coordinate systems to be corrected; determining starting point position data of the image coordinate system includes: for any image coordinate system to be corrected, determining distance data between a starting point of the image coordinate system to be corrected and a starting point of the reference image coordinate system, wherein the distance data includes distance data in the direction of the horizontal coordinate axis and distance data in the direction of the vertical coordinate axis; determining starting point position data of the image coordinate system corresponding to the image coordinate system to be corrected based on the distance data and the coordinate data of the starting point of the reference image coordinate system,

[0100] Specifically, for any image coordinate system to be corrected, the image coordinate system to be corrected is projected onto the plane of the reference image coordinate system, and the distance data between the starting point of the image coordinate system to be corrected and the starting point of the reference image coordinate system is determined, and then the starting point position data of the image coordinate system to be corrected in the global coordinate system is determined according to the distance data and the coordinate data of the starting point of the reference image coordinate system. Specifically, the following formula is used:

[0101]

[0102] in, is the starting point position information of the nth image coordinate system, is the distance data between the starting point of the image coordinate system to be corrected and the starting point of the reference image coordinate system.

[0103] Optionally, determining the distance data between the starting point of the coordinate system of the image to be corrected and the starting point of the reference image coordinate system includes: obtaining multiple test images of the test object captured by multiple pre-installed cameras, wherein the cameras pre-installed in the same direction are on the same horizontal line, and the fields of view of each camera do not overlap, and the test object is an object of standard size; obtaining the actual physical coordinate data and test angle data of the first test corner point in the test image corresponding to the reference image coordinate system; obtaining the standard size data between the first test corner point and the second test corner point in the horizontal axis direction and the vertical axis direction, respectively, wherein the second test corner point is a test corner point in any test image corresponding to the coordinate system of the image to be corrected; determining the offset distance data of the second test corner point relative to the first test corner point based on the standard size data and the test angle data, and determining the coordinate offset data of the second test corner point relative to the starting point of the reference image coordinate system based on the offset distance data and the actual physical coordinate data of the first test corner point; determining the difference between the coordinate offset data of the second test corner point relative to the starting point of the reference image coordinate system and the physical coordinate data of the second test corner point in the coordinate system of the image to be corrected, so as to obtain the distance data between the starting point of the coordinate system of the image to be corrected and the starting point of the reference image coordinate system.

[0104] Specifically, a corresponding number of cameras are set according to the number of points to be detected on the target object. The cameras installed in the same direction are on the same horizontal line, and the fields of view of each camera have no overlapping areas, so that the size measurement of large-sized objects can be achieved. After installing multiple cameras, the multiple cameras are calibrated by preparing an object with a standard size as a test object in advance. The standard size data of the test object includes the time physical length of each edge. In this embodiment, a copper clad board with four edges is used as the test object. Figure 8 A schematic diagram of a test object is shown, wherein standard sizes of the test object are H1, W1, H2 and W2 respectively. Image data of the test object is collected and displayed in an image coordinate system, where the test image obtained by collecting the upper left corner is taken as the first test image, and the image coordinate system corresponding to the first test image is also taken as the reference image coordinate system. The image coordinate systems corresponding to the test images of other corner points are the coordinate systems to be corrected. The test corner points in the test images corresponding to any image coordinate system to be corrected are the second test corner points, and the corner points in the first test image are the first test corner points. The actual physical coordinate data and test angle data of the first test corner point in the test image corresponding to the reference image coordinate system are obtained, and the standard size data between the first test corner point and the second test corner point in the horizontal axis direction and the vertical axis direction are obtained. If the upper right corner is the second test corner point, the standard size data of the second test corner point and the first test corner point in the horizontal axis direction and the vertical axis direction are W1 and 0 respectively. Correspondingly, if the lower left corner is the second test corner point, the corresponding standard size data are 0 and H1. If the lower right corner is the second test corner point, the corresponding standard size data are W2 and H2. However, in fact, there will be a certain angle between each side of the test object and the corresponding coordinate axis, such as Fig. 9 The schematic diagram of the image coordinate system where the test image is located is shown in Corner, therefore, it is necessary to process the standard size data through a trigonometric function algorithm to obtain the actual distance data between the two test corner points. The test image corresponding to the upper left corner is set as image one, the test image corresponding to the upper right corner is set as image two, the test image corresponding to the lower left corner is set as image three, and the test image corresponding to the lower right corner is set as image four. The image number corresponding to each corner point is set in a clockwise manner. The distance change calculation formula between the test corner point in image two and the test corner point in image one is:

[0105]

[0106] The calculation formula for the distance change between the test corner point in image 3 and the test corner point in image 1 is:

[0107]

[0108] The calculation formula for the distance change between the test corner point in image 4 and the test corner point in image 1 is:

[0109]

[0110] Among them, the distance change obtained according to the above calculation formula is the corresponding offset distance data.

[0111] The physical coordinate data corresponding to the corner point in the test image is determined according to the image coordinate data of the corner point in the test image and the corresponding single-pixel physical size data. The calculation formula of the physical coordinate data of the first test corner point is:

[0112]

[0113] Based on the offset distance data and the actual physical coordinate data of the first test corner point, the coordinate offset data of the second test corner point relative to the starting point of the reference image coordinate system is determined; that is, the coordinate offset data calculation formula corresponding to each test corner point is as follows:

[0114]

[0115] By determining the difference between the coordinate offset data of the second test corner point relative to the starting point of the reference image coordinate system and the physical coordinate data of the second test corner point in the image coordinate system to be corrected, the distance data between the starting point of the image coordinate system to be corrected and the starting point of the reference image coordinate system can be obtained. The specific distance data calculation formula is as follows:

[0116]

[0117] Optionally, determining the physical coordinate data of the second test corner point in the coordinate system of the image to be corrected includes: obtaining first angle data of the corner point in the test image corresponding to the reference image coordinate system; in any image coordinate system to be corrected, obtaining second angle data of the corner point in the test image corresponding to the image coordinate system to be corrected, and determining the angle deviation between the first angle data and the second angle data; determining weight data of the physical coordinate data of the second test corner point in the coordinate system of the image to be corrected based on the angle deviation data, adjusting the physical coordinate data of the second test corner point in the coordinate system of the image to be corrected based on the weight data, and using the adjusted physical coordinate data as the physical coordinate data of the second test corner point in the coordinate system of the image to be corrected.

[0118] The image coordinate correction data specifically characterizes the angle difference data caused by the camera installation posture relationship. The corresponding image coordinate correction data can be determined by identifying the angle between the edge to be measured and the corresponding coordinate axis in each test image. To determine the image correction data, it is necessary to first determine the reference coordinate system in the coordinate systems corresponding to multiple cameras to unify the image coordinate correction rules. Optionally, the image coordinate system corresponding to any camera among the multiple cameras is the reference image coordinate system, and the image coordinate systems corresponding to the other cameras among the multiple cameras are set as the image coordinate system to be corrected. For example, Fig. 9 The schematic diagram of the image coordinate system where the test image is located is shown. In the schematic diagram of the image coordinate system, under ideal conditions, the inner angle in the image 1 and the interior angle in image 2 are equal. In practical applications, there is an angle difference between the two. In the case of an angle difference, the image coordinate data needs to be corrected to eliminate the measurement error caused by the angle difference. Optionally, determining the image coordinate correction data includes: obtaining first angle data of the corner point in the test image corresponding to the reference image coordinate system; in any image coordinate system to be corrected, obtaining second angle data of the corner point in the test image corresponding to the image coordinate system to be corrected, determining the angle deviation between the first angle data and the second angle data, and determining the image coordinate correction data based on the angle deviation. The angle data represents the internal angle data between the edge to be measured and the corresponding coordinate axis. The first angle data is the angle data in image one, and the second angle data is the angle data in image two. Fig. 9 As shown, the image coordinate system corresponding to image 1 can be used as the reference image coordinate system, and the image coordinate system corresponding to image 2 can be used as the image coordinate system to be corrected. is the first angle data, The second angle data is calculated, and the angle deviation between the first angle data and the second angle data is calculated to obtain the image coordinate correction data corresponding to the image two. It should be noted that the image one is the reference image coordinate system, and the image coordinate correction data corresponding to the image one is 0 and can be ignored.

[0119] Specifically, by performing image recognition processing on the test images, the internal angle data between the side to be measured and the corresponding coordinate axis in each test image is identified, and the angle difference data between the angle data in the image coordinate system where each test image is located and the angle data identified in the reference coordinate system is determined, and the image coordinate correction data corresponding to the image coordinate system where each test image is located is obtained. Based on the image coordinate correction data, the image coordinate correction data is processed according to a preset weight determination algorithm to determine the weight coefficient of the image coordinate data of the corner point in each test image, and the inner product operation result of the weight coefficient and the image coordinate data of the corner point in the test image is determined. Based on the obtained result, the physical coordinate data of the second test corner point in the image coordinate system to be corrected is updated. Fig. 9Taking the image 2 shown in the figure as an example, the image coordinate correction result corresponding to the corner point in the test image corresponding to the image 2 is determined according to the following formula:

[0120]

[0121] in, is the image coordinate correction data, , is the weight coefficient, is the image coordinate data of the corner points in the test image corresponding to image 2, is the updated result of the image coordinate data corresponding to the corner point in the test image corresponding to the second image. Similarly, the updated results of the image coordinate data corresponding to the corner points in other test images in the multiple test images can be determined according to the above method, and recorded as The distance data of the starting point is corrected based on the updated result of the image coordinate data to improve the accuracy and applicability of the calibration parameter information. Therefore, the calculation formula of the distance data of the starting point can be updated as follows:

[0122]

[0123] In this embodiment, by correcting the image coordinate data of the corner points in the test image, the error of the image coordinate data caused by the angle difference of the image coordinate system corresponding to each test image relative to the reference coordinate system is eliminated. This eliminates the need to strictly require that the installation position of the camera in the same direction be absolutely horizontal, thereby improving the applicability of using the camera to determine the size data and improving the accuracy of the image coordinate data of the corner points in the test image.

[0124] In the process of camera parameter calibration, the deviation of the camera installation posture is taken into account to determine the calibration parameter information corresponding to each camera, which is used to perform spatial transformation on the image coordinate data of the corner points in the measurement image collected by each camera. When the target object is subsequently measured, it is only necessary to obtain the physical coordinate data of each corner point in the measurement image in the corresponding image coordinate system, and call the calibration parameter information of the corresponding camera to directly determine the physical coordinate data of the corner point in the measurement image in the global coordinate system, so as to quickly determine the size measurement result of the target object, simplify the measurement process of size measurement, facilitate the operation of the staff, improve the efficiency of size measurement, reduce measurement errors, and improve measurement accuracy.

[0125] S250 , determining distance data between any two corner points based on physical coordinate data of a plurality of corner points corresponding to the target object, and determining a size measurement result of the target object based on the distance data.

[0126] The technical solution of this embodiment is to obtain multiple measurement images of the target object captured by multiple cameras, wherein any measurement image includes a corner point of the target object and parts of two sides to be measured corresponding to the corner point, and different test images include different corner points of the target object; for any measurement image, determine the image coordinate data of the corner point in the measurement image; determine the physical coordinate data corresponding to the corner point in the measurement image based on the image coordinate data of the corner point in the measurement image and the corresponding single-pixel physical size data; determine the physical coordinate data of the corner point in the measurement image in the global coordinate system based on the physical coordinate data corresponding to the corner point in the measurement image and the starting point position data of the image coordinate system corresponding to the measurement image; determine the distance data between any two corner points based on the physical coordinate data corresponding to the multiple corner points of the target object, and determine the size measurement result of the target object based on the distance data. The method realizes processing of multiple measurement images collected by the camera of the target object, performs coordinate space conversion on the image coordinate data of the corner points in each measurement image through calibration parameter information, obtains the physical coordinate data of each corner point in the global coordinate system, determines the distance data according to the physical coordinate data to obtain the size measurement result of the target object, solves the problem that the size measurement cannot be performed without a high-precision calibration plate, and does not need to impose strict requirements on the installation position of the camera, thereby improving the operability, efficiency and accuracy of the size measurement of the target object, especially the size measurement of large-sized target objects.

[0127] Embodiment 3

[0128] Fig.10 Schematic diagram of a size measuring device based on machine vision provided by the third embodiment of the present invention. Fig.10 As shown, the device comprises:

[0129] The measurement image acquisition module 510 is used to acquire multiple measurement images of the target object captured by multiple cameras, wherein any measurement image includes a corner point of the target object and parts of two edges to be measured corresponding to the corner point, and different test images include different corner points of the target object;

[0130] A corner point physical coordinate data determination module 520 is used to determine the image coordinate data of the corner points in the measurement image for any measurement image, and to perform coordinate space transformation on the image coordinate data of the corner points in the measurement image based on the calibration parameter information to obtain the physical coordinate data of the corner points in the measurement image in the global coordinate system;

[0131] The size measurement result determination module 530 is used to determine the distance data between any two corner points based on the physical coordinate data of the multiple corner points corresponding to the target object, and determine the size measurement result of the target object based on the distance data.

[0132] The technical solution of this embodiment is to obtain multiple measurement images of the target object captured by multiple cameras through a measurement image acquisition module, wherein any measurement image includes a corner point of the target object and parts of two sides to be measured corresponding to the corner point, and different test images include different corner points of the target object; the corner point physical coordinate data determination module determines the image coordinate data of the corner points in the measurement image for any measurement image, performs coordinate space transformation on the image coordinate data of the corner points in the measurement image based on calibration parameter information, and obtains the physical coordinate data of the corner points in the measurement image in the global coordinate system; the size measurement result determination module determines the distance data between any two corner points based on the physical coordinate data of the multiple corner points corresponding to the target object, and determines the size measurement result of the target object based on the distance data. The method realizes processing of multiple measurement images collected by the camera of the target object, performs coordinate space conversion on the image coordinate data of the corner points in each measurement image through calibration parameter information, obtains the physical coordinate data of each corner point in the global coordinate system, determines the distance data according to the physical coordinate data to obtain the size measurement result of the target object, solves the problem that the size measurement cannot be performed without a high-precision calibration plate, and does not need to impose strict requirements on the installation position of the camera, thereby improving the operability, efficiency and accuracy of the size measurement of the target object, especially the size measurement of large-sized target objects.

[0133] On the basis of the above embodiment, optionally, the corner point physical coordinate data determination module 520 includes a coordinate space conversion processing unit and a starting point position data determination unit.

[0134] The calibration parameter information includes single-pixel physical size data corresponding to the image coordinate system where the measured image is located and the starting point position data of the image coordinate system; a coordinate space conversion processing unit is used to determine the physical coordinate data corresponding to the corner point in the measured image based on the image coordinate data of the corner point in the measured image and the corresponding single-pixel physical size data; and determine the physical coordinate data of the corner point in the measured image in the global coordinate system based on the physical coordinate data corresponding to the corner point in the measured image and the starting point position data of the image coordinate system corresponding to the measured image.

[0135] Optionally, the image coordinate system corresponding to any camera among the multiple cameras is the reference image coordinate system, and the image coordinate systems corresponding to other cameras among the multiple cameras are set as the image coordinate system to be corrected; a starting point position data determination unit is used to determine, for any image coordinate system to be corrected, the distance data between the starting point of the image coordinate system to be corrected and the starting point of the reference image coordinate system, wherein the distance data includes the distance data in the direction of the horizontal coordinate axis and the distance data in the direction of the vertical coordinate axis; based on the distance data and the coordinate data of the starting point of the reference image coordinate system, the starting point position data of the image coordinate system corresponding to the image coordinate system to be corrected is determined.

[0136] The starting point position data determination unit is specifically used to obtain multiple test images collected by multiple pre-installed cameras on the test object, wherein the cameras pre-installed in the same direction are on the same horizontal line, and the fields of view of each camera do not overlap, and the test object is an object of standard size; obtain the actual physical coordinate data and test angle data of the first test corner point in the test image corresponding to the reference image coordinate system; obtain the standard size data between the first test corner point and the second test corner point in the horizontal axis direction and the vertical axis direction respectively, wherein the second test corner point is a test corner point in the test image corresponding to any image coordinate system to be corrected; determine the offset distance data of the second test corner point relative to the first test corner point based on the standard size data and the test angle data, and determine the coordinate offset data of the second test corner point relative to the starting point of the reference image coordinate system based on the offset distance data and the actual physical coordinate data of the first test corner point; determine the difference between the coordinate offset data of the second test corner point relative to the starting point of the reference image coordinate system and the physical coordinate data of the second test corner point in the image coordinate system to be corrected, so as to obtain the distance data between the starting point of the image coordinate system to be corrected and the starting point of the reference image coordinate system. The starting point position data determination unit is also specifically used to obtain first angle data of the corner point in the measurement image corresponding to the reference image coordinate system; in any image coordinate system to be corrected, obtain second angle data of the corner point in the measurement image corresponding to the image coordinate system to be corrected, and determine the angle deviation between the first angle data and the second angle data; determine weight data of the physical coordinate data of the second test corner point in the image coordinate system to be corrected based on the angle deviation data, adjust the physical coordinate data of the second test corner point in the image coordinate system to be corrected based on the weight data, and use the adjusted physical coordinate data as the physical coordinate data of the second test corner point in the image coordinate system to be corrected.

[0137] Optionally, the size measurement result determination module 530 is specifically used to determine, for any distance data, a corresponding adaptive adjustment parameter based on identification information of a measurement image to which two corner points corresponding to the distance data belong, wherein the identification information has a corresponding relationship with the camera; and adjust the distance data based on the adaptive adjustment parameter to obtain a size measurement result between the two corner points corresponding to the distance data.

[0138] Optionally, the device is also used to: obtain type index data of the target object, and determine a preset standard size threshold range based on the type index data; perform a conformity check on the size measurement results of the target object based on the preset standard size threshold range, if the size measurement results of the target object all meet the preset standard size threshold range, then the target object is determined to be qualified, and if any one of the size measurement results of the target object does not meet the preset standard size threshold range, then the target object is determined to be unqualified.

[0139] The machine vision-based dimension measurement device provided in the embodiment of the present invention can execute the machine vision-based dimension measurement method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0140] Embodiment 4

[0141] Fig.11 1 is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0142] like Fig.11 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.

[0143] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0144] The processor 11 may be a variety of general and / or dedicated processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a dimension measurement method based on machine vision.

[0145] In some embodiments, the dimension measurement method based on machine vision can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the dimension measurement method based on machine vision described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the dimension measurement method based on machine vision in any other appropriate manner (for example, by means of firmware).

[0146] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0147] The computer program for implementing the machine vision-based dimension measurement method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0148] Embodiment 5

[0149] Embodiment 5 of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to execute a dimension measurement method based on machine vision, the method comprising:

[0150] Acquire multiple measurement images of the target object captured by multiple cameras, wherein any measurement image includes a corner point of the target object and parts of two edges to be measured corresponding to the corner point, and different test images include different corner points of the target object;

[0151] For any measurement image, determine the image coordinate data of the corner points in the measurement image, perform coordinate space transformation on the image coordinate data of the corner points in the measurement image based on the calibration parameter information, and obtain the physical coordinate data of the corner points in the measurement image in the global coordinate system;

[0152] The distance data between any two corner points is determined based on the physical coordinate data of the multiple corner points corresponding to the target object, and the size measurement result of the target object is determined based on the distance data.

[0153] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0154] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0155] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0156] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0157] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0158] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A dimension measurement method based on machine vision, characterized in that: include: Acquire multiple measurement images of the target object captured by multiple cameras, wherein any of the measurement images includes a corner point of the target object and parts of two edges to be measured corresponding to the corner point, and different test images include different corner points of the target object; For any of the measurement images, determine the image coordinate data of the corner points in the measurement image, and perform coordinate space transformation on the image coordinate data of the corner points in the measurement image based on the calibration parameter information to obtain the physical coordinate data of the corner points in the measurement image in the global coordinate system; Determine distance data between any two corner points based on physical coordinate data of a plurality of corner points corresponding to the target object, and determine a size measurement result of the target object based on the distance data; The calibration parameter information includes the single pixel physical size data corresponding to the image coordinate system where the measured image is located and the starting point position data of the image coordinate system; The step of performing coordinate space conversion on the image coordinate data of the corner points in the measured image based on the calibration parameter information to obtain the physical coordinate data of the corner points in the measured image in the global coordinate system includes: Determine the physical coordinate data corresponding to the corner point in the measurement image based on the image coordinate data of the corner point in the measurement image and the corresponding single-pixel physical size data; Determine the physical coordinate data of the corner point in the measurement image in the global coordinate system based on the physical coordinate data corresponding to the corner point in the measurement image and the starting point position data of the image coordinate system corresponding to the measurement image; The image coordinate system corresponding to any one of the multiple cameras is used as the reference image coordinate system, and the image coordinate systems corresponding to the other cameras of the multiple cameras are set as the image coordinate system to be corrected; Determining the starting point position data of the image coordinate system includes: For any of the to-be-corrected image coordinate systems, determining distance data between a starting point of the to-be-corrected image coordinate system and a starting point of the reference image coordinate system, wherein the distance data includes distance data in the direction of the abscissa axis and distance data in the direction of the ordinate axis; Determine the starting point position data of the image coordinate system corresponding to the image coordinate system to be corrected based on the distance data and the coordinate data of the starting point of the reference image coordinate system; The step of determining the distance data between the starting point of the coordinate system of the image to be corrected and the starting point of the coordinate system of the reference image includes: Acquire multiple test images of a test object captured by multiple pre-installed cameras, wherein the cameras pre-installed in the same direction are on the same horizontal line, and the fields of view of the cameras do not overlap, and the test object is an object of standard size; Acquire actual physical coordinate data and test angle data of a first test corner point in the test image corresponding to the reference image coordinate system; acquire standard size data between the first test corner point and a second test corner point in the horizontal axis direction and the vertical axis direction, respectively, wherein the second test corner point is a test corner point in any test image corresponding to the image coordinate system to be corrected; Determine the offset distance data of the second test corner point relative to the first test corner point based on the standard size data and the test angle data, and determine the coordinate offset data of the second test corner point relative to the starting point of the reference image coordinate system based on the offset distance data and the actual physical coordinate data of the first test corner point; Determine the difference between the coordinate offset data of the second test corner point relative to the starting point of the reference image coordinate system and the physical coordinate data of the second test corner point in the image coordinate system to be corrected, so as to obtain the distance data between the starting point of the image coordinate system to be corrected and the starting point of the reference image coordinate system.

2. The method according to claim 1, characterized in that: Determining the physical coordinate data of the second test corner point in the coordinate system of the image to be corrected includes: Acquire first angle data of a corner point in the measurement image corresponding to the reference image coordinate system; In any of the coordinate systems of the image to be corrected, obtaining second angle data of a corner point in the measurement image corresponding to the coordinate system of the image to be corrected, and determining an angle deviation between the first angle data and the second angle data; Based on the angle deviation data, weight data of the physical coordinate data of the second test corner point in the coordinate system of the image to be corrected is determined; based on the weight data, the physical coordinate data of the second test corner point in the coordinate system of the image to be corrected is adjusted; and the adjusted physical coordinate data is used as the physical coordinate data of the second test corner point in the coordinate system of the image to be corrected.

3. The method according to claim 1, characterized in that The determining the size measurement result of the target object based on the distance data includes: For any of the distance data, determining a corresponding adaptive adjustment parameter based on identification information of a measurement image to which two corner points corresponding to the distance data belong, wherein the identification information has a corresponding relationship with a camera; The distance data is adjusted based on the adaptive adjustment parameter to obtain a size measurement result between the two corner points corresponding to the distance data.

4. The method according to claim 1, characterized in that: The method also includes: Acquire type index data of the target object, and determine a preset standard size threshold range based on the type index data; Based on the preset standard size threshold range, the size measurement results of the target object are respectively checked for qualification; if the size measurement results of the target object all meet the preset standard size threshold range, the target object is determined to be qualified; if any one of the size measurement results of the target object does not meet the preset standard size threshold range, the target object is determined to be unqualified.

5. A dimension measuring device based on machine vision, characterized in that: include: A measurement image acquisition module, used to acquire multiple measurement images of a target object captured by multiple cameras, wherein any of the measurement images includes a corner point of the target object and parts of two edges to be measured corresponding to the corner point, and different test images include different corner points of the target object; A corner point physical coordinate data determination module is used to determine the image coordinate data of the corner points in any of the measurement images, and to perform coordinate space transformation on the image coordinate data of the corner points in the measurement image based on calibration parameter information to obtain the physical coordinate data of the corner points in the measurement image in the global coordinate system; A size measurement result determination module, configured to determine distance data between any two corner points based on physical coordinate data of a plurality of corner points corresponding to the target object, and determine a size measurement result of the target object based on the distance data; The calibration parameter information includes the single-pixel physical size data corresponding to the image coordinate system where the measured image is located and the starting point position data of the image coordinate system; the image coordinate system corresponding to any one of the multiple cameras is the reference image coordinate system, and the image coordinate systems corresponding to the other cameras of the multiple cameras are set as the image coordinate system to be corrected; the corner point physical coordinate data determination module includes a coordinate space conversion processing unit and a starting point position data determination unit; The coordinate space conversion processing unit is used to determine the physical coordinate data corresponding to the corner point in the measurement image based on the image coordinate data of the corner point in the measurement image and the corresponding single-pixel physical size data; determine the physical coordinate data of the corner point in the measurement image in the global coordinate system based on the physical coordinate data corresponding to the corner point in the measurement image and the starting point position data of the image coordinate system corresponding to the measurement image; The starting point position data determining unit is used to determine, for any of the image coordinate systems to be corrected, distance data between the starting point of the image coordinate system to be corrected and the starting point of the reference image coordinate system, wherein the distance data includes distance data in the direction of the horizontal coordinate axis and distance data in the direction of the vertical coordinate axis; and determine the starting point position data of the image coordinate system corresponding to the image coordinate system to be corrected based on the distance data and the coordinate data of the starting point of the reference image coordinate system; The starting point position data determination unit is specifically used to obtain multiple test images collected by multiple pre-installed cameras on the test object, wherein the cameras pre-installed in the same direction are on the same horizontal line, and the fields of view of each camera do not overlap, and the test object is a standard size object; obtain the actual physical coordinate data and test angle data of the first test corner point in the test image corresponding to the reference image coordinate system; obtain the standard size data between the first test corner point and the second test corner point in the horizontal axis direction and the vertical axis direction, respectively, wherein the second test corner point is a test corner point in any test image corresponding to the image coordinate system to be corrected; determine the offset distance data of the second test corner point relative to the first test corner point based on the standard size data and the test angle data, and determine the coordinate offset data of the second test corner point relative to the starting point of the reference image coordinate system based on the offset distance data and the actual physical coordinate data of the first test corner point; determine the difference between the coordinate offset data of the second test corner point relative to the starting point of the reference image coordinate system and the physical coordinate data of the second test corner point in the image coordinate system to be corrected, so as to obtain the distance data between the starting point of the image coordinate system to be corrected and the starting point of the reference image coordinate system.

6. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the machine vision-based dimension measurement method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the machine vision-based dimension measurement method according to any one of claims 1 to 4 when executed.

Citation Information

Patent Citations

  • Dimension measurement method and device based on machine vision and electronic equipment

    CN117115233A

  • Boundary point detection method and device, electronic equipment and storage medium

    CN118411382A