A method for detecting the pose of a cross target
Through iterative methods, binarization, edge extraction, Hough transform and convolution processing, the problem of poor robustness in cross target pose detection is solved, and high-precision pose measurement is achieved in the case of rotation, missing or blurred conditions.
Patent Information
- Application Number
- CN202111455451.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-01
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2041-12-01
AI Technical Summary
The existing technology has poor robustness in the pose detection of cross targets, especially when facing cross rotation, missing pieces and blur, making it difficult to achieve high-precision pose measurement.
An iterative method is used for image binarization, edge extraction, Hough transform line feature extraction, orthogonal intersection calculation and clustering algorithm to obtain center information. The center position is optimized through convolution processing, and morphological processing and Canny operator are combined to eliminate blurred edges to achieve sub-pixel precision center extraction.
It has good robustness when the cross target is rotated, missing or blurred, and can accurately extract the center and rotation angle information, thereby improving the accuracy and stability of detection.
Smart Images

Figure CN114387340B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image processing, and in particular relates to a method for detecting the position and posture of a cross target. Background Art
[0002] With the development of image processing and machine vision, many links in the measurement and positioning work of precision manufacturing that previously relied on manual labor have been replaced by machines.
[0003] For example, most of the advanced domestic optoelectronic detection products use a coarse and fine two-level mechanism to achieve stabilization. The coarse-level stabilization uses mechanical image stabilization, which realizes the inertial stabilization of the line of sight by driving the inner and outer frame shaft systems to rotate through motors; the fine-level stabilization uses optical image stabilization, which compensates for the image jitter caused by the inertial deflection of the line of sight through the deflection of the optical fast-reflection mirror, thereby realizing high-precision inertial stabilization of the line of sight.
[0004] In order to achieve high-precision inertial stabilization using a fast-reflection mirror, the position of the fast-reflection mirror in the imaging system needs to be accurately measured and calibrated.
[0005] When performing fast-reflection mirror calibration, image processing is generally used to calculate the miss-attention distance at the center of the image. Commonly used methods such as template matching and centroid extraction have poor robustness when facing cross rotation, missing cross pieces, and cross blur. Summary of the Invention
[0006] In response to the above-mentioned defects of the prior art, the present invention proposes a cross target posture detection method for extracting the center and rotation angle information of the cross target, which has a certain robustness against cross target rotation, partial loss and blur.
[0007] The technical solution adopted by the present invention to solve the technical problem is: a method for detecting the posture of a cross target, comprising the following steps:
[0008] (1) Obtain a grayscale image of the cross target and use an iterative method to binarize the image;
[0009] (2) Extract edges from grayscale images;
[0010] (3) Using the Hough transform method to extract the straight line features in the edge image, based on the extracted edge image, the Hough transform method is used to extract the straight line features in the image, and then the straight lines are divided into two groups and the cross rotation angle information is calculated by fitting;
[0011] (4) Perform orthogonal calculations on the two sets of straight lines to obtain a set of intersection information, and then use a clustering algorithm based on the intersection to obtain the center information of the cross target;
[0012] (5) In the area near the center of the cross target, convolution processing is performed to optimize the extraction and obtain the sub-pixel accurate target center.
[0013] Furthermore, in step (1), each iteration divides the image into two parts, calculates the mean u and v of each part, and then takes the mean of the two as the segmentation threshold c until the threshold no longer changes:
[0014] c=(v+u) / 2
[0015] In the first iteration, the average of the maximum grayscale value and the minimum grayscale value is taken as the threshold until the threshold no longer changes.
[0016] Furthermore, in the step (2), the grayscale image is first subjected to morphological processing, and blurred edges are eliminated by a certain number of erosion and dilation processes, while retaining the main cross outline information, and then edge extraction is performed using the Canny operator.
[0017] Furthermore, in step (3), let L be a straight line in the image space, and its equation in the rectangular coordinate system of the image space is:
[0018] P=x*Cosθ+y*Sinθ
[0019] Where θ is the angle between the line L and the Y axis, P is the distance between the line L and the rectangular coordinate space, and the point (θ, P) is the point mapping of the line L in the polar coordinate space. After performing Hough transform on each edge pixel in the original image, the straight line in the image space is obtained by counting the intersection points in the transformed Hough space; the straight lines are divided into parallel groups and perpendicular groups according to their slopes, and then by setting an appropriate threshold r, the straight lines in each category whose slope and mean slope exceed the threshold are eliminated. Finally, the weighted average method is adopted for the remaining straight lines to fit and calculate the inclination angle of the cross target.
[0020] Furthermore, in the step (4), a set of four corner points around the center of the cross target is first obtained, and then a weighted average value of the four corner points is calculated to obtain the position of the center point.
[0021] Furthermore, in step (5), the average distance n between the four corner points is first calculated, and a template M of size 2n*2n is taken. With the center point area of 3*3, a total of 9 points, as the center, a 3*3 grayscale value matrix is obtained by convolution calculation through the template M. After normalization, it is used as the offset coefficient of the cross center position. The coefficient is convolved with the following template K to obtain the offset of the center position. After superimposing the offset, the final center position can be obtained:
[0022] (-1,1) (0,1) (1,1) (-1,0) (0,0) (1,0) (-1,-1) (0,-1) (1,-1)
[0023] The beneficial effects of the present invention are as follows: the present invention adopts a geometric feature method to extract cross target posture information, and has good robustness in the case of cross rotation, cross missing and cross blur. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is the principle diagram of Hough transform of the present invention;
[0025] Figure 2 This is a schematic diagram of the intersection calculation cross center of the present invention;
[0026] Figure 3 This is a flowchart of the cross target posture detection process of the present invention. DETAILED DESCRIPTION
[0027] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0028] Reference Figure 1 、 Figure 2 As shown, the present invention discloses a method for detecting the posture of a cross target, which obtains a grayscale image of the cross target and binarizes the image using an iterative method; performs edge extraction on the grayscale image; according to the edge image, uses the Hough transform method to extract the straight line features in the image, and then divides the straight lines into two groups and fits and calculates the rotation angle information of the cross; orthogonally calculates the intersection information set of the two groups of straight lines, and then uses the intersection to perform a clustering algorithm to obtain the center information of the cross target; performs convolution processing and optimization extraction in the area near the center of the cross target to obtain the sub-pixel accurate target center.
[0029] The specific steps are as follows.
[0030] (1) Use the iterative method to calculate the image binarization threshold: Each round of iteration divides the image into two parts, calculates the mean u and v of each part respectively, and then takes the mean of the two as the segmentation threshold c until the threshold no longer changes:
[0031] c=(v+u) / 2,
[0032] In the first iteration, there is only one part, and the average of the maximum grayscale value and the minimum grayscale value is taken as the threshold. This continues until the threshold no longer changes.
[0033] (2) Edge extraction: First, perform morphological processing on the grayscale image. Through a certain number of corrosion and expansion processes, the blurred edges are eliminated and the main cross contour information is retained. Then, the edge can be extracted using the Canny operator.
[0034] (3) Extracting straight line features in the image: Use the Hough transform method to extract straight line features. The basic principle of Hough transform is as follows: Figure 3As shown, let L be a straight line in the image space, and its equation in the rectangular coordinate system of the image space is:
[0035] P=x*Cosθ+y*Sinθ,
[0036] Where θ is the angle between line L and the Y axis, P is the distance between line L and the rectangular coordinate space, and the point (θ, P) is the point mapping of line L in polar coordinate space. After performing a Hough transform on each edge pixel in the original image, the line in image space is obtained by counting the intersection points in the transformed Hough space.
[0037] Based on the characteristics of the cross target, the extracted valid lines should be orthogonal and perpendicular. Therefore, the lines are divided into parallel and perpendicular groups based on their slope. Then, by setting an appropriate threshold r, lines in each category whose slope exceeds the mean slope are removed. Finally, the remaining lines are fitted using the weighted average method to calculate the cross target's inclination angle.
[0038] (4) Calculate the intersection center of the straight lines: First, perform orthogonal calculations on the two groups of straight lines to obtain a set of intersection points. Then, use a clustering algorithm on this set to obtain a set of four corner point positions around the center of the cross target. Finally, calculate the weighted average of the four corner points to obtain the position of the center point.
[0039] (5) Optimize the center position: Calculate the average distance n between the four corner points through step 4, take a 2n*2n template M, and use the 9 points in the center point area (3*3) as the center. Perform convolution calculation on the template M to obtain a 3*3 grayscale value matrix. After normalization, use it as the offset coefficient of the cross center position. Convolve this coefficient with the following template K to obtain the offset of the center position:
[0040] (-1,1) (0,1) (1,1) (-1,0) (0,0) (1,0) (-1,-1) (0,-1) (1,-1)
[0041] The final center position can be obtained by superimposing the offset.
[0042] The above embodiments are merely illustrative of the principles and effects of the present invention, as well as some embodiments of its application. A person skilled in the art may make several modifications and improvements without departing from the inventive concept of the present invention, and all of these modifications and improvements fall within the scope of protection of the present invention.
Claims
1. A method for detecting the position and posture of a cross target, characterized by: Includes the following steps (1) Obtain a grayscale image of the cross target and use an iterative method to binarize the image: in each iteration, the image is divided into two parts, and the mean u and v of each part are calculated respectively. Then, the mean of the two is taken as the segmentation threshold c until the threshold no longer changes: c = (v + u) / 2. In the first iteration, the mean of the maximum grayscale value and the minimum grayscale value is taken as the threshold; (2) Edge extraction of grayscale image: First, perform morphological processing on the grayscale image, eliminate the blurred edges through corrosion and expansion processing, retain the main cross contour information, and then perform edge extraction through the Canny operator; (3) The Hough transform method is used to extract the straight line features in the edge image, and then the straight lines are divided into two groups and fitted to calculate the rotation angle information of the cross: Let L be a straight line in the image space, and the equation in the rectangular coordinate system of the image space is ,in is the angle between the line L and the Y axis, is the distance between the straight line L and the rectangular coordinate space, point ( , ) is the point mapping of the line L in the polar coordinate space. After performing Hough transform on each edge pixel in the original image, the straight line in the image space is obtained by counting the intersection points in the transformed Hough space. According to the slope of the straight line, the straight lines are divided into parallel groups and perpendicular groups. Then, by setting an appropriate threshold r, the straight lines in each category whose slope and mean slope exceed the threshold are eliminated. Finally, the weighted average method is adopted for the remaining straight lines to fit and calculate the inclination angle of the cross target. (4) Perform orthogonal calculations on the two sets of straight lines to obtain a set of intersection information. Then, a clustering algorithm is used based on the intersection to obtain the center information of the cross target: first, a set of four corner points around the center of the cross target is obtained, and then the weighted average of the four corner points is calculated to obtain the position of the center point. (5) In the area near the center of the cross target, perform convolution processing to optimize the extraction and obtain the sub-pixel accurate target center: first calculate the average distance n between the four corner points, take a 2n*2n template M, and use the 3*3 center point area (9 points in total) as the center. Perform convolution calculation on the template M to obtain a 3*3 grayscale value matrix. After normalization, use it as the offset coefficient of the cross center position. Convolve this coefficient with the following template K to obtain the offset of the center position. After superimposing the offset, the final center position can be obtained: 。
Citation Information
Patent Citations
Grid feature point extraction method based on fast line extraction
CN105096298A
Cross target detection method and system and storage medium
CN110458858A