Image rotation distortion adaptive calibration method based on reference cross target, electronic device and medium
Patent Information
- Application Number
- CN202611161283.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-31
- Publication Date
- 2026-10-27
AI Technical Summary
现有校准方法多依赖人工设定校准参数或简单的旋转变换校准,存在校准效率低、适应性差、校准精度不足等问题,难以适配复杂背景、多场景下的旋转畸变校准需求
[0015]本公开提供一种基于参考十字标靶的图像旋转畸变自适应校准方法、电子设备及介质,所述方法包括:获取待校准的目标图像以及包含参考十字标靶的参考图像,所述目标图像以及所述参考图像由同一成像设备在同一机械安装状态下采集得到;对所述参考图像进行参考十字标靶的几何旋转误差提取,得到旋转仿射矩阵,所述旋转仿射矩阵表征图像旋转畸变的几何变换参数与坐标映射关系,用于校准图像旋转几何畸变;基于所述仿射变换矩阵,对所述目标图像进行旋转校准,得到校准图像。本公开所提供的基于参考十字标靶的图像旋转畸变自适应校准方法,通过科学的畸变量化、精准的校准算法,可以高效、精准地消除旋转畸变对图像质量及后续处理的影响,适用于各类处理场景,保障机器视觉系统的检测精度与稳定性,满足各领域对图像采集与处理的高精度需求。
Smart Images

Figure CN122990155A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and in particular to an image rotation distortion adaptive calibration method, electronic device and medium based on a reference crosshair target. Background Technology
[0002] In fields such as machine vision inspection, precision measurement, and target positioning, rotational distortion often occurs in the acquired target image due to factors such as camera mounting posture deviation, slight wobbling of mechanical fixtures, lens optical characteristic deviation, or tilted shooting angle. This rotational distortion manifests as a certain angle of deflection of the target image relative to the ideal frontal view image, causing deviations in the geometric shape and positional relationships of the target in the image. Especially for targets with strict geometric constraints, such as crosshairs or orthogonal coordinate axes, rotational distortion directly destroys their key geometric features such as orthogonality and symmetry, thereby affecting the accuracy and precision of subsequent image analysis, parameter calculation, and target positioning.
[0003] Currently, image rotation distortion calibration has become one of the core components for improving the detection accuracy of machine vision systems. Existing calibration methods mostly rely on manually setting calibration parameters or simple rotation transformation calibration, which suffers from problems such as low calibration efficiency, poor adaptability, and insufficient calibration accuracy, making it difficult to adapt to the rotation distortion calibration needs in complex backgrounds and multiple scenarios.
[0004] Therefore, there is an urgent need for an efficient, accurate, and adaptable image rotation distortion calibration scheme to address the technical problems caused by image rotation distortion, such as geometric feature deviation, insufficient calibration accuracy, and poor adaptability. Summary of the Invention
[0005] In a first aspect, embodiments of this disclosure provide an adaptive calibration method for image rotation distortion based on a reference crosshair target. The method includes: acquiring a target image to be calibrated and a reference image containing a reference crosshair target, wherein the target image and the reference image are acquired by the same imaging device under the same mechanical installation state; extracting the geometric rotation error of the reference crosshair target from the reference image to obtain a rotation affine matrix, wherein the rotation affine matrix characterizes the geometric transformation parameters and coordinate mapping relationship of image rotation distortion and is used to calibrate the image rotation geometric distortion; and performing rotation calibration on the target image based on the rotation affine matrix to obtain a calibration image.
[0006] In some embodiments, the step of extracting the geometric rotation error of the reference crosshair target from the reference image to obtain a rotation affine matrix includes: performing target pattern enhancement processing on the reference image to obtain an enhanced image; extracting lines from the enhanced image to obtain a set of line segments composed of all line segments in the enhanced image; and determining the affine transformation matrix based on the set of line segments.
[0007] In some embodiments, the step of performing target pattern enhancement processing on the reference image to obtain an enhanced image includes: performing grayscale preprocessing on the reference image to obtain a preprocessed image; and enhancing the target pattern in the preprocessed image using an enhancement algorithm to obtain the enhanced image, wherein the enhancement algorithm includes at least one of filtering and noise reduction, edge detection, threshold segmentation, and morphological processing.
[0008] In some embodiments, the step of extracting lines from the enhanced image to obtain a set of line segments composed of all line segments in the enhanced image includes: extracting lines from the target pattern in the enhanced image using a line detection algorithm to obtain the set of line segments, wherein the line detection algorithm includes at least one of standard Hough transform, probabilistic Hough transform, least squares fitting, RANSAC fitting, edge clustering line detection, contour polygon approximation, morphological skeleton tracking, and deep learning line detection.
[0009] In some embodiments, determining the affine transformation matrix based on the set of line segments includes: for any line segment in the set of line segments, determining the actual inter-axis angle between the line segment and the absolute horizontal axis of the image; performing an absolute value operation on the difference between the actual inter-axis angle and the standard orthogonal angle 90° to obtain the orthogonal axis normalized deviation angle of the line segment, wherein the orthogonal axis normalized deviation angle characterizes the rotational offset of the line segment relative to the orthogonal coordinate axis; determining the global rotation angle based on the orthogonal axis normalized deviation angles of all line segments in the set of line segments; and constructing the affine transformation matrix based on the global rotation angle and the geometric center of the reference image.
[0010] In some embodiments, determining the global rotation angle based on the orthogonal axis normalized deviation angles of all line segments in the line segment set includes: solving for a data center feature based on the orthogonal axis normalized deviation angles of all line segments in the line segment set, wherein the data center feature represents the central tendency of all the orthogonal axis normalized deviation angles; and determining the data center feature as the global rotation angle.
[0011] In some embodiments, the data center characteristic includes at least one of the following: median, truncated mean, and Gaussian distribution fitted peak center.
[0012] In some embodiments, the image rotation distortion adaptive calibration method based on a reference crosshair target further includes: after obtaining the global rotation angle, determining whether the global rotation angle exceeds a preset safety angle threshold; if it does, stopping the image rotation distortion calibration process and outputting an alarm message.
[0013] Secondly, embodiments of this disclosure provide an electronic device, including: one or more processors; and a memory storing one or more programs thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above-described image rotation distortion adaptive calibration method based on a reference crosshair target.
[0014] Thirdly, embodiments of this disclosure provide a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the above-described adaptive calibration method for image rotation distortion based on a reference crosshair target.
[0015] This disclosure provides an adaptive calibration method, electronic device, and medium for image rotation distortion based on a reference crosshair target. The method includes: acquiring a target image to be calibrated and a reference image containing a reference crosshair target, wherein the target image and the reference image are acquired by the same imaging device under the same mechanical mounting condition; extracting the geometric rotation error of the reference crosshair target from the reference image to obtain a rotation affine matrix, wherein the rotation affine matrix characterizes the geometric transformation parameters and coordinate mapping relationship of image rotation distortion, and is used to calibrate the image rotation geometric distortion; and performing rotation calibration on the target image based on the affine transformation matrix to obtain a calibrated image. The adaptive calibration method for image rotation distortion based on a reference crosshair target provided in this disclosure, through scientific distortion quantification and precise calibration algorithms, can efficiently and accurately eliminate the impact of rotation distortion on image quality and subsequent processing, is applicable to various processing scenarios, ensures the detection accuracy and stability of machine vision systems, and meets the high-precision requirements of various fields for image acquisition and processing. Attached Figure Description
[0016] Figure 1 A flowchart of an image rotation distortion adaptive calibration method based on a reference crosshair target provided in this disclosure embodiment.
[0017] Figure 2 Another flowchart of an image rotation distortion adaptive calibration method based on a reference crosshair target provided in this disclosure embodiment.
[0018] Figure 3 This is a schematic diagram illustrating image acquisition via an imaging device, provided as an embodiment of this disclosure.
[0019] Figure 4 A schematic diagram of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0020] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions of this disclosure will be described in detail below with reference to the accompanying drawings.
[0021] Exemplary embodiments will be described more fully below with reference to the accompanying drawings; however, these exemplary embodiments may be embodied in different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will enable those skilled in the art to fully understand the scope of this disclosure.
[0022] Where there is no conflict, the various embodiments of this disclosure and the features thereof in the embodiments may be combined with each other.
[0023] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.
[0024] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. As used herein, the singular forms “a” and “the” are also intended to include the plural forms unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded.
[0025] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.
[0026] In modern optical inspection, camera calibration, and head-mounted display field of view testing, the assembly deviation between the test camera and the optical module, especially the optical axis roll angle error, can cause image rotation distortion.
[0027] Current mainstream calibration methods have obvious drawbacks: First, algorithms that rely on image features have poor reliability when faced with low-feature and high-distortion images; second, manual calibration is time-consuming, has limited accuracy, and is subject to subjective errors, making it unsuitable for automated production lines; third, when measuring angles based on grids and crosshairs, the horizontal and vertical lines increase computational complexity, and judgment errors are prone to occur around 45°.
[0028] To address the aforementioned shortcomings, this disclosure proposes an adaptive calibration method for image rotation distortion based on a reference crosshair target. Through a decoupled calibration logic of "measuring the deviation of the reference image and calibrating the target image" and an innovative orthogonal axis normalized angle extraction algorithm, an independent crosshair target reference image is introduced to extract global rotation parameters, which are then applied to the target image under test, thereby achieving high-precision and automated rotation error calibration for any image under test.
[0029] The technical solutions of this disclosure and how they solve the aforementioned technical problems will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this disclosure will now be described with reference to the accompanying drawings.
[0030] This disclosure provides an image rotation distortion adaptive calibration method based on a reference crosshair target. The processing flow of this method can be implemented by electronic devices, such as computers, handheld smart terminals, etc. For ease of explanation, the embodiments of this disclosure are described with the computer as the method execution subject.
[0031] Figure 1 This is a schematic diagram of an image rotation distortion adaptive calibration method based on a reference crosshair target provided in an embodiment of this disclosure. Figure 2 Another schematic diagram of the image rotation distortion adaptive calibration method based on a reference crosshair target provided in this disclosure embodiment is shown below. Figure 1 as well as Figure 2 As shown, this disclosure provides an adaptive calibration method for image rotation distortion based on a reference crosshair target. In some embodiments, the method includes steps S1 to S3, as follows: S1. Acquire the target image to be calibrated and the reference image containing the reference crosshair target. The target image and the reference image are acquired by the same imaging device under the same mechanical installation state.
[0032] Specifically, this step is the image acquisition step, which mainly involves acquiring the target image to be calibrated and the reference image containing the reference crosshair target using the same imaging device. In order to avoid deviations and ensure image consistency, this disclosure uses the same mechanical installation state of the imaging device to capture the target image and the reference image respectively.
[0033] For example, Figure 3 This is a schematic diagram illustrating image acquisition via an imaging device (described as a test camera in the following embodiment) provided by an embodiment of this disclosure. Figure 3As shown, a test camera (e.g., an industrial camera / imaging sensor for image acquisition) is fixedly mounted using a mechanical fixture. The test camera captures images of a crosshair target positioned at a predetermined standard location to obtain a reference image, and also captures images of a target object positioned at the predetermined standard location to obtain a target image. The crosshair target is a high-contrast standard physical calibration plate with a preset geometry, used to characterize the mounting posture deviation of the test camera relative to the optical module under test. Due to a slight tilt in the test camera's mounting, or the tilt of the optical module under test, a mechanical mounting rotation deviation around the optical axis (Roll angle) occurs, resulting in image distortion in both the target image and the reference image.
[0034] To facilitate distortion calibration, this disclosure adopts a dual-channel decoupled architecture of "reference image bias measurement and target image calibration", specifically including: (1) Target reference channel: Acquire a reference image with a high-contrast crosshair target, which is dedicated to extracting the mechanical rotational deviation (Roll angle) of the test system.
[0035] (2) Target test channel: Collect the actual image to be evaluated (such as FOV test image). The target image may lack features or be distorted.
[0036] In this disclosure, the rotational affine matrix used to calibrate the rotational geometric distortion of the image is calculated solely from an independent target reference image and transparently mapped onto the target image to be calibrated, eliminating dependence on the features of the target image. Therefore, to ensure consistency between the reference image and the target image, both must be acquired sequentially by the same test camera under the same mounting condition with the mechanical fixture completely stationary.
[0037] S2. Extract the geometric rotation error of the reference crosshair target from the reference image to obtain a rotation affine matrix. The rotation affine matrix represents the geometric transformation parameters and coordinate mapping relationship of the image rotation distortion and is used to calibrate the image rotation geometric distortion.
[0038] In this disclosure, the rotation affine matrix represents the geometric transformation parameters and coordinate mapping relationship of image rotation distortion. By directly applying the rotation affine matrix to the target image, the image rotation geometric distortion calibration of the target image can be achieved.
[0039] In some embodiments, S2 extracts the geometric rotation error of the reference crosshair target from the reference image to obtain a rotation affine matrix, including: S21. Perform target pattern enhancement processing on the reference image to obtain an enhanced image.
[0040] S22. Extract straight lines from the enhanced image to obtain a set of line segments composed of all line segments in the enhanced image.
[0041] S23. Determine the affine transformation matrix based on the set of line segments.
[0042] The purpose of target pattern enhancement processing on the reference image is to highlight key features of the target pattern, suppress noise, improve visual quality, facilitate subsequent line extraction processing, and obtain a more accurate affine transformation matrix based on the line extraction results.
[0043] In some embodiments, S21 performs target pattern enhancement processing on the reference image to obtain an enhanced image, including: performing grayscale preprocessing on the reference image to obtain a preprocessed image; and enhancing the target pattern in the preprocessed image using an enhancement algorithm to obtain an enhanced image, wherein the enhancement algorithm includes at least one of filtering and noise reduction, edge detection, threshold segmentation, and morphological processing.
[0044] Specifically, the reference image is first preprocessed to grayscale to obtain a preprocessed image, which simplifies image information, reduces processing complexity, and reduces irrelevant interference, laying the foundation for the extraction and enhancement of the target pattern.
[0045] Then, the target pattern in the preprocessed image is enhanced by an enhancement algorithm to obtain an enhanced image, thereby highlighting the features of the target pattern (outline, edge, shape, etc.), suppressing noise and interference in the image, improving the contrast between the target and the background, and making the target pattern clearer and easier for subsequent recognition and positioning algorithms to capture.
[0046] The enhancement algorithm includes at least one of filtering and noise reduction, edge detection, threshold segmentation, and morphological processing. Depending on the quality of the preprocessed image, the type of target, and the actual interference, a single algorithm or a combination of algorithms can be selected. The following is an explanation of each algorithm: (1) Filtering and noise reduction is the basic pre-step for target enhancement. The core is to suppress or remove noise in the preprocessed image (such as salt and pepper noise, Gaussian noise, random noise, etc.), while preserving the details of the target pattern as much as possible and avoiding noise interference with subsequent edge detection, threshold segmentation and other operations.
[0047] (2) Edge detection is one of the core steps of target enhancement. The core is to identify the region of gray value change in the preprocessed image (i.e. the boundary between the target and the background) through the algorithm, extract the edge contour of the target, make the shape and boundary of the target clearer, and provide a basis for subsequent target positioning and feature extraction.
[0048] (3) Threshold segmentation is the key step to completely separate the target from the background. The core is to set a reasonable gray threshold and divide the pixels in the preprocessed image into two categories: pixels with gray values higher than the threshold (target area) and pixels with gray values lower than the threshold (background area), thereby obtaining a black and white binary image, so that the target pattern and the background form a strong contrast and are easier to identify.
[0049] (4) Morphological processing is a subsequent optimization step of target enhancement. The core is to repair the defects of the target pattern (such as edge breakage, small gaps, and residual noise) by a series of morphological operations (dilation, erosion, opening operation, closing operation, etc.) based on the geometric shape of the target, optimize the shape of the target, make the target pattern more complete and regular, and provide a clearer target for subsequent identification and positioning.
[0050] Taking threshold segmentation in the enhancement algorithm as an example, the process is as follows: First, the input crosshair target reference image is converted to grayscale, and then binarization processing with a set threshold (such as cv2.threshold) is applied to remove background noise and extract the high-contrast target skeleton. For a regular 8-bit image, the binarization threshold is usually set between 200 and 255 to separate the bright crosshair from the dark background.
[0051] In some embodiments, S22 extracts straight lines from the enhanced image to obtain a set of line segments composed of all line segments in the enhanced image, including: extracting straight lines from the target pattern in the enhanced image using a straight line detection algorithm to obtain the set of line segments, wherein the straight line detection algorithm includes at least one of standard Hough transform, probabilistic Hough transform, least squares fitting, RANSAC fitting, edge clustering straight line detection, contour polygon approximation, morphological skeleton tracking, and deep learning straight line detection.
[0052] After the target pattern enhancement process is completed, one or more line detection algorithms are used to extract high-precision lines from the target pattern in the enhanced image, and finally output a standardized set of line segments. Depending on the quality of the enhanced image, the type of target, and the actual interference, a single algorithm or a combination of algorithms can be selected. The following is an explanation of each algorithm: (1) Standard Hough Transform: Based on parameter space mapping and accumulator voting mechanism, discrete edge points in the image are mapped to polar coordinate parameter space. By finding local peaks, straight line parameters are identified. It has good inclusiveness for long straight contours with edge breaks and slight noise interference in the target pattern. It can stably detect the complete straight line direction and is suitable for global extraction of continuous or discontinuous straight line features such as target outline and long scale.
[0053] (2) Probabilistic Hough Transform: As a lightweight improvement algorithm of the standard Hough Transform, it performs local voting by randomly sampling edge points. It does not need to traverse all pixels and can directly output the coordinates of the start and end points of the line segment instead of an infinitely long straight line. It has higher computational efficiency and can accurately adapt to the fine extraction needs of segmented straight lines, crosshairs and short scale lines of the target. It is the most commonly used basic algorithm for target line segment detection.
[0054] (3) Least square fitting: Using the minimum of the sum of squared errors of the edge point set as a constraint, the optimal straight line is fitted to the discrete points of the local edge of the target. The algorithm is simple in principle and easy to calculate. It is suitable for the smooth calibration and fitting optimization of the straight line edge of the target with regular edge distribution and no obvious abnormal noise. It can effectively regularize the straight line contour and reduce the fitting deviation caused by discrete pixels.
[0055] (4) RANSAC fitting: Using the idea of random sampling and iterative verification, the inliers are repeatedly screened and outliers and interference points are removed. Even in enhanced images with local noise and edge clutter, the true target line can still be robustly fitted, effectively making up for the defect of least squares fitting being sensitive to outliers. It is suitable for robust fitting and extraction of target lines under complex backgrounds and residual noise.
[0056] (5) Edge clustering line detection: Based on the spatial location, gradient direction and curvature features of edge pixels, clustering is performed to group edge points with the same direction and spatial proximity into the same line category. It can adaptively distinguish multiple lines distributed in parallel, vertical and multi-directional directions in the target without presetting the number of lines, which is convenient for batch separation of the contour line segments of the target in different directions.
[0057] (6) Contour polygon approximation: First, extract the complete closed contour of the target, and then use the contour simplification algorithm to filter the contour inflection points and approximate the polygon, simplifying the irregular contour into a polygon structure composed of multiple straight line segments. It is especially suitable for targets with regular geometric shapes such as rectangles and squares, and can quickly calculate the straight line segments of each side of the target from the overall contour. The process is simple and has strong real-time performance.
[0058] (7) Morphological skeleton tracking: By using morphological refinement, erosion and skeleton extraction operations, the central axis of the target fine line pattern is obtained, and then the straight line branches are decomposed by skeleton path tracking. It is specifically suitable for narrow line structures such as fine line targets and cross center lines. It can accurately extract the center straight line of the line and avoid detection errors caused by edge offset.
[0059] (8) Deep learning line detection: Relying on deep models such as convolutional neural networks and Transformer, it is trained through a target line sample dataset to achieve end-to-end autonomous learning and prediction of line features. It does not require manual design of edge features and parameter tuning. It has strong generalization ability for target patterns under complex working conditions such as occlusion, blurring, and uneven lighting. It can complete the task of extracting lines and line segments in complex scenes with high precision and intelligence.
[0060] The probabilistic Hough transform in line detection algorithms is used as an example for explanation. An improved Hough transform is applied to extract the set of all line segments in a target image: Typical parameters include: angular resolution of 1 degree, minimum line segment length of 100 pixels, maximum line segment break gap of 20 pixels, and extracted line segments stored in the form of pixel coordinates of the start and end points.
[0061] In some embodiments, S23 determines the affine transformation matrix based on the set of line segments, including: S231. For any line segment Li in the set of line segments, determine the actual angle between line segment Li and the absolute horizontal axis of the image.
[0062] S232. The absolute value of the difference between the actual interaxial angle and the standard orthogonal angle 90° is calculated to obtain the orthogonal axis normalized deviation angle of line segment Li. The orthogonal axis normalized deviation angle represents the rotational offset of the line segment relative to the orthogonal coordinate axis.
[0063] S233. Determine the global rotation angle based on the orthogonal axis normalized deviation angle of all line segments in the line segment set.
[0064] S234. Construct an affine transformation matrix based on the global rotation angle and the geometric center of the reference image.
[0065] This disclosure employs an orthogonal axis normalization angle calculation model, which uniformly transforms line segments, whether originally horizontal or vertical, into minimal offset angles deviating from the ideal horizontal or vertical state. This enables the extraction of globally uniform rotational deviation angles directly from images containing horizontal and vertical line segments without classification.
[0066] Specifically, for any extracted line segment The endpoint is and Traditional methods struggle to determine whether a line is a slightly tilted horizontal or vertical line. This disclosure achieves adaptive normalization through the following matrix and modular operations: (1) Original slope angle: Calculate line segments The actual interaxial angle relative to the absolute horizontal axis of the image : Alternatively, in addition to using trigonometric functions to calculate the slope at both ends, other methods can be used, such as calculating the gradient direction distribution of image pixels or using principal component analysis (to extract the principal direction of line segment pixels) to obtain the actual interaxial angle.
[0067] (2) Normalized deviation angle of orthogonal axis ( ): To avoid the need to classify whether a line segment is horizontal or vertical, this disclosure introduces a model. Space mapping algorithm: The above formula will be close to (level), (Vertical) and All (perpendicular) line segments are uniformly mapped to... Within the deviation range, the result directly represents the rotation offset of the current line segment relative to the nearest orthogonal coordinate axis. This step completely eliminates the need for complex line segment clustering logic. Here, orthogonal coordinate axes refer to two reference axes that are ideally 90° orthogonal (perpendicular) to each other.
[0068] Optionally, when determining the normalized deviation angle of the orthogonal axis, the modulo operation can be omitted, and conditional branching logic (i.e., if-else statements) can be used to achieve the same function: for example, if the angle is close to 90 degrees, subtract 90 degrees; if it is close to negative 90 degrees, add 90 degrees; if it is close to 0 degrees, leave it unchanged. The modulo operation is simply a preferred branchless expression of this logic.
[0069] In some embodiments, S233 determines the global rotation angle based on the orthogonal axis normalized deviation angles of all line segments in the line segment set, including: solving for the data center feature based on the orthogonal axis normalized deviation angles of all line segments in the line segment set, wherein the data center feature represents the central tendency of all orthogonal axis normalized deviation angles; and determining the data center feature as the global rotation angle.
[0070] Specifically, since target edge burrs or image noise may lead to the erroneous extraction of short line segments, this disclosure normalizes the set of deviation angles for all orthogonal axes. Solving for the data center characteristics yields the final system-wide rotation angle. This angle represents the overall deviation of the camera around the optical axis.
[0071] In some embodiments, the data center characteristic includes at least one of the following: median, truncated mean, and Gaussian distribution fitted peak center.
[0072] Among them, the median is a statistical measure taken after sorting, which masks isolated outliers and is suitable for obtaining robust benchmark values in noisy environments. The truncated mean is calculated by discarding extreme outliers at both ends and averaging the effective data in the middle, balancing noise resistance and overall data representativeness. The Gaussian distribution fitting peak center is achieved by fitting the statistical distribution to a standard Gaussian model and solving for the expected value of the distribution as the center position, realizing sub-pixel-level high-precision benchmark positioning and resisting local fluctuation interference.
[0073] This disclosure determines the data center characteristic as a global rotation angle. Compared with the arithmetic mean, the median, truncated mean, and Gaussian distribution fitted peak center have extremely strong anti-interference ability against outliers, greatly improving the robustness of the evaluation.
[0074] In some embodiments, S234, constructing an affine transformation matrix based on the global rotation angle and the geometric center of the reference image, includes: With reference image geometric center Using the global rotation angle as the center of rotation Construct a two-dimensional rotational affine matrix M: The geometric center coordinates of the image are obtained by reading the total pixel width and total pixel height of the reference image and dividing them by two respectively.
[0075] S3. Based on the affine transformation matrix, the target image is rotated and calibrated to obtain a calibrated image.
[0076] In this disclosure, the affine transformation matrix can be directly applied to any image to be calibrated. The method of use is to input the matrix into the image affine transformation function, combine it with the image interpolation algorithm (such as cubic interpolation), recalculate and generate the flattened image pixels, and obtain the calibrated image.
[0077] The image rotation distortion adaptive calibration method based on a reference crosshair target provided in this disclosure can be applied to automated pipeline testing applications, for example, by calculating a single rotation matrix. Cache and batch apply to multiple target test images (such as luminance maps, chrominance maps, and distortion maps) in the same batch and under the same mechanical installation condition, saving repetitive calculation time and significantly improving the overall throughput of the automated testing system.
[0078] In some embodiments, the method further includes: after obtaining the global rotation angle, determining whether the global rotation angle exceeds a preset safe angle threshold; if it does, stopping the image rotation distortion calibration process and outputting an alarm message.
[0079] This disclosure also includes an anomaly alarm process; specifically, when the calculated global rotation angle... When the set safety angle threshold is exceeded (the value can be between 3° and 5°, depending on the mechanical tolerance of the test fixture), for example... If the system determines that the mechanical fixture installation has a serious failure, it will refuse to perform subsequent affine transformations and trigger a hardware alarm. If an audible and visual alarm is triggered, manual intervention will be required.
[0080] The image rotation distortion adaptive calibration method based on a reference crosshair target provided in this disclosure has the following advantages compared to traditional algorithms: 1. Decoupled image calibration architecture: Extract geometric rotation error from a reference image (crosshair target) containing high contrast features, and apply the rotation affine matrix across the image to the target image with no features or complex features, thus solving the problem of difficult feature extraction of target images.
[0081] 2. Orthogonal axis normalized angle extraction formula (core patent barrier): Utilizing the formula... This method processes the set of line segments extracted by the Hough transform. It cleverly maps the absolute angles of horizontal and vertical line segments to offsets relative to the nearest orthogonal axis, thus avoiding the redundant line segment classification / clustering steps in traditional algorithms.
[0082] 3. Robust Angle Aggregation Strategy Based on Median: For the normalized set of offsets, the global rotation angle is obtained by calculating the median instead of the arithmetic mean. This effectively eliminates calculation errors caused by edge burrs or outliers.
[0083] 4. Cross-image affine transformation matrix mapping mechanism based on the same rotation center: Ensures that the reference image and the target image maintain the same physical resolution and field of view center, and achieves pixel-level lossless rotation interpolation.
[0084] 5. Extended Protection - Batch Reuse Mechanism: After calculating the rotation matrix once, it is buffered and applied in batches to multiple types of optical test images (FOV, MTF, brightness map, etc.) acquired under the same machine station.
[0085] The adaptive calibration method for image rotation distortion based on a reference crosshair target provided in this disclosure can efficiently and accurately eliminate the impact of rotation distortion on image quality and subsequent processing through scientific distortion quantification and precise calibration algorithms. It is applicable to various processing scenarios, ensures the detection accuracy and stability of machine vision systems, and meets the high-precision requirements of various fields for image acquisition and processing.
[0086] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0087] Figure 4 A schematic diagram of an electronic device provided in an embodiment of this disclosure, such as... Figure 4 As shown, in some embodiments, this disclosure provides an electronic device including: one or more processors 201; a memory 202 storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement any of the above-described image rotation distortion adaptive calibration methods based on a reference crosshair target; and one or more I / O interfaces 203 connected between the processors and the memory, configured to enable information interaction between the processors and the memory.
[0088] The processor 201 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the memory 202 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), and flash memory (FLASH); the I / O interface (read / write interface) 203 is connected between the processor 201 and the memory 202, enabling information exchange between the processor 201 and the memory 202, including but not limited to a data bus (Bus).
[0089] In some embodiments, the processor 201, memory 202, and I / O interface 203 are interconnected via bus 204, and thus connected to other components of the computing device.
[0090] In some embodiments, this disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described adaptive calibration methods for image rotation distortion based on a reference crosshair target.
[0091] It will be understood by those skilled in the art that all or some of the steps, systems, or apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software may be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0092] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in connection with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in connection with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this disclosure as set forth by the appended claims.
Claims
1. An adaptive calibration method for image rotation distortion based on a reference crosshair target, characterized in that, The method includes: Acquire the target image to be calibrated and the reference image containing the reference crosshair target, wherein the target image and the reference image are acquired by the same imaging device under the same mechanical mounting condition; The geometric rotation error of the reference crosshair target is extracted from the reference image to obtain a rotation affine matrix. The rotation affine matrix represents the geometric transformation parameters and coordinate mapping relationship of the image rotation distortion and is used to calibrate the image rotation geometric distortion. Based on the rotation affine matrix, the target image is rotated and calibrated to obtain a calibrated image.
2. The image rotation distortion adaptive calibration method based on a reference crosshair target according to claim 1, characterized in that, The step of extracting the geometric rotation error of the reference crosshair target from the reference image to obtain the rotation affine matrix includes: The reference image is subjected to target pattern enhancement processing to obtain an enhanced image; Line extraction is performed on the enhanced image to obtain a set of line segments consisting of all line segments in the enhanced image; Determine the affine transformation matrix based on the set of line segments.
3. The image rotation distortion adaptive calibration method based on a reference crosshair target according to claim 2, characterized in that, The step of performing target pattern enhancement processing on the reference image to obtain an enhanced image includes: The reference image is preprocessed to grayscale to obtain a preprocessed image; The target pattern in the preprocessed image is enhanced by an enhancement algorithm to obtain the enhanced image, wherein the enhancement algorithm includes at least one of filtering and noise reduction, edge detection, threshold segmentation, and morphological processing.
4. The image rotation distortion adaptive calibration method based on a reference crosshair target according to claim 2, characterized in that, The step of extracting straight lines from the enhanced image to obtain a set of line segments consisting of all line segments in the enhanced image includes: The target pattern in the enhanced image is extracted by a line detection algorithm to obtain the set of line segments. The line detection algorithm includes at least one of the following: standard Hough transform, probabilistic Hough transform, least squares fitting, RANSAC fitting, edge clustering line detection, contour polygon approximation, morphological skeleton tracking, and deep learning line detection.
5. The image rotation distortion adaptive calibration method based on a reference crosshair target according to claim 2, characterized in that, The step of determining the affine transformation matrix based on the set of line segments includes: For any line segment in the set of line segments, determine the actual angle between the line segment and the absolute horizontal axis of the image; The absolute value of the difference between the actual interaxial angle and the standard orthogonal angle 90° is calculated to obtain the orthogonal axis normalized deviation angle of the line segment. The orthogonal axis normalized deviation angle represents the rotational offset of the line segment relative to the orthogonal coordinate axis. The global rotation angle is determined based on the orthogonal axis normalized deviation angle of all line segments in the line segment set; The affine transformation matrix is constructed based on the global rotation angle and the geometric center of the reference image.
6. The image rotation distortion adaptive calibration method based on a reference crosshair target according to claim 5, characterized in that, The step of determining the global rotation angle based on the orthogonal axis normalized deviation angle of all line segments in the line segment set includes: The data center characteristic is calculated based on the orthogonal axis normalized deviation angles of all line segments in the set of line segments. The data center characteristic represents the central tendency of all the orthogonal axis normalized deviation angles. The data center characteristic is determined as the global rotation angle.
7. The image rotation distortion adaptive calibration method based on a reference crosshair target according to claim 6, characterized in that, The data center characteristics include at least one of the following: median, truncated mean, and Gaussian distribution fitted peak center.
8. The image rotation distortion adaptive calibration method based on a reference crosshair target according to any one of claims 5 to 7, characterized in that, Also includes: After obtaining the global rotation angle, it is determined whether the global rotation angle exceeds a preset safety angle threshold. If the error exceeds the limit, the image rotation distortion calibration process will be stopped and an alarm message will be output.
9. An electronic device, characterized in that, include: One or more processors; A memory having stored one or more programs that, when executed by one or more processors, cause the one or more processors to implement the image rotation distortion adaptive calibration method based on a reference crosshair target according to any one of claims 1 to 8.
10. A computer-readable medium, characterized in that, It stores a computer program that, when executed by a processor, implements the image rotation distortion adaptive calibration method based on a reference crosshair target according to any one of claims 1 to 8.