A method for image edge migration

By obtaining image edge points and performing offset calculations and abnormal point removal, the problem of irregular image edge offset is solved, and effective offset processing is achieved for image edges, which is suitable for path planning and glue coating applications of robots.

CN114972785BActive Publication Date: 2025-08-19HANGZHOU HUICUI INTELLIGENT TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210522945.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-13
Publication Date
2025-08-19
Estimated Expiration
2042-05-13

AI Technical Summary

Technical Problem

The prior art cannot handle edge offsets of irregular images, especially effective offsets of extracted image edges.

Method used

By obtaining the image edge and extracting edge points, setting the offset direction and distance, calculating the offset direction of the edge points, obtaining the offset edge points, and removing the abnormal points, obtaining the offset edge lines.

Benefits of technology

Edge offset processing for any shape image is realized and can be directly used for subsequent image processing, such as path planning and glue application of robots.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114972785B_ABST
    Figure CN114972785B_ABST
Patent Text Reader

Abstract

The present invention discloses an image edge offset method, comprising the following steps: S1, obtaining image edges and extracting edge points; S2, setting edge offset directions and offset distances; S3, calculating the offset directions of the edge points; S4, obtaining the offset edge points; and S5, determining and eliminating outliers, and obtaining offset edge lines based on the remaining offset edge points. The present invention can perform offset calculations using only edge points after extracting image edges, making it suitable for edge offset processing of images of any shape.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to an image edge offset method. Background Art

[0002] Image edge extraction is a commonly used image feature extraction technique. By performing edge extraction on an image, we can obtain edge contour information of the extracted object, thus providing effective information for subsequent image processing and application. For example, when a robot applies glue, it needs to use the edge of the object after it has been offset a certain distance as the trajectory for applying glue. Therefore, we can first obtain the offset edge of the image and use it for path planning of the robot.

[0003] Existing image edge extraction algorithms can only extract the edges of the target object and cannot offset the extracted edges. Existing algorithms with edge offset functions, such as polygon offset filling algorithms, can only offset regular polygon edges and cannot process irregular curved edges. Summary of the Invention

[0004] The object of the present invention is to provide an image edge offset method to solve the problem that the prior art cannot process irregular images and cannot directly offset the extracted image edges.

[0005] In one aspect, an embodiment of the present invention provides an image edge shift method, comprising the following steps:

[0006] S1, obtain the edge of the image and extract edge points;

[0007] S2, set the edge offset direction and offset distance;

[0008] S3, calculate the offset direction of the edge point;

[0009] S4, obtaining the edge points after offset;

[0010] S5, judging and eliminating abnormal points, and obtaining the offset edge line based on the remaining offset edge points.

[0011] Furthermore, the S1 further includes: acquiring the edge of the image using an image edge detection algorithm, and obtaining the number of edge points through the detected image edges.

[0012] Furthermore, in S1, the image edges obtained include open edges and closed edges. For open edges, any endpoint of the edge line is selected as the first edge point p1, and one of the adjacent edge points of edge point p1 is selected as p2, and another adjacent edge point of edge point p2 is selected as p3, and so on until the last edge point p N ;

[0013] For closed edges, a point is randomly selected as the first edge point p1 of the edge line, and one of the adjacent edge points of edge point p1 is used as p2, and another adjacent edge point of edge point p2 is used as p3, and so on until the last edge point p N , p N It is an adjacent edge point to p1.

[0014] Furthermore, in S2, the offset direction includes a positive direction and a negative direction, and the left direction along the edge point motion trajectory is set as the positive direction, and the right direction along the edge point motion trajectory is set as the negative direction.

[0015] Furthermore, the S3 further includes: assuming that the edge point p i Point to edge point p i+1 The vector is S i,i+1 , when the offset direction is positive, vector R i,i+1 satisfy:

[0016] R i,i+1 =Rot 90 (S i,i+1 )

[0017] When the offset direction is negative, vector R i,i+1 satisfy:

[0018] R i,i+1 =Rot -90 (S i,i+1 )

[0019] Among them, R i,i+1 Represents the edge point p after offset i Points to the offset edge point p i+1 Vector, Rot θ (·) means rotating the vector counterclockwise by θ degrees, where θ is either 90° or -90°.

[0020] Furthermore, the S3 further includes: assuming that the edge point p i The offset direction vector is V i , calculate the edge point p i The offset direction unit vector:

[0021]

[0022] in, is the edge point p i The offset direction unit vector, |V i | is the edge point p i The magnitude of the offset direction vector.

[0023] Furthermore, the S3 further includes:

[0024] For the first edge point p1, its offset direction vector V1 satisfies V1=R 1,2 ;

[0025] For the last edge point p N , its offset direction vector V N Meet V N =R N-1,N ;

[0026] When 2≤i≤N-1, for the i-th edge point p i , its offset direction vector V i satisfy:

[0027] V i =R i-1,i +R i,i+1

[0028] Among them, R i-1,i Represents the edge point p after offset i-1 Points to the offset edge point p i vector.

[0029] Furthermore, the step S4 further includes: setting the offset distance of the edge point to D, and the offset edge point p′ i Satisfies the following calculation formula:

[0030]

[0031] in, Represents the edge point p i The offset direction unit vector.

[0032] Furthermore, the determining of abnormal points further includes: determining whether each edge point after the shift satisfies a removal condition, and if so, treating the edge point after the shift as an abnormal point and removing it, and if not, retaining it;

[0033] Among them, the exclusion conditions are:

[0034] dis(p′ i , p j ) <D

[0035] Among them, dis(p′ i , p j ) The edge point p′ after shift i To edge point p j The distance between j Represents the j-th edge point of the image, and i∈[1,N], j∈[1,N].

[0036] The beneficial effects of the present invention are as follows: the image edge offset method proposed by the present invention, based on the extraction of image edges, only uses edge points for offset calculation, and can be applied to edge offset processing of images of any shape; by obtaining the offset edge, it can be directly used for subsequent image processing. For example, in the path planning of a robot, such as the application of a robot applying glue, the edge of the object after being offset a certain distance outward is used as the trajectory for gluing. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0038] Figure 1 Schematic diagram of the overall process of the image edge offset method provided in an embodiment of the present invention;

[0039] Figure 2 Schematic diagram of the offset direction in an embodiment of the present invention;

[0040] Figure 3 Schematic diagram of edge point offset in an embodiment of the present invention;

[0041] Figure 4 Schematic diagram of removing outliers in an embodiment of the present invention. DETAILED DESCRIPTION

[0042] To make the purpose, technical solutions and advantages of the embodiments of the present invention more clear, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. Here, the exemplary embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.

[0043] In the description of this specification, the terms "include", "including", "have", "contain", etc. are all open terms, which mean including but not limited to. The descriptions with reference to the terms "one embodiment", "a specific embodiment", "some embodiments", "for example", etc. mean that the specific features, structures or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. The order of steps involved in each embodiment is used to schematically illustrate the implementation of the present application, and the order of steps therein is not limited and can be appropriately adjusted as needed.

[0044] An embodiment of the present invention provides an image edge shifting method. Figure 1 FIG. 1 is a schematic diagram of the overall process of the image edge offset method, as shown in FIG. Figure 1 As shown, the method includes the following steps:

[0045] S1, obtain the edge of the image and extract edge points;

[0046] Among them, an image edge detection algorithm is used to obtain the edge of the image, such as the Canny edge detection algorithm, the Sobel edge detection algorithm, etc.; the edge of a single pixel is obtained by the edge detection algorithm, and the number of edge points can be obtained through the detected image edge.

[0047] Furthermore, based on the acquired image edge points, the motion trajectory of the edge points can be obtained by moving along the edge with one end point of the edge as the starting point. In the present invention, the motion trajectory of the edge points can be obtained by searching the eight neighborhoods of the edge points and using a recursive method.

[0048] Specifically, the image edges obtained include open edges and closed edges. For open edges, any endpoint of the edge line is selected as the first edge point p1, and one of the adjacent edge points of edge point p1 is selected as p2, and another adjacent edge point of edge point p2 is selected as p3, and so on until the last edge point p N .

[0049] For closed edges, a point is randomly selected as the first edge point p1 of the edge line, and one of the adjacent edge points of edge point p1 is used as p2, and another adjacent edge point of edge point p2 is used as p3, and so on until the last edge point p N , p N It is an adjacent edge point to p1.

[0050] S2, set the edge offset direction and offset distance;

[0051] The offset direction of the edge in S2 includes positive and negative directions. From the viewpoint of the observer observing the movement of the edge point, the left direction along the edge point movement trajectory is set as the positive direction, and the right direction along the edge point movement trajectory is set as the negative direction. Figure 2 Schematic diagram of edge point p i The positive direction is The direction indicated, the negative direction is V 1,2 The direction pointed to, 1≤i≤N.

[0052] S3, calculate the offset direction vector of the edge point;

[0053] Specifically, let the edge point p i Point to edge point p i+1The vector is S i,i+1 , when the offset direction is positive, vector R i,i+1 satisfy:

[0054] R i,i+1 =Rot 90 (S i,i+1 )

[0055] When the offset direction is negative, vector R i,i+1 satisfy:

[0056] R i,i+1 =Rot -90 (S i,i+1 )

[0057] Among them, R i,i+1 Represents the edge point p after offset i Points to the offset edge point p i+1 Vector, Rot θ (·) means rotating the vector counterclockwise by θ degrees, where θ is either 90° or -90°.

[0058] Let edge point p i The offset direction vector is V i , calculate the edge point p i The offset direction unit vector:

[0059]

[0060] in, is the edge point p i The offset direction unit vector, |V i | is the edge point p i The offset direction vector V i Model.

[0061] Furthermore, for the first edge point p1, its offset direction vector V1 satisfies V1=R 1,2 ; For the last edge point p N , its offset direction vector V N Meet V N =R N-1,N ;

[0062] When 2≤i≤N-1, for the i-th edge point p i , its offset direction vector V i satisfy:

[0063] V i =R i-1,i +R i,i+1

[0064] Among them, R i-1,iRepresents the edge point p after offset i-1 Points to the offset edge point p i vector.

[0065] S4, obtain the edge points after offset;

[0066] Specifically, the user sets the required offset distance of the image according to actual needs, and the unit of the offset distance is pixel. Figure 3 As shown in the figure, set the edge point p i The offset distance is D, then the edge point p′ after offset i Satisfies the following calculation formula:

[0067]

[0068] in, Represents the edge point p i The offset direction unit vector.

[0069] S5, judging and eliminating abnormal points, and obtaining edge lines of the shifted image based on the remaining shifted edge points.

[0070] Reference Figure 4 As shown in FIG, after obtaining each offset edge point through S4, it is determined whether each offset edge point meets the elimination condition. If so, the offset edge point is treated as an abnormal point and eliminated. If not, the offset edge point is retained.

[0071] Specifically, the exclusion conditions are:

[0072] dis(p′ i , p j ) <D

[0073] Among them, dis(p′ i , p j ) The edge point p′ after shift i To edge point p j The distance between j Represents the j-th edge point of the original image, and i∈[1,N], j∈[1,N].

[0074] After removing abnormal points, the remaining retained offset edge points are connected in sequence to obtain the edge line of the image after offset. The offset distance between each point on the edge of the offset image and the corresponding point on the edge of the original image is the same. This edge line can be provided for subsequent image processing.

[0075] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0076] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0077] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0078] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0079] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. An image edge offset method, characterized in that: The following steps are involved: S1, obtain the edge of the image and extract edge points; S2, set the edge offset direction and offset distance; S3, calculate the offset direction of the edge point; S4, obtaining the edge points after offset; S5, determine and remove abnormal points, and obtain the offset edge line based on the remaining offset edge points; In S1, the image edges obtained include open edges and closed edges. For open edges, any endpoint of the edge line is selected as the first edge point. , and the edge points One of the adjacent edge points is , and then the edge points Another adjacent edge point of , and continue until the last edge point ; For closed edges, a point is randomly selected as the first edge point of the edge line , and the edge points One of the adjacent edge points is , and then the edge points Another adjacent edge point of , and continue until the last edge point , and are adjacent edge points; In S2, the offset direction includes a positive direction and a negative direction, and the left direction along the edge point motion trajectory is set as the positive direction, and the right direction along the edge point motion trajectory is set as the negative direction; The S3 also includes: setting edge points Point to edge point The vector is , when the offset direction is positive, the vector satisfy: , when the offset direction is negative, the vector satisfy: , in, Indicates rotating the vector counterclockwise degrees, and The value is 90° or -90°.

2. The image edge shift method according to claim 1, wherein: Said S1 further comprises: using an image edge detection algorithm to obtain the edge of the image, and obtaining the number of edge points through the detected image edge.

3. The image edge shift method according to claim 2, wherein: The S3 also includes: setting edge points The offset direction vector is , calculate the edge points The offset direction unit vector: ,in, Edge points The offset direction unit vector, Edge points The magnitude of the offset direction vector.

4. The image edge shift method according to claim 2 or 3, wherein: Said S3 further comprises: For the first edge point , its offset direction vector satisfy ; For the last edge point , its offset direction vector satisfy ; when When, for the edge points , its offset direction vector satisfy: .

5. The image edge shift method according to claim 1, wherein: The step S4 further includes: setting the offset distance of the edge point to be , then the edge point after offset Satisfies the following calculation formula: ,in, Represents edge points The unit vector of the offset direction.

6. The image edge shift method according to claim 5, wherein: The determining of abnormal points further includes: determining whether each edge point after the shift meets a removal condition, if so, treating the edge point after the shift as an abnormal point and removing it, and if not, retaining it; Among them, the exclusion conditions are: ,in, Edge points after offset To the edge point The distance between represents the jth edge point of the image, and , .

Citation Information

Patent Citations

  • Shoe sole gluing track generation method and device

    CN110226806A

  • Robot shoe sole dynamic gluing system and method based on 3D scanning

    CN111067197A