A Measuring Method, Device, Equipment and Medium for a Sheet
By dividing edge rectangles in the image and generating projection lines to identify the edge position of the sheet, the problem of inaccurate edge recognition in the prior art is solved, and more accurate measurement results are achieved.
Patent Information
- Application Number
- CN202411943367.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2044-12-27
AI Technical Summary
The prior art is not accurate enough when identifying the edges of sheets in images, resulting in inaccurate measurement results.
By dividing the initial edge line into multiple line segments in the image of the sheet to be processed, and building an edge rectangle at each line segment, a projection line parallel to the initial edge line is generated, the target projection line is determined based on the comprehensive pixel value of the projection line, and finally the measurement is performed based on the boundary point on the target projection line.
Accurate identification of the edge position of the sheet is achieved, and the accuracy of the measurement results is improved.
Smart Images

Figure CN119379677B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of sheet measurement, and particularly to a method, device, equipment and medium for measuring a sheet. Background Art
[0002] In industrial production, boundary detection and corner positioning are the basis for many quality control and dimensional measurement tasks. Precise boundary detection can help identify the shape and defects of products, while accurate corner positioning is a prerequisite for achieving high-precision measurement and positioning.
[0003] Currently, when identifying the edge of a sheet in an image, methods such as Canny edge detection, Hough line detection, and SIFT (Scale-Invariant Feature Transform) can be used. However, the edges of the sheet determined by the above methods are not precise enough, resulting in inaccurate measurement results of the sheet. Summary of the Invention
[0004] The present invention provides a method, device, equipment and medium for measuring a sheet, which can accurately identify the edge position of the sheet and thus obtain accurate measurement results.
[0005] According to one aspect of the present invention, there is provided a method for measuring a sheet, the method comprising:
[0006] In the image of the sheet to be processed, divide the initial edge line into a first preset number of line segments, and construct an edge rectangle including the line segment at each line segment; the initial edge line is the connection line between two adjacent corner points of the sheet to be processed;
[0007] In the edge rectangle, generate a second preset number of projection lines parallel to the initial edge line;
[0008] In the same edge rectangle, based on the comprehensive pixel value of the target pixel points corresponding to the projection lines, determine the target projection line located at the edge position of the sheet to be processed among the projection lines;
[0009] Measure the sheet to be processed based on the boundary points on the target projection lines in each edge rectangle, and obtain the measurement result of the sheet to be processed.
[0010] According to another aspect of the present invention, there is provided a device for measuring a sheet, comprising:
[0011] An edge rectangle determination module, configured to divide the initial edge line into a first preset number of line segments in the image of the sheet to be processed, and construct an edge rectangle including the line segment at each line segment; the initial edge line is the connection line between two adjacent corner points of the sheet to be processed;
[0012] A projection line generation module, configured to generate a second preset number of projection lines parallel to the initial edge line in the edge rectangle;
[0013] A target projection line determination module, configured to determine, in the same edge rectangle, a target projection line located at the edge position of the sheet to be processed among the projection lines based on the comprehensive pixel value of the target pixel points corresponding to the projection lines;
[0014] A sheet measurement module, configured to measure the sheet to be processed based on the boundary points on the target projection lines in each edge rectangle to obtain a measurement result of the sheet to be processed.
[0015] According to another aspect of the present invention, there is provided an electronic device, including:
[0016] At least one processor; and
[0017] A memory communicatively connected to the at least one processor; wherein,
[0018] The memory stores a computer program executable by the at least one processor, and when the computer program is executed by the at least one processor, the at least one processor is enabled to execute the sheet measurement method according to any embodiment of the present invention.
[0019] According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for enabling a processor to implement the sheet measurement method according to any embodiment of the present invention when executed.
[0020] The technical solution of the embodiments of the present application includes: in the image of the sheet to be processed, dividing the initial edge line into a first preset number of line segments, and constructing an edge rectangle including the line segment at each line segment; the initial edge line is a connection line between two adjacent corner points of the sheet to be processed; in the edge rectangle, generating a second preset number of projection lines parallel to the initial edge line; in the same edge rectangle, determining a target projection line located at the edge position of the sheet to be processed among the projection lines based on the comprehensive pixel value of the target pixel points corresponding to the projection lines; measuring the sheet to be processed based on the boundary points on the target projection lines in each edge rectangle to obtain a measurement result of the sheet to be processed. This technical solution provides support for the accurate measurement of the sheet to be processed by dividing the area between the corner points into multiple edge rectangles and identifying boundary points in each edge rectangle that can accurately reflect the edge position.
[0021] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used 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
[0022] To more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.
[0023] Figure 1 is a flowchart of a method for measuring a sheet according to Embodiment 1 of the present application;
[0024] Figure 2 is a flowchart of a method for measuring a sheet according to Embodiment 2 of the present application;
[0025] Figure 3 is a schematic diagram of the camera field of view and the material position according to Embodiment 2 of the present application;
[0026] Figure 4 is a schematic diagram of the motion space relationship between the camera and the material according to Embodiment 2 of the present application;
[0027] Figure 5 is a schematic diagram of the edge rectangle of the sheet image to be processed captured by a camera according to Embodiment 2 of the present application;
[0028] Figure 6 is a schematic diagram of the edge rectangle of the sheet image to be processed captured by another camera according to Embodiment 2 of the present application;
[0029] Figure 7 is a schematic diagram of a comprehensive pixel value according to Embodiment 2 of the present application;
[0030] Figure 8 is a schematic diagram of the structure of a sheet measuring device according to Embodiment 3 of the present application;
[0031] Figure 9 is a schematic diagram of the structure of an electronic device for implementing the method for measuring a sheet in the embodiments of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0032] To enable those skilled in the art to better understand the solutions of the present invention, the following clearly and completely describes the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0033] It should be noted that the terms "first", "second", "target", etc. in the specification, claims and the above-mentioned drawings of the present invention are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present invention described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0034] Embodiment 1
[0035] Figure 1 FIG. is a flowchart of a method for measuring a sheet provided in Embodiment 1 of the present application. The embodiments of the present application are applicable to the situation of measuring a sheet. This method can be executed by a measuring device for the sheet. The measuring device for the sheet can be implemented in the form of hardware and / or software, and the measuring device for the sheet can be configured in an electronic device with data processing capabilities. As Figure 1 shown, the method includes:
[0036] S110, in the image of the sheet to be processed, divide the initial edge line into a first preset number of line segments, and construct an edge rectangle including the line segment at each line segment; the initial edge line is the connection line between two adjacent corner points of the sheet to be processed.
[0037] Among them, the sheet to be processed can be materials that need to be measured, such as metal, plastic, leather, etc., such as aluminum plates, PVC sheets, etc. The first preset number can be determined according to the actual situation, and the embodiments of the present application do not limit this.
[0038] Specifically, obtain the image of the sheet to be processed, after performing corner point recognition on its image, obtain each corner point of the sheet to be processed, determine the connection line between two adjacent corner points as the initial edge line, evenly divide the initial edge line to obtain a first preset number of line segments, and use the line segment as the median line of the edge rectangle to obtain the edge rectangle. In a specific example, the process of generating the edge rectangle can be: assume that the four sides of the edge rectangle are the first side, the second side, the third side, and the fourth side respectively, the first side and the third side are opposite, the second side and the fourth side are opposite, take the two ends of the line segment as the midpoints of the first side and the third side, and set the lengths of the first side and the third side as the preset distance, then the edge rectangle can be obtained.
[0039] S120, in the edge rectangle, generate a second preset number of projection lines parallel to the initial edge line.
[0040] Among them, the second preset quantity can be determined according to the actual situation, and the embodiments of the present application do not limit this.
[0041] Specifically, in the edge rectangle, there are partial line segments of the initial edge line. Since the initial edge line roughly reflects the edge position of the sheet, the line segments of the initial edge line in the edge rectangle can be translated to obtain projection lines, and each projection line is parallel to the initial edge line.
[0042] In the image, the lengths of the first side and the third side of the edge rectangle may be 50 pixel lengths (the first side and the third side are the two sides of the edge rectangle that intersect with the initial edge line). Each pixel length is the length of one pixel point. In this case, the second preset quantity can be determined to be 50, that is, when translating the initial edge line, only move one pixel length each time to make the projection lines cover as much as possible in the edge rectangle.
[0043] S130. In the same edge rectangle, based on the comprehensive pixel values of the target pixel points corresponding to the projection lines, determine the target projection lines located at the edge position of the sheet to be processed among the projection lines.
[0044] Specifically, since the image of the edge position of the sheet to be processed is at the boundary position between the background and the sheet, that is, the pixel values of the pixel points near the edge of the sheet to be processed have numerical changes. The projection lines with larger differences between the comprehensive pixel values and the comprehensive pixel values of adjacent projection lines can be identified according to the comprehensive pixel values corresponding to different projection lines, and these projection lines are determined as the target projection lines.
[0045] S140. Measure the sheet to be processed based on the boundary points on the target projection lines in each edge rectangle to obtain the measurement result of the sheet to be processed.
[0046] Specifically, after obtaining the target projection lines in each edge rectangle, boundary points can be identified on the projection lines (for example, taking the midpoint of the projection line as the boundary point). In this case, all the obtained boundary points are located in the edge area of the sheet to be processed, and the length, area and other parameters of the sheet to be processed can be measured according to the boundary points on each side of the sheet to be processed.
[0047] The technical solution of the embodiment of the present application includes: in the image of the sheet to be processed, dividing the initial edge line into a first preset number of line segments, and constructing an edge rectangle including the line segment at each line segment; the initial edge line is the connection line between two adjacent corner points of the sheet to be processed; in the edge rectangle, generating a second preset number of projection lines parallel to the initial edge line; in the same edge rectangle, based on the comprehensive pixel value of the target pixel points corresponding to the projection lines, determining the target projection line located at the edge position of the sheet to be processed among the projection lines; measuring the sheet to be processed based on the boundary points on the target projection lines in each edge rectangle to obtain the measurement result of the sheet to be processed. This technical solution provides support for the precise measurement of the sheet to be processed by dividing multiple edge rectangles between the corner points and identifying the boundary points in each edge rectangle that can accurately reflect the edge position.
[0048] Embodiment 2
[0049] Figure 2 The flowchart of a method for measuring a sheet provided in Embodiment 2 of the present application is optimized based on the above embodiment.
[0050] As Figure 2 shown, the method of the embodiment of the present application specifically includes the following steps:
[0051] S210, determining the corner points in the image of the sheet to be processed.
[0052] In the embodiment of the present application, optionally, the process of determining the corner points of the sheet to be processed includes: performing corner point detection on the initial detection area of the image of the sheet to be processed based on the corner point detection model to obtain the initial corner point coordinates; performing an outward expansion process based on the initial corner point coordinates to obtain an updated detection area; if corner point recognition is performed using the target corner point detection algorithm in the updated detection area to obtain the updated corner point coordinates, then determining the final corner point coordinates according to the initial corner point coordinates, the updated corner point coordinates, and the distance between the initial corner point coordinates and the updated corner point coordinates; otherwise, determining the initial corner point coordinates as the final corner point coordinates.
[0053] Exemplarily, Figure 3 is a schematic diagram of the camera field of view and the material position. The material can be photographed by the camera to obtain the image of the sheet to be processed. If the sheet to be processed is large, two line-scan cameras are used to cover the entire sheet, and there is a certain overlap between the cameras to prevent area omission. See the schematic diagram of the motion space relationship between the camera and the material in Figure 4. An initial detection area is marked in the sheet image to be processed, and the corner point detection model is used to perform corner point detection on the initial detection area of the sheet image to be processed to obtain the initial corner point coordinates; an outward expansion process is performed with the initial corner point coordinates as the center to obtain an updated detection area smaller than the initial detection area; in the updated detection area, the Harris Corner Detection algorithm is used to identify the corner points. If the corner points are identified, the identified corner point coordinates are used as the updated corner point coordinates, and then the distance between the initial corner point coordinates and the updated corner point coordinates is determined according to the following formula:
[0054] ;
[0055] in, is the distance between the initial corner point coordinates and the updated corner point coordinates, are the initial corner point coordinates, To update the corner point coordinates, is the distance threshold.
[0056] If it is less than or equal to the distance threshold, the updated corner point coordinates are determined as the final corner point coordinates; if it is greater than the distance threshold, the final corner point coordinates are determined based on the product of the initial corner point coordinates and the first weight, and the product of the updated corner point coordinates and the second weight; the first weight is less than the second weight, and the sum of the first weight and the second weight is 1; exemplarily, the first weight is 0.4 and the second weight is 0.6.
[0057] Exemplarily, the final corner point coordinates are determined according to the following formula:
[0058] ;
[0059] in, is the final corner point coordinate, is the first weight, is the second weight.
[0060] It should be noted that, for a sheet of fixed size, the corner detection model can be a fixed-size target detection model based on deep learning. For a sheet of non-fixed size, the corner detection model can be a multi-scale pyramid feature fusion network model.
[0061] This solution combines a deep learning model with traditional corner detection methods for corner detection, effectively improving the positioning accuracy of boundaries and corners. In complex backgrounds and noisy environments, the cases of missed detection and false detection are reduced. By adopting the combination of deep learning detection and traditional corner detection, if the traditional method fails to detect a corner, the deep learning result can be used as the standard to ensure the effective positioning of each corner. This solution reduces background interference unrelated to detection by setting an initial detection area and updating the detection area (the detection area is the region of interest (ROI)), significantly improving the detection effect of corners and boundaries.
[0062] S220. Connect the adjacent two corners in the sheet image to be processed to obtain an initial edge line.
[0063] In an embodiment of the present application, optionally, before dividing the initial edge line into a first preset number of line segments, the method further includes: calculating the angle between the initial edge line and the horizontal line; if the angle is not within the preset angle range, an angle anomaly alarm is given and the angle anomaly information is recorded.
[0064] Specifically, after corner detection, four corners may be obtained. Each corner is located at the edge position of the sheet to be processed. Connect the four corners to form a rectangle. Each side in the rectangle is the initial edge line. Calculate the angle between each initial edge line and the horizontal line (which can be the x-axis). If the angle is within the preset angle range, the position of the sheet is normal; if the angle is not within the preset angle range, an angle anomaly alarm is given and the angle anomaly information is recorded.
[0065] This solution realizes the monitoring of each side by setting angle anomaly detection. If it exceeds the set range, the system can give an alarm in time to remind the staff to check, and can timely detect equipment deviation or abnormal sheet position, preventing the occurrence of production accidents. It ensures the stability and safety of the production line. Effectively realizes the monitoring of the equipment state and early warning of possible problems, thus avoiding system failures caused by significant deviations in the hardware structure.
[0066] Exemplarily, for the straight-line equation: for two corners (x1, y1) and (x2, y2), the calculation formula for the slope m of the straight line is:
[0067] ;
[0068] Calculate the angle between each side and the horizontal line according to the slope :
[0069] .
[0070] For each initial edge line, according to the allowable deviation angle and determine a preset included angle range according to a set value, for example, the preset included angle range = the set value .
[0071] S230. In the image of the sheet to be processed, divide the initial edge line into a first preset number of line segments, and construct an edge rectangle including the line segment at each line segment.
[0072] Exemplarily, Figure 5 is a schematic diagram of an edge rectangle of an image of a sheet to be processed captured by one camera, Figure 6 is a schematic diagram of an edge rectangle of an image of a sheet to be processed captured by another camera. The red circles around are corner points, and each rectangle between the corner points is an edge rectangle.
[0073] Specifically, divide the initial edge line into a first preset number of line segments. At each line segment, construct an edge rectangle with the midpoints of the first side and the third side of the edge rectangle at both ends of the line segment (the lengths of the first side and the third side can be set according to the actual situation). In this case, each edge rectangle includes a part of the line segment of the initial edge line, and the line segment is the median line of the edge rectangle.
[0074] S240. Determine the starting projection line as the initial edge line located in the edge rectangle.
[0075] Specifically, in the edge rectangle, it is necessary to determine each projection line. Since the projection lines are all parallel to the initial edge line, the initial edge line in the edge rectangle can be determined as the starting projection line, and each projection line can be obtained by translating the starting projection line subsequently.
[0076] S250. In the edge rectangle, translate the starting projection line along the normal direction of the initial edge line to obtain a second preset number of projection lines; the interval between adjacent two projection lines is an integer multiple of the pixel length.
[0077] Specifically, after determining the starting projection line, the translation distance each time can be set as one pixel length, and then the starting projection line is translated. Each translation obtains a new projection line until the translation reaches the boundary of the edge rectangle and ends, obtaining each projection line with an interval of one pixel length in the edge rectangle.
[0078] S260. In the same edge rectangle, determine the target pixel points corresponding to the projection lines.
[0079] In an embodiment of the present application, optionally, determining the target pixel points corresponding to the projection line includes: determining the intersection point of the projection line and the first side of the edge rectangle as the starting point; constructing a rectangular coordinate system corresponding to the pixel coordinate system and determining the projection expression of the projection line in the rectangular coordinate system; determining the target movement interval according to the slope of the projection expression and the pixel length of the pixel points; starting from the starting point of the projection line, obtaining discrete projection points by moving the target movement interval each time on the projection line; and determining the pixel points corresponding to the discrete projection points in the pixel coordinate system as the target pixel points corresponding to the projection line.
[0080] Specifically, the projection line intersects two sides of the edge rectangle and there are two intersection points. Any one of the two sides can be used as the first side, and the intersection point of the projection line and the first side of the edge rectangle is determined as the starting point. Starting from the starting point, the target movement interval is moved each time on the initial edge line within the edge rectangle to obtain each discrete projection point. The pixel points corresponding to the discrete projection points (including the starting point) in the pixel coordinate system are determined, and these pixel points are determined as the target pixel points corresponding to the projection line. Among them, when determining the pixel points corresponding to the discrete projection points in the pixel coordinate system, the coordinates of the discrete projection points can be rounded to obtain the pixel points corresponding to the pixel coordinate system, or the coordinate ranges of the discrete projection points corresponding to each pixel point can be preset in advance, and then the pixel points corresponding to the discrete projection points in the pixel coordinate system are determined based on the preset information.
[0081] Further, determining the target movement interval according to the slope of the projection expression and the pixel length of the pixel points may be:
[0082] If the slope of the projection expression is equal to 1, then the target movement interval is determined to be times the pixel length; if the slope of the projection expression is less than 1, after moving one pixel length on the abscissa, the moving distance on the projection line is the target movement interval. Specifically, the angle between the projection line and the x-axis can be calculated according to the slope of the projection expression, and the ratio of one pixel length to the cosine value of the angle is used as the target movement interval. If the slope of the projection expression is greater than 1, after moving one pixel length on the ordinate, the moving distance on the projection line is the target movement interval. Specifically, the angle between the projection line and the y-axis can be calculated according to the slope of the projection expression, and the ratio of one pixel length to the cosine value of the angle is used as the target movement interval.
[0083] S270, taking the average pixel value of the target pixel points as the comprehensive pixel value corresponding to the projection line.
[0084] S280, determining the projection line corresponding to the comprehensive pixel value that satisfies the pixel mutation condition among the comprehensive pixel values as the target projection line.
[0085] Exemplarily,Figure 7 is a schematic diagram of comprehensive pixel values. In Figure 7 , the ordinate pixel value is the comprehensive pixel value. The comprehensive pixel values corresponding to each projection line are different. At the edge position of the sheet to be processed, the comprehensive pixel value changes greatly. The projection line corresponding to the comprehensive pixel value that meets the pixel mutation condition can be determined as the target projection line.
[0086] S290. Measure the sheet to be processed based on the boundary points on the target projection line in each edge rectangle, and obtain the measurement result of the sheet to be processed.
[0087] Specifically, after determining the target projection line, the midpoint on the target projection line can be used as the boundary point. In this way, the boundary points of each edge rectangle are all located on the edge of the sheet to be processed, and the precise measurement of the sheet to be processed can be carried out according to the boundary point position and the corner point position.
[0088] In the embodiment of the present application, optionally, measuring the sheet to be processed based on the boundary points on the target projection line in each edge rectangle, and obtaining the measurement result of the sheet to be processed includes: determining the boundary points according to the comprehensive pixel value corresponding to the target projection line and the position where the target projection line is located; determining the length of the side to be measured of the sheet to be processed according to the position of the boundary points in the edge rectangle on the upper edge of the side to be measured of the sheet to be processed; if it is determined that the side to be measured of the sheet to be processed appears in at least two images, then determine the final length of the side to be measured of the sheet to be processed based on the length of the side to be measured detected in each image and the length of the pixel coincidence area in the camera.
[0089] Exemplarily, a feasible solution is to determine the midpoint as the boundary point on the target projection line. Another feasible solution is to determine the pixel point closest to the comprehensive pixel value among the pixel points on the target projection line as the boundary point. After determining the boundary points, on one side, adjacent two boundary points can be connected, and each side can be connected through the corner points to obtain all the edges of the sheet to be processed. If the sheet to be processed is large, for example Figure 3 as shown, if two images are required to obtain a complete sheet, then calculate the length and area of the side to be measured of the sheet to be processed in the image in each of the two images of the sheet to be processed (the side to be measured is the side with coincidence), and then, based on the installation positions and field of view ranges of the two cameras, determine the coincidence length and coincidence area in the two images respectively, and determine the final length and final area of the side to be measured according to the above results.
[0090] Specifically, in an image of a sheet to be processed, the length of a first side to be measured and a first overlapping length are measured; in another image of a sheet to be processed, the length of a second side to be measured and a second overlapping length are measured; the difference between the length of the first side to be measured and the first overlapping length is determined as a first value, the difference between the length of the second side to be measured and the second overlapping length is determined as a second value, and the sum of the first value and the second value is determined as the final length of the side to be measured.
[0091] In an image of a sheet to be processed, a first detected area and a first overlapping area are measured; in another image of a sheet to be processed, a second detected area and a second overlapping area are measured. The difference between the first detected area and the first overlapping area is used as a third value, the difference between the second detected area and the second overlapping area is used as a fourth value, and the sum of the third value and the fourth value is determined as the final area.
[0092] With this setting in this solution, the boundary points of the sheet to be processed can be accurately determined. And since each boundary point is determined within the edge rectangle, it can more accurately reflect the edge position of the sheet to be processed, thereby making the calculated values such as the length and area of the sheet to be processed more accurate.
[0093] Embodiment III
[0094] Figure 8 FIG. is a schematic structural diagram of a sheet measuring device provided in Embodiment III of the present application. This device can execute the sheet measuring method provided in any embodiment of the present invention and has corresponding functional modules and beneficial effects for executing the method. As Figure 8 shown, the device includes:
[0095] An edge rectangle determination module 310, configured to divide an initial edge line into a first preset number of line segments in an image of a sheet to be processed, and construct an edge rectangle including the line segment at each line segment; the initial edge line is a connection line between two adjacent corner points of the sheet to be processed;
[0096] A projection line generation module 320, configured to generate a second preset number of projection lines parallel to the initial edge line in the edge rectangle;
[0097] A target projection line determination module 330, configured to determine, in the same edge rectangle, a target projection line located at the edge position of the sheet to be processed among the projection lines based on the comprehensive pixel value of the target pixel points corresponding to the projection lines;
[0098] A sheet measurement module 340, configured to measure the sheet to be processed based on the boundary points on the target projection lines in each edge rectangle to obtain a measurement result of the sheet to be processed.
[0099] The technical solution of the embodiment of the present application includes: an edge rectangle determination module 310, configured to divide an initial edge line into a first preset number of line segments in the image of the sheet to be processed, and construct an edge rectangle including the line segment at each line segment; the initial edge line is a connection line between two adjacent corner points of the sheet to be processed; a projection line generation module 320, configured to generate a second preset number of projection lines parallel to the initial edge line in the edge rectangle; a target projection line determination module 330, configured to determine a target projection line located at the edge position of the sheet to be processed among the projection lines based on the comprehensive pixel value of the target pixel points corresponding to the projection lines in the same edge rectangle; a sheet measurement module 340, configured to measure the sheet to be processed based on the boundary points on the target projection lines in each edge rectangle to obtain a measurement result of the sheet to be processed. This technical solution divides multiple edge rectangles between the corner points, identifies boundary points that can accurately reflect the edge position in each edge rectangle, and provides support for the accurate measurement of the sheet to be processed.
[0100] In the embodiment of the present application, optionally, the projection line generation module 320 includes:
[0101] A starting projection line determination unit, configured to determine the initial edge line located in the edge rectangle as the starting projection line;
[0102] A projection line generation unit, configured to translate the starting projection line along the normal direction of the initial edge line in the edge rectangle to obtain a second preset number of projection lines; the interval between two adjacent projection lines is an integer multiple of the pixel length.
[0103] In the embodiment of the present application, optionally, the target projection line determination module 330 includes:
[0104] A target pixel point determination unit, configured to determine the target pixel points corresponding to the projection lines;
[0105] A comprehensive pixel value calculation unit, configured to use the average pixel value of the target pixel points as the comprehensive pixel value corresponding to the projection line;
[0106] A target projection line determination unit, configured to determine the projection line corresponding to the comprehensive pixel value that satisfies the pixel mutation condition among the comprehensive pixel values as the target projection line.
[0107] In the embodiment of the present application, optionally, the target pixel point determination unit includes:
[0108] A starting point determination subunit, configured to determine the intersection point of the projection line and the first side of the edge rectangle as the starting point;
[0109] A projection expression determination subunit, configured to construct a rectangular coordinate system corresponding to the pixel coordinate system and determine the projection expression of the projection line in the rectangular coordinate system;
[0110] A target movement interval determination subunit, configured to determine a target movement interval according to the slope of a projection expression and the pixel length of a pixel point;
[0111] A discrete projection point determination subunit, configured to start from the starting point of the projection line and obtain discrete projection points by moving the target movement interval each time on the projection line;
[0112] A target pixel point determination subunit, configured to determine the pixel point corresponding to the discrete projection point in the pixel coordinate system as the target pixel point corresponding to the projection line.
[0113] In an embodiment of the present application, optionally, the device further includes: a corner point determination module, specifically including:
[0114] Performing corner point detection on an initial detection area of a to-be-processed sheet image based on a corner point detection model to obtain initial corner point coordinates;
[0115] Performing an outward expansion process based on the initial corner point coordinates to obtain an updated detection area;
[0116] If corner point recognition is performed using a target corner point detection algorithm in the updated detection area to obtain updated corner point coordinates, then determine the final corner point coordinates according to the initial corner point coordinates, the updated corner point coordinates, and the distance between the initial corner point coordinates and the updated corner point coordinates;
[0117] Otherwise, determine the initial corner point coordinates as the final corner point coordinates.
[0118] In an embodiment of the present application, optionally, the device further includes:
[0119] An included angle calculation module, configured to calculate the included angle between the initial edge line and the horizontal line;
[0120] An abnormal alarm module, configured to perform an included angle abnormal alarm and record included angle abnormal information if the included angle is not within a preset included angle range.
[0121] In an embodiment of the present application, optionally, the sheet measurement module 340 includes:
[0122] A boundary point determination unit, configured to determine boundary points according to the comprehensive pixel value corresponding to a target projection line and the position where the target projection line is located;
[0123] A length determination unit, configured to determine the length of the to-be-measured side according to the positions of the boundary points in the upper edge rectangle of the to-be-measured side of the to-be-processed sheet;
[0124] A final length determination unit, configured to, if it is determined that the side to be measured of the sheet to be processed appears in at least two images, determine the final length of the side to be measured of the sheet to be processed based on the length of the side to be measured detected in each image and the length of the pixel coincidence region in the camera.
[0125] The sheet measuring device provided by the embodiments of the present application can execute the sheet measuring method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method.
[0126] Embodiment Four
[0127] Figure 9 FIG. shows a schematic structural diagram of an electronic device 10 that can be used to implement the embodiments of the present invention. The electronic device is intended to represent various forms of digital computers, such as, for example, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, for example, a personal digital processor, a cellular phone, a smart phone, a wearable device (such as a helmet, glasses, a watch, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0128] As Figure 9 shown, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc. Among them, the memory stores a computer program executable by the at least one processor. 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 into 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.
[0129] A plurality 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 magnetic 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.
[0130] The processor 11 may be various general-purpose and / or special-purpose 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 suitable processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the method for measuring a sheet.
[0131] In some embodiments, the method for measuring a sheet may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed onto 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 method for measuring a sheet described above may be executed. Alternatively, in other embodiments, the processor 11 may be configured to execute the method for measuring a sheet by any other suitable means (e.g., by means of firmware).
[0132] The various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGA), application specific integrated circuits (ASIC), application specific standard products (ASSP), systems on a chip (SOC), complex programmable logic devices (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments 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 receives data and instructions from a storage system, at least one input device, and at least one output device, and transmits the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0133] The computer program for implementing the method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowchart and / or block diagram are implemented. The computer program can be executed entirely on the machine, partially on the machine, as a stand-alone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0134] In the context of the present invention, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0135] To provide for interaction with a user, the systems and techniques described herein can 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 a trackball) by which the user can provide input to the electronic device. Other kinds of devices can also be used to provide for interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0136] The systems and techniques described herein can 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 having a graphical user interface or a web browser through which the user can interact with an implementation 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 can 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.
[0137] A computing system may include a client and a server. The client and the server are generally far from each other and usually interact via a communication network. The relationship between the client and the server is created by computer programs running on respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, solving the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services.
[0138] It should be understood that various forms of processes shown above can be used, with steps reordered, added or deleted. For example, the steps recited in the present invention can be executed in parallel, sequentially or in a different order, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is made herein.
[0139] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for measuring a sheet material, characterized in that: include: In the image of the sheet to be processed, the initial edge line is divided into a first preset number of line segments, and an edge rectangle including the line segment is constructed at each line segment; the initial edge line is a line connecting two adjacent corner points of the sheet to be processed; the median line of the edge rectangle is a line segment obtained by evenly dividing the initial edge line; In the edge rectangle, generating a second preset number of projection lines parallel to the initial edge line; In the same edge rectangle, based on the comprehensive pixel values of the target pixel points corresponding to the projection lines, a target projection line located at the edge position of the sheet to be processed is determined in each projection line; The sheet to be processed is measured based on the boundary points on the target projection line in each edge rectangle to obtain a measurement result of the sheet to be processed.
2. The method according to claim 1, characterized in that: In the edge rectangle, generating a second preset number of projection lines parallel to the initial edge line, comprising: An initial edge line located in the edge rectangle is determined as a starting projection line; In the edge rectangle, the starting projection line is translated along the normal direction of the initial edge line to obtain a second preset number of projection lines; the interval between two adjacent projection lines is an integer multiple of the pixel length.
3. The method according to claim 1, characterized in that Based on the comprehensive pixel values of the target pixel points corresponding to the projection lines, a target projection line located at the edge of the sheet to be processed is determined in each projection line, including: Determine the target pixel point corresponding to the projection line; The average pixel value of the target pixel point is taken as the comprehensive pixel value corresponding to the projection line; The projection line corresponding to the integrated pixel value that meets the pixel mutation condition among the integrated pixel values is determined as the target projection line.
4. The method according to claim 3, characterized in that Determine the target pixel point corresponding to the projection line, including: Determine the intersection point of the projection line and the first side of the edge rectangle as the starting point; Construct a rectangular coordinate system corresponding to the pixel coordinate system, and determine the projection expression of the projection line in the rectangular coordinate system; According to the slope of the projection expression and the pixel length of the pixel point, the target movement interval is determined; Starting from the starting point of the projection line, a discrete projection point is obtained by moving the target each time on the projection line; The pixel point corresponding to the discrete projection point in the pixel coordinate system is determined as the target pixel point corresponding to the projection line.
5. The method according to claim 1, characterized in that The process of determining the corner points of the sheet to be processed includes: Performing corner point detection on the initial detection area of the sheet image to be processed based on the corner point detection model to obtain initial corner point coordinates; Perform outward expansion processing based on the initial corner point coordinates to obtain an updated detection area; If a target corner point detection algorithm is used in the update detection area to identify corner points and obtain update corner point coordinates, the final corner point coordinates are determined according to the initial corner point coordinates, the update corner point coordinates, and the distance between the initial corner point coordinates and the update corner point coordinates; Otherwise, the initial corner point coordinates are determined as the final corner point coordinates.
6. The method according to claim 1, characterized in that Before dividing the initial edge line into a first preset number of line segments, the method further includes: Calculate the angle between the initial edge line and the horizontal line; If the angle is not within the preset angle range, an angle abnormality alarm is issued and the angle abnormality information is recorded.
7. The method according to claim 1, characterized in that The sheet to be processed is measured based on the boundary points on the target projection line in each edge rectangle to obtain the measurement result of the sheet to be processed, including: Determine the boundary point according to the integrated pixel value corresponding to the target projection line and the position of the target projection line; Determine the length of the side to be measured according to the position of the boundary point in the edge rectangle on the side to be measured of the sheet to be processed; If it is determined that the edge to be measured of the sheet to be processed appears in at least two images, the final length of the edge to be measured of the sheet to be processed is determined based on the length of the edge to be measured detected in each image and the length of the pixel overlap area in the camera.
8. A sheet material measuring device, characterized in that: include: An edge rectangle determination module is used to divide the initial edge line into a first preset number of line segments in the image of the sheet to be processed, and construct an edge rectangle including the line segment at each line segment; the initial edge line is a line connecting two adjacent corner points of the sheet to be processed; and the median line of the edge rectangle is a line segment obtained by evenly dividing the initial edge line; A projection line generating module, used for generating a second preset number of projection lines parallel to the initial edge line in the edge rectangle; A target projection line determination module is used to determine the target projection line located at the edge position of the sheet to be processed in each projection line based on the comprehensive pixel value of the target pixel point corresponding to the projection line in the same edge rectangle; The sheet material measurement module is used to measure the sheet material to be processed based on the boundary points on the target projection line in each edge rectangle to obtain the measurement result of the sheet material to be processed.
9. 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 perform the sheet material measuring method according to any one of claims 1 to 7.
10. 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 sheet material measuring method according to any one of claims 1 to 7 when the processor executes the computer instructions.
Citation Information
Patent Citations
Method for detecting quadrangular marker in image
CN105654097A