A method and device for measuring the size of a target object

By dividing the contour to be measured of the target object into multiple contour segments and calculating their actual physical dimensions based on the conversion coefficients of each contour segment, the measurement error problem caused by the solid conversion coefficient in the prior art is solved, and a higher dimensional measurement accuracy is achieved.

CN119737883APending Publication Date: 2025-04-01JIANGSU CELL WALL INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411677720.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

In the measurement of object size, the use of fixed conversion coefficients leads to large measurement errors, especially when the object profile almost covers the image picture, the pixel size of the outline is larger, and the slight differences in the conversion coefficients cause large cumulative errors.

Method used

By dividing the contour to be measured of the target object into multiple contour segments, the conversion coefficients of each contour segment are determined, and the actual physical dimensions of each contour segment are calculated based on these conversion coefficients, and finally the actual physical dimensions of the contour to be measured of the target object are determined based on the sum of the actual physical dimensions of each contour segment.

Benefits of technology

The distribution characteristics of the conversion coefficients in the plane are fully considered, which avoids the impact of the camera's optical axis not perpendicular to the plane to be measured, improves the accuracy of dimensional measurement, and reduces measurement errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119737883A_ABST
    Figure CN119737883A_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for measuring the size of a target object, the method comprising: acquiring an image of the target object, dividing the contour to be measured of the target object in the image into a plurality of contour segments, and determining the conversion coefficient of each contour segment; determining the actual physical size of the contour segment based on the conversion coefficient of the contour segment; and determining the actual physical size of the contour to be measured of the target object based on the sum of the actual physical sizes of each contour segment. The present invention fully considers the distribution characteristics of the conversion coefficient in the plane, avoids the influence caused by the non-perpendicularity of the camera optical axis to the measured plane, avoids the problem of large measurement errors caused by the use of fixed conversion coefficients, and improves the accuracy of size measurement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of visual technology, and in particular to a method and device for measuring the size of a target object. Background Art

[0002] At present, in actual application scenarios, there is often a requirement to accurately measure the size of the object being measured by a monocular camera. This type of measurement is usually performed in a 2D plane. The image captured by the camera can only provide the size information of the object in pixels. In order to obtain the actual size of the object, it is necessary to obtain the conversion relationship between the pixel size and the actual size, that is, the conversion coefficient from the pixel size to the physical size, and then calculate the actual size of the object based on the conversion coefficient.

[0003] In the related object size measurement technology, when calculating the actual size of the object, the "conversion coefficient" at different positions in the image screen is usually fixed. In a 2D measurement environment, the optical axis of the camera is usually perpendicular to the plane where the measured object is located, and the distance from the camera to the plane is fixed. In theory, the distance from any object in the plane to the camera's photosensitive surface is the same and remains constant, so it has the same and unchanged "magnification". However, due to factors such as camera installation errors, this assumption is not strictly valid. Especially when the camera is installed at the end of a moving robotic arm, the perpendicularity of its optical axis to the plane of the measured object is affected by multiple factors such as the robotic arm's motion control accuracy and the camera installation accuracy. The conversion ratio from pixels to physical size presents a certain distribution in the plane. Therefore, when the measurement accuracy is high, using a fixed conversion coefficient will cause errors, especially when the object outline almost fills the image screen, the outline has a large pixel size, and the slight difference in the conversion coefficient will cause a large cumulative error. Therefore, when measuring the actual size of an object, using a fixed conversion coefficient will result in a large measurement error, reducing the accuracy of the size measurement. Summary of the invention

[0004] In view of this, an object of the present invention is to provide a method and device for measuring the size of a target object, which fully considers the distribution characteristics of the conversion coefficient in the plane, avoids the problem of large measurement errors caused by using fixed conversion coefficients, and improves the accuracy of size measurement.

[0005] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:

[0006] In a first aspect, an embodiment of the present invention provides a method for measuring the size of a target object, comprising:

[0007] Acquire an image of the target object, divide the contour to be measured of the target object in the image into a plurality of contour segments, and determine a conversion coefficient of each of the contour segments;

[0008] determining an actual physical size of the contour segment based on a conversion coefficient of the contour segment;

[0009] The actual physical size of the contour to be measured of the target object is determined based on the sum of the actual physical sizes of each contour segment.

[0010] Further, an embodiment of the present invention provides a first possible implementation manner of the first aspect, wherein the step of determining the conversion coefficient of each contour segment includes:

[0011] Obtaining the midpoint pixel coordinates of each of the contour segments;

[0012] Obtaining a pre-established conversion coefficient lookup table; wherein the conversion coefficient lookup table includes conversion coefficients corresponding to each pixel in the image;

[0013] The conversion coefficient at the midpoint pixel coordinates of each contour segment is searched in the conversion coefficient lookup table, and the conversion coefficient at the midpoint pixel coordinates is used as the conversion coefficient of the corresponding contour segment.

[0014] Furthermore, the embodiment of the present invention provides a second possible implementation of the first aspect, wherein the method further includes:

[0015] Acquire a graphic array image captured by a target camera; wherein the graphic array image has the same size as the image of the target object, and the graphic array image includes a plurality of preset graphics of the same shape distributed in a matrix array;

[0016] Obtaining the pixel coordinates of the center point of each of the preset graphics in the graphic array image;

[0017] A conversion coefficient lookup table corresponding to the target camera is established based on the actual size of the preset graphics and the pixel coordinates of the center points of each of the preset graphics.

[0018] Furthermore, an embodiment of the present invention provides a third possible implementation of the first aspect, wherein the step of establishing a conversion coefficient lookup table corresponding to the target camera based on the actual size of the preset graphics and the pixel coordinates of the center point of each preset graphics includes:

[0019] Determining a conversion coefficient at a pixel coordinate of a center point of each of the preset graphics based on an actual size of the preset graphics and a pixel size of each of the preset graphics;

[0020] Establishing a corresponding pixel table based on the resolution of a target camera that acquires the graphic array image;

[0021] The conversion coefficient at the center point pixel coordinate of each preset graphic is filled into the corresponding position of the pixel table, and the blank position in the pixel table except the center point pixel coordinate table position is supplemented with the corresponding conversion coefficient value to obtain the conversion coefficient lookup table corresponding to the target camera.

[0022] Furthermore, an embodiment of the present invention provides a fourth possible implementation of the first aspect, wherein the step of supplementing the blank positions in the pixel table except the position of the center point pixel coordinate table with corresponding conversion coefficient values ​​comprises:

[0023] Based on a preset interpolation algorithm and the conversion coefficient at the center point pixel coordinate table position in the pixel table, the conversion coefficient of each blank position in the pixel table is calculated.

[0024] Furthermore, an embodiment of the present invention provides a fifth possible implementation of the first aspect, wherein the step of determining the conversion coefficient at the pixel coordinates of the center point of each preset graphic based on the actual size of the preset graphic and the pixel size of each preset graphic comprises:

[0025] The ratios of the actual size of the preset graphic outlines to the pixel size of each preset graphic outline are calculated respectively to obtain the conversion coefficient at the pixel coordinates of the center point of each preset graphic.

[0026] Furthermore, an embodiment of the present invention provides a sixth possible implementation of the first aspect, wherein the preset graphics are dots, the graphic array image is a dot array image, and the step of determining the conversion coefficient at the pixel coordinates of the center point of each preset graphic based on the actual size of the preset graphics and the pixel size of each preset graphic comprises:

[0027] Obtaining pixel coordinates of the centers of each circle in the dot array image;

[0028] Acquire the actual physical size of the diameter of the dots, and acquire the pixel size of the diameter of each dot in the dot array image;

[0029] The ratios of the actual physical size of the diameter to the pixel size of the diameter of each of the dots in the dot array image are calculated respectively to obtain conversion coefficients at the pixel coordinates of each center of the circle in the dot array image.

[0030] Furthermore, an embodiment of the present invention provides a seventh possible implementation of the first aspect, wherein the preset interpolation algorithm includes any one of a linear interpolation algorithm, a bilinear interpolation algorithm and a spline interpolation algorithm.

[0031] Furthermore, an embodiment of the present invention provides an eighth possible implementation of the first aspect, wherein the length of the contour segment ranges from 2 to 10 pixels.

[0032] In a second aspect, an embodiment of the present invention further provides a device for measuring the outline dimension of a target object, characterized in that it includes:

[0033] A segmentation module is used to obtain an image of the target object, segment the contour to be measured of the target object in the image into a plurality of contour segments, and determine a conversion coefficient of each of the contour segments;

[0034] A first determination module, configured to determine an actual physical size of the contour segment based on a conversion coefficient of the contour segment;

[0035] The second determining module is used to determine the actual physical size of the contour to be measured of the target object based on the sum of the actual physical sizes of each contour segment.

[0036] The embodiment of the present invention provides a method and device for measuring the size of a target object, the method comprising: acquiring an image of the target object, dividing the contour to be measured of the target object in the image into a plurality of contour segments, and determining the conversion coefficient of each contour segment; determining the actual physical size of the contour segment based on the conversion coefficient of the contour segment; and determining the actual physical size of the contour to be measured of the target object based on the sum of the actual physical sizes of each contour segment. The present invention divides the contour to be measured of the target object into a plurality of segments and determines the conversion coefficient of each segment accordingly, fully considering the distribution characteristics of the conversion coefficient in the plane, avoiding the influence caused by the non-perpendicularity of the camera optical axis to the measured plane, and determining the actual physical size of each contour segment according to the conversion coefficient of the contour segment. The sum of the actual physical sizes of the contour segments is the actual physical size of the contour to be measured, avoiding the problem of large measurement errors caused by the use of fixed conversion coefficients, and improving the accuracy of size measurement.

[0037] Other features and advantages of the embodiments of the present invention will be described in the following description, or some features and advantages can be inferred or determined without doubt from the description, or can be learned by implementing the above-mentioned techniques of the embodiments of the present invention.

[0038] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 A flow chart of a method for measuring the size of a target object provided by an embodiment of the present invention is shown;

[0041] Figure 2 A schematic diagram of segmenting a contour to be measured of a target object provided by an embodiment of the present invention is shown;

[0042] Figure 3 A schematic diagram of visualization results of a conversion coefficient lookup table provided in an embodiment of the present invention is shown;

[0043] Figure 4 A dot array image provided by an embodiment of the present invention is shown;

[0044] Figure 5 A schematic structural diagram of a device for measuring the size of a target object provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be described below in conjunction with the drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments.

[0046] At present, the existing vision-based dimension measurement methods usually include two ways to determine the conversion coefficient from pixel size to actual physical size: one is to shoot an object with known size and relatively simple structure (called "ruler"), and through image processing methods, the outline of the ruler can be extracted with sub-pixel accuracy, and then the characteristic size of the ruler in pixels is obtained. The ratio of this characteristic size to the actual physical size of the ruler can be used as the conversion coefficient of the visual measurement method. The other is to make the camera and the ruler move relative to each other, and through image processing methods, the displacement of the ruler in the image in pixels is obtained, and then the conversion coefficient is obtained by comparing it with the actual displacement. However, when the measurement accuracy requirements are high, using a fixed conversion coefficient will cause errors, especially when the object outline almost fills the screen, the pixel size of the outline is large, and the slight difference in the conversion coefficient will cause a large cumulative error.

[0047] In order to improve the above problems, an embodiment of the present invention provides a method and device for measuring the size of a target object. The embodiment of the present invention is described in detail below.

[0048] This embodiment provides a method for measuring the size of a target object, which can be applied to electronic devices such as computers. Figure 1 The method for measuring the size of a target object shown in the flowchart mainly includes the following steps:

[0049] Step S102, acquiring an image of the target object, dividing the contour to be measured of the target object in the image into a plurality of contour segments, and determining a conversion coefficient of each contour segment;

[0050] The image of the target object may be an image in which the contour of the target object occupies a relatively large proportion of the image frame, and the contour to be measured may be the entire contour or a portion of the contour of the target object.

[0051] The contour to be measured of the target object is segmented. The contour to be measured can be divided into multiple segments, which are recorded as contour segments. The conversion coefficient corresponding to each contour segment is determined, such as the conversion coefficient based on the midpoint of each contour segment, or the conversion coefficient corresponding to the contour segment based on the average of the conversion coefficients of each pixel point of the contour segment.

[0052] In order to improve the measurement accuracy, the pixel size of each contour segment should not be too large, and the length of the contour segment can range from 2 to 10 pixels, preferably 2 to 3 pixels.

[0053] Step S104, determining the actual physical size of the contour segment based on the conversion coefficient of the contour segment;

[0054] The pixel size of each contour segment is obtained, and the actual physical size of each contour segment can be obtained according to the product of the pixel size of each contour segment and the corresponding conversion coefficient.

[0055] Step S106: determining the actual physical size of the contour to be measured of the target object based on the sum of the actual physical sizes of each contour segment.

[0056] The actual physical size of the contour to be measured can be obtained by accumulating the actual physical size of each contour segment obtained by segmenting the contour to be measured.

[0057] The dimension measurement method of the target object provided in the present embodiment divides the contour to be measured of the target object into multiple segments and determines the conversion coefficient of each segment accordingly, fully considering the distribution characteristics of the conversion coefficient in the plane, avoiding the influence caused by the non-perpendicularity of the camera optical axis and the measured plane, and determining the actual physical size of each contour segment according to the conversion coefficient. The sum of the actual physical sizes of the contour segments is the actual physical size of the contour to be measured, avoiding the problem of large measurement errors caused by the use of fixed conversion coefficients, and improving the accuracy of dimension measurement.

[0058] In one implementation, this embodiment provides an implementation for determining the conversion coefficient of each contour segment, which can be specifically performed with reference to the following steps:

[0059] Step (1), obtaining the midpoint pixel coordinates of each contour segment;

[0060] See Figure 2 The schematic diagram of the target object to be measured is shown in the figure. N Divide into N-1 segments, the length of each contour segment can be the same or different, and obtain the pixel coordinates of the midpoint of each contour segment.

[0061] Step (2), obtaining a pre-established conversion coefficient lookup table;

[0062] The above conversion coefficient lookup table includes the conversion coefficients corresponding to each pixel in the image of the target object; the visualized result of the conversion coefficient lookup table is usually a surface, see Figure 3 The conversion coefficient lookup table visualization result diagram is shown. Figure 3 The XY axis of the coordinate system is the pixel coordinate of the image, and the Z axis represents the distribution of the conversion coefficient of each pixel.

[0063] Step (3), searching the conversion coefficient at the midpoint pixel coordinates of each contour segment from the conversion coefficient lookup table, and using the conversion coefficient at the midpoint pixel coordinates as the conversion coefficient of the corresponding contour segment.

[0064] For the midpoint of each contour segment, the conversion coefficient corresponding to the pixel coordinates of the midpoint is found from the conversion coefficient lookup table to obtain the conversion coefficient of each contour segment. The actual physical size of each contour segment can be calculated based on the conversion coefficient of each contour segment.

[0065] In one implementation, the method provided in this embodiment further includes a method for establishing a conversion coefficient lookup table, which may be specifically referred to the following steps:

[0066] Step 1), obtaining a graphic array image captured by a target camera;

[0067] The pixel size of the graphic array image is the same as that of the image of the target object, that is, the resolution of the target camera is the same as that of the camera that captures the image of the target object.

[0068] The above-mentioned graphic array image includes a plurality of preset graphics of the same shape uniformly distributed in a matrix array; the preset graphics can be regular graphics such as circles, rectangles, triangles and polygons.

[0069] The above-mentioned graphic array image can be obtained by shooting a checkerboard calibration plate, ArUco or ChArUco calibration plate image. Figure 4The dot array image shown is obtained by collecting the dot array.

[0070] Step 2), obtaining the pixel coordinates of the center point of each preset graphic in the graphic array image;

[0071] For the acquired graphic array image, the center point of each preset graphic is determined, and the pixel coordinates of the center point of each preset graphic in the image are determined.

[0072] Step 3), based on the actual size of the preset graphics and the pixel coordinates of the center points of each preset graphics, a conversion coefficient lookup table corresponding to the target camera is established.

[0073] In a specific embodiment, the conversion coefficient at the pixel coordinates of the center point of each preset graphic is determined based on the actual size of the preset graphic and the pixel size of each preset graphic; for example, the conversion coefficient at the pixel coordinates of the center point of each preset graphic can be determined based on the ratio of the actual outline size of the preset graphic to the pixel size of the outline of each preset graphic.

[0074] A corresponding pixel table is established based on the resolution of the target camera; the conversion coefficients at the pixel coordinates of the center point of each preset graphic are filled into the corresponding positions of the pixel table, and the blank positions in the pixel table except the table positions of the center point pixel coordinates are supplemented with corresponding conversion coefficient values ​​to obtain a conversion coefficient lookup table corresponding to the target camera.

[0075] According to the resolution of the target camera, grid points are generated. If the number of pixels in the target camera's photosensitive element is W×H, a W×H 2D table is generated, which is equivalent to generating a two-dimensional grid with 1 pixel as the step size and the maximum size of the image as the boundary. The data stored in the grid table is the conversion coefficient value at the corresponding pixel position. For example, the value S on the Xth column and the Yth row is the conversion coefficient corresponding to the pixel coordinate (X, Y) in the graphic array image.

[0076] In a specific implementation, the conversion coefficient of each blank position in the pixel table is calculated based on a preset interpolation algorithm and the conversion coefficients filled in the pixel table.

[0077] The above-mentioned preset interpolation algorithm includes any one of a linear interpolation algorithm, a bilinear interpolation algorithm and a spline interpolation algorithm.

[0078] According to the point set (x i ,y i ,s i), use mathematical interpolation to calculate all conversion coefficient values ​​of blank positions in the conversion coefficient lookup table. The specific interpolation method can be linear, bilinear or spline interpolation. For each blank position (X, Y) (pixel coordinate) in the conversion coefficient lookup table except the pixel coordinate position of the preset graphic center point, interpolate and calculate the conversion coefficient S at that location, and fill the value into the corresponding position of the table until all conversion coefficient values ​​in the conversion coefficient lookup table are calculated.

[0079] In a specific implementation, the present embodiment provides a specific implementation for determining the conversion coefficient at the pixel coordinates of the center point of each preset graphic based on the actual size of the preset graphic and the pixel size of each preset graphic: respectively calculating the ratio of the actual size of the preset graphic outline to the pixel size of each preset graphic outline to obtain the conversion coefficient at the pixel coordinates of the center point of each preset graphic.

[0080] For each graphic in the graphic array image, the pixel coordinates of its center position and the pixel size of its outline are extracted, and the ratio of the pixel size of its outline to its actual physical size is calculated to obtain the conversion coefficient at the pixel coordinates of the center position.

[0081] In a specific implementation, the preset graphics are dots, and the graphic array image is a dot array image. This embodiment provides a specific implementation method for determining the conversion coefficients at the pixel coordinates of the center points of each preset graphic based on the actual size of the preset graphics and the pixel size of each preset graphics: obtaining the pixel coordinates of the centers of each circle in the dot array image; obtaining the actual physical size of the diameter of the dots, and obtaining the pixel size of the diameter of each dot in the dot array image; respectively calculating the ratio of the actual physical size of the diameter to the pixel size of the diameter of each dot in the dot array image, and obtaining the conversion coefficients at the pixel coordinates of the centers of each circle in the dot array image.

[0082] Perform image processing on the captured dot array image to obtain the pixel coordinates (x i ,y i ), and the diameter d of the dot in pixels i (i.e., the diameter pixel size of the dot), generally sub-pixel level processing is performed, i.e., x i ,y i , d i The actual physical size of the dots (i.e., the actual physical size of the diameter of the dots, generally in millimeters) is known. The actual physical size of all dots in the dot array image is the same, and the diameter is D i . Then calculate the pixel coordinates (x i ,y i ) For each dot in the dot array image, the conversion coefficient at the pixel coordinate of its center is calculated, and the data point set (x i ,y i ,s i ).

[0083] The size measurement method of the target object provided in this embodiment is based on a 2D lookup table as the main data structure for calculation, which usually has high calculation efficiency, avoids the influence caused by the non-perpendicularity of the camera optical axis and the measured plane, and fully considers the distribution characteristics of the conversion coefficient in the plane.

[0084] Based on the above embodiment, this embodiment provides an example of applying the above target object size measurement method, which can be specifically performed with reference to the following steps:

[0085] Step 1, using a camera to capture a dot array image with known characteristic size, extracting the center point pixel coordinates and outline pixel size of each dot in the array, and using the ratio of the outline pixel size to the actual perimeter of the dot as the conversion coefficient at the center point pixel coordinates;

[0086] Step 2, constructing a conversion coefficient lookup table based on the conversion coefficient at the pixel coordinates of the center point of each dot in the dot array image, wherein the conversion coefficient lookup table stores the conversion coefficient at any pixel point;

[0087] Step 3, extracting the contour of the object to be measured from the image, and segmenting the contour, the pixel size of each segment should not be too large, for example, it can be selected to be 2 to 3 pixels;

[0088] Step 4, using the midpoint of each contour segment as an index to search the conversion coefficient lookup table, obtain the conversion coefficient of the location of the contour segment, and then calculate the actual physical size of the contour segment;

[0089] Step 5, adding the actual physical dimensions of each contour segment to obtain the actual physical dimensions of the contour of the measured object.

[0090] The actual physical size of the outline of the measured object can be expressed as:

[0091]

[0092] Corresponding to the target object size measurement method provided in the above embodiment, the embodiment of the present invention provides a target object size measurement device, see Figure 5 The schematic diagram of the structure of a device for measuring the size of a target object is shown, and the device includes the following modules:

[0093] A segmentation module 51 is used to obtain an image of the target object, segment the contour to be measured of the target object in the image into a plurality of contour segments, and determine a conversion coefficient of each contour segment;

[0094] A first determination module 52, configured to determine an actual physical size of the contour segment based on a conversion coefficient of the contour segment;

[0095] The second determining module 53 is used to determine the actual physical size of the contour to be measured of the target object based on the sum of the actual physical sizes of each contour segment.

[0096] The above-mentioned target object contour dimension measurement device provided in the present embodiment divides the contour to be measured of the target object into multiple segments and determines the conversion coefficient of each segment accordingly, fully considering the distribution characteristics of the conversion coefficient in the plane, avoiding the influence caused by the non-perpendicularity of the camera optical axis and the measured plane, and determining the actual physical size of each contour segment according to the conversion coefficient. The sum of the actual physical sizes of the contour segments is the actual physical size of the contour to be measured, avoiding the problem of large measurement errors caused by the use of fixed conversion coefficients, and improving the accuracy of dimension measurement.

[0097] In one embodiment, the segmentation module 51 is used to obtain the midpoint pixel coordinates of each contour segment;

[0098] Obtaining a pre-established conversion coefficient lookup table; wherein the conversion coefficient lookup table includes conversion coefficients corresponding to each pixel in the image;

[0099] The conversion coefficient at the midpoint pixel coordinates of each contour segment is found in the conversion coefficient lookup table, and the conversion coefficient at the midpoint pixel coordinates is used as the conversion coefficient of the corresponding contour segment.

[0100] In one embodiment, the above device further comprises:

[0101] Establishing a module for acquiring a graphic array image captured by a target camera; wherein the graphic array image has the same size as the image of the target object, and the graphic array image includes a plurality of preset graphics of the same shape distributed in a matrix array;

[0102] Obtain the pixel coordinates of the center point of each preset graphic in the graphic array image;

[0103] A conversion coefficient lookup table corresponding to the target camera is established based on the actual size of the preset graphics and the pixel coordinates of the center points of each preset graphics.

[0104] In one embodiment, the establishment module is used to determine the conversion coefficient at the pixel coordinates of the center point of each preset graphic based on the actual size of the preset graphic and the pixel size of each preset graphic;

[0105] Establishing a corresponding pixel table based on the resolution of a target camera that acquires a graphic array image;

[0106] The conversion coefficient at the center pixel coordinate of each preset graphic is filled into the corresponding position of the pixel table, and the corresponding conversion coefficient value is supplemented for the blank position in the pixel table except the center pixel coordinate table position to obtain the conversion coefficient lookup table corresponding to the target camera.

[0107] In one embodiment, the establishment module is used to calculate the conversion coefficient of each blank position in the pixel table based on a preset interpolation algorithm and the conversion coefficient at the center point pixel coordinate table position in the pixel table.

[0108] In one embodiment, the establishment module is used to respectively calculate the ratio of the actual size of the preset graphic outline to the pixel size of each preset graphic outline to obtain the conversion coefficient at the pixel coordinate of the center point of each preset graphic.

[0109] In one embodiment, the preset graphic is a dot, the graphic array image is a dot array image, and the above-mentioned establishment module is used to obtain the pixel coordinates of each center of the dot array image;

[0110] Obtain the actual physical size of the diameter of the dots, and obtain the diameter pixel size of each dot in the dot array image;

[0111] The ratios of the actual physical size of the diameter to the pixel size of the diameter of each dot in the dot array image are calculated respectively to obtain the conversion coefficients at the pixel coordinates of each center of the dot array image.

[0112] In one implementation, the preset interpolation algorithm includes any one of a linear interpolation algorithm, a bilinear interpolation algorithm and a spline interpolation algorithm.

[0113] In one implementation, the length of the contour segment ranges from 2 to 10 pixels.

[0114] The implementation principle and technical effects of the device provided in this embodiment are the same as those of the aforementioned embodiments. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.

[0115] An embodiment of the present invention provides an electronic device, which includes a processor and a memory. The memory stores a computer program that can be run on the processor. When the processor executes the computer program, the steps of the method provided in the above embodiment are implemented.

[0116] An embodiment of the present invention provides a computer-readable medium, wherein the computer-readable medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method described in the above embodiment.

[0117] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system described above can refer to the corresponding process in the aforementioned embodiment, and will not be repeated here.

[0118] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0119] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0120] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0121] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for measuring the size of a target object, characterized in that: include: Acquire an image of the target object, divide the contour to be measured of the target object in the image into a plurality of contour segments, and determine a conversion coefficient of each of the contour segments; determining an actual physical size of the contour segment based on a conversion coefficient of the contour segment; The actual physical size of the contour to be measured of the target object is determined based on the sum of the actual physical sizes of each contour segment.

2. The method according to claim 1, characterized in that The step of determining the conversion coefficient of each contour segment comprises: Obtaining the midpoint pixel coordinates of each of the contour segments; Obtaining a pre-established conversion coefficient lookup table; wherein the conversion coefficient lookup table includes conversion coefficients corresponding to each pixel in the image; The conversion coefficient at the midpoint pixel coordinates of each contour segment is searched in the conversion coefficient lookup table, and the conversion coefficient at the midpoint pixel coordinates is used as the conversion coefficient of the corresponding contour segment.

3. The method according to claim 2, characterized in that Also includes: Acquire a graphic array image captured by a target camera; wherein the graphic array image has the same size as the image of the target object, and the graphic array image includes a plurality of preset graphics of the same shape distributed in a matrix array; Obtaining the pixel coordinates of the center point of each of the preset graphics in the graphic array image; A conversion coefficient lookup table corresponding to the target camera is established based on the actual size of the preset graphics and the pixel coordinates of the center points of each of the preset graphics.

4. The method according to claim 3, characterized in that The step of establishing a conversion coefficient lookup table corresponding to the target camera based on the actual size of the preset graphics and the pixel coordinates of the center points of each preset graphic comprises: Determining a conversion coefficient at a pixel coordinate of a center point of each of the preset graphics based on an actual size of the preset graphics and a pixel size of each of the preset graphics; Establishing a corresponding pixel table based on the resolution of a target camera that acquires the graphic array image; The conversion coefficient at the center point pixel coordinate of each preset graphic is filled into the corresponding position of the pixel table, and the blank position in the pixel table except the center point pixel coordinate table position is supplemented with the corresponding conversion coefficient value to obtain the conversion coefficient lookup table corresponding to the target camera.

5. The method according to claim 4, characterized in that The step of supplementing the blank positions in the pixel table except the position of the center point pixel coordinate table with the corresponding conversion coefficient value comprises: Based on a preset interpolation algorithm and the conversion coefficients filled in the pixel table, a conversion coefficient of each blank position in the pixel table is calculated.

6. The method according to claim 4, characterized in that The step of determining the conversion coefficient at the pixel coordinates of the center point of each preset graphic based on the actual size of the preset graphic and the pixel size of each preset graphic comprises: The ratios of the actual size of the preset graphic outlines to the pixel size of each preset graphic outline are calculated respectively to obtain the conversion coefficient at the pixel coordinates of the center point of each preset graphic.

7. The method according to claim 4, characterized in that The preset graphics are dots, the graphic array image is a dot array image, and the step of determining the conversion coefficient at the pixel coordinates of the center point of each preset graphic based on the actual size of the preset graphics and the pixel size of each preset graphic comprises: Obtaining pixel coordinates of the centers of each circle in the dot array image; Acquire the actual physical size of the diameter of the dots, and acquire the pixel size of the diameter of each dot in the dot array image; The ratios of the actual physical size of the diameter to the pixel size of the diameter of each of the dots in the dot array image are calculated respectively to obtain conversion coefficients at the pixel coordinates of each center of the circle in the dot array image.

8. The method according to claim 5, characterized in that The preset interpolation algorithm includes any one of a linear interpolation algorithm, a bilinear interpolation algorithm and a spline interpolation algorithm.

9. The method according to any one of claims 1 to 7, characterized in that: The length of the contour segment ranges from 2 to 10 pixels.

10. A device for measuring the contour size of a target object, characterized in that: include: A segmentation module is used to obtain an image of the target object, segment the contour to be measured of the target object in the image into a plurality of contour segments, and determine a conversion coefficient of each of the contour segments; A first determination module, configured to determine an actual physical size of the contour segment based on a conversion coefficient of the contour segment; The second determining module is used to determine the actual physical size of the contour to be measured of the target object based on the sum of the actual physical sizes of each contour segment.