An image contour optimization method and terminal based on visual detection
By weighted fusion of binarized contours and Canny contours, the problem that the Canny algorithm cannot obtain complete contours and binarized images is solved, and high accuracy and multi-dimensional defect detection is achieved.
Patent Information
- Application Number
- CN202210636781.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-07
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2042-06-07
AI Technical Summary
In the prior art, the Canny algorithm can only judge whether the significance region has defects, and cannot obtain a complete image outline, and the binarized image is not robust to images of different brightness, resulting in low accuracy in defect detection and inability to make multi-dimensional judgments.
By weighted fusion of binarized contours and Canny contours, the overlap weights are determined, the basic contours are marked, the remaining contours are connected, and the closed contours are filled to obtain the final contour image.
It improves the accuracy and robustness of defect detection, and can judge whether the detection object meets the standards from multiple dimensions, so as to achieve simultaneous acquisition of multiple detection objects.
Smart Images

Figure CN114972281B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image recognition, and particularly to an image contour optimization method and a terminal based on visual detection. Background Art
[0002] An industrial inspection scenario usually includes five processes: image acquisition, image preprocessing, image detection, position feedback, and subsequent processing. In the field of defect detection, image segmentation is often required after image preprocessing to eliminate the interference of the noisy environment and obtain a complete image contour, and to identify single or multiple complete workpieces through the image contour, so as to judge secondary defects such as part size, part boundary, and part surface on a single workpiece, thereby realizing the defect detection of multiple parts.
[0003] In the current industrial scenario, after collecting an image, image binarization is usually performed to obtain the position of a single part and eliminate the image at other positions, and then the Canny (multi-level edge detection) algorithm is used to judge whether there are defects in the significant region; this defect detection method only retains a single part image contour; for example Figure 1 , there are a large number of cracks at the edge of the Canny contour, which are difficult to separate from the image. At the same time, the internal patterns of the contour are likely to interfere with the result of obtaining a complete contour. Therefore, the Canny algorithm can only judge whether there are defects in the significant region and cannot obtain a complete contour; for example Figure 2 , although the binarized image can obtain a complete image, its robustness to images with different brightnesses is not high, and high-brightness images and low-brightness images are prone to errors, and the accuracy of defect detection is relatively low. Moreover, this defect detection method has no concept of an object and cannot perform multi-dimensional judgments, such as scratch size and whether the part is deformed. Summary of the Invention
[0004] The technical problem to be solved by the present invention is: to provide an image contour optimization method and a terminal based on visual detection, so as to improve the accuracy of defect detection and achieve multi-dimensional detection.
[0005] To solve the above technical problem, the technical solution adopted by the present invention is:
[0006] An image contour optimization method based on visual detection, comprising the steps of:
[0007] S1. Obtain the binarized contour and the Canny contour corresponding to the source image;
[0008] S2. Weightedly fuse the binarized contour and the Canny contour to determine the coincidence weight value of the contours;
[0009] S3. Judge whether the coincidence weight value exceeds a preset threshold. If so, mark the binarized contour as the basic contour;
[0010] S4. Traverse the Canny contours, and connect the basic contours with the remaining contours of the Canny contours that exceed the basic contours to obtain the target binary contour;
[0011] S5. Combine the target binary contour and the Canny contour, search for and fill the closed contours to obtain the final contour image.
[0012] To solve the above technical problems, another technical solution adopted by the present invention is:
[0013] An image contour optimization terminal based on visual detection, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:
[0014] S1. Obtain the binary contour and the Canny contour corresponding to the source image;
[0015] S2. Weightedly fuse the binary contour and the Canny contour to determine the coincidence weight of the contours;
[0016] S3. Judge whether the coincidence weight exceeds a preset threshold. If so, mark the binary contour as the basic contour;
[0017] S4. Traverse the Canny contours, and connect the basic contours with the remaining contours of the Canny contours that exceed the basic contours to obtain the target binary contour;
[0018] S5. Combine the target binary contour and the Canny contour, search for and fill the closed contours to obtain the final contour image.
[0019] The beneficial effects of the present invention are as follows: Based on the visual detection algorithm of binary and Canny algorithms, aiming at the advantages and disadvantages of obtaining contour images from binary images and Canny images, fusing the binary contour image and the Canny contour image can not only meet the requirement of eliminating interference factors formed by the brightness of the light source board in specific scenarios, improve the robustness and detection accuracy between images with different brightnesses, but also obtain the complete image of the detection object, and can judge whether the detection object meets the standard from multiple dimensions, which is convenient for quickly completing subsequent defect detection operations and simultaneously realizing the recognition of multiple detection objects. Description of the Drawings
[0020] Figure 1 It is a contour image obtained by a Canny algorithm described in the background art of the present invention;
[0021] Figure 2 It is a contour image obtained from a binary image described in the background art of the present invention;
[0022] Figure 3 It is a step flowchart of an image contour optimization method based on visual detection provided by an embodiment of the present invention;
[0023] Figure 4 It is a program flowchart of an image contour optimization method based on visual detection provided by an embodiment of the present invention;
[0024] Figure 5 It is an image fusion program flowchart of an image contour optimization method based on visual detection provided by an embodiment of the present invention;
[0025] Figure 6 It is a coincidence weight program flowchart of an image contour optimization method based on visual detection provided by an embodiment of the present invention;
[0026] Figure 7 It is a binary contour approximation program flowchart of an image contour optimization method based on visual detection provided by an embodiment of the present invention;
[0027] Figure 8 It is a program flowchart for connecting Canny remaining contours of an image contour optimization method based on visual detection provided by an embodiment of the present invention;
[0028] Figure 9 It is an isolated edge filling program flowchart of an image contour optimization method based on visual detection provided by an embodiment of the present invention;
[0029] Figure 10 It is a structural schematic diagram of an image contour optimization terminal based on visual detection provided by an embodiment of the present invention;
[0030] Label description:
[0031] 1. An image contour optimization terminal based on visual detection; 2. A memory; 3. A processor. Specific embodiments
[0032] To describe in detail the technical content, achieved objectives and effects of the present invention, the following is described in conjunction with embodiments and with reference to the accompanying drawings.
[0033] Please refer to Figure 3 , an image contour optimization method based on visual detection, including the steps:
[0034] S1. Obtain the binary contour and the Canny contour corresponding to the source image;
[0035] S2. Weightedly fuse the binary contour and the Canny contour to determine the coincidence weight of the contour;
[0036] S3. Determine whether the overlapping weight exceeds a preset threshold. If so, mark the binarized contour as the basic contour;
[0037] S4. Traverse the Canny contour, connect the basic contour with the remaining contour of the Canny contour that exceeds the basic contour, and obtain the target binarized contour;
[0038] S5. Combine the target binarized contour and the Canny contour, search for and fill the closed contour, and obtain the final contour image.
[0039] As can be seen from the above description, the beneficial effects of the present invention are as follows: Based on the visual detection algorithm of binarization and Canny algorithm, aiming at the advantages and disadvantages of obtaining the contour image from the binarized image and the Canny image, the binarized contour and the Canny contour are fused, which can not only meet the requirement of eliminating the interference factors formed by the brightness of the light source board in a specific scenario, improve the robustness and detection accuracy between images with different brightnesses, but also obtain the complete image of the detection object, facilitating the subsequent defect detection operation to be completed quickly; at the same time, it can identify multiple detection objects and judge whether the detection objects meet the standards from multiple dimensions.
[0040] Further, the specific content of S2 is as follows:
[0041] S21. Obtain the first circumscribed rectangle of the binarized contour and the second circumscribed rectangle of the Canny contour;
[0042] S22. Draw the first circumscribed rectangle and the second circumscribed rectangle on the same image, and determine the area of the first circumscribed rectangle, the area of the second circumscribed rectangle, and the overlapping area between the first circumscribed rectangle and the second circumscribed rectangle;
[0043] S23. Determine the overlapping weight specifically as:
[0044]
[0045] where S r重合 is the overlapping area between the first circumscribed rectangle and the second circumscribed rectangle, S r二值化 is the area of the first circumscribed rectangle, and S rCanny is the area of the second circumscribed rectangle.
[0046] As can be seen from the above description, the overlapping weight is the overlapping degree between the binarized contour and the Canny contour. By obtaining the circumscribed rectangles of the binarized contour and the Canny contour, it is determined whether the general contours of the two coincide, so as to mutually verify whether the general contours of the two are correct and improve the accuracy of the final contour.
[0047] Further, S3 further includes:
[0048] If the overlapping weight does not exceed a preset threshold, determine the approximation direction of the binarized contour towards the Canny contour to obtain a secondary binarized contour, use the secondary binarized contour as the binarized contour, and return to execute S2;
[0049] Specifically, determining the approximation direction is as follows:
[0050]
[0051] where S 重合 is the overlapping area of the binarized contour and the Canny contour, S 二值化 is the area of the binarized contour, and S Canny is the area of the Canny contour.
[0052] As can be seen from the above description, if the coincidence degree of the binarized contour and the Canny contour does not exceed the threshold, the binarized contour is approximated to the Canny contour by different degrees until the coincidence degree of the two contours exceeds the threshold, with the Canny contour as a reference, so as to avoid the contour missing or incorrect acquisition caused by image brightness interference of the binarized contour, and at the same time, a complete contour can be obtained.
[0053] Further, S4 is specifically as follows:
[0054] S41. Traverse the Canny contour to obtain the end points on the Canny contour;
[0055] S42. Determine whether the end point is within the basic contour. If so, return to execute S41; if not, obtain the preset point and preset distance of the basic contour;
[0056] S43. The basic contour is dilated and eroded with the preset point as the center and the preset distance as the radius until the boundary of the Canny contour is encountered to obtain the target binarized contour.
[0057] As can be seen from the above description, after continuously comparing the binarized contour and the Canny contour, there are still some remaining contours in the Canny contour that cannot completely coincide with the binarized contour. To improve the fusion degree of the two, based on the complete binarized contour, connect the end points of the Canny contour that do not fall within the binarized contour, effectively solving the problem that the Canny contour cannot obtain a complete contour.
[0058] Further, S5 is specifically as follows:
[0059] Draw the target binarized contour and the Canny contour on the same image, find and fill the closed contour in the image to obtain the final contour image.
[0060] As can be seen from the above description, except that the main contours of the binary contour and the Canny contour belong to closed contours, there may be non-main closed contours in the image. Fill the non-main closed contours to exclude the interference of other contours on the main contour.
[0061] Please refer to Figure 10 , an image contour optimization terminal based on visual detection, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:
[0062] S1. Obtain the binary contour and the Canny contour corresponding to the source image;
[0063] S2. Weightedly fuse the binary contour and the Canny contour to determine the coincidence weight value of the contours;
[0064] S3. Judge whether the coincidence weight value exceeds a preset threshold. If so, mark the binary contour as the basic contour;
[0065] S4. Traverse the Canny contour, and connect the remaining contour of the Canny contour that exceeds the basic contour with the basic contour to obtain the target binary contour;
[0066] S5. Combine the target binary contour and the Canny contour, search for and fill the closed contour to obtain the final contour image.
[0067] Further, the specific content of S2 is as follows:
[0068] S21. Obtain the first circumscribed rectangle of the binary contour and the second circumscribed rectangle of the Canny contour;
[0069] S22. Draw the first circumscribed rectangle and the second circumscribed rectangle on the same image, and soak water to determine the area of the first circumscribed rectangle, the area of the second circumscribed rectangle, and the overlapping area of the first circumscribed rectangle and the second circumscribed rectangle;
[0070] S23. Determine the coincidence weight value specifically as:
[0071]
[0072] Among them, S r重合 is the overlapping area of the first circumscribed rectangle and the second circumscribed rectangle, S r二值化 is the area of the first circumscribed rectangle, and S rCanny is the area of the second circumscribed rectangle.
[0073] As can be seen from the above description, the overlapping weight is the degree of overlap between the binarized contour and the Canny contour. The circumscribed rectangles of the binarized contour and the Canny contour are obtained, and it is determined whether the general contours of the two coincide, so as to mutually verify whether the general contours of the two are correct and improve the accuracy of the final contour.
[0074] Further, the step S3 further includes:
[0075] If the overlapping weight does not exceed the preset threshold, then determine the approximation direction of the binarized contour towards the Canny contour to obtain a secondary binarized contour, use the secondary binarized contour as the binarized contour, and return to execute S2;
[0076] Determining the approximation direction specifically is:
[0077]
[0078] where S 重合 is the overlapping area of the binarized contour and the Canny contour, S 二值化 is the area of the binarized contour, and S Canny is the area of the Canny contour.
[0079] As can be seen from the above description, if the degree of overlap between the binarized contour and the Canny contour does not exceed the threshold, the binarized contour is approximated to the Canny contour by different degrees until the degree of overlap between the two contours exceeds the threshold, using the Canny contour as a reference, so as to avoid contour missing or incorrect acquisition caused by image brightness interference of the binarized contour, and at the same time, a complete contour can be obtained.
[0080] Further, the step S4 is specifically:
[0081] S41. Traverse the Canny contour to obtain the end points on the Canny contour;
[0082] S42. Judge whether the end point is within the basic contour. If so, return to execute S41; if not, obtain the preset point and preset distance of the basic contour;
[0083] S43. The basic contour is dilated and eroded with the preset point as the center and the preset distance as the radius until the boundary of the Canny contour is encountered to obtain the target binarized contour.
[0084] From the above description, we can see that after continuous comparison of the binary contour and the Canny contour, there are still some residual contours of the Canny contour that cannot completely overlap with the binary contour. In order to improve the fusion of the two, based on the complete binary contour, the endpoints of the Canny contour that do not fall within the binary contour are connected, which effectively solves the problem that the Canny contour cannot obtain the complete contour.
[0085] Furthermore, the S5 is specifically as follows:
[0086] The target binary contour and the Canny contour are drawn on the same image, and closed contours in the image are found and filled to obtain a final contour image.
[0087] From the above description, we can see that in addition to the main contours of the binary contour and the Canny contour, there may be closed contours other than the main contour in the image. The closed contours of the non-main contour are filled to eliminate the interference of other contours on the main contour.
[0088] A method for optimizing image contours based on visual inspection can be applied to industrial visual inspection of parts to accurately detect defects or quality issues in parts. The following is an example of how this method can be used:
[0089] Please refer to Figures 3 to 9 , embodiment 1 of the present invention is:
[0090] A method for optimizing image contours based on visual detection, comprising the steps of:
[0091] S1, obtain the binary contour and Canny contour corresponding to the source image;
[0092] Please refer to Figure 4 In an optional embodiment, a source image is collected and subjected to different preprocessing: the source image is subjected to grayscale processing to generate a binary contour, and the source image is subjected to Gaussian filtering to generate a Canny contour;
[0093] Please refer to Figure 5 , S2, weighted fusion of the binary contour and the Canny contour to determine the contour overlap weight;
[0094] The S2 is specifically:
[0095] S21, obtaining a first circumscribed rectangle of the binary contour, and obtaining a second circumscribed rectangle of the Canny contour;
[0096] In an optional embodiment, the maximum contour in the binary contour is found, the maximum contour is retained, the remaining contours are eliminated, and the minimum bounding rectangle of the maximum contour is obtained; the Canny contour is found, and the minimum bounding rectangle of the Canny contour is obtained;
[0097] S22. Draw the first circumscribed rectangle and the second circumscribed rectangle on the same image, and determine the area of the first circumscribed rectangle, the area of the second circumscribed rectangle, and the overlapping area between the first circumscribed rectangle and the second circumscribed rectangle by immersion.
[0098] In an alternative embodiment, determine the overlapping region between the binary contour and the Canny contour by immersion, and then determine the overlapping relationship between the circumscribed rectangles of the two, that is, calculate the overlapping weight.
[0099] S23. Determine that the overlapping weight is specifically:
[0100]
[0101] where S r重合 is the overlapping area between the first circumscribed rectangle and the second circumscribed rectangle, S r二值化 is the area of the first circumscribed rectangle, and S rCanny is the area of the second circumscribed rectangle.
[0102] S3. Determine whether the overlapping weight exceeds a preset threshold. If so, mark the binary contour as the basic contour.
[0103] In an alternative embodiment, the preset threshold is obtained by external setting.
[0104] In an alternative embodiment, if the overlapping weight exceeds the preset threshold, the binary contour and the Canny contour are basically overlapped, and the binary contour is the basic contour; if the overlapping weight does not exceed the preset threshold, there is a certain distance between the binary contour and the Canny contour, and the binary contour needs to be continuously approximated to the Canny contour.
[0105] Please refer to Figure 7 , and S3 further includes:
[0106] If the overlapping weight does not exceed the preset threshold, determine the approximation direction of the binary contour to the Canny contour, obtain a secondary binary contour, use the secondary binary contour as the binary contour, and return to execute S2.
[0107] Determine the approximation direction specifically as:
[0108]
[0109] where S 重合 is the overlapping area between the binary contour and the Canny contour, S 二值化 is the area of the binary contour, and S Canny is the area of the Canny contour.
[0110] In an alternative embodiment, if D>0, it indicates that the binary contour is included in the Canny contour; if D = 0, it indicates that there is no inclusion relationship between the binary contour and the Canny contour; if D<0, it indicates that the Canny contour is included in the binary contour;
[0111] In an alternative embodiment, if the binary contour includes the Canny contour, the edges of the binary contour are eroded to obtain a new binary contour; if the binary contour does not completely include the Canny contour, the edges of the binary contour are dilated to obtain a new binary contour;
[0112] S4. Traverse the Canny contour, and connect the basic contour with the remaining contour of the Canny contour that exceeds the basic contour to obtain the target binary contour;
[0113] Please refer to Figure 8 , where S4 is specifically as follows:
[0114] S41. Traverse the Canny contour to obtain the end points on the Canny contour;
[0115] In an alternative embodiment, there is only one edge point in the eight-direction chain code, which is the end point of the curve;
[0116] S42. Determine whether the end point is within the basic contour. If so, return to execute S41; if not, obtain the preset point and preset distance of the basic contour;
[0117] In an alternative embodiment, if the end point is within the basic contour, skip this end point;
[0118] S43. The basic contour is dilated and eroded with the preset point as the center and the preset distance as the radius until the boundary of the Canny contour is encountered to obtain the target binary contour;
[0119] In an alternative embodiment, obtain the nearest distance point N and the nearest distance D between the end point and the basic contour; and perform dilation and erosion with the nearest distance point N as the center and the nearest distance D as the radius, and stop dilation or erosion when the Canny contour is encountered in the approaching direction;
[0120] S5. Combine the target binary contour and the Canny contour, search for and fill the closed contour to obtain the final contour image;
[0121] Please refer to Figure 9 , where S5 is specifically as follows:
[0122] Draw the target binary contour and the Canny contour on the same image, search for and fill the closed contours within the image to obtain the final contour image;
[0123] In an alternative embodiment, draw the target binary contour and the Canny contour on the same image with the same pixel value, and search for closed contours other than the target binary contour and the Canny contour.
[0124] Please refer to Figure 10 , Embodiment 2 of the present invention is as follows:
[0125] An image contour optimization terminal 1 based on visual detection includes a memory 2, a processor 3, and a computer program stored on the memory 2 and executable on the processor 3. When the processor 3 executes the computer program, all steps of Embodiment 1 are implemented.
[0126] In summary, for the advantages and disadvantages of obtaining contour images for binary images and Canny images, the present invention provides an image contour optimization method and terminal that fuse the binary contour image and the Canny contour image. The integrity of the binary contour is used to make up for the non-complete contour of the Canny contour, and the clear image of the Canny contour is used to eliminate the error caused by the image brightness of the binary contour, so as to obtain a clear and complete contour of the detection object, and multiple-dimensional judgments can be made to determine whether the detection object meets the standard, ensuring the accuracy of the detection result; moreover, the fused image can detect multiple closed contours, enabling multiple detection objects to be obtained simultaneously and improving the detection efficiency.
[0127] The above are only embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent transformation made using the specification and drawings of the present invention, or directly or indirectly applied in related technical fields, shall be included in the patent protection scope of the present invention by the same token.
Claims
1. An image contour optimization method based on visual detection, characterized in that Including the steps: S1. Obtain the binary contour and Canny contour corresponding to the source image; S2. Weightedly fuse the binary contour and the Canny contour to determine the coincidence weight value of the contours; S3. Determine whether the coincidence weight value exceeds a preset threshold. If so, mark the binary contour as the basic contour; S4. Traverse the Canny contour, and connect the remaining contour of the Canny contour that exceeds the basic contour with the basic contour to obtain the target binary contour; S5. Combine the target binary contour and the Canny contour, search for and fill the closed contour to obtain the final contour image; Specifically, S4 is as follows: S41. Traverse the Canny contour to obtain the end points on the Canny contour; S42. Determine whether the end point is within the basic contour. If so, return to execute S41; If not, obtain the preset point and preset distance of the basic contour; S43. The basic contour is dilated and eroded with the preset point as the center and the preset distance as the radius until the boundary of the Canny contour is encountered to obtain the target binary contour; Specifically, S5 is as follows: Draw the target binary contour and the Canny contour on the same image, search for and fill the closed contour in the image except for the target binary contour and the Canny contour to obtain the final contour image.
2. The image contour optimization method based on visual detection according to claim 1, wherein Specifically, S2 is as follows: S21. Obtain the first circumscribed rectangle of the binary contour and the second circumscribed rectangle of the Canny contour; S22. Draw the first circumscribed rectangle and the second circumscribed rectangle on the same image, and immerse in water to determine the area of the first circumscribed rectangle, the area of the second circumscribed rectangle, and the overlapping area of the first circumscribed rectangle and the second circumscribed rectangle; S23. Determine that the coincidence weight value is specifically: Among them, S r重合 is the overlapping area of the first circumscribed rectangle and the second circumscribed rectangle, S r二值化 is the area of the first circumscribed rectangle, and S rCanny is the area of the second circumscribed rectangle.
3. A method for optimizing an image contour based on visual detection according to claim 1, characterized in that, S3 further includes: If the coincidence weight value does not exceed the preset threshold, determine the approximation direction of the binary contour towards the Canny contour to obtain a secondary binary contour, use the secondary binary contour as the binary contour, and return to execute S2; Determine the approximation direction specifically as follows: Among them, S 重合 is the overlapping area of the binarized contour and the Canny contour, and S 二值化 is the area of the binarized contour, and S Canny is the area of the Canny contour; If the approximation direction D > 0, the binary contour is included in the Canny contour; if the approximation direction D = 0, there is no complete inclusion relationship between the binary contour and the Canny contour; if the approximation direction D < 0, the Canny contour is included in the binary contour; if the binary contour includes the Canny contour, the edge of the binary contour is eroded to obtain a secondary binary contour; if the binary contour does not completely include the Canny contour, the edge of the binary contour is dilated to obtain a secondary binary contour.
4. An image contour optimization terminal based on visual detection, characterized in that, Including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented: S1. Obtain the binary contour and Canny contour corresponding to the source image; S2. Weightedly fuse the binary contour and the Canny contour to determine the coincidence weight value of the contours; S3. Determine whether the overlapping weight exceeds a preset threshold. If so, mark the binarized contour as the basic contour; S4. Traverse the Canny contour, and connect the remaining contour of the Canny contour that exceeds the basic contour to the basic contour to obtain the target binarized contour; S5. Combine the target binarized contour and the Canny contour, search for and fill the closed contour to obtain the final contour image; Specifically, S4 is as follows: S41. Traverse the Canny contour to obtain the endpoints on the Canny contour; S42. Determine whether the endpoint is within the basic contour. If so, return to execute S41; If not, obtain the preset point and preset distance of the basic contour; S43. The basic contour is dilated and eroded with the preset point as the center and the preset distance as the radius until the boundary of the Canny contour is encountered to obtain the target binarized contour; Specifically, S5 is as follows: Draw the target binarized contour and the Canny contour on the same image, search for and fill the closed contour in the image except the target binarized contour and the Canny contour to obtain the final contour image.
5. An image contour optimization terminal based on visual detection according to claim 4, characterized in that Specifically, S2 is as follows: S21. Obtain the first circumscribed rectangle of the binarized contour and the second circumscribed rectangle of the Canny contour; S22. Draw the first circumscribed rectangle and the second circumscribed rectangle on the same image, and immerse in water to determine the area of the first circumscribed rectangle, the area of the second circumscribed rectangle, and the overlapping area between the first circumscribed rectangle and the second circumscribed rectangle; S23. Determine the overlapping weight specifically as: Among them, S r重合 is the overlapping area of the first circumscribed rectangle and the second circumscribed rectangle, S r二值化 is the area of the first circumscribed rectangle, S rCanny is the area of the second circumscribed rectangle.
6. The image contour optimization terminal based on visual detection according to claim 4, characterized in that, S3 further includes: If the overlapping weight does not exceed the preset threshold, determine the approximation direction of the binarized contour towards the Canny contour to obtain a secondary binarized contour, use the secondary binarized contour as the binarized contour, and return to execute S2; Determine the approximation direction specifically as: Among them, S 重合 is the overlapping area of the binarized contour and the Canny contour, S 二值化 is the area of the binarized contour, S Canny is the area of the Canny contour; If the approximation direction D>0, the binarized contour is included in the Canny contour; if the approximation direction D = 0, there is no complete inclusion relationship between the binarized contour and the Canny contour; if the approximation direction D<0, the Canny contour is included in the binarized contour; if the binarized contour includes the Canny contour, the edge of the binarized contour is eroded to obtain a secondary binarized contour; if the binarized contour does not completely include the Canny contour, the edge of the binarized contour is dilated to obtain a secondary binarized contour.
Citation Information
Patent Citations
Braille-based image registration method
CN110310311A
Touch screen operable area-oriented automatic lighting device and automatic lighting method thereof
CN110426400A