A curve segmentation fitting method, device and storage medium for image segmentation
By combining the DCE evaluation criterion and the Euler curve model, automatic segmented fitting of curves in images is achieved, solving the problems of large noise influence and high computational complexity in existing technologies, and improving fitting efficiency and accuracy.
Patent Information
- Application Number
- CN202210718720.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-23
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2042-06-23
AI Technical Summary
Existing technologies suffer from problems such as significant noise impact, high computational complexity, and low efficiency in curve extraction and fitting, especially for irregular curves and local edge detection algorithms with significant noise impact.
The contour segmentation algorithm based on the DCE evaluation standard is combined with the Euler curve model. Through image preprocessing, contour data acquisition, segment point list calculation and curve fitting, the automatic segmentation and fitting of curves is achieved, reducing human intervention. The fitting is performed by utilizing the translation, rotation and scale invariance of Euler curves.
It achieves automatic segmented fitting of curves in images, reduces subjective errors, improves fitting efficiency, can adapt to curves with rapidly changing curvature, satisfies translation, rotation, and scale invariance, and is suitable for fitting various types of curves.
Smart Images

Figure CN115222753B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing, and in particular to a method, apparatus, and storage medium for curve segmentation fitting for image segmentation. Background Technology
[0002] Curve extraction and fitting, along with related image retrieval and image segmentation technologies, have significant theoretical implications and broad application prospects in many fields, from medical image analysis of blood vessels to remote sensing for identifying roads and rivers, and then to biometrics and robotics. Images contain not only regular curves such as straight lines and arcs, but also some irregular curves without specific equations. Even regular curves can exhibit undulating contour edges in images due to noise.
[0003] Current research on curve extraction and fitting can be divided into two categories. One category is based on global methods. Using models with a small number of parameters often avoids overfitting, but may face high levels of noise. Complex equations and parameter models significantly increase computational requirements and often lead to overfitting. The other category is curve fitting algorithms based on local edges. Generally, there are two approaches: one is to predict and judge based on the pixel distribution within a certain neighborhood of a pixel. The detection results are often small contour fragments, which are greatly affected by image noise. The other approach is to divide the image into grids and subgrids, considering only a subset. This local image modeling can accurately represent the curve direction and branch points, making it easy to infer global curve information. However, the workload is too large, resulting in low efficiency for this type of algorithm. Summary of the Invention
[0004] In order to overcome the above-mentioned shortcomings and deficiencies of the prior art, the purpose of this invention is to provide a method, device and storage medium for curve segmentation fitting for image segmentation.
[0005] The objective of this invention is achieved through the following technical solution:
[0006] A curve piecewise fitting method for image segmentation includes the following:
[0007] Image preprocessing is performed to obtain contour data;
[0008] Based on the contour data, a contour segmentation algorithm according to the DCE evaluation standard is performed to obtain a list of segmentation points;
[0009] Based on the list of segmented points, a curve fitting algorithm based on the Euler curve model is performed to obtain the final fitting result.
[0010] Furthermore, the image preprocessing includes the following:
[0011] Convert the image to grayscale (I);
[0012] Coarse edge localization: A combination of Gabor operators is used to coarsely localize the edges of the grayscale image I, yielding the coarse localization result M(x, y) and the angle θ. M ;
[0013] Subpixel localization: Subpixel edges are calculated using Zernike moments to obtain fine-grained results M(xx, yy);
[0014] Contour extraction: Extract contours based on the eight-neighbor information of a pixel.
[0015] Furthermore, based on the contour data, a contour segmentation algorithm according to the DCE evaluation standard is performed to obtain a list of segmentation points, specifically:
[0016] Calculate the contribution rate K of each vertex in the contour;
[0017] After removing the vertex with the lowest contribution rate, we obtain the segmentation point list V. c .
[0018] Furthermore, a curve fitting algorithm based on the Euler curve model is performed according to the segmented list to obtain the final fitting result, specifically:
[0019] Obtain the data from the segmentation point list one by one and perform segmented fitting;
[0020] Fitting endpoint V c (k) and V c (k+1), with direction θ at the endpoint. M (k) and θ M (k+1), calculate vector V c (k+1)-V c The angle ψ of (k);
[0021] Based on the angle ψ, the curve type is determined, and categorized fitting is performed, specifically as follows:
[0022] If ψ is not equal to V c (k) and V c The average angle of (k+1), θ M (k)≠θ M (k+1), in this case, the curve is an irregular curve, and curve fitting is performed according to the Euler model;
[0023] If ψ equals V c (k) and V c The average angle of (k+1) and ψ=θ M (k)=θ M (k+1), in this case, the curve is a straight line;
[0024] If ψ equals V c (k) and V c The average angle of (k+1), and θ M (k)≠θ M (k+1), in this case, the curve is an arc.
[0025] Furthermore, when the curve is irregular, curve fitting is performed based on the Euler model, specifically as follows:
[0026] V c The curvature at (k) is κ0, V c The curvature at (k+1) is κ2, and after fitting, V c (k) and V c The arc length between (k+1) is L, the rate of curvature increase is γ, and V c The total arc length after fitting between (k) and Z(1) is called L1, Z(1), V c The total arc length after fitting between (k+1) is called L2, the curvature at Z(1) is κ1, and the direction at Z(1) is represented by θ. Z (1) Let V c (k+1)-V c (k)=L0e iψ When |θ M (k)-θ M When (k+1)|>π, then we have:
[0027]
[0028]
[0029] When 0 < |θ M (k)-θ M When (k+1)|<π, then we have
[0030]
[0031]
[0032] Arc length L can be expressed as
[0033]
[0034] The choice of k1 and k2 ensures that L1 and L2 are the smallest positive numbers.
[0035] Furthermore, when the curve is a straight line, the fitting result is as follows:
[0036] κ0=κ2=0
[0037] L = L0.
[0038] Furthermore, when the curve is an arc, the fitting result is as follows:
[0039]
[0040]
[0041] further,
[0042] The expression for the curve arc length s parameter is as follows:
[0043] When 0≤s≤L k hour:
[0044]
[0045]
[0046] When L1≤s≤L k +L k+1 hour:
[0047]
[0048]
[0049] Complete the curve fitting.
[0050] A storage medium having a computer program stored thereon, which, when executed by a processor, implements the curve segmentation fitting method.
[0051] An apparatus includes a memory, a processor, and the curve segmentation fitting method stored in the memory and operable on the processor.
[0052] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0053] (1) The curve fitting algorithm of the present invention can realize automatic segmentation of the contour, reducing subjective errors caused by human intervention.
[0054] (2) Euler space curves satisfy translation, rotation, scale invariance and scalability, and are ideal contour fitting models. Furthermore, since Euler curves are curves with linearly increasing curvature, they can be iteratively fitted.
[0055] (3) The curvature of the curve can be known immediately after the fitting is completed in this invention, without the need for additional calculation.
[0056] (4) The curve fitting algorithm of this invention adopts Euler fitting and flexibly adjusts the fitting formula according to the curvature change, which can fit the curve with rapidly changing curvature in the image. Attached Figure Description
[0057] Figure 1 This is a flowchart of the process of this invention;
[0058] Figure 2 This is a schematic diagram of the contour segmentation of the present invention;
[0059] Figure 3 This is a schematic diagram of curve fitting in this invention. Detailed Implementation
[0060] The present invention will be further described in detail below with reference to the embodiments, but the implementation of the present invention is not limited thereto.
[0061] like Figures 1-3 As shown, a curve piecewise fitting method for image segmentation includes the following steps:
[0062] Step A: Image preprocessing to obtain contour data.
[0063] The image preprocessing includes:
[0064] A1. Convert the input image to grayscale image I.
[0065] A2. Coarse Edge Localization. The Gabor operator combination Θ and the image I are transformed to the frequency domain using Discrete Fourier Transform. The transformation formula is:
[0066]
[0067] in, and Let i represent the Gabor function and image in the frequency domain, respectively, where i represents the imaginary unit, m and n represent the length and width of image I, and Θ is padded with zeros to be the same size as image I.
[0068] After frequency domain processing, the result is returned in the spatial domain. The conversion formula is:
[0069]
[0070] The processing result is denoted as H, which represents the multi-channel feature map obtained after processing by a set of Gabor operators. The number of channels depends on the number of Gabor operators designed.
[0071] The maximum value in each channel is taken as the edge detection result, denoted as M, where M(x, y) = max(H). The angle of the channel containing the maximum value is the direction of the texture edge, denoted as θ. M .
[0072] In this embodiment, the Gabor operator combination design is a combination of three scales and eight directions.
[0073] A3. Subpixel localization. Subpixel edges are calculated using ZeFnike moments to obtain a fine-grained result M(xx, yy).
[0074] If the template size used in the Zernike moment calculation is S×S, then sub-pixel edge localization can be obtained.
[0075]
[0076] Where (xx, yy) are the sub-pixel coordinates of the edge. The edge angle is represented by d, and the vertical distance between the edge and the image origin is represented by d.
[0077] A4. Extract the contour based on the eight-neighbor information of the pixel.
[0078] Starting from the bottom left corner of the image, scan from bottom to top and left to right to find a black pixel and set this point as the starting pixel. Each time a black pixel is found, set it as the current boundary pixel. Then, return to the white pixel reached in the previous loop and search every pixel in the Moore's neighborhood in a clockwise direction until the next black pixel is encountered. Repeat the above steps. The algorithm terminates when the starting pixel is traversed for the second time. The black pixels traversed during the entire algorithm's operation are the boundary pixels of the target.
[0079] The formula for the Gabor operator is:
[0080]
[0081]
[0082] Where x and y represent pixel coordinates; x ro y ro Represents the pixel coordinates after rotation; θ represents the normal direction of the parallel stripes, with a value of 0-2π. λ represents the phase shift in the independent variable of the cosine factor; λ represents the wavelength of the cosine factor, typically greater than 2 but less than 1 / 5 of the input image size; γ represents the aspect ratio, specifying the ellipticity supported by the Gabor function. When γ = 1, it represents a circle; when γ < 1, the shape elongates along the direction of the parallel stripes, typically taken as 0.5; σ represents the standard deviation, also known as the scale. The larger the scale, the larger the Gabor shape, and the more parallel stripes are visible in the same window.
[0083] The Gabor operator is designed with three scales and eight directions, for a total of 24 operators. The specific parameter settings are λ = 8, σ = 0.3, 0.6, 1. γ = 1.
[0084] The Zernike rectangular template size S is 7.
[0085] Step B: Contour segmentation algorithm.
[0086] B1. Calculate the contribution rate K of each vertex in the contour. The formula for calculating the contribution rate K is:
[0087]
[0088] Where, θ i s i s i+1 The rotation angle between them Figure 3 As shown, l represents the normalized arc length. The larger the K value, the greater the contribution of s1 and s2 to the object's contour.
[0089] B2. Remove the vertex containing the minimum contribution rate to obtain the segmentation point list V. c ;
[0090] Step C: Curve fitting algorithm.
[0091] C1 takes data from the segmentation point list one by one and performs segmented fitting;
[0092] C2 fitting endpoint V c (k) and V c (k+1), with direction θ at the endpoint. M (k) and θ M (k+1), calculate vector V c (k+1)-V c The angle ψ of (k);
[0093] C3 determines the curve type and performs type-specific fitting;
[0094] As a further improvement of the present invention, step C3 includes:
[0095] C31 If ψ is not equal to V c (k) and V c The average angle of (k+1), θ M (k)≠θ M (k+1), in this case, the curve is an irregular curve, and curve fitting is performed according to the Euler model;
[0096] C32 If ψ equals V c (k) and V c The average angle of (k+1) and ψ=θ M (k)=θ M (k+1), in this case, the curve is a straight line;
[0097] C33 If ψ equals V c (k) and V cThe average angle of (k+1), but θ M (k)≠θ M (k+1), in this case, the curve is an arc;
[0098] In the case of an irregular curve, such as Figure 3 As shown, V c The curvature at (k) is κ0, V c The curvature at (k+1) is κ2, and after fitting, V c (k) and V c The arc length between (k+1) is L, the rate of curvature increase is γ, and V c The total arc length after fitting between (k) and Z(1) is called L1, Z(1), V c The total arc length after fitting between (k+1) is called L2, the curvature at Z(1) is κ1, and the direction at Z(1) is represented by θ. Z (1) Let V c (k+1)-V c (k)=L0e iψ When |θ M (k)-θ M When (k+1)|>π, then we have
[0099]
[0100]
[0101] When 0 < |θ M (k)-θ M When (k+1)|<π, then we have
[0102]
[0103]
[0104] Arc length L can be expressed as
[0105]
[0106] The choice of k1 and k2 ensures that L1 and L2 are the smallest positive numbers.
[0107] When the line is straight, the resulting fitting result is:
[0108] κ0=κ2=0
[0109] L = L0
[0110] In the case of a circular arc, the obtained fitting result is:
[0111]
[0112]
[0113] Through the above process, V can be obtained. c (k), Z(1), V c The arc length s parameter expression of the curve is obtained by taking k1, k2, L1, and L2 between (k+1).
[0114] When 0≤s≤L k hour:
[0115]
[0116]
[0117] When L1≤s≤L k +L k+1 hour:
[0118]
[0119]
[0120] Calculate Z(1), Z(2), V step by step c Using parameters such as (k+1), curve fitting is completed.
[0121] This invention's curve fitting algorithm can automatically segment contours, reducing subjective errors caused by human intervention. Euler space curves satisfy translation, rotation, and scale invariance, as well as scalability, making them ideal contour fitting models. Furthermore, since Euler curves exhibit linearly increasing curvature, iterative curve fitting can be performed. The curve curvature is known immediately upon fitting, eliminating the need for additional calculations, and enabling the fitting of curves with rapidly changing curvature in images.
[0122] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the embodiments described above. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.
Claims
1. A curve piecewise fitting method for image segmentation, characterized in that, Including the following: Image preprocessing is performed to obtain contour data; Based on the contour data, a contour segmentation algorithm according to the DCE evaluation standard is performed to obtain a list of segmentation points; Based on the list of segmented points, a curve fitting algorithm based on the Euler curve model is performed to obtain the final fitting result; Based on the list of segmented points, a curve fitting algorithm based on the Euler curve model is performed to obtain the final fitting result, specifically: Obtain the data from the segmentation point list one by one and perform segmented fitting; Fitting endpoint V c (k) and V c (k+1), with direction θ at the endpoint. M (k) and θ M (k+1), calculate vector V c (k+1)-V c The angle ψ of (k); Based on the angle ψ, the curve type is determined, and categorized fitting is performed, specifically as follows: If ψ is not equal to V c (k) and V c The average angle of (k+1), θ M (k)≠θ M (k+1), in this case, the curve is an irregular curve, and curve fitting is performed according to the Euler model; If ψ equals V c (k) and V c The average angle of (k+1) and ψ=θ M (k)=θ M (k+1), in this case, the curve is a straight line; If ψ equals V c (k) and V c The average angle of (k+1), and θ M (k)≠θ M (k+1), in this case, the curve is an arc; When the curve is irregular, curve fitting is performed according to the Euler model, specifically as follows: V c The curvature at (k) is κ0, V c The curvature at (k+1) is κ2, and after fitting, V c (k) and V c The arc length between (k+1) is L, the rate of curvature increase is γ, and V c The total arc length after fitting between (k), Z(1) is called L1, Z(1), V c The total arc length after fitting between (k+1) is called L2, the curvature at z(1) is κ1, and the direction at Z(1) is represented by θ. Z (1) Let V c (k+1)-V c (k)=L0e iψ When |θ M (k)-θ M When (k+1)|>π, then we have If 0<|θ M (k)-θ M (k+1) | Arc length L is represented as The choice of k1 and k2 ensures that L1 and L2 are the smallest positive numbers.
2. The curve segmentation fitting method according to claim 1, characterized in that, The image preprocessing includes the following: Convert the image to grayscale (I); Coarse edge localization: A combination of Gabor operators is used to coarsely localize the edges of the grayscale image I, yielding the coarse localization result M(x,y) and the angle θ. M ; Subpixel localization: Subpixel edges are calculated using Zernike moments to obtain fine-grained results M(xx,yy); Contour extraction: Extract contours based on the eight-neighbor information of a pixel.
3. The curve piecewise fitting method according to claim 1, characterized in that, Based on the contour data, a contour segmentation algorithm according to the DCE evaluation standard is performed to obtain a list of segmentation points, specifically: Calculate the contribution rate K of each vertex in the contour; After removing the vertex with the lowest contribution rate, we obtain the segmentation point list V. c .
4. The curve piecewise fitting method according to claim 1, characterized in that, When the curve is a straight line, the fitting result is: κ0=κ2=0 L = L0.
5. The curve segmentation fitting method according to claim 1, characterized in that, When the curve is an arc, the fitting result is as follows:
6. The curve piecewise fitting method according to claim 1, characterized in that, The expression for the curve arc length s parameter is as follows: When 0 ≤ s ≤ L1: When L1≤s≤L1+L2: Complete the curve fitting.
7. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the curve segmentation fitting method according to any one of claims 1-6.
8. A device, characterized in that, Includes a memory, a processor, and a curve segmentation fitting method as described in any one of claims 1-6, stored in the memory and capable of running on the processor.
Citation Information
Patent Citations
Image processing method and apparatus
CN106651907A
Motion track reconstruction method and device, storage medium and electronic device
CN110160541A