An array positioning method, device, storage medium, and program product based on minimum error.

By employing connected component analysis and error minimization strategies, the problems of recognition stability and accuracy in complex scenarios of array positioning technology were solved, enabling array point recognition and positioning under strong interference conditions.

CN120031983BActive Publication Date: 2025-10-31NANJING MUMUSILI TECH CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing array positioning technology has weak anti-interference ability in complex scenarios and is difficult to correctly identify array points, especially when there are missing points or uneven lighting, which can easily lead to identification errors.

Method used

The foreground and background regions are separated by connected component analysis, the minimum bounding rectangle is constructed and rectangles with areas within a set range are selected, a set of direction vectors is generated and a grid set is constructed, and array positioning is performed using an error minimization strategy.

Benefits of technology

It can stably identify array points in strong interference scenarios, improve recognition stability and accuracy, reduce the difficulty of using the algorithm, enhance adaptability and versatility, and is applicable to various array shapes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120031983B_ABST
    Figure CN120031983B_ABST
Patent Text Reader

Abstract

This invention discloses an array localization method, device, storage medium, and program product based on minimum error. The method includes the following steps: preprocessing the input image, separating the foreground and background through bilateral filtering for noise reduction and Otsu's method segmentation, and extracting regional geometric features using connected component analysis; constructing the minimum bounding rectangle of each region and filtering candidate regions based on a normal distribution; calculating the vector set between the center points of the candidate regions, and generating effective direction vectors through angle filtering; rotating the direction vectors counterclockwise to generate perpendicular vectors, and constructing a two-dimensional grid coordinate system using the direction vectors and perpendicular vectors; traversing the grid set, calculating the sum of the distances from the center point of the rectangle to the grid points as the error value, and selecting the grid with the smallest error value to determine the final array point region. This invention does not require hyperparameter design, can effectively cope with missing points and noise interference, and significantly improves the recognition accuracy in complex scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine vision technology, and specifically to an array positioning method, device, storage medium, and program product based on minimum error. Background Technology

[0002] In the field of machine vision, numerous applications involve the recognition of array points. Examples include the recognition of circular array calibration boards and laser-etched arrays. Researchers have developed many algorithms for array recognition. Taking calibration board recognition as an example, the OpenCV image algorithm library uses blob analysis and feature analysis algorithms, which can recognize arrays in most scenarios. Its basic principle is to locate the array by clustering the direction vectors of neighboring regions and finding the longest path to locate the array. However, its anti-interference ability is weak, making it difficult to meet the recognition requirements of complex arrays. When there are missing points in the array, or when uneven lighting causes significant regional noise, this algorithm often fails to recognize points correctly or requires parameter adjustments to achieve correct recognition. Summary of the Invention

[0003] Technical objective: To address the shortcomings of existing array positioning technologies, this 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 includes the following steps:

[0006] The input image is preprocessed to separate the foreground and background regions of the array, and each region is numbered using connected component analysis.

[0007] Based on the results of connected component analysis, the minimum bounding rectangle of each region 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 bounding rectangle and select rectangles with areas within a preset range as candidate regions.

[0009] Calculate the nearest candidate region for each candidate region, form a vector set, and generate a direction vector set based on angle filtering;

[0010] Create a set of perpendicular vectors from the set of direction vectors, construct a coordinate system with the direction vectors and perpendicular vectors as coordinate axes, and generate a mesh set;

[0011] Traverse the grid set, using the sum of the distances from the center point of each rectangle to the corresponding grid point as the error value, and solve for 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] Where (k, l) are the coordinates of the center point in the template window, (i, j) are the coordinates 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 domain parameters, and g is the filtering result.

[0015] Preferably, separating the array foreground from the background and performing connected component analysis includes the following steps:

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

[0017] The foreground and background regions are labeled and numbered through connected component analysis to obtain the set of pixels in each region.

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

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

[0020] Where μ is the mean area, σ is the minimum bounding rectangle area threshold, and X represents the area of ​​the current rectangle.

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

[0022] Determine the center point of the smallest bounding rectangle for each candidate region;

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

[0024] Form a rectangle pair between the candidate region corresponding to the center point and the candidate region corresponding to the nearest center point, and calculate the vector set based on the rectangle pair. Each vector is defined by the following formula:

[0025]

[0026] Where, p o and p q These are the center points of the two rectangles in the rectangle pair;

[0027] The angle between each vector in the vector set V and the horizontal unit vector is calculated using the following formula:

[0028]

[0029] in, For each vector in the vector set V, It is a horizontal unit vector. θ is a vector With horizontal unit vector The included angle;

[0030] The vector set V is filtered using a filter function to remove outlier vectors whose included angles do not meet the conditions, resulting in a set of direction vectors.

[0031] Preferably, creating a set of perpendicular vectors from the set of direction vectors, constructing a coordinate system with the direction vectors and perpendicular vectors as coordinate axes, and generating a mesh set includes the following steps:

[0032] For each direction vector in the set A of direction vectors Generate its set of perpendicular vectors by rotating it by 90°. Where the direction vector perpendicular vector

[0033] With each pair of direction vectors and its corresponding perpendicular vector Construct a two-dimensional coordinate system using the coordinate axes;

[0034] In each coordinate system, the direction vector starts from the origin. and perpendicular vector The modulus is the step size, and an array grid g covering the entire image is generated sequentially. r ;

[0035] Traverse all direction vectors and its corresponding perpendicular vector The generated array mesh g r , and each group of array mesh g r Merge to generate a mesh set G = {g1, g2, ..., g} r}

[0036] Preferably, traversing the grid set and using the sum of the distances from the center point of each rectangle to the corresponding grid point as the error value, the solution for the grid with the smallest error value includes the following steps:

[0037] Iterate through each array grid g in the grid set G. r Calculate the distance between it and the center point of the corresponding rectangle;

[0038] Define the error function E r This represents the sum of distances between all grid points within an array and the center point of their corresponding rectangles. The formula for calculating this sum is:

[0039]

[0040] Among them, (u r v r ) represents the coordinates of a grid point in the array grid, (u′) r , v′ r ) represents the coordinates of the center point of the rectangle corresponding to the array grid, N is the number of grid points in the array grid, and E r This represents the error value of the current array grid.

[0041] For all array grids g in grid set G r Error value E r The comparisons are made, and the array grid with the smallest error value is selected as the final array grid.

[0042] The final array point region is determined by the area covered by the array grid points, thus completing the array positioning.

[0043] 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 executes the program to implement an array positioning method based on minimum error as described above.

[0044] The present invention also provides a storage medium storing computer-executable instructions for executing an array positioning method based on minimum error as described above.

[0045] The present invention also provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform an 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 this invention have the following beneficial effects:

[0047] 1. This invention filters candidate regions with the smallest bounding rectangles within a set area, and combines this with angle filtering of the vector set to eliminate abnormal noise regions. It also optimizes array positioning in the grid set by using the remaining effective regions. Even when there are missing points in the array image or the noise in the region is large due to uneven lighting, it can still accurately identify effective array points, improving the stability of array recognition in strong interference scenarios. Furthermore, by constructing a grid set and adopting an error minimization strategy, it avoids the dependence on parameters (such as neighborhood size, threshold range, etc.) in traditional algorithms. Array detection in different scenarios can be achieved without manually adjusting parameters, reducing the difficulty of using the algorithm and enhancing its adaptability.

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

[0049] 3. This invention constructs a grid coordinate system by using vector sets and perpendicular vector sets, which enables unified description and positioning of different array shapes (such as regular rectangular arrays, partially missing arrays, etc.). It is applicable to various scenarios (such as circular calibration plates, laser etching arrays), and has low requirements for array shape, thus improving the versatility and practical application range of the method. Attached Figure Description

[0050] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.

[0051] Figure 1 This is a flowchart of the array positioning method of the present invention;

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

[0053] Figure 3 This is a schematic diagram showing the separation of the array foreground and background regions in an embodiment of the present invention;

[0054] Figure 4 This is a schematic diagram illustrating the normal distribution of the area set when filtering candidate regions from the smallest bounding rectangle in an embodiment of the present invention;

[0055] Figure 5 This is a schematic diagram of the center point of the nearest rectangle in the candidate area in an embodiment of the present invention;

[0056] Figure 6 This is a schematic diagram of generating an array mesh in an embodiment of the present invention. Detailed Implementation

[0057] The present invention will now be described more clearly and completely by way of a preferred embodiment in conjunction with the accompanying drawings, but this does not limit the invention to the scope of the described 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 to separate the foreground and background regions of the array, and number each region using connected component analysis.

[0060] The imaging process of a camera is affected by random noise, which manifests as noise components superimposed on the grayscale values ​​of pixels in the image. During image segmentation, noise interference leads to poor segmentation results. Therefore, image filtering is necessary before segmentation.

[0061] This invention uses a bilateral filter to denoise images, which effectively preserves high-frequency details while removing noise. The specific calculation process is as follows:

[0062] Solving for the spatial domain kernel:

[0063]

[0064] Solve for the range kernel:

[0065]

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

[0067]

[0068] Therefore, the bilateral filter can be expressed as:

[0069]

[0070] Where (k,l) are the coordinates of the center point in the template window, (i,j) are the coordinates of other pixels in the template window, and σ d and σ r Here, f is the preset standard deviation parameter, and w is the pixel grayscale value. d For spatial domain parameters, w r is the range parameter, w is the weighted sum of the spatial domain, parameter domain, and range parameters, and g is the filtering result.

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

[0072] S11. Using Otsu's method, threshold segmentation is performed on the denoised image to separate the foreground and background regions, such as... Figure 2 and Figure 3The images shown are the original input image and a schematic diagram showing the foreground and background regions. Otsu's method is a global value segmentation method based on the principle of maximizing inter-class variance. It analyzes the grayscale histogram of the image to automatically determine an optimal threshold and divide the image into foreground and background. The goal is to maximize the inter-class variance between the foreground and background, thereby achieving the best classification effect.

[0073] S12. The foreground and background regions are marked and numbered through connected component analysis to obtain the pixel set in each region.

[0074] S2. Based on the results of connected component analysis, construct the minimum bounding rectangle for each region, and extract the center point and length and width features of the minimum bounding rectangle.

[0075] S3. Perform statistical analysis on the smallest bounding rectangle and select rectangles with areas within a preset range as candidate areas.

[0076] In the preceding steps, the foreground and background regions have been separated, and the region numbers and minimum bounding rectangles of each region have been obtained. These regions include both true feature regions and interference regions; therefore, the interference regions need to be removed. We assume that the interference rectangles and the true feature rectangles mathematically satisfy a normal distribution; therefore, rectangles within the area range of σ are selected as candidate rectangles. For example... Figure 4 As shown, rectangles with an area within σ are selected as candidate rectangles (i.e., the region within the middle 0.6826 range is selected). This means 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:

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

[0078] Where μ is the mean area, σ is the minimum bounding rectangle area threshold, and X represents the area of ​​the current rectangle.

[0079] S4. Calculate the nearest candidate region for each candidate region, form a vector set, and generate a direction vector set based on angle filtering. This includes the following steps:

[0080] S41. Determine the center point of the smallest bounding rectangle of each candidate region;

[0081] S42. For each center point, calculate its distance to the center points of other candidate areas in turn, and select the center point with the closest distance.

[0082] S43. Form a rectangular pair between the candidate region corresponding to the center point and the candidate region corresponding to the nearest center point, and calculate the vector set based on the rectangular pair. Each vector is defined by the following formula:

[0083]

[0084] Where, p o and p q These are the center points of the two rectangles in the rectangle pair;

[0085] like Figure 5 As shown, points P1 and P2 form a pair of rectangles, and points P3 and P4 form a pair of rectangles. Then the vector... vector Obtain the matrix pairs of all 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, For each vector in the vector set V, A horizontal unit vector, θ is a vector With horizontal unit vector The included angle;

[0089] An angle filter is used here to filter the vector set, which can reduce computational resource consumption and reduce abnormal interference.

[0090] S45. Filter the vector set V using a filter function to remove abnormal vectors whose included angles do not meet the conditions, thus obtaining the direction vector set. The specific calculation formula is as follows:

[0091] A = F(V)

[0092] Where F is a filter, and elements in V whose angles do not meet the requirements will be filtered out.

[0093] S5. Create a set of perpendicular vectors to the set of direction vectors, construct a coordinate system using the direction vectors and perpendicular vectors as coordinate axes, and generate a mesh set. This includes the following steps:

[0094] S51. For each direction vector in the set of direction vectors A Generate its set of perpendicular vectors by rotating it by 90°. Where the direction vector perpendicular vector

[0095] S52, with each pair of direction vectors and its corresponding perpendicular vector Construct a two-dimensional coordinate system using the coordinate axes;

[0096] S53. In each coordinate system, with the origin as the starting point, the direction vector... and perpendicular vector The modulus is the step size, and an array grid g covering the entire image is generated sequentially. r ,like Figure 6 The diagram shown illustrates the generation of the array mesh.

[0097] S54, Traverse all direction vectors and its corresponding perpendicular vector The generated array mesh g r , and each group of array mesh g r Merge to generate a mesh set G = {g1, g2, ..., g} r}

[0098] S6. Traverse the grid set, using the sum of the distances from the center point of each rectangle to the corresponding grid point as the error value, and find the grid with the smallest error value to achieve array positioning. This includes the following steps:

[0099] S61. Traverse each array grid g in the grid set G. r Calculate the distance between it and the center point of the corresponding rectangle;

[0100] S62. Define the error function E r This represents the sum of distances between all grid points within an array and the center point of their corresponding rectangles. The formula for calculating this sum is:

[0101]

[0102] Among them, (u r v r ) represents the coordinates of a grid point in the array grid, (u′) r , v′ r ) represents the coordinates of the center point of the rectangle corresponding to the array grid, N is the number of grid points in the array grid, and E r This represents the error value of the current array grid.

[0103] S63. For all array grids g in grid set G. r Error value E r The comparisons are made, and the array grid with the smallest error value is selected as the final array grid.

[0104] S64. Determine the final array point region 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 on the memory and executable on the processor. When the processor executes the program, it implements an array positioning method based on minimum error as described above. The memory can be of various types, such as random access memory, read-only memory, flash memory, etc. The processor can be of various types, such as a central processing unit, microprocessor, digital signal processor, or 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 various media capable of storing program code, such as a USB flash drive, portable hard drive, ROM, RAM, magnetic disk, or optical disk.

[0107] The present invention also provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform an array positioning method based on minimum error as described above. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.

[0108] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. An array positioning method based on minimum error, characterized in that, Includes the following steps: The input image is preprocessed to separate the foreground and background regions of the array, and each region is numbered using connected component analysis. Based on the results of connected component analysis, the minimum bounding rectangle of each region 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 bounding rectangle and select rectangles with areas within a preset range as candidate regions. Calculate the nearest candidate region for each candidate region, form a vector set, and generate a direction vector set based on angle filtering; Create a set of perpendicular vectors from the set of direction vectors, construct a coordinate system with the direction vectors and perpendicular vectors as coordinate axes, and generate a mesh set; Traverse the grid set, using the sum of the distances from the center point of each rectangle to the corresponding grid point as the error value, and solve for the grid with the smallest error value to achieve array positioning; The process of calculating the nearest candidate region to each candidate region, forming a vector set, and generating a direction vector set based on angle filtering includes the following steps: Determine the center point of the smallest bounding rectangle for each candidate region; For each center point, calculate its distance to the center points of other candidate areas in turn, and select the center point with the closest distance; Form a rectangle pair between the candidate region corresponding to the center point and the candidate region corresponding to the nearest center point, and calculate the vector set based on the rectangle pair. Each vector is defined by the following formula: Where, p o and p q These are the center points of the two rectangles in the rectangle pair; The angle between each vector in the vector set V and the horizontal unit vector is calculated using the following formula: in, For each vector in the vector set V, It is a horizontal unit vector. θ is a vector With horizontal unit vector The included angle; The vector set V is filtered using a filter function to remove outlier vectors whose included angles do not meet the conditions, resulting in a set of direction vectors.

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

3. The array positioning method based on minimum error according to claim 1, characterized in that, Separating the array foreground from the background and performing connected component analysis includes the following steps: The Otsu method is used to perform threshold segmentation on the denoised image to separate the foreground and background regions; The foreground and background regions are labeled and numbered through connected component analysis to obtain the set of pixels in each region.

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 areas within a set range are selected as candidate regions, satisfying the following normal distribution model: P(μ-σ≤X≤μ+σ)=0.6826 Where μ is the mean area, σ is the minimum bounding rectangle area threshold, and X represents the area of ​​the current rectangle.

5. The array positioning method based on minimum error according to claim 1, characterized in that, Creating a set of perpendicular vectors from the set of direction vectors, constructing a coordinate system with the direction vectors and perpendicular vectors as coordinate axes, and generating a mesh set includes the following steps: For each direction vector in the set A of direction vectors Generate its set of perpendicular vectors by rotating it by 90°. Where the direction vector perpendicular vector With each pair of direction vectors a r and its corresponding perpendicular vector Construct a two-dimensional coordinate system using the coordinate axes; In each coordinate system, the direction vector starts from the origin. and perpendicular vector The modulus is the step size, and an array grid g covering the entire image is generated sequentially. r ; Traverse all direction vectors and its corresponding perpendicular vector The generated array mesh g r , and each group of array mesh g r Merge to generate a mesh set G = {g1, g2, ..., g r } 6. The array positioning method based on minimum error according to claim 1, characterized in that, Traversing the mesh set and using the sum of distances from the center point of each rectangle to the corresponding grid point as the error value, the solution for the mesh with the smallest error value includes the following steps: Iterate through each array grid g in the grid set G. r Calculate the distance between it and the center point of the corresponding rectangle; Define the error function E r This represents the sum of distances between all grid points within an array and the center point of their corresponding rectangles. The formula for calculating this sum is: Among them, (u r ,v r ) represents the coordinates of a grid point in the array grid, (u' r ,v' r ) represents the coordinates of the center point of the rectangle corresponding to the array grid, N is the number of grid points in the array grid, and E r This represents the error value of the current array grid. For all array grids g in grid set G r Error value E r The comparisons are made, and the array grid with the smallest error value is selected as the final array grid. The final array point region is determined by the area covered by the array grid points, thus completing the array positioning.

7. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement an array positioning method based on minimum error as described in any one of claims 1-6.

8. A storage medium, characterized in that, The device stores computer-executable instructions for performing an array positioning method based on minimum error as described in any one of claims 1-6.

9. A computer program product containing instructions, characterized in that, When the instructions are executed on the computer, the computer performs an array positioning method based on minimum error as described in any one of claims 1-6.

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