Array positioning method and device based on minimum error, storage medium and program product

By adopting a method based on the minimum error in the array positioning technology to build grid sets and coordinate systems, the stability problem of array point recognition in strong interference scenarios is solved, and high-precision and adaptive array positioning are achieved.

CN120031983AActive Publication Date: 2025-05-23NANJING MUMUSILI TECH CO LTD +2
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510105252.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-05-23
Estimated Expiration
2045-01-23

AI Technical Summary

Technical Problem

Existing array positioning technologies are difficult to stably identify array points in strong interference scenarios, especially when there are missing points or uneven light noise, they often cannot correctly identify or need to adjust parameters.

Method used

The array positioning method based on the minimum error is adopted, and the array foreground and background are separated by preprocessing images, the minimum external rectangle and grid set is constructed, and the coordinate system is constructed by combining vectors and vertical vectors. The grid set is traversed to solve the grid with the smallest error value to achieve array positioning.

Benefits of technology

Steady identification of array points in strong interference scenarios improves the stability and accuracy of array recognition, reduces dependence on parameters, and enhances adaptability and universality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120031983A_ABST
    Figure CN120031983A_ABST
Patent Text Reader

Abstract

The invention discloses an array positioning method and device based on a minimum error, a storage medium and a program product, and the method comprises the following steps: carrying out the preprocessing of an input image, achieving the separation of a foreground and a background through bilateral filtering denoising and Otsu method segmentation, and extracting the geometric features of a region through the analysis of a connected domain; constructing a minimum enclosing rectangle of each region, and screening candidate regions based on normal distribution; calculating a vector set among the central points of the candidate areas, and generating effective direction vectors through angle screening; anticlockwise rotating the direction vector to generate a vertical vector, and constructing a two-dimensional grid coordinate system by using the direction vector and the vertical vector; and traversing the grid set, calculating the sum of the distances from the center point of the rectangle to the grid points as error values, and selecting the grid with the minimum error value to determine a final array point area. The method does not need hyper-parameter design, can effectively cope with missing points and noise interference, and remarkably improves the recognition precision in a complex scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of machine vision, and in particular to an array positioning method, device, storage medium and program product based on minimum error. Background Art

[0002] In the field of machine vision, many applications involve the recognition of array points. For example, the recognition of circular array calibration plates and laser-etched arrays. In the array recognition scenario, researchers have developed many algorithms. Taking calibration plate recognition as an example, the image algorithm library OpenCV uses blob analysis and feature analysis algorithms to identify arrays in most scenarios. The basic principle is to find and sort the arrays according to the direction vector clustering of the neighborhood area and the longest path to complete the array positioning. However, its anti-interference ability is weak, and it is difficult to meet the recognition scenarios of complex arrays. When there are missing points in the array, or the regional noise is relatively large due to uneven lighting, the algorithm often fails to recognize correctly or needs to adjust parameters to correctly recognize. Summary of the invention

[0003] Technical purpose: In view of the shortcomings of existing array positioning technology, the present invention discloses an array positioning method, device, storage medium and program product based on minimum error, which can stably identify array points in strong interference scenarios.

[0004] Technical solution: To achieve the above technical objectives, the present invention adopts the following technical solution:

[0005] An array positioning method based on minimum error comprises the following steps:

[0006] Preprocess the input image, separate the array foreground area from the background area, and number each area using connected domain analysis;

[0007] Based on the results of connected domain analysis, the minimum bounding rectangle of each area is constructed, and the center point and length and width feature information of the minimum bounding rectangle are extracted;

[0008] Perform statistical analysis on the minimum circumscribed rectangle and select rectangles with areas within a preset range as candidate areas;

[0009] Calculate the nearest candidate area to each candidate area to form a vector set, and generate a direction vector set based on angle screening;

[0010] Create a vertical vector set of the direction vector set, build a coordinate system with the direction vector and the vertical vector as coordinate axes, and generate a grid set;

[0011] Traverse the grid set, take the sum of the distances from the center points of each rectangle to the corresponding grid points as the error value, and solve the grid with the smallest error value to achieve array positioning.

[0012] Preferably, preprocessing the input image includes denoising using a bilateral filter, the calculation formula of which is:

[0013]

[0014] Among them, (k, l) is the coordinate of the center point in the template window, (i, j) is the coordinate of other pixels in the template window, f is the pixel gray value, w is the weighted sum of the spatial domain, parameter domain and value range parameters, and g is the filtering result.

[0015] Preferably, separating the array foreground from the background and analyzing the connected domains comprises the following steps:

[0016] The Otsu method is used to perform threshold segmentation on the denoised image to separate the foreground area and the background area;

[0017] The foreground area and background area are marked and numbered through connected domain analysis to obtain the pixel point set in each area.

[0018] Preferably, based on the extracted minimum circumscribed rectangle, rectangles with areas within a set range are screened as candidate regions, satisfying the following normal distribution model:

[0019] P(μ-σ≤X≤μ+σ)=0.6826

[0020] Among them, μ is the mean area, σ is the threshold for setting the minimum circumscribed rectangle area, and X represents the area of ​​the current rectangle.

[0021] Preferably, calculating the nearest candidate area to each candidate area to form a vector set, and generating a direction vector set based on angle screening includes the following steps:

[0022] Determine the center point of the minimum circumscribed rectangle of each selected area;

[0023] For each center point, calculate the distance to the center points of other candidate areas in turn, and select the center point with the closest distance;

[0024] The candidate area corresponding to the center point and the candidate area corresponding to the nearest center point form a rectangular pair, and the vector set is calculated based on the rectangular pair Each vector is defined by:

[0025]

[0026] Among them, p o and p q are the center points of the two rectangles in the rectangular pair respectively;

[0027] Calculate the angle between each vector in the vector set V and the horizontal unit vector. The calculation formula is as follows:

[0028]

[0029] in, is a vector in the vector set V, is the horizontal unit vector, θ is a vector With the horizontal unit vector The angle of

[0030] The vector set V is screened by the filter function to remove abnormal vectors whose angles do not meet the conditions, and the direction vector set is obtained.

[0031] Preferably, creating a vertical vector set of the direction vector set, constructing a coordinate system with the direction vector and the vertical vector as coordinate axes, and generating a grid set comprises the following steps:

[0032] For each direction vector in the direction vector set A Generate its vertical vector set by rotating 90° The direction vector Vertical vector

[0033] For each pair of direction vectors and its corresponding vertical vector As the coordinate axis, construct a two-dimensional coordinate system;

[0034] In each coordinate system, starting from the origin, the direction vector and perpendicular vector The modulus length is the step length, and the array grid g covering the entire image is generated in sequence r ;

[0035] Iterate over all direction vectors and its corresponding vertical vector The generated array grid g r , each group of array grids g r Merge to generate a grid set G = {g 1 , g 2 , …, g r}.

[0036] Preferably, traversing the grid set, taking the sum of the distances from the center points of each rectangle to the corresponding grid point as the error value, and solving the grid with the minimum error value comprises the following steps:

[0037] Traverse each array grid g in the grid set G r , calculate the distance between it and the corresponding rectangle center point;

[0038] Define the error function E r It represents the sum of the distances between all grid points in an array grid and the corresponding rectangular center point. The calculation formula is:

[0039]

[0040] Among them, (u r , v r ) is the coordinate of the grid point in the array grid, (u′ r , v′ r ) is the coordinate of the center point of the rectangle corresponding to the array grid, N is the number of grid points in the array grid, E r is the error value of the current array grid;

[0041] For all array grids g in the grid set G r The error value E r After comparison, the array grid with the smallest error value is selected as the final array grid;

[0042] The final array point area is determined by the area covered by the array grid points to complete the array positioning.

[0043] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the array positioning method based on minimum error as described above is implemented.

[0044] The present invention also provides a storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the array positioning method based on minimum error as described above.

[0045] The present invention also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the array positioning method based on minimum error as described above.

[0046] Beneficial effects: The array positioning method, device, storage medium and program product based on minimum error provided by the present invention have the following beneficial effects:

[0047] 1. The present invention eliminates abnormal noise areas by screening the minimum circumscribed rectangular candidate areas within a set range, combined with the angle screening of the vector set, and optimizes the array positioning through the remaining effective areas in the grid set. Even when there are missing points in the array diagram or the regional noise is large due to uneven illumination, the effective array points can still be accurately identified, thereby improving the stability of array recognition in strong interference scenarios; and by constructing a grid set and adopting an error minimization strategy, the dependence on parameters (such as neighborhood size, threshold range, etc.) in traditional algorithms is avoided, and array detection in different scenarios can be achieved without manually adjusting parameters, thereby reducing the difficulty of using the algorithm and enhancing adaptability.

[0048] 2. The present invention optimizes the selection of all grids by calculating the distance between the grid point and the center point of the rectangle as the error value, ensuring that the grid point area with the smallest error value covers the actual array point area, effectively reducing the positioning error caused by noise or local offset, and significantly improving the detection and positioning accuracy of the array points.

[0049] 3. The present invention constructs a grid coordinate system through a vector set and a vertical vector set, thereby realizing a unified description and positioning of different array shapes (such as a regular rectangular array, a partially missing array, etc.). It is applicable to a variety of scenarios (such as a circular calibration plate, a laser-etched array), and has low requirements on the array shape, thereby improving the versatility and practical application scope of the method. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0051] Figure 1 is a flow chart of the array positioning method of the present invention;

[0052] Figure 2 is a schematic diagram of inputting an image in an embodiment of the present invention;

[0053] Figure 3 is a schematic diagram of an array after the foreground area and the background area are separated in an embodiment of the present invention;

[0054] Figure 4 A schematic diagram of a normal distribution that is set when selecting a region to be selected from a minimum circumscribed rectangle in an embodiment of the present invention;

[0055] Figure 5 Schematic diagram of the nearest rectangular center point of the selected area in an embodiment of the present invention;

[0056] Figure 6 A schematic diagram of generating an array grid in an embodiment of the present invention. DETAILED DESCRIPTION

[0057] The present invention will be described more clearly and completely below by way of a preferred embodiment in conjunction with the accompanying drawings, but the present invention is not limited to the scope of the embodiment.

[0058] like Figure 1 As shown, an array positioning method based on minimum error includes the following steps:

[0059] S1. Preprocess the input image, separate the array foreground area from the background area, and number each area using connected domain analysis.

[0060] The imaging process of the camera will be affected by random noise, which is reflected in the image as the gray value of the pixel superimposed with the noise component. When segmenting the image, the interference of noise will lead to poor segmentation effect. Therefore, the image needs to be filtered before segmentation.

[0061] The present invention uses a bilateral filter to denoise the image, which can better protect high-frequency details while removing noise. The specific calculation process is as follows:

[0062] Solve for the kernel in the spatial domain:

[0063]

[0064] Solve for the range kernel:

[0065]

[0066] Multiply the spatial domain kernel by the range kernel:

[0067]

[0068] The bilateral filter is then expressed as:

[0069]

[0070] Among them, (k, l) is the coordinate of the center point in the template window, (i, j) is the coordinate of other pixels in the template window, σ d and σ r is the preset standard deviation parameter, f is the pixel gray value, w d is the spatial domain parameter, w r is the range parameter, w is the weighted sum of the spatial domain, parameter domain and range parameter, and g is the filtering result.

[0071] Separating array foreground from background and connected domain analysis includes the following steps:

[0072] S11. Use Otsu's method to perform threshold segmentation on the denoised image to separate the foreground area and the background area. Figure 2 and Figure 3The following are the input image and the schematic diagram of the foreground and background regions. Otsu's method is a global value segmentation method based on the principle of maximum inter-class variance. It analyzes the grayscale histogram of the image and automatically determines an optimal threshold to divide the image into foreground and background. The purpose is to maximize the inter-class variance between the foreground and background, thereby optimizing the classification effect.

[0073] S12. Mark and number the foreground area and the background area through connected domain analysis to obtain a pixel point set in each area.

[0074] S2. Based on the results of the connected domain analysis, the minimum bounding rectangle of each area is constructed, and the center point and length and width feature information of the minimum bounding rectangle are extracted.

[0075] S3. Perform statistical analysis on the minimum circumscribed rectangle and select a rectangle whose area is within a preset range as a candidate area.

[0076] In the previous steps, the foreground area and the background area have been separated, and the area numbers and the minimum bounding rectangles have been obtained. The area contains the real feature area and the interference area, so the interference area needs to be removed. We believe that the interference rectangle and the real feature rectangle mathematically satisfy the normal distribution characteristics, so the rectangle within the area range of σ is selected as the candidate rectangle. Figure 4 As shown, a rectangle with an area within σ is selected as a candidate rectangle (that is, the area within the middle 0.6826 range is selected). That is, based on the extracted minimum circumscribed rectangle, a rectangle with an area within the set range σ is selected as a candidate area, which satisfies the following normal distribution model:

[0077] P(μ-σ≤X≤μ+σ)=0.6826

[0078] Among them, μ is the mean area, σ is the threshold for setting the minimum circumscribed rectangle area, and X represents the area of ​​the current rectangle.

[0079] S4, calculating the nearest candidate area to each candidate area to form a vector set, and generating a direction vector set based on angle screening, specifically including the following steps:

[0080] S41, determining the center point position of the minimum circumscribed rectangle of each to-be-selected area;

[0081] S42, for each center point, calculate the distance from it to the center points of other candidate areas in turn, and select the center point with the closest distance;

[0082] S43, forming a rectangular pair with the candidate area corresponding to the center point and the candidate area corresponding to the nearest center point, and calculating a vector set based on the rectangular pair Each vector is defined by:

[0083]

[0084] Among them, p o and p q are the center points of the two rectangles in the rectangular pair respectively;

[0085] like Figure 5 As shown, point P 1 With point P 2 Construct a rectangular pair, point P 3 With point P 4 To form a rectangular pair, the vector vector Get all matrix pairs of candidate matrices and form a vector set V.

[0086] S44. Calculate the angle between each vector in the vector set V and the horizontal unit vector. The calculation formula is as follows:

[0087]

[0088] in, is a vector in the vector set V, is the horizontal unit vector, θ is a vector With the horizontal unit vector The angle of

[0089] Here, an angle filter is used to filter the vector set, which can reduce computing resource consumption and reduce abnormal interference.

[0090] S45. Filter the vector set V through the filter function to remove abnormal vectors whose angles do not meet the conditions, and obtain the direction vector set The specific calculation formula is:

[0091] A=F(V)

[0092] Among them, F is a filter. When the angle of the element in V does not meet the requirements, it will be filtered.

[0093] S5. Create a vertical vector set of the direction vector set, construct a coordinate system with the direction vector and the vertical vector as coordinate axes, and generate a grid set, specifically including the following steps:

[0094] S51, for each direction vector in the direction vector set A Generate its vertical vector set by rotating 90° The direction vector Vertical vector

[0095] S52, with each pair of direction vectors and its corresponding vertical vector As the coordinate axis, construct a two-dimensional coordinate system;

[0096] S53. In each coordinate system, starting from the origin of the coordinate system, the direction vector and perpendicular vector The modulus length is the step length, and the array grid g covering the entire image is generated in sequence r ,like Figure 6 Shown is a schematic diagram of generating an array grid;

[0097] S54, traverse all direction vectors and its corresponding vertical vector The generated array grid g r , each group of array grids g r Merge to generate a grid set G = {g 1 , g 2 , …, g r}.

[0098] S6, traversing the grid set, taking the sum of the distances from the center points of each rectangle to the corresponding grid points as the error value, solving the grid with the smallest error value to achieve array positioning, specifically including the following steps:

[0099] S61, traverse each array grid g in the grid set G r , calculate the distance between it and the corresponding rectangle center point;

[0100] S62. Define error function E r It represents the sum of the distances between all grid points in an array grid and the corresponding rectangular center point. The calculation formula is:

[0101]

[0102] Among them, (u r , v r ) is the coordinate of the grid point in the array grid, (u′ r , v′ r ) is the coordinate of the center point of the rectangle corresponding to the array grid, N is the number of grid points in the array grid, E r is the error value of the current array grid;

[0103] S63, for all array grids g in the grid set G r The error value E r After comparison, the array grid with the smallest error value is selected as the final array grid;

[0104] S64: Determine the final array point area based on the area covered by the array grid points to complete array positioning.

[0105] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the array positioning method based on minimum error as described above when executing the program. The memory may be various types of memory, such as random access memory, read-only memory, flash memory, etc. The processor may be various types of processors, such as a central processing unit, a microprocessor, a digital signal processor, or an image processor, etc.

[0106] The present invention also provides a storage medium storing computer executable instructions for executing the array positioning method based on minimum error as described above. The storage medium includes: a U disk, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk, and other media that can store program codes.

[0107] The present invention also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the array positioning method based on minimum error as described above, wherein the computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable devices.

[0108] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. An array positioning method based on minimum error, characterized in that: The following steps are involved: Preprocess the input image, separate the array foreground area from the background area, and number each area using connected domain analysis; Based on the results of connected domain analysis, the minimum bounding rectangle of each area is constructed, and the center point and length and width feature information of the minimum bounding rectangle are extracted; Perform statistical analysis on the minimum circumscribed rectangle and select rectangles with areas within a preset range as candidate areas; Calculate the nearest candidate area to each candidate area to form a vector set, and generate a direction vector set based on angle screening; Create a vertical vector set of the direction vector set, build a coordinate system with the direction vector and the vertical vector as coordinate axes, and generate a grid set; Traverse the grid set, take the sum of the distances from the center points of each rectangle to the corresponding grid points as the error value, and solve the grid with the smallest error value to achieve array positioning.

2. The array positioning method based on minimum error according to claim 1, characterized in that: The preprocessing of the input image includes denoising using a bilateral filter, the calculation formula of which is: Among them, (k, l) is the coordinate of the center point in the template window, (i, j) is the coordinate of other pixels in the template window, f is the pixel gray value, w is the weighted sum of the spatial domain, parameter domain and value range parameters, and g is the filtering result.

3. The array positioning method based on minimum error according to claim 1, characterized in that: Separating array foreground from background and connected domain analysis includes the following steps: The Otsu method is used to perform threshold segmentation on the denoised image to separate the foreground area and the background area; The foreground area and background area are marked and numbered through connected domain analysis to obtain the pixel point set in each area.

4. The array positioning method based on minimum error according to claim 1, characterized in that: Based on the extracted minimum bounding rectangle, rectangles with an area within the set range are selected as candidate regions, satisfying the following normal distribution model: P(μ-σ≤X≤μ+σ)=0.6826 Among them, μ is the mean area, σ is the threshold for setting the minimum circumscribed rectangle area, and W represents the area of ​​the current rectangle.

5. The array positioning method based on minimum error according to claim 1, characterized in that: Calculating the nearest candidate area to each candidate area to form a vector set, and generating a direction vector set based on angle screening includes the following steps: Determine the center point of the minimum circumscribed rectangle of each selected area; For each center point, calculate the distance to the center points of other candidate areas in turn, and select the center point with the closest distance; The candidate area corresponding to the center point and the candidate area corresponding to the nearest center point form a rectangular pair, and the vector set is calculated based on the rectangular pair Each vector is defined by: Among them, p o and p q are the center points of the two rectangles in the rectangular pair respectively; Calculate the angle between each vector in the vector set V and the horizontal unit vector. The calculation formula is as follows: in, is a vector in the vector set V, is the horizontal unit vector, θ is a vector With the horizontal unit vector The angle of The vector set V is screened by the filter function to remove abnormal vectors whose angles do not meet the conditions, and the direction vector set is obtained.

6. The array positioning method based on minimum error according to claim 1, characterized in that: Create a vertical vector set of the direction vector set, build a coordinate system with the direction vector and the vertical vector as coordinate axes, and generate a grid set including the following steps: For each direction vector in the direction vector set A Generate its vertical vector set by rotating 90° The direction vector Vertical vector For each pair of direction vectors a r and its corresponding vertical vector As the coordinate axis, construct a two-dimensional coordinate system; In each coordinate system, starting from the origin, the direction vector and perpendicular vector The modulus length is the step length, and the array grid g covering the entire image is generated in sequence r ; Iterate over all direction vectors and its corresponding vertical vector The generated array grid g r , each group of array grids g r Merge to generate a grid set G = {g1, g2, ..., g r }.

7. The array positioning method based on minimum error according to claim 1, characterized in that: Traversing the grid set, taking the sum of the distances from the center points of each rectangle to the corresponding grid points as the error value, solving the grid with the minimum error value includes the following steps: Traverse each array grid g in the grid set G r , calculate the distance between it and the corresponding rectangle center point; Define the error function E r It represents the sum of the distances between all grid points in an array grid and the corresponding rectangular center point. The calculation formula is: Among them, (u r ,v r ) is the coordinate of the grid point in the array grid, (u' r ,v' r ) is the coordinate of the center point of the rectangle corresponding to the array grid, N is the number of grid points in the array grid, E r is the error value of the current array grid; For all array grids g in the grid set G r The error value E r After comparison, the array grid with the smallest error value is selected as the final array grid; The final array point area is determined by the area covered by the array grid points to complete the array positioning.

8. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, an array positioning method based on minimum error as described in any one of claims 1 to 7 is implemented.

9. A storage medium, characterized in that: Computer executable instructions are stored, and the computer executable instructions are used to execute an array positioning method based on minimum error as described in any one of claims 1-7.

10. A computer program product comprising instructions, characterized in that When the instructions are executed on a computer, the computer is caused to execute an array positioning method based on minimum error as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Infrared photovoltaic array segmentation method based on threshold segmentation and K-means clustering

    CN109308685A

  • Intelligent file management system based on OCR (Optical Character Recognition)

    CN115995080A

  • Sobel filtering-based detection method for reading optical storage dot matrix

    CN116452433A

  • Image matching positioning core area automatic extraction method, device, equipment and medium

    CN116543144A

  • Spatial positioning method for multiple circular targets based on binocular vision

    CN118052883A