Polygon contour optimization method and system based on annular point density

Through the polygonal contour optimization method based on the circumferential point density, the problems of redundant information extraction and inaccurate polygonal outline extraction in traditional image contour extraction are solved, and the precise optimization of polygonal contours and effective acquisition of geometric contours are achieved.

CN119693407AActive Publication Date: 2025-03-25DALIAN UNIV OF TECH

Patent Information

Application Number
CN202411762551.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-03-25
Estimated Expiration
2044-12-03

AI Technical Summary

Technical Problem

Traditional image contour extraction methods are easy to extract redundant information when processing polygon targets, and cannot accurately extract the polygon outline, resulting in loss of edge description information.

Method used

The polygon contour optimization method based on the density of the circumferential point is adopted. By calculating the polar coordinates of the polygon contour points, setting the detection interval and threshold, deleting outline points with density greater than or equal to the preset threshold, traversing the polygon contour for one week, and completing the optimization.

Benefits of technology

It effectively solves the problems of inaccurate redundant information extraction and polygon outline extraction in traditional methods, and can accurately obtain geometric contours that conform to polygon features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119693407A_ABST
    Figure CN119693407A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of image processing, and particularly discloses a polygon contour optimization method and system based on annular point density. The method comprises the following steps: calculating polar coordinates of each contour point in a polygonal contour; setting a detection interval, calculating the density of contour points in the detection interval according to the polar coordinates, and deleting all contour points of which the density is greater than or equal to a preset threshold value; setting a circulation step length delta, calculating the density of the contour points in the next detection interval in the circulation step length delta, deleting all the contour points with the density larger than or equal to a preset threshold value, and traversing the polygon contour for one circle to complete polygon contour optimization. According to the method, the problems that redundant information can be extracted in the traditional image contour extraction process and the outer contour of the polygon cannot be accurately extracted are solved, and the geometric contour conforming to the polygon features can be effectively obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image processing, and in particular relates to a polygon outline optimization method and system based on annular point density. Background Art

[0002] In the field of image processing and computer vision, contour extraction technology is often used for target recognition and image segmentation. Currently, most methods based on thresholds are used to solve the problem of contour extraction. However, due to interference and occlusion in the image, the contour edges extracted from polygonal targets are uneven, resulting in the loss of polygon edge description information. Summary of the invention

[0003] The purpose of the present invention is to solve the problem that redundant information is extracted in the traditional image contour extraction process and the outer contour of the polygon cannot be accurately extracted. A polygon contour optimization method and system based on annular point density are proposed.

[0004] The technical solution of the present invention is as follows: In the first aspect, a polygon outline optimization method based on annular point density comprises the following steps:

[0005] S1. Calculate the polar coordinates of each contour point in the polygon contour;

[0006] S2. Set the detection interval, calculate the density of contour points in the detection interval according to polar coordinates, and delete all contour points whose density is greater than or equal to a preset threshold;

[0007] S3. Set the loop step length δ, calculate the density of contour points in the next detection interval within the loop step length δ, and delete all contour points whose density is greater than or equal to a preset threshold, traverse the polygon contour for one cycle, and complete the polygon contour optimization.

[0008] The beneficial effects of the present invention are:

[0009] The present invention expresses the contour points of the polygon contour with polar coordinates, obtains the density of the contour and optimizes the contour by deleting the contour points in the area with too large point density, thereby solving the problem that redundant information is extracted and the outer contour of the polygon cannot be accurately extracted in the traditional image contour extraction process, and can effectively obtain a geometric contour that meets the characteristics of the polygon.

[0010] Preferably, the step S1 specifically includes the following sub-steps:

[0011] S11. The polygonal contour in the image is represented by a series of contour points composed of pixels, and the contour center point is calculated;

[0012] S12. Taking the center point of the contour as the origin of polar coordinates, the polar coordinates of each contour point are calculated.

[0013] Preferably, the step S12 specifically includes the following steps:

[0014] Calculate the vector v of each contour point relative to the contour center point i , the formula is:

[0015] v i =(x i -c x ,y i -c y )

[0016] Among them, x i Represents the horizontal coordinate of the i-th contour point, y i represents the ordinate of the i-th contour point, c x Indicates the horizontal coordinate of the center point of the contour, c y Indicates the ordinate of the center point of the contour;

[0017] Calculate the vector v i The cosine value of the angle with the horizontal x-axis is cosθ i , the formula is:

[0018]

[0019] Among them, v x Represents the unit vector in the x-axis direction, θ i Represents vector v i The angle with the horizontal x-axis, ||·|| represents the magnitude of the vector;

[0020] Calculate the vector v i The sine of the angle with the horizontal x-axis is sinθ i , the formula is:

[0021]

[0022] According to the cosine value cosθ i and sine value sinθ i θ i Normalize to the range of 0°-360° to obtain the polar coordinates of each contour point.

[0023] Preferably, the step S2 specifically includes the following sub-steps:

[0024] S21. Set the detection interval to θ∈(j,j+s), and set the threshold of the ring point density to m; where j represents the lower limit of the detection interval, and s represents the step size of the detection interval;

[0025] S22. Count the number of contour points within the detection interval θ∈(j,j+s);

[0026] S23. Calculate the density ρ of the contour points within the detection interval θ ∈ (j, j + s) according to the number of contour points.

[0027] S24. Determine whether there exists ρ < m within the detection interval θ ∈ (j, j + s). If so, execute step S3; if not, delete all the contour points within the detection interval θ ∈ (j, j + s) and execute step S3.

[0028] Preferably, the calculation formula for the density ρ of the contour points described in step S23 is:

[0029]

[0030] where ρ represents the number of contour points within the detection interval θ ∈ (j, j + s).

[0031] The beneficial effect of the above preferred solution is:

[0032] The above preferred solution takes the contour center as the origin of the polar coordinate system, represents the contour as a series of pixel coordinate points, calculates the angles of the contour points in the polar coordinate system, obtains the density distribution of the contour points along the circumferential direction, and further deletes the points in the sector with too high density by reasonably setting and threshold judging the circumferential point density within the sector detection interval, which can effectively optimize the polygon contour.

[0033] In a second aspect, a polygon contour optimization system based on circumferential point density includes:

[0034] A coordinate conversion module for calculating the polar coordinates of each contour point in the polygon contour.

[0035] A density detection module for receiving the polar coordinates of the respective contour points, setting a detection interval, calculating the density of the contour points within the detection interval according to the polar coordinates, and deleting all the contour points whose density is greater than or equal to a preset threshold.

[0036] A loop judgment module for setting a step size δ, calculating the density of the contour points at the step size δ, and deleting all the contour points whose density is greater than or equal to a preset threshold, and traversing the polygon contour once to complete the optimization of the polygon contour.

[0037] In a third aspect, an electronic device is provided, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method as in the first aspect.

[0038] In a fourth aspect, a non-transitory computer-readable storage medium storing computer instructions is provided, and the computer instructions are used to cause a computer to execute the method as in the first aspect.

[0039] According to a fifth aspect, a computer program product is provided, comprising a computer program, wherein the computer program implements the method according to the first aspect when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 The figure shows a flow chart of the polygon outline optimization method based on annular point density provided in Example 1 of the present invention.

[0041] Figure 2 Shown is a schematic diagram of a pentagonal outline containing two defects provided in Example 3 of the present invention.

[0042] Figure 3 The figure shows the distribution of contour points of the pentagonal contour provided in Example 3 of the present invention in polar coordinates.

[0043] Figure 4 Shown is a schematic diagram of a pentagon after eliminating two defects provided in Example 3 of the present invention.

[0044] Figure 5 Shown is a schematic diagram of a triangle profile containing a defect provided in Example 4 of the present invention.

[0045] Figure 6 The figure shows the distribution of contour points of the triangle contour provided in Example 4 of the present invention in polar coordinates.

[0046] Figure 7 Shown is a schematic diagram of a triangle after eliminating a defect provided in Example 4 of the present invention. DETAILED DESCRIPTION

[0047] Now, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings. It should be understood that the embodiments shown and described in the accompanying drawings are only exemplary and are intended to explain the principles and spirit of the present invention, rather than to limit the scope of the present invention.

[0048] Embodiment 1:

[0049] like Figure 1 As shown, a polygon outline optimization method based on annular point density includes the following steps:

[0050] S1. Calculate the polar coordinates of each contour point in the polygon contour;

[0051] S2. Set the detection interval, calculate the density of contour points in the detection interval according to polar coordinates, and delete all contour points whose density is greater than or equal to a preset threshold;

[0052] S3. Set the loop step δ, calculate the density of contour points in the next detection interval θ′∈(j+δ,j+s+δ) within the loop step δ, delete all contour points whose density is greater than or equal to the preset threshold, traverse the polygon contour once, and complete the polygon contour optimization, where j represents the lower limit of the detection interval, and s represents the detection interval step.

[0053] In this embodiment, step S1 specifically includes the following sub-steps:

[0054] S11. The polygonal contour in the image is represented by a series of contour points composed of pixels, and the contour center point is calculated;

[0055] S12. Taking the center point of the contour as the origin of polar coordinates, the polar coordinates of each contour point are calculated.

[0056] In this embodiment, step S12 specifically includes the following steps:

[0057] Calculate the vector v of each contour point relative to the contour center point i , the formula is:

[0058] v i =(x i -c x ,y i -c y )

[0059] Among them, x i Represents the horizontal coordinate of the i-th contour point, y i represents the ordinate of the i-th contour point, c x Indicates the horizontal coordinate of the center point of the contour, c y Indicates the ordinate of the center point of the contour;

[0060] Calculate the vector v i The cosine value of the angle with the horizontal x-axis is cosθ i , the formula is:

[0061]

[0062] Among them, v x Represents the unit vector in the x-axis direction, θ i Represents vector v i The angle with the horizontal x-axis, ||·|| represents the magnitude of the vector;

[0063] Calculate the vector v i The sine of the angle with the horizontal x-axis is sinθ i , the formula is:

[0064]

[0065] According to the cosine value cosθ i and the sine value sinθ i normalize θ i to the range of 0° - 360°, and obtain the polar coordinates of each contour point.

[0066] In this embodiment, the step S2 specifically includes the following sub-steps:

[0067] S21. Set the detection interval as θ ∈ (j, j + s), and set the threshold of the circumferential point density as m; where j represents the lower limit of the detection interval, and s represents the detection interval step size;

[0068] S22. Count the number of contour points within the detection interval θ ∈ (j, j + s);

[0069] S23. Calculate the density ρ of the contour points within the detection interval θ ∈ (j, j + s) according to the number of contour points;

[0070] S24. Determine whether there is ρ < m within the detection interval θ ∈ (j, j + s). If so, execute step S3; if not, delete all the contour points within the detection interval θ ∈ (j, j + s), and execute step S3.

[0071] In this embodiment, the calculation formula for the density ρ of the contour points in step S23 is:

[0072]

[0073] where ρ represents the number of contour points within the detection interval θ ∈ (j, j + s).

[0074] Embodiment 2:

[0075] Based on Embodiment 1, this embodiment provides a polygon contour optimization system based on circumferential point density, which can be used to implement the polygon contour optimization method based on circumferential point density as described in Embodiment 1. The system includes:

[0076] A coordinate conversion module, which is used to calculate the polar coordinates of each contour point in the polygon contour;

[0077] A density detection module, which is used to receive the polar coordinates of each contour point, set the detection interval, calculate the density of the contour points within the detection interval according to the polar coordinates, and delete all the contour points whose density is greater than or equal to the preset threshold;

[0078] A loop judgment module, which is used to set the step size δ, calculate the density of the contour points at the step size δ, and delete all the contour points whose density is greater than or equal to the preset threshold, and traverse the polygon contour once to complete the optimization of the polygon contour.

[0079] In this embodiment, an electronic device, a readable storage medium, and a computer program product are also provided.

[0080] In this embodiment, the electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the polygon contour optimization method based on annular point density as described in the above embodiment 1.

[0081] In this embodiment, the readable storage medium may be a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the polygon contour optimization method based on annular point density according to the above embodiment 1.

[0082] In this embodiment, the computer program product includes a computer program, which, when executed by a processor, implements the polygon outline optimization method based on annular point density according to the above embodiment 1.

[0083] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0084] In the context of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0085] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0086] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0087] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0088] Embodiment 3:

[0089] On the basis of Example 1, a pentagonal contour containing two defects is optimized to illustrate the technical effect of the polygonal contour optimization method based on annular point density proposed by the present invention.

[0090] like Figure 2 As shown in , each corner of the pentagon contains 1 contour point, and there are 3 contour points at each of the two defects. The distribution of contour points of the pentagon contour in polar coordinates is shown in Figure 3 As shown in the figure, the custom interval length s = 5°, the cycle step length δ = 1°, and the threshold m of the annular point density is customized to 2. After processing, the two polygonal defects can be successfully deleted, as shown in the figure. Figure 4 shown.

[0091] Embodiment 4:

[0092] On the basis of Example 1, a triangle contour containing one defect is optimized to illustrate the technical effect of the polygon contour optimization method based on annular point density proposed by the present invention.

[0093] like Figure 5 As shown in Figure 1, each corner of the triangle contains 1 contour point, and there are 13 contour points at the hypotenuse defect, a total of 16 contour points, with an average density of 16 / 360=0.04. The contour point distribution of the triangle contour in polar coordinates is shown in Figure 1. Figure 6 As shown in . Set the initial angle to 0°, the loop step length δ = 1°, when the search interval reaches the defect, keep the lower limit of the angle interval unchanged, and increase the upper limit of the angle interval according to the given step length. If the density in the interval is greater than the average density each time, continue to increase the upper limit until the upper limit of the interval increases by a certain angle and the contour points no longer increase. Get the angle range and number of contour points at the defect, delete them all, and get the contour that conforms to the triangle as shown in Figure 7 shown.

[0094] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and should be understood that the protection scope of the present invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific variations and combinations that do not deviate from the essence of the present invention based on the technical revelations disclosed by the present invention, and these variations and combinations are still within the protection scope of the present invention.

Claims

1. A polygonal contour optimization method based on annular point density, characterized in that: The method includes the following steps: S1. Calculate the polar coordinates of each contour point in the polygon contour; S2. Set a detection interval, calculate the density of contour points within the detection interval according to the polar coordinates, and delete all contour points whose density is greater than or equal to a preset threshold, then execute step S3; S3. Set a loop step size δ, calculate the density of contour points in the next detection interval within the loop step size δ, and delete all contour points whose density is greater than or equal to the preset threshold, and traverse the polygon contour once to complete the optimization of the polygon contour.

2. The polygonal contour optimization method based on annular point density according to claim 1, characterized in that: The specific steps of step S1 include the following sub-steps: S11. Represent the polygon contour in the image by a series of contour points composed of pixel points, and calculate the contour center point; S12. Take the contour center point as the origin of the polar coordinates to calculate the polar coordinates of each contour point.

3. The polygonal contour optimization method based on annular point density according to claim 2, characterized in that: The specific steps of step S12 include the following steps: Calculate the vector v of each contour point relative to the contour center point i , the formula is: v i =(x i -c x ,y i -c y ) Among them, x i Represents the horizontal coordinate of the i-th contour point, y i represents the ordinate of the i-th contour point, c x Indicates the horizontal coordinate of the center point of the contour, c y Indicates the ordinate of the center point of the contour; Calculate the vector v i The cosine value of the angle with the horizontal x-axis is cosθ i , the formula is: Among them, v x Represents the unit vector in the x-axis direction, θ i Represents vector v i The angle with the horizontal x-axis, ||·|| represents the magnitude of the vector; Calculate the vector v i The sine of the angle with the horizontal x-axis is sinθ i , the formula is: According to the cosine value cosθ i and sine value sinθ i θ i Normalize to the range of 0°-360° to obtain the polar coordinates of each contour point.

4. The polygon outline optimization method based on annular point density according to claim 1, characterized in that: The specific steps of step S2 include the following sub-steps: S21. Set the detection interval as θ∈(j,j + s), and set the threshold of the circumferential point density as m; where j represents the lower limit of the detection interval, and s represents the detection interval step size; S22. Count the number of contour points within the detection interval θ∈(j,j + s); S23. Calculate the density ρ of the contour points within the detection interval θ∈(j,j + s) according to the number of contour points; S24. Determine whether there is ρ < m within the detection interval θ∈(j,j + s). If so, execute step S3; if not, delete all contour points within the detection interval θ∈(j,j + s), and execute step S3.

5. The polygonal contour optimization method based on annular point density according to claim 4, characterized in that: In step S23, the calculation formula for the density ρ of the contour points is: where n represents the number of contour points within the detection interval θ∈(j,j + s).

6. A polygonal contour optimization system based on annular point density, characterized in that: The system includes: A coordinate conversion module for calculating the polar coordinates of each contour point in the polygon contour; A density detection module for receiving the polar coordinates of each contour point, setting a detection interval, calculating the density of contour points within the detection interval according to the polar coordinates, and deleting all contour points whose density is greater than or equal to a preset threshold; A loop judgment module for setting a step size δ, calculating the density of contour points at the step size δ, and deleting all contour points whose density is greater than or equal to a preset threshold, and traversing the polygon contour once to complete the optimization of the polygon contour.

7. An electronic device, characterized in that: Including: At least one processor; And a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the method according to any one of claims 1-5.

8. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause a computer to execute the method according to any one of claims 1-5.

9. A computer program product, characterized in that Including a computer program, which when executed by a processor implements the method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Notch defect detection method for flexible IC package substrate line

    CN108918526A

  • Image processing method and device

    CN111640114A

  • Bottom covered edge detection method based on contour fitting comparison and related device

    CN112927193A

  • Method for inspecting appearance of spherical body

    JP1996201033A

  • Contour detection and image classification

    US8422782B1

Cited By

  • Interference image pair screening method and application thereof

    CN120161418A