Edge positioning method and device based on computer vision and related equipment

By acquiring and processing workpiece images using computer vision technology, and by using the least squares method and a preset calculation model to filter feature attributes, the problem of low workpiece edge positioning accuracy was solved, and efficient and accurate positioning was achieved.

CN115578594BActive Publication Date: 2025-12-09SHENZHENSHI YUZHAN PRECISION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211288606.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-20
Publication Date
2025-12-09
Estimated Expiration
2042-10-20

AI Technical Summary

Technical Problem

In existing technologies, workpiece edge positioning methods rely on initial positioning using reference points, resulting in low positioning accuracy, a tendency to mistakenly capture interfering edges formed by tool marks, and long edge-finding times, thus affecting efficiency.

Method used

A computer vision-based edge localization method is adopted. By acquiring workpiece images, preprocessing, extracting contours, fitting edge lines, and using the least squares method and a preset calculation model to filter feature attributes, the target edge line is determined.

Benefits of technology

It improves the accuracy of edge positioning, reduces knife-mark interference, and improves positioning efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115578594B_ABST
    Figure CN115578594B_ABST
Patent Text Reader

Abstract

The application provides a computer vision-based edge positioning method, comprising: acquiring an original image of a processed workpiece; preprocessing the original image to determine a target edge region; performing contour extraction and screening on the target edge region to obtain a suspected edge straight line contour; fitting the suspected edge straight line contour into a fitted edge straight line based on a least square method; substituting a plurality of characteristic attributes of the fitted edge straight line into a pre-designed calculation model to obtain a straight line weighted score value, so as to determine a target edge straight line; and setting a positioning parameter of a pre-set positioning tool based on the target edge straight line, so as to position the target edge straight line. The application determines the target edge straight line by introducing the straight line weighted score value obtained by substituting the plurality of characteristic attributes of the fitted edge straight line into the pre-designed calculation model, realizes accurate positioning of the target edge straight line, and improves the recognition accuracy of edge positioning. The application also provides a computer vision-based edge positioning device, an electronic device and a computer readable storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of visual detection, and particularly relates to an edge positioning method and device based on computer vision, electronic equipment and a computer readable storage medium. BACKGROUND

[0002] After a workpiece passes through a machining process (for example, CNC machining), machining textures similar to the edge of the workpiece are left on the surface of the workpiece, affecting visual positioning. Since the textures are formed on the surface of the workpiece, it is difficult to remove them through traditional methods such as polishing. The current edge positioning method of the workpiece is to preliminarily position through a reference point, correct the position of a caliper, and search for the edge using the caliper. The positioning accuracy is low during preliminary positioning, resulting in a large search range of the caliper. Therefore, the interference edge formed by the tool marks is easily grabbed, the edge searching accuracy is not high, and a long time is required for edge searching, which affects the edge positioning efficiency. SUMMARY

[0003] In view of the above, it is necessary to provide an edge positioning method and device based on computer vision, electronic equipment and a computer readable storage medium, to improve the recognition accuracy of edge positioning.

[0004] The embodiment of the present application provides an edge positioning method based on computer vision, comprising:

[0005] obtaining an original image of a machined workpiece;

[0006] preprocessing the original image to determine a target edge region;

[0007] performing contour extraction and screening on the target edge region to obtain a suspicious edge straight line contour;

[0008] fitting the suspicious edge straight line contour into a fitted edge straight line based on a least square method;

[0009] substituting a plurality of characteristic properties of the fitted edge straight line into a pre-designed calculation model to obtain a straight line weighted score value, to determine a target edge straight line, the pre-designed calculation model satisfying a relationship formula:

[0010]

[0011] wherein, the straight line weighted score value of the fitted edge straight line is represented by a i the i-th characteristic property of the fitted edge straight line is represented by ai, the average value of a plurality of characteristic properties of a standard edge straight line corresponding to the plurality of characteristic properties of the fitted edge straight line is represented by wi, i the weight value of the i-th characteristic property of the fitted edge straight line is represented by wi.

[0012] Based on the target edge line, the positioning parameters of the preset positioning tool are set to locate the target edge line.

[0013] The aforementioned computer vision-based edge localization method introduces several feature attributes of the fitted edge line through a preset calculation model to calculate the linear weighted score of the fitted edge line. Based on the linear weighted score of the fitted edge line, the target edge line is determined, thereby achieving accurate localization of the target edge line and improving the recognition accuracy of edge localization.

[0014] In some embodiments, the training method of the preset computational model includes:

[0015] Acquire training data, wherein the training data includes multiple standard images containing the standard edge line and multiple detection images containing the target edge line;

[0016] Based on several feature attributes of the standard edge line in multiple standard images, the average value of several feature attributes of the standard edge line is obtained;

[0017] Substituting several feature attributes of the target edge line from multiple detected images into the benchmark training model, the line weighted score of the target edge line is obtained. The benchmark training calculation model satisfies the following relationship:

[0018]

[0019] in, a represents the line weighted score of the target edge line. i1 The i1th feature attribute representing the target edge line w represents the average value of the characteristic attributes of the standard edge line corresponding to several characteristic attributes of the target edge line. i1 The weight of the i1th feature attribute of the target edge line;

[0020] Cyclic Change w i1 The value of w is calculated for each group. i1 The value corresponds to the obtained The sum of all values, and filter out the ones with the largest sum. A corresponding set of w i1 The value;

[0021] Substitution The value and the selected w i1 The value is added to the relation satisfied by the preset calculation model as a formula constant to obtain the trained preset calculation model.

[0022] In some embodiments, the preprocessing the original image to determine a target edge region comprises:

[0023] determining a mark point of the workpiece by using a template matching method;

[0024] determining an offset value according to the mark point, and obtaining an affine matrix based on the offset value;

[0025] performing affine transformation on the original image according to the affine matrix to obtain an initial edge region;

[0026] filtering the initial edge region to obtain the target edge region.

[0027] In some embodiments, the performing contour extraction and screening on the target edge region to obtain a suspicious edge straight line contour comprises:

[0028] extracting an initial suspicious edge straight line contour of the target edge region based on a contour extraction algorithm;

[0029] screening out initial suspicious edge straight line contours with excessively long or short lengths from the initial suspicious edge straight line contours to obtain suspicious edge straight line contours.

[0030] In some embodiments, the substituting a plurality of characteristic attributes of the fitted edge straight line into a pre-designed calculation model to obtain a straight line weighted score value to determine a target edge straight line comprises:

[0031] screening the weighted score value of the fitted edge straight line determining the weighted score value of the fitted edge straight line the highest fitted edge straight line is the target edge straight line.

[0032] In some embodiments, the characteristic attributes comprise at least one of a straight line normal vector, a distance value, an edge amplitude value, a straightness, and a contour length.

[0033] In some embodiments, the preset positioning tool is a caliper.

[0034] Embodiments of the present application also provide an edge positioning device based on computer vision, comprising:

[0035] an image acquisition module configured to acquire an original image of a processed workpiece;

[0036] an image preprocessing module configured to preprocess the original image to determine a target edge region;

[0037] a contour extraction module configured to perform contour extraction and screening on the target edge region to obtain a suspicious edge straight line contour;

[0038] a straight line fitting module, configured to fit the suspicious edge straight line contour into a fitted edge straight line based on a least square method;

[0039] a straight line calculating module, configured to substitute a plurality of characteristic attributes of the fitted edge straight line into a pre-designed calculation model to obtain a straight line weighted score value, so as to determine a target edge straight line, wherein the pre-designed calculation model satisfies a relationship:

[0040]

[0041] wherein, the straight line weighted score value of the fitted edge straight line is represented by a i the i th characteristic attribute of the fitted edge straight line is represented by the average value of a plurality of characteristic attributes of a standard edge straight line corresponding to the plurality of characteristic attributes of the fitted edge straight line is represented by w i the weight value of the i th characteristic attribute of the fitted edge straight line is represented by

[0042] a straight line positioning module, configured to set a positioning parameter of a pre-set positioning tool based on the target edge straight line, so as to position the target edge straight line.

[0043] Embodiments of the present application also provide an electronic device, comprising:

[0044] a memory, configured to store computer instructions;

[0045] a processor, coupled to the memory, configured to invoke the computer instructions in the memory to execute the computer vision-based edge positioning method in the above embodiments.

[0046] Embodiments of the present application also provide a computer readable storage medium,

[0047] the computer readable storage medium stores computer instructions, and the computer instructions are run by a processor to execute the computer vision-based edge positioning method in the above embodiments.

[0048] The above computer vision-based edge positioning device, electronic device and computer readable storage medium can realize accurate positioning of a target edge straight line, and improve the recognition accuracy of edge positioning. BRIEF DESCRIPTION OF DRAWINGS

[0049] Figure 1 is a flowchart of the computer vision-based edge positioning method in embodiments of the present application.

[0050] Figure 2 is a flowchart of S20 in the above embodiments. Figure 1

[0051] Figure 3 is a flowchart of S20 in the above embodiments.​Figure 1 Flowchart of the method in S30.

[0052] Figure 4 For Figure 1 Flowchart of the training method of the pre-designed model in S50.

[0053] Figure 5 The composition diagram of the edge positioning device based on computer vision of the embodiment of the present application.

[0054] Figure 6 The architecture diagram of the electronic device of the embodiment of the present application.

[0055] Main element symbol explanation

[0056] Edge positioning device 10

[0057] Image acquisition module 11

[0058] Image preprocessing module 12

[0059] Contour extraction module 13

[0060] Straight line fitting module 14

[0061] Straight line calculation module 15

[0062] Straight line positioning module 16

[0063] Electronic device 20

[0064] Processor 21

[0065] Memory 22 DETAILED DESCRIPTION

[0066] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of the present application.

[0067] In the description of the present application, it should be understood that the terms "first", "second" are only for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features limited by "first", "second" can explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of "multiple" is two or more, unless otherwise specifically limited.

[0068] In the description of the present application, it should be noted that unless otherwise explicitly specified and limited, the terms "mounting", "connection", "connecting" should be understood in a broad sense, for example, can be fixedly connected, can be detachably connected, or integrally connected; can be mechanically connected, or electrically connected, or can be in communication with each other; can be directly connected, or indirectly connected through an intermediate medium; can be the internal connection of two elements or the interaction relationship between two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.

[0069] The embodiments of the present application will be described in detail below with reference to the drawings.

[0070] Please refer to Figure 1 The embodiment of the present application provides an edge positioning method based on computer vision, which is used for positioning the edge of a workpiece. The material of the workpiece can be metal and in a processed state. The processing method can be CNC processing.

[0071] In some embodiments, the edge positioning method based on computer vision comprises:

[0072] S10, acquiring an original image of a processed workpiece.

[0073] In the embodiment, the processed workpiece refers to an object that needs to be positioned.

[0074] Specifically, a camera device is assembled on a CNC machine, which is used to acquire the original image of the processed workpiece. For example, the camera device can be a CCD camera, a CMOS camera, etc.

[0075] Further, when acquiring the original image, the processed workpiece is placed on the CNC machine, and the camera device takes a photo of the workpiece to obtain a clearer original image, so as to reduce the interference of external working environment such as fingerprints and dust on the edge positioning.

[0076] S20, preprocessing the original image to determine a target edge region.

[0077] Please refer to Figure 2 In some embodiments, S20, preprocessing the original image to determine a target edge region comprises:

[0078] S210, determining a mark point of the workpiece by using a template matching method.

[0079] Specifically, the detailed process of the template matching method is as follows: according to the characteristics of the shooting device and imaging, the imaging result radius range of the marker point is estimated, a template group is generated in advance, for example, 9 templates with radii of 4 pixels to 12 pixels are set, and the template shape is approximately circular; each template is matched in all regions of the original image; the sum range is the circular range corresponding to the template, and the similarity is judged by the absolute difference sum; if the absolute difference sum result is less than 35% of the number of pixels of the template, is the minimum and unique in the neighborhood range, and the matching similarity meets the requirement, the region formed by the total pixels in the template radius range with the current point as the center is recorded as the marker point. Because the template value is all 1, and the value on the original image is 1 or 0, the result of the absolute difference sum calculation is the total number of pixels different from the template in the circular neighborhood of the current point on the original image.

[0080] In order to further improve the reliability of template matching, an improvement is that a circle is expanded outward at the boundary of each template of the template group, and the pixel value of the circle is 0; the new template formed is still approximately circular, the inside is all 1, and the outermost circle is all 0; the sum range during matching includes the outermost circle; the absolute difference sum result is less than 35% of the number of pixels of the template (including the expanded circle) to meet the similarity requirement, and the region formed by the total pixels corresponding to the template before the boundary expansion with the current point as the center is recorded as the marker point.

[0081] This improvement is equivalent to adding a layer of opposite values to the outer circle of the template, so that the optimal matching region is truly similar to the marker point, and the region itself is a circular surface surrounded by the background. This method excludes a part of the candidate marker points that cannot be real marker points in the original matching method, improves the robustness of the algorithm, and does not need to exclude large continuous regions before matching.

[0082] S220, determining an offset value according to the marker point, and obtaining an affine matrix based on the offset value.

[0083] Specifically, the offset value is determined according to the coordinate information of the marker point, and then the rotation angle and the scaling scale are calculated based on the offset value, and then the affine matrix is calculated based on the rotation angle and the scaling scale.

[0084] S230, performing affine transformation on the original image according to the affine matrix to obtain an initial edge region.

[0085] Specifically, the initial edge region is obtained by performing affine transformation on the region of interest image in the original image. It should be noted that the affine transformation is a conventional operation in the field of image processing, and the affine transformation method used in the present application is not limited.

[0086] S240, filtering the initial edge region to obtain a target edge region.

[0087] Specifically, the filtering processing includes bilateral filtering processing, Candy filtering processing, and Laplacian filtering processing. Specifically, the initial edge region is subjected to bilateral filtering processing to remove interference (rust, paint residue, etc.) information of the image and retain boundary information of the initial edge region. The initial edge region is subjected to Candy filtering to extract edge information of the initial edge region, and the Candy filtering is used to extract edge information of the image. The initial edge region is subjected to Laplacian filtering to perform image enhancement. The filtering processing can suppress noise and smooth the image to facilitate subsequent extraction of straight lines of the target edge region.

[0088] The above steps sequentially preprocess the original image of the workpiece collected through template matching, affine transformation, filtering processing, and contour extraction, etc. After the preprocessing, interference features can be preliminarily filtered out to obtain tool mark image information that needs to be analyzed. For example, the interference features are uneven brightness and darkness of the image, poor wiping, and aluminum chip scratches, etc.

[0089] S30, contour extraction and screening of the target edge region are performed to obtain a suspicious edge straight line contour.

[0090] See Figure 3 In some embodiments, S30, contour extraction and screening of the target edge region are performed to obtain a suspicious edge straight line contour include:

[0091] S310, an initial suspicious edge straight line contour of the target edge region is extracted based on a contour extraction algorithm.

[0092] Specifically, the preset contour extraction algorithm is a Canny algorithm or a threshold segmentation algorithm, etc. In the present embodiment, the Canny algorithm is adopted, which is the most popular and effective edge contour extraction algorithm at present.

[0093] Further, for an image with relatively more background texture, the target edge region can be converted into a binary image before the edge contour is extracted, and a suitable threshold is set to prevent the background texture from being extracted as an edge.

[0094] S320, an initial suspicious edge straight line contour with a length that is too long or too short is screened out from the initial suspicious edge straight line contour to obtain a suspicious edge straight line contour.

[0095] Specifically, Hough transformation is adopted to find a straight line within a certain length range, and a minimum length and a maximum length are set. A straight line that is too short is likely to be a straight line segment of a curved boundary, and a straight line that is too long is likely to be an edge of sheet metal. The initial suspicious edge straight line contour with a length that is too long or too short is screened out, and a suspicious edge straight line contour is left.

[0096] S40, fitting the suspicious edge straight line contour into a fitting edge straight line based on a least square method.

[0097] Specifically, based on the acquired pixel point coordinate information, the slope and intercept of the suspicious edge straight line contour in the target edge region are determined according to a least square method, and based on the slope and intercept, the fitting edge straight line in the target edge region is determined. When the least square method is used for straight line detection, the approximate position and direction of the fitting edge straight line can be obtained.

[0098] S50, substituting the several characteristic attributes of the fitting edge straight line into a pre-designed calculation model to obtain a straight line weighted score value, so as to determine the target edge straight line.

[0099] Specifically, the pre-designed calculation model satisfies the following relationship:

[0100]

[0101] wherein, represents the straight line weighted score value of the fitting edge straight line, a i represents the i-th characteristic attribute of the fitting edge straight line, represents the average value of the several characteristic attributes of the standard edge straight line corresponding to the several characteristic attributes of the fitting edge straight line, w i represents the weight value of the i-th characteristic attribute of the fitting edge straight line.

[0102] For example, the characteristic attributes can include at least one of a straight line normal vector, a distance value, an edge amplitude value, a straightness, and a contour length, that is, the characteristic attributes can be a single characteristic attribute or a combination of any two or more characteristic attributes.

[0103] The above characteristic attributes are common straight line characteristic attributes for edge positioning, have wide application range, and play an important role in improving the positioning accuracy of the edge straight line, and therefore, the above characteristic attributes are listed in the embodiment.

[0104] In the embodiment, the characteristic attributes of the fitting edge straight line include the four characteristic attributes of the straight line normal vector, the distance value, the edge amplitude value, and the straightness.

[0105] Firstly, the four characteristic attributes are substituted into the relationship satisfied by the pre-designed calculation model:

[0106]

[0107]

[0108] Wherein, a1 represents the straight line normal vector of the target edge straight line, a2 represents the distance value of the target edge straight line, that is, the distance from the target edge straight line to the positioning point, a3 represents the edge amplitude value of the target edge straight line, and a4 represents the straightness of the target edge straight line. The average value of the straight line normal vector of the standard edge straight line is represented by The average value of the distance value of the standard edge straight line, that is, the average value of the distance from the standard edge straight line to the positioning point, is represented by The average value of the edge amplitude value of the standard edge straight line is represented by The average value of the straightness of the standard edge straight line is represented by w1, w2, w3, and w4, respectively representing the weight values of a1, a2, a3, and a4 in the target edge straight line.

[0109] It should be noted that in the formula is obtained by averaging the characteristic attributes of the standard edge straight line in a large number of standard pictures, and w1, w2, w3, and w4 in the formula are reasonable weight values of each characteristic attribute obtained by training a large number of pictures by a benchmark training calculation model.

[0110] Secondly, the weighted score value of the fitting edge straight line is screened The weighted score value of the fitting edge straight line is determined The highest fitting edge straight line is the target edge straight line.

[0111] As can be seen from the above formula, when the variables a1 are closer to the standard value of , tends to 1, and the value of tends to the maximum value 1, so the possibility of the straight line being the target edge straight line we need is greater.

[0112] The above steps preliminarily screen the straight line by introducing four characteristic attributes: straight line normal vector, distance value, edge amplitude value, and straightness in combination with a pre-designed calculation model to determine the preliminary position of the target edge straight line.

[0113] Please refer to Figure 4 In some embodiments, the training method of the pre-designed calculation model in S50 includes:

[0114] S1, obtaining training data, wherein the training data includes a plurality of standard images containing standard edge straight lines and a plurality of detection images containing target edge straight lines.

[0115] It should be noted that a standard image refers to an image that has undergone edge localization and conforms to a standard, while a standard edge line refers to a target edge line that has been detected and conforms to the standard. A detection image refers to an image that has undergone edge localization but may not necessarily conform to the standard, and a target edge line refers to a target edge line that has been determined through edge localization. For example, the training data includes 100 standard images and 1000 detection images.

[0116] S2, based on several feature attributes of standard edge lines in multiple standard images, obtain the average value of several feature attributes of standard edge lines.

[0117] Specifically, the average value of each characteristic attribute of the standard edge line is calculated to obtain the average value of each characteristic attribute of the standard edge line.

[0118] S3, substitute several feature attributes of the target edge line in multiple detection images into the benchmark training model to obtain the line weighted score of the target edge line.

[0119] Specifically, the benchmark training computation model satisfies the following relation:

[0120]

[0121] in, a represents the weighted score of the line representing the edge of the target. i1 This represents the i1th feature attribute of the target edge line. w represents the average value of the characteristic attributes of a standard edge line corresponding to several characteristic attributes of the target edge line. i1 The weight of the i1th feature attribute of the target edge line.

[0122] S4, cyclical change w i1 The value of w is calculated for each group. i1 The value corresponds to the obtained The sum of all values, and filter out the ones with the largest sum. A corresponding set of w i1 The value of .

[0123] For example, when both the standard edge line and the target edge line include four feature attributes: line normal vector, distance value, edge amplitude value, and straightness, these four feature attributes are substituted into the relationship satisfied by the benchmark training calculation model:

[0124]

[0125] Among them, a 11 a represents the normal vector of the line representing the edge of the target. 21 This represents the distance value of the straight line at the edge of the target, that is, the distance from the straight line at the edge of the target to the positioning point, 'a'.31 edge magnitude value of the target edge straight line, a 41 straightness of the target edge straight line; average value of the straight line normal vector of the standard edge straight line, average value of the distance value of the standard edge straight line, i.e. average value of the distance from the standard edge straight line to the positioning point, average value of the edge magnitude value of the standard edge straight line, average value of the straightness of the standard edge straight line; w 11 , w 21 , w 31 , w 41 respectively represent a 11 , a 21 , a 31 , a 41 weight value of the target edge straight line.

[0126] Specifically, three variables among w 11 , w 21 , w 31 , w 41 are extracted and divided into 100 parts according to the value of 0-1, i.e. 0, 0.01, 0.02, 0.03, …, 0.09, 1. According to the exhaustion method, the fourth variable is supplemented after the permutation and combination is completed, so that w 11 + 21 + 31 + 41 =1. For example:

[0127] w 11 =0.01, w 21 =0.01, w 31 =0.01, w 41 =0.97;

[0128] w 11 =0.02, w 21 =0.01, w 31 =0.01, w 41 =0.96;

[0129]

[0130] w 11 =1, w 21 =0, w 31 =0, w 41 =0;

[0131] w 11 =0.01, w 21 =0.02, w 31 =0.01, w41 =0.96;

[0132] w 11 =0.01, w 21 =0.03, w 31 When = 0.01, w 41 =0.95;

[0133]

[0134] w 11 =0, w 21 =1, w 31 When = 0, w 41 =0;

[0135]

[0136] w 41 =0.01, w 21 =0.01, w 31 When = 0.01, w 11 =0.97;

[0137]

[0138] w 41 =1, w 21 =0, w 31 When = 0, w 11 =0.

[0139] Based on the above combinations, calculate w for each group. 11 w 21 w 31 w 41 Substitute the corresponding 1000 groups a 11 a 21 a 31 a 41 The 1000 obtained The value of w is calculated for each group. 11 w 21 w 31 w 41 The corresponding 1000 The sum of the values ​​calculated each time Compare the sums of the values ​​to find the largest one. And determine the A corresponding set of w 11 w 21 w 31 w 41 The value of .

[0140] S5, substitute The value and the selected w i1The values of w1, w2, w3, w4, and w5 are substituted into a relational expression satisfied by the pre-design calculation model as formula constants to obtain the trained pre-design calculation model.

[0141] Specifically, the group of w1, w2, w3, w4, and w5 selected in step S4 11 , w4, and w5 are substituted into a relational expression satisfied by the pre-design calculation model as formula constants to obtain the trained pre-design calculation model. 21 , w4, and w5 are substituted into a relational expression satisfied by the pre-design calculation model as formula constants to obtain the trained pre-design calculation model. 31 , w4, and w5 are substituted into a relational expression satisfied by the pre-design calculation model as formula constants to obtain the trained pre-design calculation model. 41 , w4, and w5 are substituted into a relational expression satisfied by the pre-design calculation model as formula constants to obtain the trained pre-design calculation model. , w4, and w5 are substituted into a relational expression satisfied by the pre-design calculation model as formula constants to obtain the trained pre-design calculation model.

[0142] The above steps are performed by substituting the average values of the characteristic attributes of the standard edge straight lines in the 100 standard pictures and the characteristic attributes of the target edge straight lines extracted from the 1000 pictures containing the target edge straight lines into a relational expression satisfied by the reference training calculation model, and repeatedly changing the weight values of the characteristic attributes of the target edge straight lines to obtain multiple sets of straight line weighted score values of the target edge straight lines, and comparing to obtain the optimal weight values of the characteristic attributes of the target edge straight lines as formula constants. Through multiple training and screening, the calculation accuracy of the pre-design calculation model can be improved, thereby improving the accuracy of edge positioning.

[0143] S60, setting positioning parameters of a preset positioning tool based on the target edge straight line to position the target edge straight line.

[0144] Specifically, the preset positioning tool is a caliper, and the caliper is used for accurate measurement based on the preliminary position of the target edge straight line determined by the pre-design calculation model, thereby improving the edge recognition accuracy.

[0145] Therefore, the above computer vision-based edge positioning method can accurately position the target edge straight line by introducing multiple characteristic attributes of the fitted edge straight line into the pre-design calculation model to screen the straight line, thereby reducing the interference of tool marks in the edge positioning process of the workpiece and improving the recognition accuracy of edge positioning.

[0146] Referring to Figure 5 , the embodiment of the present application also provides a computer vision-based edge positioning device 10.

[0147] In the embodiment, the computer vision-based edge positioning device 10 can be used to perform the computer vision-based edge positioning method according to the same idea as the computer vision-based edge positioning method in the above embodiment. For ease of illustration, only the parts related to the embodiment of the present application are shown in the composition diagram of the computer vision-based edge positioning device 10 embodiment, and those skilled in the art can understand that the diagrammatic structure does not constitute a limitation on the computer vision-based edge positioning device 10, and the computer vision-based edge positioning device 10 can include more or fewer components than the diagram, or combine certain components, or have a different component arrangement.

[0148] In some embodiments, the computer vision-based edge positioning apparatus 10 comprises an image acquisition module 11, an image preprocessing module 12, a contour extraction module 13, a straight line fitting module 14, a straight line calculation module 15, and a straight line positioning module 16. The image acquisition module 11 is configured to acquire an original image of a processed workpiece. The image preprocessing module 12 is configured to preprocess the original image to determine a target edge region. The contour extraction module 13 is configured to perform contour extraction and screening on the target edge region to obtain a suspected edge straight line contour. The straight line fitting module 14 is configured to fit the suspected edge straight line contour into a fitted edge straight line based on a least square method. The straight line calculation module 15 is configured to substitute a plurality of characteristic attributes of the fitted edge straight line into a pre-designed calculation model to obtain a straight line weighted score value, so as to determine a target edge straight line, wherein the pre-designed calculation model satisfies the following relationship:

[0149]

[0150] wherein, represents the straight line weighted score value of the fitted edge straight line, a i represents the i-th characteristic attribute of the fitted edge straight line, represents the average value of a plurality of characteristic attributes of a standard edge straight line corresponding to the plurality of characteristic attributes of the fitted edge straight line, w i represents the weight value of the i-th characteristic attribute of the fitted edge straight line. The straight line positioning module 16 is configured to set a positioning parameter of a pre-set positioning tool based on the target edge straight line, so as to position the target edge straight line.

[0151] The computer vision-based edge positioning apparatus 10 described above can accurately position the target edge straight line by introducing a plurality of characteristic attributes of the fitted edge straight line into the pre-designed calculation model to screen the straight line, thereby reducing the interference of knife marks in the edge positioning process of the workpiece and improving the recognition accuracy of the edge positioning.

[0152] Please refer to Figure 6 The embodiments of the present application also provide an electronic device 20.

[0153] In some embodiments, the electronic device 20 comprises a processor 21 and a memory 22. The memory 22 is configured to store computer instructions, and the processor 21 is coupled to the memory 22 and configured to invoke the computer instructions in the memory 22 to perform the steps of the computer vision-based edge positioning method of the above-described embodiments.

[0154] For example, the computer instructions can be divided into one or more modules / units, one or more modules / units are stored in the memory 22 and executed by the processor 21. One or more modules / units can be a series of computer instruction segments capable of completing a specific function, and the instruction segments are used to describe the execution process of the computer instructions in the electronic device 20. For example, the computer instructions can be divided into Figure 5 The image acquisition module 11, the image preprocessing module 12, the contour extraction module 13, the straight line fitting module 14, the straight line calculation module 15 and the straight line positioning module 16 shown in the figure.

[0155] The electronic device 20 can be a desktop computer, a notebook computer, a palm computer, an industrial computer, a tablet computer, a server, etc. Those skilled in the art can understand that the schematic diagram is only an example of the electronic device 20, and does not constitute a limitation on the electronic device 20, and can include more or less components than the schematic diagram, or combine certain components, or different components, for example, the electronic device 20 can also include an input device, a network access device, a bus, etc.

[0156] The processor 21 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor, a single-chip computer or the processor 21 can also be any conventional processor, etc.

[0157] The memory 22 can be used to store computer instructions and / or modules / units, and the processor 21 implements various functions of the electronic device 20 by running or executing the computer instructions and / or modules / units stored in the memory 22, and calling data stored in the memory 22. The memory 22 can mainly include a storage program area and a storage data area, wherein the storage program area can store an operating system, an application program required by at least one function, etc.; and the storage data area can store data created according to the use of the electronic device 20, etc. In addition, the memory 22 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device.

[0158] The electronic device 20 described above is used to perform the steps of the computer vision-based edge positioning method of the above-described embodiments, a plurality of characteristic attributes of the fitted edge straight line are introduced by a pre-designed calculation model to screen the straight line, the target edge straight line can be accurately positioned, the interference of the tool marks in the edge positioning process of the workpiece is reduced, and the recognition accuracy of the edge positioning is improved.

[0159] The application also discloses a computer readable storage medium, which stores computer instructions, and when the computer instructions are run by the processor 21, the steps of the computer vision-based edge positioning method of the above-described embodiments are performed. The storage medium can be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various storage program code storage media.

[0160] The computer readable storage medium described above is used to perform the steps of the computer vision-based edge positioning method of the above-described embodiments, a plurality of characteristic attributes of the fitted edge straight line are introduced by a pre-designed calculation model to screen the straight line, the target edge straight line can be accurately positioned, the interference of the tool marks in the edge positioning process of the workpiece is reduced, and the recognition accuracy of the edge positioning is improved.

[0161] It is obvious for those skilled in the art that the present application is not limited to the details of the above-described exemplary embodiments, and the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application. Therefore, the embodiments should be regarded as exemplary and non-limiting, and the scope of the present application is defined by the appended claims rather than the above description, and all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present application.

[0162] Finally, it should be noted that the above examples are only used to illustrate the technical solutions of the present application and are not limiting. Although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present application.

Claims

1. A computer vision-based edge positioning method, characterized by, The method comprises the following steps: obtaining an original image of a workpiece after processing; preprocessing the original image to determine a target edge region; contour extraction and screening are performed on the target edge region to obtain a suspected edge straight line contour; the suspected edge straight line contour is fitted into a fitted edge straight line based on a least square method; a plurality of characteristic attributes of the fitted edge straight line are substituted into a pre-designed calculation model to obtain a straight line weighted score value, so as to determine a target edge straight line, and the pre-designed calculation model satisfies a relationship: wherein, represents a linear weighted score value of the fitted edge line, represents the i-th feature attribute of the fitted edge line, represents an average value of a number of feature attributes of a standard edge line corresponding to the number of feature attributes of the fitted edge line, represents a weight value of the i-th feature attribute of the fitted edge line; a training method of the pre-designed calculation model comprises: obtaining training data, wherein the training data comprises a plurality of standard images containing the standard edge straight line and a plurality of detection images containing the target edge straight line; based on a plurality of characteristic attributes of the standard edge straight line in the plurality of standard images, average values of the plurality of characteristic attributes of the standard edge straight line are obtained; a plurality of characteristic attributes of the target edge straight line in the plurality of detection images are substituted into a reference training model to obtain a straight line weighted score value of the target edge straight line, and the reference training calculation model satisfies a relationship: in, This represents the line weighted score of the target edge line. This represents the i1th feature attribute of the target edge line. This represents the average value of the characteristic attributes of the standard edge line, corresponding to several characteristic attributes of the target edge line. The weight represents the i1th feature attribute of the target edge line, wherein the feature attribute includes at least one of the following: line normal vector, distance value, edge amplitude value, straightness, and contour length; cyclically changing The value is calculated for each group. The value corresponds to the obtained The sum of all values, and filter out the ones with the largest sum. A corresponding set The value; substitute The values ​​and the filtered values The value is added to the relation satisfied by the preset calculation model as a formula constant to obtain the trained preset calculation model; based on the target edge straight line, a positioning parameter of a pre-set positioning tool is set to position the target edge straight line.

2. The computer vision-based edge positioning method of claim 1, wherein, The preprocessing of the original image to determine the target edge region comprises: determining a mark point of the workpiece by using a template matching method; determining an offset value according to the mark point, and obtaining an affine matrix based on the offset value; performing affine transformation on the original image according to the affine matrix to obtain an initial edge region; filtering processing the initial edge region to obtain the target edge region.

3. The computer vision-based edge positioning method of claim 1, wherein, The contour extraction and screening on the target edge region to obtain the suspected edge straight line contour comprises: extracting an initial suspected edge straight line contour of the target edge region based on a contour extraction algorithm; screening out initial suspected edge straight line contours with excessively long or short lengths from the initial suspected edge straight line contour to obtain a suspected edge straight line contour.

4. The computer vision-based edge positioning method of claim 1, wherein, The substitution of the plurality of characteristic attributes of the fitted edge straight line into the pre-designed calculation model to obtain the straight line weighted score value to determine the target edge straight line comprises: screening the weighted score values of the fitted edge straight lines determining the weighted score values of the fitted edge straight lines the highest fitted edge straight line is the target edge straight line.

5. The computer vision-based edge positioning method of claim 1, wherein the pre-set positioning tool is a caliper.

6. A computer vision based edge positioning device, characterized by, The method comprises the following steps: an image acquisition module is configured to obtain an original image of a workpiece after processing; an image preprocessing module is configured to preprocess the original image to determine a target edge region; a contour extraction module is configured to perform contour extraction and screening on the target edge region to obtain a suspected edge straight line contour; a straight line fitting module is configured to fit the suspected edge straight line contour into a fitted edge straight line based on a least square method; a straight line calculation module is configured to substitute a plurality of characteristic attributes of the fitted edge straight line into a pre-designed calculation model to obtain a straight line weighted score value, so as to determine a target edge straight line, and the pre-designed calculation model satisfies a relationship: wherein, represents a linear weighted score value of the fitted edge line, represents the i-th feature attribute of the fitted edge line, represents an average value of the number of feature attributes of the standard edge line corresponding to the number of feature attributes of the fitted edge line, represents a weight value of the i-th feature attribute of the fitted edge line; The training method of the pre-designed calculation model comprises: acquiring training data, wherein the training data comprises multiple standard images containing the standard edge straight line and multiple detection images containing the target edge straight line; obtaining average values of feature attributes of the standard edge straight line based on feature attributes of the standard edge straight line in multiple standard images; and substituting feature attributes of the target edge straight line in multiple detection images into a reference training model to obtain a straight line weighted score value of the target edge straight line, wherein the reference training calculation model satisfies a relationship formula: in, This represents the line weighted score of the target edge line. This represents the i1th feature attribute of the target edge line. This represents the average value of the characteristic attributes of the standard edge line, corresponding to several characteristic attributes of the target edge line. The weight represents the i1th feature attribute of the target edge line, wherein the feature attribute includes at least one of the following: line normal vector, distance value, edge amplitude value, straightness, and contour length; cyclically changing The value is calculated for each group. The value corresponds to the obtained The sum of all values, and filter out the ones with the largest sum. A corresponding set The value; substitute The values ​​and the filtered values The value is added to the relation satisfied by the preset calculation model as a formula constant to obtain the trained preset calculation model; The straight line positioning module is configured to set a positioning parameter of a preset positioning tool based on the target edge straight line to position the target edge straight line.

7. An electronic device, comprising: The method comprises: a memory configured to store computer instructions; a processor coupled to the memory and configured to invoke the computer instructions in the memory to execute the computer vision-based edge positioning method according to any one of claims 1 to 5.

8. A computer readable storage medium, comprising: The computer readable storage medium stores computer instructions, and the computer instructions are executed by a processor to execute the computer vision-based edge positioning method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Mechanical arm visual servo target recognition method based on local contour

    CN110766750A

  • Linear fitting algorithm based on contour edge

    CN114972575A