A method, apparatus, equipment and medium for positioning crosshairs
By performing line detection and line segment fitting on the crosshair image, combined with the total length of vertical line segments and clustering methods, the problem of inaccurate crosshair positioning was solved, and accurate positioning was achieved in complex backgrounds.
Patent Information
- Application Number
- CN202610248503.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-02
- Publication Date
- 2026-11-10
- Estimated Expiration
- 2046-03-02
AI Technical Summary
In existing technologies, the location of the crosshair is difficult to accurately identify in complex backgrounds and is affected by scratches, metallic textures, etc., resulting in inaccurate positioning.
By performing line detection on the crosshair image, an initial set of line segments is determined. Line segments are then fitted and filtered. Combining the total length of vertical line segments and clustering methods, the location of the crosshair is determined.
It achieves precise positioning of the crosshair in complex backgrounds, reduces the impact of background interference, and improves positioning accuracy.
Smart Images

Figure CN122199667B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing, and in particular to a method, apparatus, device, and medium for positioning crosshairs. Background Technology
[0002] Precise positioning of crosshairs is a core aspect of industrial vision inspection, widely used in PCB board positioning, precision equipment calibration, and other scenarios. For example, in circuit board manufacturing, crosshairs serve as optical positioning marks to guide pick-and-place machines in precisely mounting chips, capacitors, and other components to designated positions; lithography machines align photomasks with wafers by recognizing crosshairs on the wafers; additionally, crosshairs are used during circuit assembly to align different circuit layers.
[0003] However, in practical applications, the location of the crosshair is difficult to accurately identify due to interference from background elements such as scratches and metallic textures.
[0004] Therefore, how to accurately determine the location of the crosshair has become a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] In view of the above-mentioned technical status, the present invention provides a method, apparatus, device and medium for positioning a crosshair, so as to accurately confirm the positioning position of the crosshair.
[0006] To achieve the above objectives, the present invention provides the following technical solution: a crosshair positioning method, comprising: performing line detection on a crosshair image to determine an initial set of line segments in the crosshair image; fitting the initial line segments of the initial set of line segments to determine a first set of fitted line segments; filtering the first set of line segments according to the total length of the vertical line segments in the first set of line segments to obtain a set of crosshair main line segments in the first set of line segments; and determining the positioning position of the crosshair based on the intersection points of the vertical line segments in the set of crosshair main line segments.
[0007] In one optional embodiment of this application, the step of performing line detection on the crosshair image to determine the initial set of line segments in the crosshair image includes: determining the gradient magnitude and gradient direction of each pixel in the crosshair image, and determining pixels with gradient magnitude greater than a preset gradient magnitude threshold as target pixels; traversing each adjacent target pixel, and determining adjacent target pixels with gradient direction differences less than a preset direction difference as line segment pixels; and determining the pixel region composed of each line segment pixel as the initial set of line segments.
[0008] In one optional embodiment of this application, fitting the initial line segments of the initial line segment set to determine the first set of fitted line segments includes: determining the endpoints of each line segment in the initial line segment set; determining the angle and distance between each line segment based on the endpoints of each line segment; selecting a set of line segments to be fitted from the initial line segment set that meet preset angle and distance thresholds based on the angle and distance between each line segment; and using the least squares method to perform line fitting on the endpoints of each set of line segments to be fitted to determine the first set of fitted line segments.
[0009] In one optional embodiment of this application, the step of using the least squares method to perform line fitting on the endpoints of each line segment to be fitted, and determining the first set of fitted line segments, includes: using the least squares method to perform a first line fitting on the endpoints of the line segment set to be fitted, to obtain a fitted set of line segments; using the least squares method to perform a second line fitting on the endpoints of the fitted set of line segments, until the number of line segments in the fitted set is equal to the number of line segments in the line segment set to be fitted, and determining the finally fitted set of line segments as the first set of line segments.
[0010] In one optional embodiment of this application, the step of filtering the first line segment set according to the total length of the vertical line segments in the first line segment set to obtain the main line segment set of the crosshair in the first line segment set includes: determining the total length of the vertical line segments in the first line segment set, and determining the vertical line segments whose total length is greater than a preset length threshold as the main line segments of the crosshair; or, determining the total length of the vertical line segments in the first line segment set; sorting the vertical line segments according to the total length of the vertical line segments, and determining the vertical line segments sorted before a preset position as the main line segments of the crosshair.
[0011] In one optional embodiment of this application, determining the location of the crosshair based on the intersection points of the vertical line segments in the crosshair body line segment set includes: performing clustering processing on the intersection points of the vertical line segments in the crosshair body line segment set using a clustering method to determine the apex position of the crosshair; and determining the location of the crosshair based on the apex position of the crosshair.
[0012] In one optional embodiment of this application, the clustering method is at least the K-means clustering method; the step of using the clustering method to cluster the intersection points of the vertical line segments in the main line segment set of the crosshair to determine the vertex position of the crosshair includes: using the K-means clustering method to cluster the intersection points of the vertical line segments in the main line segment set of the crosshair, determining the cluster of the line segment intersection points, and determining the centroid of the cluster as the vertex position of the crosshair.
[0013] Compared with the prior art, the crosshair positioning method provided by the present invention, after determining the initial set of line segments in the crosshair pattern, filters the first set of line segments by fitting line segments and combining the total length of vertical line segments to obtain the set of line segments of the crosshair body, and further combines the intersection points of the vertical line segments in the set of line segments of the crosshair body to locate the crosshair, which can accurately confirm the positioning position of the crosshair.
[0014] The present invention also provides a crosshair positioning device, comprising: A line detection unit is used to perform line detection on the crosshair image and determine the initial set of line segments in the crosshair image.
[0015] A line fitting unit is used to fit the initial line segments of the initial line segment set to determine the first line segment set after fitting.
[0016] The noise reduction processing unit is used to filter the first line segment set according to the total length of the vertical line segments in the first line segment set, and obtain the cross-shaped main line segment set in the first line segment set.
[0017] The positioning unit is used to determine the positioning position of the crosshair based on the intersection point of the vertical line segments in the set of line segments of the crosshair body.
[0018] Compared with the prior art, the beneficial effects of the printing device provided by the present invention are the same as those of the crosshair positioning method described in the above technical solution, and will not be repeated here.
[0019] The present invention also provides an electronic device, comprising: a processor; a memory for storing processor-executable instructions; the processor being configured to execute the above-described crosshair positioning method by running the instructions in the memory.
[0020] Compared with the prior art, the beneficial effects of the electronic device provided by the present invention are the same as those of the crosshair positioning method described in the above technical solution, and will not be repeated here.
[0021] The present invention also provides a computer storage medium storing instructions that, when executed, implement the above-described crosshair positioning method.
[0022] Compared with the prior art, the beneficial effects of the computer storage medium provided by the present invention are the same as those of the crosshair positioning method described in the above technical solution, and will not be repeated here. Attached Figure Description
[0023] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this invention, illustrate exemplary embodiments of the invention and are used to explain the invention, but do not constitute an undue limitation of the invention. In the drawings: Figure 1 This is a schematic diagram of the crosshair positioning method provided in the embodiments of this application.
[0024] Figure 2 This is a schematic diagram of the initial set of line segments provided in an embodiment of this application.
[0025] Figure 3 A partial schematic diagram of the crosshair image provided in the embodiments of this application. Figure 1 .
[0026] Figure 4 A partial schematic diagram of the crosshair image provided in the embodiments of this application. Figure 2 .
[0027] Figure 5 This is a structural diagram of the crosshair positioning device provided in an embodiment of this application.
[0028] Figure 6 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. Detailed Implementation
[0029] To facilitate a clear description of the technical solutions in the embodiments of the present invention, the terms "first" and "second" are used to distinguish identical or similar items with essentially the same function and effect. For example, the first threshold and the second threshold are merely used to distinguish different thresholds and do not limit their order. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that the terms "first" and "second" are not necessarily different.
[0030] It should be noted that in this invention, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in this invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0031] In this invention, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, a combination of a and b, a combination of a and c, a combination of b and c, or a, b, and c, where a, b, and c can be single or multiple.
[0032] Precise positioning of crosshairs is a core aspect of industrial vision inspection, widely used in PCB board positioning, precision equipment calibration, and other scenarios. For example, in circuit board manufacturing, crosshairs serve as optical positioning marks to guide pick-and-place machines in precisely mounting chips, capacitors, and other components to designated positions; lithography machines align photomasks with wafers by recognizing crosshairs on the wafers; additionally, crosshairs are used during circuit assembly to align different circuit layers.
[0033] However, in practical applications, the location of the crosshair is difficult to accurately identify due to interference from background elements such as scratches and metallic textures.
[0034] Therefore, how to accurately determine the location of the crosshair has become a technical problem that urgently needs to be solved by those skilled in the art.
[0035] To address the aforementioned technical problems, this application provides a method, apparatus, device, and medium for positioning a crosshair, which will be described in detail in the following embodiments.
[0036] Please refer to Figure 1 , Figure 1 This is a schematic diagram of the crosshair positioning method provided in the embodiments of this application.
[0037] like Figure 1 As shown, the crosshair positioning method includes the following steps S101 to S104.
[0038] S101, Perform line detection on the crosshair image to determine the initial set of line segments in the crosshair image.
[0039] Crosshair images are typical high-noise, low-signal-noise-ratio images in industrial settings. They are widely used in dense electronic components, circuit traces, and other industrial fields. Due to interference scratches, oil stains, and uneven lighting, crosshair images have a large amount of interference texture.
[0040] The purpose of S101 above is to obtain the line segments corresponding to the main body of the crosshair and the line segments corresponding to the interference texture in the crosshair image by performing cross detection on the crosshair image, so as to further eliminate the influence of the interference texture on the crosshair positioning through corresponding methods and achieve accurate positioning of the crosshair.
[0041] In this embodiment, the line detection of the crosshair image is achieved using a line detection algorithm based on local gradient analysis.
[0042] The Line Segment Detector (LSD) algorithm, based on local gradient analysis, analyzes the gradient features of the pixel neighborhood and aggregates adjacent pixels with the same gradient direction into a straight line region to achieve line segment detection. Even if there are breaks in the image, it can still detect independent short line segments and effectively cope with external interference.
[0043] Specifically, S101 includes: determining the gradient magnitude and gradient direction of each pixel in the crosshair image, and determining the pixel with a gradient magnitude greater than a preset gradient magnitude threshold as the target pixel; traversing each adjacent target pixel, and determining the adjacent target pixel with a gradient direction difference less than a preset direction difference as the line segment pixel; and determining the pixel region composed of each line segment pixel as the initial line segment set.
[0044] The embodiments of this application employ a line detection algorithm based on local gradient analysis, which helps to perform full detection of the line segment set in the crosshair image at the pixel level, so as to facilitate subsequent analysis of the line segments and realize the localization of the crosshair.
[0045] In one optional embodiment of this application, before performing the above S101, in order to better achieve line detection, the crosshair positioning method further includes: performing binarization processing on the crosshair image, and performing erosion and dilation on the crosshair body in the binarized crosshair image to obtain a crosshair image for line detection.
[0046] The purpose of performing binarization, erosion, and dilation on the crosshair image is to extract the main body of the crosshair in the image, so as to separate the crosshair region in the complex background and reduce the interference of the complex background to a certain extent.
[0047] Binarization refers to adaptive thresholding of the crosshair image, converting the grayscale image of the crosshair into a binary image, thereby initially separating the crosshair body from the background and highlighting the general outline of the crosshair.
[0048] Erosion and dilation are morphological operations used to eliminate minor noise in a binary image, restore the size of the crosshair, fill internal holes in the binary image, and ultimately generate a binary image that includes and highlights the crosshair's main body region.
[0049] Please refer to Figure 2 , Figure 2 This is a schematic diagram of the initial set of line segments provided in an embodiment of this application.
[0050] like Figure 2 As shown, Figure 2 The image contains multiple messy line segments and line segments corresponding to the main body of the crosshair. These line segments together form the initial line segment set mentioned in embodiment S101 of this application. During the positioning process of the crosshair, all line segments other than the main body of the crosshair are redundant. However, in actual application, the processing of the crosshair image inevitably introduces these redundant line segments.
[0051] S102, Fit the initial line segments of the initial line segment set to determine the first line segment set after fitting.
[0052] The purpose of S102 above is to reassemble the broken line segments in the initial line segment set into complete straight lines through fitting, while suppressing background interference line segments to a certain extent, so as to provide a line segment structure basis for subsequent accurate positioning.
[0053] In one optional embodiment of this application, the initial line segments of the initial line segment set are fitted to determine the first line segment combination after fitting, including the following S1021 and S1022.
[0054] S1021, Determine the endpoints of each initial line segment in the initial line segment set.
[0055] S1022, Determine the angle and distance between each line segment based on the endpoints of each line segment.
[0056] S1023, Based on the angle and distance between each line segment, select a set of line segments to be fitted from the initial set of line segments that meet the preset angle threshold and distance threshold.
[0057] S1024. Using the least squares method, straight lines are fitted to the endpoints of each set of line segments to be fitted, and the first set of line segments after fitting is determined.
[0058] For example, for any initial line segment in the initial set of line segments, its endpoints include and .in, This represents the coordinates of the first endpoint of the line segment. This indicates the coordinates of the second endpoint of the line segment.
[0059] In this embodiment of the application, the angle and distance between the various line segments in S1022 above can be represented by the difference between the endpoints of the different line segments.
[0060] Specifically, based on the distances and angles between the initial line segments, the line segments to be synthesized in the initial line segment set can be determined using the following formulas (1) to (3): (1); (2); (3); in, Represents line segment The x-coordinate; Represents line segment The x-coordinate; Represents line segment The ordinate; Represents line segment The ordinate; This represents the preset distance threshold; This refers to the preset angle threshold.
[0061] When all of the above formulas (1), (2), and (3) are true, the line segment is considered to be true. and line segments The line segment to be fitted.
[0062] In this embodiment, the line segments to be fitted are selected based on the angle and distance between each line segment. This helps to eliminate the influence of messy line segments in the background of the crosshair image on the subsequent crosshair positioning, thereby improving the accuracy of crosshair positioning.
[0063] Specifically, using the least squares method, straight lines are fitted to the endpoints of the line segment to be fitted. The sum of squared residuals of the endpoints can be constructed using the following formula (4): (4) in, The first line segment to be synthesized represents the initial line segment of the line to be synthesized. One endpoint; This represents the total number of initial line segments to be synthesized; Indicates the first The length of the line segment corresponding to each endpoint; This represents the sum of squared residuals at each endpoint to be synthesized; and This represents the slope and intercept of the first line segment after fitting. , Indicates the first The coordinates of each endpoint.
[0064] After that, In respectively and Taking the partial derivatives above, we obtain the following formulas (5) and (6): (5); (6); Substitute the coordinates of the line segment to be synthesized into the above formulas (5) and (6), and set the above formulas (5) and (6) equal to 0, to finally obtain the result. and This allows for the fitting of the line segment to be synthesized.
[0065] In one optional embodiment of this application, S1024 includes: using the least squares method to perform a first straight line fitting on the endpoints of the line segments in the set of line segments to be fitted, to obtain a fitted set of line segments; using the least squares method to perform a second straight line fitting on the endpoints of the fitted set of line segments, until the number of line segments in the fitted set of line segments is equal to the number of line segments in the set of line segments to be fitted, and determining the finally fitted set of line segments as the first set of line segments.
[0066] That is, for the endpoints of the line segments in the set of line segments to be fitted, the least squares method is used to fit the line segments to each endpoint to obtain a new set of line segments; then, the least squares method is used again to fit the new set of line segments to a line; until the number of line segments in the fitted set of line segments is equal to the number of line segments in the set of line segments before fitting.
[0067] By performing line fitting in the above manner, the line segments in the initial line segment set can be merged to the greatest extent, reducing the computational complexity in the subsequent process of determining the position of the crosshair.
[0068] S103, based on the total length of the vertical line segments in the first line segment set, perform line segment filtering on the first line segment set to obtain the cross-shaped main line segment set in the first line segment set.
[0069] The purpose of S103 above is to eliminate interfering line segments that affect the positioning of the crosshair, based on the total length of the vertical line segments in the first line segment set.
[0070] Specifically, S103 above includes: Determine the total length of the vertical line segments in the first line segment set, and identify the vertical line segments whose total length is greater than a preset length threshold as the main line segments of the crosshair. or, Determine the total length of the vertical line segments in the first line segment set; sort the vertical line segments according to the total length of the vertical line segments, and determine the vertical line segments that are ranked before a preset position as the main line segments of the crosshair.
[0071] Specifically, the vertical line segments can be understood as pairs of line segments that are perpendicular to each other and intersect. In practical applications, the total length of pairs of line segments that are perpendicular to each other and intersect within the main body of the crosshair is usually greater than that of pairs of line segments that are perpendicular to each other and intersect within the background. Therefore, S103 above, by combining the total length of the line segments processed in the first line segment combination, achieves the goal of reducing interference from the line segments in the background, while also eliminating interference from line segments in the main body of the crosshair that are unrelated to the crosshair's positioning position, thereby improving the accuracy of the crosshair's positioning.
[0072] For further details, please refer to... Figure 3 , Figure 3 A partial schematic diagram of the crosshair image provided in the embodiments of this application. Figure 1 .
[0073] like Figure 3 As shown, Figure 3 It includes: line segment 1, line segment 2, line segment 3, line segment 4, line segment 5 and line segment 6.
[0074] Among them, line segment 1 and line segment 2 are mutually perpendicular line segments; line segment 3 and line segment 4 are mutually perpendicular line segments, and line segments 3 to 6 belong to the main body of the cross mark.
[0075] It can be seen that the total length of line segments 1 and 2 is significantly shorter than the total length of line segments 3 and 4, and line segments 1 and 2 are unrelated to the positioning of the crosshair. Therefore, by restricting mutually perpendicular line segments that intersect, it is possible to effectively remove line segments that are irrelevant to the main body of the crosshair and its positioning.
[0076] In this embodiment of the application, it is considered that if the included angle between two intersecting line segments is within the range of... Between these two intersecting line segments, the two intersecting line segments are perpendicular to each other, where θ is the preset error magnitude.
[0077] S104, Based on the intersection points of the vertical line segments in the set of line segments of the crosshair main body, determine the positioning position of the crosshair.
[0078] In this embodiment, mutually perpendicular line segments in the set of main line segments of the crosshair selected by line segment fitting and length accumulation are considered as the main line segments of the crosshair. However, since a single edge of the crosshair may be detected as multiple approximately parallel line segments, multiple mutually perpendicular line segments are generated on the same side. These multiple mutually perpendicular line segments will produce a large number of intersections, interfering with the positioning of the crosshair.
[0079] To address the issue of numerous intersections of vertical line segments interfering with the positioning of the crosshair, S104 includes: using a clustering method to cluster the intersections of vertical line segments in the main line segment set of the crosshair to determine the apex position of the crosshair; and determining the positioning position of the crosshair based on the apex position of the crosshair.
[0080] In one optional implementation, the clustering method is the K-means clustering method, wherein the K-means clustering method is used to cluster the intersections of vertical line segments in the set of line segments of the crosshair to determine the location of the crosshair, including: The K-means clustering method is used to cluster the intersection points of the perpendicular line segments in the main line segment set of the cross mark, and the cluster of the line segment intersection points is determined. The centroid of the cluster is determined as the vertex position of the cross mark. The positioning position of the cross mark is determined according to the vertex position of the cross mark.
[0081] It should be noted that the above-described method of clustering the intersection points of vertical line segments using K-means clustering is only one available clustering method provided in this application embodiment. In actual applications, the clustering method can also be density clustering, hierarchical clustering, etc., and this application does not impose any restrictions on it.
[0082] After obtaining the accurate positions of the four vertices of the crosshair, the positioning position of the crosshair can be determined by combining the accurate positions of the four vertices.
[0083] For further details, please refer to... Figure 4 , Figure 4 A partial schematic diagram of the crosshair image provided in the embodiments of this application. Figure 2 .
[0084] like Figure 4 As shown, Figure 4 The crosshair includes four vertices, namely vertex 1, vertex 2, vertex 3, and vertex 4. After obtaining the positions of vertices 1 to 4 through the above steps S101 to S104, the position of the center point from vertex 1 to vertex 4 can be determined and used as the positioning position of the crosshair.
[0085] In summary, the crosshair positioning method provided in this application involves: performing line detection on a crosshair image to determine an initial set of line segments in the crosshair image; fitting the initial line segments of the initial set of line segments to determine a first set of fitted line segments; performing noise reduction processing on the first set of line segments based on the total length of the vertical line segments in the first set of line segments to obtain a set of crosshair main line segments in the first set of line segments; and determining the positioning position of the crosshair based on the intersection points of the vertical line segments in the set of crosshair main line segments.
[0086] After determining the initial set of line segments in the crosshair pattern, this method filters the first set of line segments by fitting the line segments and combining the total length of the vertical line segments to obtain the set of line segments of the crosshair body. Furthermore, by combining the intersection points of the vertical line segments in the set of line segments of the crosshair body, the crosshair is located, which can accurately confirm the location of the crosshair.
[0087] Figure 5 This is a structural diagram of the crosshair positioning device provided in an embodiment of this application.
[0088] like Figure 5 As shown, the crosshair positioning method includes: The line detection unit 501 is used to perform line detection on the crosshair image and determine the initial set of line segments in the crosshair image. The line fitting unit 502 is used to fit the initial line segments of the initial line segment set to determine the first line segment set after fitting. The noise reduction processing unit 503 is used to filter the first line segment set according to the total length of the vertical line segments in the first line segment set, and obtain the cross-shaped main line segment set in the first line segment set. The positioning unit 504 is used to determine the positioning position of the crosshair based on the intersection point of the vertical line segments in the set of line segments of the crosshair body.
[0089] In one optional embodiment of this application, the step of performing line detection on the crosshair image to determine the initial set of line segments in the crosshair image includes: determining the gradient magnitude and gradient direction of each pixel in the crosshair image, and determining pixels with gradient magnitude greater than a preset gradient magnitude threshold as target pixels; traversing each adjacent target pixel, and determining adjacent target pixels with gradient direction differences less than a preset direction difference as line segment pixels; and determining the pixel region composed of each line segment pixel as the initial set of line segments.
[0090] In one optional embodiment of this application, fitting the initial line segments of the initial line segment set to determine the fitted first line segment set includes: determining the endpoints of each line segment in the initial line segment set; determining the angle and distance between each line segment based on the endpoints of each line segment; selecting a set of line segments to be fitted from the initial line segment set that meet preset angle and distance thresholds based on the angle and distance between each line segment; and performing line fitting on the endpoints of each set of line segments to be fitted using the least squares method to determine the fitted first line segment set.
[0091] In one optional embodiment of this application, the step of using the least squares method to perform line fitting on the endpoints of each line segment to be fitted, and determining the first set of fitted line segments, includes: using the least squares method to perform a first line fitting on the endpoints of the line segment set to be fitted, to obtain a fitted set of line segments; using the least squares method to perform a second line fitting on the endpoints of the fitted set of line segments, until the number of line segments in the fitted set is equal to the number of line segments in the line segment set to be fitted, and determining the finally fitted set of line segments as the first set of line segments.
[0092] In one optional embodiment of this application, the step of filtering the first line segment set according to the total length of the vertical line segments in the first line segment set to obtain the main line segment set of the crosshair in the first line segment set includes: determining the total length of the vertical line segments in the first line segment set, and determining the vertical line segments whose total length is greater than a preset length threshold as the main line segments of the crosshair; or, determining the total length of the vertical line segments in the first line segment set; sorting the vertical line segments according to the total length of the vertical line segments, and determining the vertical line segments sorted before a preset position as the main line segments of the crosshair.
[0093] In one optional embodiment of this application, determining the location of the crosshair based on the intersection points of the vertical line segments in the crosshair body line segment set includes: performing clustering processing on the intersection points of the vertical line segments in the crosshair body line segment set using a clustering method to determine the apex position of the crosshair; and determining the location of the crosshair based on the apex position of the crosshair.
[0094] In one optional embodiment of this application, the clustering method is at least the K-means clustering method; the step of using the clustering method to cluster the intersection points of the vertical line segments in the main line segment set of the crosshair to determine the vertex position of the crosshair includes: using the K-means clustering method to cluster the intersection points of the vertical line segments in the main line segment set of the crosshair, determining the cluster of the line segment intersection points, and determining the centroid of the cluster as the vertex position of the crosshair.
[0095] The device embodiment provided in this example belongs to the same application concept as the method embodiment of this application, and can execute the crosshair positioning method provided in any of the above embodiments of this application, possessing the corresponding functional modules and beneficial effects of executing the crosshair positioning method. Technical details not described in detail in this example can be found in the specific processing content of the crosshair positioning method provided in the above embodiments of this application, and will not be repeated here.
[0096] It should be understood that the units in the above device can be implemented by a processor calling software. For example, the device includes a processor connected to a memory containing instructions. The processor calls the instructions stored in the memory to implement any of the above methods or to implement the functions of each unit in the device. The processor can be a general-purpose processor, such as a CPU or microprocessor, and the memory can be internal or external to the device. Alternatively, the units in the device can be implemented as hardware circuits. By designing the hardware circuits, some or all of the unit functions can be implemented. The hardware circuits can be understood as one or more processors. For example, in one implementation, the hardware circuit is an ASIC, and the functions of some or all of the above units are implemented by designing the logical relationships between the components within the circuit. In another implementation, the hardware circuit can be implemented using a PLD, such as an FPGA, which can include a large number of logic gates. The connection relationships between the logic gates are configured through configuration files to implement the functions of some or all of the above units. All units in the above device can be implemented entirely by a processor calling software, entirely by hardware circuits, or partially by a processor calling software with the remaining parts implemented by hardware circuits.
[0097] In this application embodiment, a processor is a circuit with signal processing capabilities. In one implementation, the processor can be a circuit with instruction reading and execution capabilities, such as a CPU, microprocessor, GPU, or DSP. In another implementation, the processor can implement certain functions through the logical relationships of hardware circuits. These logical relationships are fixed or reconfigurable. For example, the processor may be a hardware circuit implemented as an ASIC or PLD, such as an FPGA. In a reconfigurable hardware circuit, the process of the processor loading a configuration document and configuring the hardware circuit can be understood as the processor loading instructions to implement the functions of some or all of the above units. Furthermore, it can also be a hardware circuit designed for artificial intelligence, which can be understood as an ASIC, such as an NPU, TPU, or DPU.
[0098] As can be seen, each unit in the above device can be one or more processors (or processing circuits) configured to implement the above methods, such as: CPU, GPU, NPU, TPU, DPU, microprocessor, DSP, ASIC, FPGA, or a combination of at least two of these processor forms.
[0099] Furthermore, the units in the above devices can be integrated in whole or in part, or they can be implemented independently. In one implementation, these units are integrated together and implemented in the form of a System-on-Chip (SoC). The SoC may include at least one processor for implementing any of the above methods or implementing the functions of the units in the device. The at least one processor may be of different types, such as CPU and FPGA, CPU and artificial intelligence processor, CPU and GPU, etc.
[0100] This application also provides an electronic device, such as... Figure 6 As shown, Figure 6 This is a schematic diagram of an electronic device structure provided in an embodiment of this application.
[0101] like Figure 6 As shown, the electronic device includes: Processor 210.
[0102] Memory 200 for storing executable instructions of the processor 210.
[0103] The processor 210 is used to execute the manganese ore exploration method disclosed in any of the above embodiments by running instructions in the memory 200.
[0104] The processor 210, memory 200, communication interface 220, input device 230, and output device 240 are interconnected via a bus. Among them: A bus can include a pathway for transmitting information between various components of a computer system.
[0105] Processor 210 can be a general-purpose processor, such as a general-purpose central processing unit (CPU), a microprocessor, etc., or an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program of the present invention. It can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0106] Processor 210 may include a main processor, as well as a baseband chip, modem, etc.
[0107] The memory 200 stores a program that executes the technical solution of this invention, and may also store an operating system and other key business functions. Specifically, the program may include program code, which includes computer operation instructions. More specifically, the memory 200 may include read-only memory (ROM), other types of static storage devices capable of storing static information and instructions, random access memory (RAM), other types of dynamic storage devices capable of storing information and instructions, disk storage, flash memory, etc.
[0108] Input device 230 may include a device for receiving user input data and information, such as a keyboard, mouse, camera, scanner, touch screen, etc.
[0109] Output device 240 may include devices that allow information to be output to a user, such as a display screen, printer, speaker, etc.
[0110] The communication interface 220 may include a device that uses any transceiver to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.
[0111] The processor 210 executes the program stored in the memory 200 and calls other devices, and can be used to implement each step of any manganese ore exploration method provided in the above embodiments of this application.
[0112] In addition to the methods and devices described above, embodiments of this application may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the steps in the manganese ore prospecting methods of various embodiments of this application.
[0113] The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of this application. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0114] Furthermore, embodiments of this application may also be storage media storing computer programs, which are executed by a processor in the manganese ore prospecting methods of various embodiments of this application.
[0115] For the foregoing method embodiments, in order to simplify the description, they are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0116] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0117] The steps in the methods of the various embodiments of this application can be adjusted, merged, or deleted in order according to actual needs, and the technical features described in each embodiment can be replaced or combined.
[0118] The modules and sub-modules in the apparatus and terminal in the various embodiments of this application can be merged, divided, and deleted according to actual needs.
[0119] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0120] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for locating a crosshair, characterized in that, include: Perform line detection on the crosshair image to determine the initial set of line segments in the crosshair image; The initial line segments of the initial line segment set are fitted to determine the first set of fitted line segments; Based on the total length of the vertical line segments in the first line segment set, the first line segment set is filtered to obtain the crosshair main line segment set in the first line segment set; The positioning position of the crosshair is determined based on the intersection points of the vertical line segments in the set of line segments of the crosshair body. The step of performing line detection on the crosshair image to determine the initial set of line segments in the crosshair image includes: Determine the gradient magnitude and gradient direction of each pixel in the crosshair image, and identify the pixel whose gradient magnitude is greater than a preset gradient magnitude threshold as the target pixel. Traverse each adjacent target pixel and determine the adjacent target pixels whose gradient direction difference is less than a preset direction difference as line segment pixels; The pixel region composed of the pixels of each line segment is determined as the initial set of line segments.
2. The crosshair positioning method according to claim 1, characterized in that, The step of fitting the initial line segments of the initial line segment set to determine the fitted first line segment set includes: Determine the endpoints of each line segment in the initial set of line segments; Determine the angles and distances between each line segment based on the endpoints of each line segment; Based on the angle and distance between each line segment, a set of line segments to be fitted that meet the preset angle threshold and distance threshold is selected from the initial set of line segments. The least squares method is used to fit straight lines to the endpoints of each set of line segments to be fitted, thus determining the first set of line segments after fitting.
3. The crosshair positioning method according to claim 2, characterized in that, The process of using the least squares method to fit straight lines to the endpoints of each line segment to be fitted, and determining the first set of fitted line segments, includes: The least squares method is used to perform a first straight line fitting on the endpoints of the line segments in the set of line segments to be fitted, so as to obtain the fitted set of line segments. The least squares method is used to fit the endpoints of the fitted line segments in the fitted line segment set to a second straight line until the number of line segments in the fitted line segment set is equal to the number of line segments in the line segment set to be fitted. The final fitted line segment set is then determined as the first line segment set.
4. The crosshair positioning method according to claim 1, characterized in that, The step of filtering the first line segment set based on the total length of the vertical line segments in the first line segment set to obtain the crosshair main line segment set in the first line segment set includes: Determine the total length of the vertical line segments in the first line segment set, and identify the vertical line segments whose total length is greater than a preset length threshold as the main line segments of the crosshair. or, Determine the total length of the vertical line segments in the first line segment set; sort the vertical line segments according to the total length of the vertical line segments, and determine the vertical line segments that are ranked before a preset position as the main line segments of the crosshair.
5. The crosshair positioning method according to claim 1, characterized in that, The step of determining the positioning position of the crosshair based on the intersection points of the vertical line segments in the set of line segments of the crosshair's main body includes: Clustering methods are used to cluster the intersection points of vertical line segments in the main line segment set of the crosshair to determine the apex position of the crosshair; based on the apex position of the crosshair, the positioning position of the crosshair is determined.
6. The crosshair positioning method according to claim 5, characterized in that, The clustering method is at least the K-means clustering method; The step of using a clustering method to cluster the intersection points of perpendicular line segments in the main line segment set of the crosshair to determine the apex position of the crosshair includes: The K-means clustering method is used to cluster the intersection points of the perpendicular line segments in the main line segment set of the cross mark, determine the cluster of the line segment intersection points, and determine the centroid of the cluster as the vertex position of the cross mark.
7. A crosshair positioning device, characterized in that, include: A line detection unit is used to perform line detection on the crosshair image and determine the initial set of line segments in the crosshair image. A line fitting unit is used to fit the initial line segments of the initial line segment set to determine the first line segment set after fitting. The noise reduction processing unit is used to filter the first line segment set according to the total length of the vertical line segments in the first line segment set, and obtain the cross-shaped main line segment set in the first line segment set. A positioning unit is used to determine the positioning position of the crosshair based on the intersection point of the vertical line segments in the set of line segments of the crosshair body. The line detection unit is used for: Determine the gradient magnitude and gradient direction of each pixel in the crosshair image, and identify the pixel whose gradient magnitude is greater than a preset gradient magnitude threshold as the target pixel. Traverse each adjacent target pixel and determine the adjacent target pixels whose gradient direction difference is less than a preset direction difference as line segment pixels; The pixel region composed of the pixels of each line segment is determined as the initial set of line segments.
8. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the crosshair positioning method according to any one of claims 1 to 6 by running instructions in the memory.
9. A computer storage medium, characterized in that, The computer storage medium stores instructions that, when executed, implement the crosshair positioning method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Cross target sub-pixel center positioning method
CN116452622A
Information processing apparatus, computer-readable storage medium, and information processing method
US20170263000A1
