A polygonal contour optimization method and system based on ring point density

By using a polygon contour optimization method based on circumferential point density, polar coordinates are calculated and contour points with excessive density are deleted, which solves the redundant information problem in traditional image contour extraction and achieves accurate polygon outer contour extraction.

CN119693407BActive Publication Date: 2025-10-17DALIAN UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Traditional image contour extraction methods have problems such as redundant information extraction and inability to accurately extract polygon contours.

Method used

A polygon outline optimization method based on circumferential point density is adopted. The polar coordinates of polygon outline points are calculated, the detection interval and threshold are set, and outline points with excessive density are deleted to optimize the polygon outline.

Benefits of technology

It effectively removes redundant information, accurately extracts the outer contour of the polygon, and obtains a geometric contour that conforms to the polygon characteristics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119693407B_ABST
    Figure CN119693407B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of image processing technology, and specifically discloses a polygon outline optimization method and system based on circumferential point density. The method comprises: calculating the polar coordinates of each contour point in the polygon outline; setting a detection interval, calculating the density of contour points within the detection interval based on the polar coordinates, and deleting all contour points whose density is greater than or equal to a preset threshold; setting a loop step length δ, calculating the density of contour points within the next detection interval within the loop step length δ, and deleting all contour points whose density is greater than or equal to the preset threshold, traversing the polygon outline once, and completing polygon outline optimization. The present invention solves the problem that redundant information is extracted and the outer contour of the polygon cannot be accurately extracted during the traditional image contour extraction process, and can effectively obtain a geometric contour that meets the characteristics of the polygon.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of image processing, and particularly relates to a polygon contour optimization method and system based on ring point density. BACKGROUND

[0002] In the field of image processing and computer vision, contour extraction technology is often used for target recognition and image segmentation. At present, for the problem of contour extraction, a threshold-based segmentation method is mostly used. However, due to the existence of interference and occlusion in the image, the contour edges obtained by the polygon target extraction are uneven, resulting in the loss of polygon edge description information. SUMMARY

[0003] The purpose of the application 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, and a polygon contour optimization method and system based on ring point density are proposed.

[0004] The technical scheme of the application is as follows: in the first aspect, a polygon contour optimization method based on ring point density comprises the following steps:

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

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

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

[0008] The application has the following beneficial effects:

[0009] The application represents the contour points of the polygon contour by polar coordinates, optimizes the contour by deleting the contour points in the area with excessive point density, solves 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, and can effectively obtain a geometric contour conforming to the polygon characteristics.

[0010] As a preferred embodiment, the step S1 specifically comprises the following sub-steps:

[0011] S11. Represent the polygon contour in the image by a series of contour points composed of pixel points, and calculate the contour center point.

[0012] S12. Take the contour center point as the polar coordinate origin, and calculate the polar coordinates of each contour point.

[0013] As preferred, the step S12 specifically comprises the following steps:

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

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

[0016] wherein x i represents the horizontal coordinate of the i-th contour point, y i represents the vertical coordinate of the i-th contour point, c x represents the horizontal coordinate of the contour center point, and c y represents the vertical coordinate of the contour center point.

[0017] Calculating the cosine value cosθ of the angle between the vector v i and the horizontal direction x-axis i , whose formula is:

[0018]

[0019] wherein v x represents the unit vector in the x-axis direction, θ i represents the angle between the vector v i and the horizontal direction x-axis, and ||·|| represents the modulus of the vector.

[0020] Calculating the sine value sinθ of the angle between the vector v i and the horizontal direction x-axis i , whose formula is:

[0021]

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

[0023] As preferred, the step S2 specifically comprises the following sub-steps:

[0024] S21. Setting the detection interval as θ∈(j,j+s), and setting the threshold value of the ring point density as m; wherein j represents the lower limit of the detection interval, and s represents the detection interval step;

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

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

[0027] S24. Determine whether there is p < m in the detection interval θ∈(j, j+s), if yes, execute step S3; if no, delete all the contour points in the detection interval θ∈(j, j+s) and execute step S3.

[0028] As preferred, the calculation formula of the density p of the contour points in step S23 is:

[0029]

[0030] Wherein, p represents the number of the contour points in the detection interval θ∈(j, j+s).

[0031] The beneficial effects of the above preferred scheme are:

[0032] The above preferred scheme takes the contour center as the polar coordinate origin, represents the contour as a series of pixel coordinate points, calculates the angle of the contour points in the polar coordinate, obtains the density distribution of the contour points along the ring direction, and further deletes the points in the sector with too high density by reasonably setting the ring direction point density in the sector and judging the threshold value, so that the optimization of the polygon contour can be effectively realized.

[0033] The second aspect is a polygon contour optimization system based on the ring direction point density, comprising:

[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 each contour point, setting a detection interval, calculating the density of the contour points in the detection interval according to the polar coordinates, and deleting all the contour points with the density greater than or equal to a preset threshold value;

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

[0037] The third aspect provides an electronic device, comprising: at least one processor; and a memory connected with the at least one processor in communication; 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 of the first aspect.

[0038] The fourth aspect provides a non-transitory computer readable storage medium storing computer instructions, the computer instructions being used to make a computer execute the method of the first aspect.

[0039] In a fifth aspect, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the method of the first aspect. BRIEF DESCRIPTION OF DRAWINGS

[0040] Figure 1 A flow chart of a polygon contour optimization method based on ring point density provided in Embodiment 1 of the present application is shown.

[0041] Figure 2 A pentagon contour with two defects provided in Embodiment 3 of the present application is shown.

[0042] Figure 3 A contour point distribution in polar coordinates of the pentagon contour provided in Embodiment 3 of the present application is shown.

[0043] Figure 4 A pentagon contour after eliminating the two defects provided in Embodiment 3 of the present application is shown.

[0044] Figure 5 A triangle contour with one defect provided in Embodiment 4 of the present application is shown.

[0045] Figure 6 A contour point distribution in polar coordinates of the triangle contour provided in Embodiment 4 of the present application is shown.

[0046] Figure 7 A triangle contour after eliminating the one defect provided in Embodiment 4 of the present application is shown. DETAILED DESCRIPTION

[0047] Exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. It should be understood that the embodiments illustrated and described herein are merely exemplary and are not intended to limit the scope of the present application, which is defined by the appended claims.

[0048] Embodiment 1:

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

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

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

[0052] ​S3. Set the loop step δ, calculate the density of contour points in the next detection interval θ′∈(j+δ,j+s+δ) within the loop step δ, and delete all contour points whose density is greater than or equal to the preset threshold. Traverse the polygon contour once to 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, calculate the polar coordinates of each contour point.

[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 Indicates the horizontal coordinate of the i-th contour point, y i Indicates 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 vertical coordinate of the center point of the contour;

[0060] Calculate vector v i The cosine 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 modulus of the vector;

[0063] Calculate 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 θ i is normalized to the range of 0°-360° to obtain the polar coordinates of each contour point.

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

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

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

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

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

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

[0072]

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

[0074] Embodiment 2:

[0075] Based on the embodiment 1, the embodiment provides a polygon contour optimization system based on the ring point density, which can be used to realize the polygon contour optimization method based on the ring point density as described in the embodiment 1, and the system comprises:

[0076] a coordinate conversion module, configured to calculate the polar coordinates of each contour point in the polygon contour;

[0077] a density detection module, configured to receive the polar coordinates of each contour point, set a detection interval, calculate the density of the contour points in the detection interval according to the polar coordinates, and delete all the contour points with the density greater than or equal to a preset threshold value;

[0078] a loop judgment module, configured to set a step δ, calculate the density of the contour points at the step δ, delete all the contour points with the density greater than or equal to a preset threshold value, traverse the polygon contour once, and complete the polygon contour optimization.

[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 comprises at least one processor, and a memory connected with the at least one processor in communication; 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 perform the polygon contour optimization method based on ring point density as described in Embodiment 1 above.

[0081] In this embodiment, the readable storage medium can be a non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the polygon contour optimization method based on ring point density as described in Embodiment 1 above.

[0082] In this embodiment, the computer program product comprises a computer program which, when executed by a processor, implements the polygon contour optimization method based on ring point density as described in Embodiment 1 above.

[0083] Program code for carrying out operations of the present application can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, causes the machine to perform the functions / operations specified in the flow diagrams and / or block diagrams. The program code can execute entirely on a machine, partly on a machine, as a stand-alone software package, partly on a machine and partly on a remote machine or entirely on a remote machine or server.

[0084] In the context of the present application, a machine-readable medium can be a tangible medium that can contain or store program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable storage media can include, without limitation, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media can include one or more lines of electrical connections, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0085] To provide for interaction with a user, the systems and techniques described here 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 a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

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

[0087] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can 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 Embodiment 1, a pentagon profile containing two defects is optimized to illustrate the technical effect of the polygon profile optimization method based on the ring point density proposed in the application.

[0090] As shown in Figure 2 , the corner points of the pentagon respectively contain 1 profile point, and there are 3 profile points at each of the two defects. The profile point distribution of the pentagon profile in polar coordinates is shown in Figure 3 . The interval length s is defined as 5°, the cycle step δ is 1°, and the threshold value m of the ring point density is defined as 2. After processing, the two polygon defects can be successfully deleted, as shown in Figure 4 .

[0091] Embodiment 4:

[0092] Based on the embodiment 1, the triangle profile with one defect is optimized to illustrate the technical effect of the polygon profile optimization method based on the circumferential point density proposed by the present application.

[0093] As shown in Figure 5 , the corner points of the triangle respectively contain 1 profile point, and there are 13 profile points at the defect of the hypotenuse, totaling 16 profile points, with an average density of 16 / 360 = 0.04. The profile point distribution of the triangle profile in polar coordinates is shown in Figure 6 . The initial angle is set to 0°, the cycle step is δ = 1°, when the search interval reaches the defect, the lower limit of the angle interval is kept unchanged, the upper limit of the angle interval is increased by a given step, and the density in the interval is judged each time. If it is greater than the average density, the upper limit will continue to increase until the profile point no longer increases after the upper limit of the interval increases by a certain angle, the angle range and the number of profile points at the defect are obtained, and they are all deleted to obtain the profile conforming to the triangle as shown in Figure 7 .

[0094] Those skilled in the art will appreciate that the embodiments described herein are intended to aid the reader in understanding the principles of the present application and should not be construed as limiting the scope of protection of the present application to such specific statements and embodiments. Those skilled in the art can make various other specific modifications and combinations according to the technical inspiration disclosed in the present application without departing from the essence of the present application, and these modifications and combinations are still within the scope of protection of the present application.

Claims

1. A polygon outline optimization method based on annular point density, characterized in that: The method comprises the following steps: S1. Calculate the polar coordinates of each contour point in the polygon contour; S2 sets the detection interval, calculates the density of the contour points within the detection interval according to the polar coordinates, and deletes all contour points whose density is greater than or equal to the preset threshold, and executes step S3; Step S2 specifically includes the following sub-steps: S21. Set the detection interval to , and set the threshold of the ring point density to ;in, represents the lower limit of the detection interval, Indicates the detection interval step length; S22. Statistical detection interval The number of inner contour points; S23. Calculate the detection interval based on the number of contour points Density of inner contour points ; S24. Determine the detection range Does it exist within If yes, go to step S3; if no, delete the detection interval All contour points within, and execute step S3; S3. Set the loop step size , calculate the loop step length Next detection interval The density of inner contour points is calculated, and all contour points whose density is greater than or equal to the preset threshold are deleted. The polygon contour is traversed for one week to complete the polygon contour optimization.

2. The polygon outline optimization method based on annular point density according to claim 1, characterized in that: The step S1 specifically includes the following sub-steps: 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; S12. Taking the center point of the contour as the origin of polar coordinates, calculate the polar coordinates of each contour point.

3. The polygon outline optimization method based on annular point density according to claim 2, characterized in that: The step S12 specifically includes the following steps: Calculate the vector of each contour point relative to the contour center point , the formula is: in, Indicates the The horizontal coordinates of the contour points, Indicates the The vertical coordinate of the contour point, Indicates the horizontal coordinate of the center point of the contour, Indicates the vertical coordinate of the center point of the contour; Calculating vectors With horizontal direction Cosine of the axis angle , the formula is: in, express The unit vector in the direction of the axis, Represents a vector With horizontal direction Axis angle, represents the magnitude of a vector; Calculating vectors With horizontal direction Sine of the axis angle , the formula is: ; According to the cosine value and sine Will 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 density of the contour points in step S23 The calculation formula is: in, Indicates the detection interval The number of inner contour points.

5. A polygonal contour optimization system based on annular point density, characterized in that: The system comprises: Coordinate transformation module, used to calculate the polar coordinates of each contour point in the polygon contour; The density detection module is used to receive the polar coordinates of each contour point, set a detection interval, calculate the density of the contour points in the detection interval based on the polar coordinates, and delete all contour points whose density is greater than or equal to a preset threshold, and enter the loop judgment module, specifically: Set the detection interval to , and set the threshold of the ring point density to ;in, represents the lower limit of the detection interval, Indicates the detection interval step length; Statistical detection interval The number of inner contour points; Calculate the detection interval based on the number of contour points Density of inner contour points ; Determine the detection range Does it exist within If yes, enter the loop judgment module; if no, delete the detection interval All contour points within and enter the loop judgment module; Loop judgment module, used to set the loop step length , calculate the loop step length Next detection interval The density of inner contour points is calculated, and all contour points whose density is greater than or equal to the preset threshold are deleted. The polygon contour is traversed for one week to complete the polygon contour optimization.

6. An electronic device, characterized in that: include: 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 according to any one of claims 1 to 4.

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

8. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Image processing method and device

    CN111640114A

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

    CN112927193A