A method for automatically perspective-correcting circular gauges
By fitting the elliptical contour of the instrument to construct a correction matrix and performing image correction, the problem of image distortion of circular instruments was solved, achieving efficient and accurate image correction results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-23
- Publication Date
- 2026-03-27
AI Technical Summary
Existing technologies are insufficient to effectively correct circular instrument image distortion caused by the angle between the camera and the instrument plane. Existing methods suffer from problems such as large errors, high computational load, or strict style requirements.
By fitting the elliptical contour of the instrument, a correction matrix is constructed using the set of coordinate points of the contour. The correction matrix is then calculated through eigenvalue decomposition, and image correction is performed using bilinear interpolation.
It improves calibration accuracy, reduces computational load, is applicable to various styles of circular instruments, and achieves efficient image calibration.
Smart Images

Figure CN116310284B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of instruments and meters, and particularly relates to a method for automatically correcting a circular instrument through perspective. BACKGROUND
[0002] With the development of machine vision, some inspection robots or fixed-position robots or fixed-position cameras can shoot instruments and read the numbers by using image processing technology, replacing manual reading and realizing automatic monitoring of production equipment. However, in actual application, there is a certain angle between the camera plane and the instrument plane, resulting in geometric distortion of the instrument image shot by the camera. The image distortion caused by the shooting angle causes great difficulty in subsequent image processing, and therefore the key step of instrument reading is to correct the distorted instrument image.
[0003] For a target with a geometric rectangular contour, most of the existing methods find the perspective transformation reference point by the intersection point of the target boundary line. However, there is no obvious reference target on the contour of the circular instrument, and it is difficult to obtain an accurate transformation reference point. In this regard, the “pointer instrument image correction method, system and storage medium” with the publication number CN112861870A proposes a method of fitting the elliptical contour of the target instrument and using the long and short axis endpoints of the ellipse as key points to correct the image. However, the number of key points is too small, the fitted ellipse already has an error with the actual contour, and the error of the image corrected by only four key points is large when performing subsequent reading; the “patrol pointer type circular instrument identification method and device” with the publication number CN113378663A uses a KNN neural network to calculate the angle difference between the target image and the standard image, and feeds back to the shooting device to adjust the shooting angle multiple times to obtain the standard image. This method needs to train an angle model, and the real-time operation amount is large, and the correction cost is high; and the “pointer instrument image tilt correction method” with the publication number CN112801094B uses a convolutional neural network to use the digital scale on the dial as a template to match the target image to obtain the transformation key point. This method has a relatively strict requirement for the style of the dial, and different matching templates need to be designed and trained for different instrument styles, and it is also not suitable for instruments without digital scales. SUMMARY
[0004] The present application proposes an automatic perspective correction method for circular instruments based on the contour to solve the problems of the existing correction methods for circular instruments. For an instrument image with geometric distortion, the elliptical contour of the instrument is fitted, and the coordinate point data set of the contour is used to construct a correction matrix. Compared with the existing methods, the operation amount is small, the coordinate points of the entire contour are used as key points to calculate the correction matrix, the correction error is small, and the correction problem of the circular instrument is effectively solved.
[0005] The application is a method for automatically correcting circular instruments in perspective, which mainly includes two steps: correction matrix estimation and image correction.
[0006] The correction matrix estimation in step 1 includes the following steps:
[0007] 1.1) The original image (i.e. source image) collected by the camera is generally a true color RGB image, which is first processed by gray scale;
[0008] 1.2) The gray scale image is fitted by using the existing ellipse fitting algorithm;
[0009] 1.3) The fitted ellipse of the instrument contour is screened out to obtain a coordinate point set;
[0010] 1.4) The special matrix is constructed by using the coordinate point set and geometric moments, and the correction matrix is calculated by performing eigenvalue decomposition;
[0011] The image correction in step 2 uses the correction matrix calculated in step 1 to perform linear interpolation on the original image to obtain the corrected instrument image.
[0012] The method for automatically correcting circular instruments in perspective only needs to obtain the coordinate set of the circular instrument contour to correct the distorted image, and the simulation experiment shows that, compared with the traditional four-point projection correction method, the correction accuracy of the method is improved by 2% to 6%, the operation amount is low, the cost is low, and the method has practical application value for the pre-processing of automatic reading of circular instruments. BRIEF DESCRIPTION OF DRAWINGS
[0013] Figure 1 The flowchart of the correction method of the application is shown in Fig. 1.
[0014] Figure 2 The schematic diagram of the instrument contour fitting ellipse of the embodiment is shown in Fig. 2.
[0015] Figure 2 (a) is the instrument gray scale image, and (b) is the fitted ellipse image.
[0016] Figure 3 The coordinate system diagram of the ellipse and the true circle of the embodiment is shown in Fig. 3.
[0017] Figure 3 (a) is the ellipse contour coordinate system, and (b) is the true circle contour coordinate system.
[0018] Figure 4 The correction effect image of the instrument of different styles of the embodiment is shown in Fig. 4.
[0019] Figure 4 (a) is the source image of the instrument I, and (b) is the corrected image of the instrument I.
[0020] (c) is the source image of Instrument II, and (d) is the image after calibration of Instrument II;
[0021] (e) Source image of Instrument III, (f) Image of Instrument III after calibration. Detailed Implementation
[0022] The present invention will be further described below with reference to embodiments and accompanying drawings, but this is not intended to limit the scope of the invention.
[0023] Example
[0024] Reference Figure 1 A method for automatically correcting circular instruments using perspective correction includes two steps: correction matrix estimation and image correction.
[0025] Step 1, the estimation of the correction matrix, includes the following steps:
[0026] 1.1) Acquire source images using a camera. Source images are generally true-color RGB images. First, perform grayscale conversion on them.
[0027] 1.2) Fit the grayscale image using existing ellipse fitting methods;
[0028] 1.3) Filter out the fitted ellipse of the instrument profile and obtain the set of profile coordinate points;
[0029] 1.4) Using the set of coordinate points and geometric moments, construct a special matrix and perform eigenvalue decomposition to calculate the correction matrix;
[0030] The image correction described in step 2 involves using the correction matrix calculated in step 1 to perform bilinear interpolation transformation on the source image to obtain the corrected instrument image.
[0031] In step 1, during the correction matrix estimation, to facilitate subsequent ellipse fitting, step 1.1) requires converting the source image acquired by the camera to grayscale and weighting the R, G, and B components of each pixel in the source image. The calculation formula is as follows:
[0032] I=0.2989×R+0.5870×G+0.1140×B (1).
[0033] Step 1.2) Using existing ellipse fitting methods, fit and select the instrument outline ellipse from the grayscale instrument image, such as... Figure 2 As shown, Figure 2 (a) is a grayscale image of the instrument. Figure 2 (b) is the fitted ellipse image.
[0034] Step 1.3) Obtain the set of contour coordinate points, such as Figure 3 As shown, the specific method is:
[0035] After obtaining the fitted ellipse in step 1.2), as follows: Figure 3 As shown in (a), an elliptical coordinate system is established. Define the set of coordinates of the instrument profile at this time as Where X a With Y a These represent the coordinates of the elliptical contour points in the coordinate system. The geometric center of the elliptical contour, formed by the above two-dimensional point set, is calculated as follows:
[0036]
[0037] in This represents the mathematical expectation of the coordinate set β, where λ is the expected value. a and μ a These represent the horizontal and vertical coordinates of the geometric center of the ellipse profile, respectively.
[0038] If we assume the profile of the calibrated instrument is a perfect circle, such as Figure 3 As shown in (b), let the coordinate system be... Let the set of coordinate points of a perfect circle be... The center of a perfect circle is So from the coordinate system To coordinate system The transformation is:
[0039]
[0040] Where H is the correction matrix.
[0041] Step 1.4) describes the calculation of the correction matrix, specifically using the following method:
[0042] Construct a matrix for the set of circular coordinates:
[0043]
[0044] in Since the outline is a perfect circle, ε x =ε y =r 2 / 2, where r is the radius of the circle;
[0045] According to formulas (3) and (4), we can obtain:
[0046]
[0047] Perform eigenvalue decomposition on the real symmetric matrix on the left side of equation (5):
[0048]
[0049] Where Q and Λ represent the corresponding eigenvector and eigenvalue matrix, respectively;
[0050] Perform singular value decomposition on matrix H:
[0051] H = USV T (7)
[0052] Where V represents the orthonormal basis of the original domain, and U represents the orthonormal basis after the H transformation. Let V = diag(1,1);
[0053] According to formulas (5)-(7), we can obtain:
[0054]
[0055] According to formula (8), we can deduce:
[0056]
[0057] Therefore, we can conclude that:
[0058]
[0059] The derivation proves that although the outline of the circular instrument under the lens is distorted, as long as the coordinate points of the instrument outline are collected, a correlation matrix is constructed and eigenvalue decomposition is performed, a correction matrix H can be obtained. This matrix can be used to transform the outline of the instrument from an ellipse to a perfect circle.
[0060] Step 2 Image correction: The calculated correction matrix H is used to transform the entire image. First, the true color source image is separated into three single-channel grayscale images: R, G, and B, and then interpolation transformation is performed.
[0061] Considering both the effectiveness of interpolation and computational time, the method of this invention employs bilinear interpolation to transform the source image, such as... Figure 4 As shown, Figure 4 (a) Source image of Instrument I; (b) Image of Instrument I after calibration; (c) Source image of Instrument II; (d) Image of Instrument II after calibration; (e) Source image of Instrument III; (f) Image of Instrument III after calibration. Figure 4 As can be seen, various styles of circular instruments photographed from different angles can be calibrated to restore the scale lines to a perfect circle, facilitating subsequent readings.
Claims
1. A method of automatically perspective-correcting a circular instrument, characterized by, The method comprises two steps of correction matrix estimation and image correction; The correction matrix estimation in step 1 comprises the following steps: 1.1) acquiring a source image by using a camera, the source image being a true color RGB image, and first performing a gray processing on the source image; 1.2) fitting the gray image by using an existing ellipse fitting method; 1.3) screening out a fitting ellipse of the instrument contour to obtain a contour coordinate point set; The specific method is: After the fitted ellipse is obtained in step 1.2), an ellipse coordinate system is established The coordinate set of the instrument profile at this time is defined as Wherein and respectively represent the two-dimensional point set composed of the coordinate points of the ellipse profile on the coordinate system The geometric center of the ellipse profile is calculated as follows: ; wherein denotes the set of coordinates the mathematical expectation is calculated, and denote the horizontal and vertical coordinate values of the geometric center of the elliptical contour, respectively. If the instrument profile after correction is a perfect circle, let the coordinate system be , let the set of coordinate points of the perfect circle profile be , and let the center of the perfect circle be . Then the transformation from the coordinate system to the coordinate system is: ; wherein is a correction matrix; 1.4) using the coordinate point set, a geometric moment to construct a special matrix and perform an eigenvalue decomposition, and calculating a correction matrix; the specific method is: constructing a matrix for the normal circle coordinate set: ; wherein , , since the profile is a perfect circle, at this time , is the radius of the perfect circle; According to the formulas (3) and (4), the following can be obtained: ; performing an eigenvalue decomposition on the real symmetric matrix on the left side of the formula (5) equal sign: ; wherein and denote the respective eigenvector and eigenvalue matrices, respectively; Will Singular value decomposition of a matrix: ; wherein denote the standard orthogonal basis of the original domain, denote the standard orthogonal basis of the original domain, denote the standard orthogonal basis of the original domain, ; According to the formulas (5)-(7), the following can be obtained: ; According to the formula (8), the following can be obtained: ; Therefore, the following can be obtained: ; Theoretical derivation proves that, although the profile of the circular instrument under the lens is distorted, as long as the related matrix is constructed by collecting the profile coordinate points of the instrument and the eigenvalue decomposition is performed, a correction matrix is obtained , and the profile of the instrument is transformed from an ellipse to a perfect circle by using the matrix. The image correction in step 2 is using the correction matrix calculated in step 1 to perform a bilinear interpolation on the source image to obtain a corrected instrument image.
2. The method of automatically perspective-correcting a circular instrument of claim 1, wherein: The gray processing in step 1.1 is specifically a weighted calculation on R, G and B components of each pixel point in the source image, and the calculation formula is: I=0.2989×R+0.5870×G+0.1140×B (1).
Citation Information
Patent Citations
A method for correcting the tilt of pointer-type instrument images
CN112801094B
Pointer type instrument image correction method and system and storage medium
CN112861870A
Inspection pointer type circular instrument identification method and device
CN113378663A
Real-time rectification algorithm for circular instrument of transformer station
CN107292871A
Variable angle multi-meter simultaneous identification method for patrol robot
CN109284718A