CN114332077A - RANSAC-based light dial plate identification method - Google Patents
RANSAC-based light dial plate identification method Download PDFInfo
- Publication number
- CN114332077A CN114332077A CN202210195989.0A CN202210195989A CN114332077A CN 114332077 A CN114332077 A CN 114332077A CN 202210195989 A CN202210195989 A CN 202210195989A CN 114332077 A CN114332077 A CN 114332077A
- Authority
- CN
- China
- Prior art keywords
- image
- circle
- straight line
- dial
- binary edge
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Image Analysis (AREA)
Abstract
The invention belongs to the technical field of image recognition, and discloses a RANSAC-based light-weight dial plate recognition method, which comprises the steps of converting a dial plate inspection image into a gray-scale image, and carrying out median filtering on the gray-scale image to reduce extracted edge pixel points; performing four convolutions by using four Sobel kernels and the gray level image after median filtering to obtain the gray level change of the image in the transverse direction and the longitudinal direction to obtain four binarization edge images, and synthesizing the four binarization edge images into one binarization edge image; removing a straight line formed by the positions of the telegraph poles in the synthesized binary edge map; obtaining a binary edge image after the straight line is deleted; and finally, performing circle fitting by using RANSAC to obtain the specific position of the dial. The method has the characteristics of small operation amount, high accuracy and no need of presetting a template.
Description
Technical Field
The invention belongs to the technical field of image recognition, and particularly relates to a RANSAC-based light-weight dial plate recognition method.
Background
To acquire the position of the meter, the detection of the shape of the dial is inevitable. Among the many shapes, the most significant for meter detection is the circular shape. To detect circles or ellipses, the most common method is to use hough transform (CHT), which first uses Canny edge detection to obtain edge pixels and then uses the edge pixels to determine the position of the circle. However, hough transform, especially hough ellipse transform, requires a large amount of storage space, has high computational complexity, and has poor accuracy under the conditions of noise in the image and incomplete target shape. In order to solve the problem, researchers at home and abroad propose a plurality of improved methods, such as probabilistic hough transform, Randomized Hough Transform (RHT), fuzzy hough transform and the like. Of these, Lu et al propose an iterative stochastic hough transform (IRHT), which, although yielding good results on noisy complex images, comes at the cost of a large increase in the number of computations. Ayalaamirez et al propose GA-based circle detectors, but this method fails to detect incomplete circles. Dasgupta proposes a circle detector optimized using the bacterial foraging algorithm (BFAOA), but it is not able to detect multiple circles simultaneously as the Ayalaamirez algorithm. In addition, Erik et al propose a Clone Selection Algorithm (CSA), Cuevas et al propose a rapid cycle detection, which can be used for a circle detection method of a Learning Automaton (LA), and the like. Although these algorithms work well in certain scenarios, they are not suitable for performing the task of dial plate recognition. In addition, Canny edge detection is found in the experimental process to generate too many edges, and the least square method has high noise sensitivity and the like.
CN108764257A discloses a multi-view pointer instrument identification method, which includes: collecting images and uploading the images to a computer; positioning an instrument area by utilizing an SSD algorithm; carrying out classification training on the instrument region by using a ResNet34 deep residual neural network, and carrying out primary correction on a sample image according to a classification result; performing secondary positioning of an instrument area on the corrected image by utilizing an SSD algorithm; performing regression training on the secondarily positioned instrument area by using the network, and identifying the position of a pointer on the dial plate; carrying out dial edge detection on the positioned instrument area by using an HED edge detection algorithm; carrying out random sampling according to RANSAC algorithm, and calculating an edge model of a meter dial; correcting the instrument pointer by utilizing the scaling ratio, and calculating an included angle between the instrument pointer and the starting needle; and looking up a database table according to the included angle to obtain the scale of the instrument panel. The method needs to rely on an SSD algorithm for positioning and an HED edge detection algorithm for edge detection, and the calculation amount is large.
Disclosure of Invention
In summary, the dial detection requires a computationally inexpensive and efficient algorithm, and the present invention aims to provide a lightweight dial identification method based on RANSAC: firstly, performing median filtering on an image and performing edge detection by using a Sobel core; then, integrating edge pixels by combining dial features; finally, the straight line and fitted dial are removed using a random sample consensus (RANSAC) method.
In order to realize the purpose, the invention adopts the following technical scheme: a RANSAC-based light dial plate identification method comprises the following steps:
step S1, converting the dial plate inspection image into a gray scale image;
step S2, median filtering is carried out on the gray level image;
step S3, performing four convolutions by using four Sobel kernels and the gray level image after median filtering to obtain four binary edge images, and synthesizing the four binary edge images into one binary edge image;
four convolutions with the median filtered gray scale map using four Sobel kernels for obtaining gray scale variations of the image in the lateral and longitudinal directionsRespectively as follows:
taking the pixel average value for the result of each convolutionAnd will be greater thanThe pixel of (1) is set to be 255, and the rest are 0, so that four binary edge images are obtained;
analyzing the gray scale change of each point on the dial plate, and then the upper left point of the dial platep 1And the lower right pointp 4Satisfies the following conditions: the product of the respective lateral gray scale variation and the longitudinal gray scale variation of the dots is greater than 0;
and the upper right pointp 2And the point at the lower leftp 3Satisfies the following conditions: the product of the respective lateral gray scale change and the longitudinal gray scale change of the dots is less than 0;
synthesizing the four binary edge images into a binary edge image;
step S4, removing straight lines in the binary edge image;
because the dial is arranged on the telegraph pole, the dial patrol inspection image not only comprises the dial but also comprises the telegraph pole, the straight line edge where the telegraph pole is located in the combined binary edge image is reserved, and the straight line formed by the position where the telegraph pole is located in the combined binary edge image is removed; a straight line can be defined as:
in the formulak l ,b l Is a constant of a straight line; it can be used at any two points Expressed as:
applying the formula (6) and the formula (7) to the previous binary edge map, namely determining a straight line by any two white points; for each straight line, calculating the distance between all white points in the binary edge image and the straight line according to the formula (8).
In the formula (I), the compound is shown in the specification,D i is as followsiDotThe distance from the straight line is set to be,counting the parallelogram intervals on both sides of the straight lineThe number of the inner white points is the number of the points of any one fitted straight lineOutside the parallelogram interval there are(ii) a DotWithin the parallelogram interval sometimes(ii) a Is provided withWhereinwAndhwidth and height of the image, respectively; and after all the straight lines are voted, obtaining the straight lines which are 20% of the votes, and deleting points contained in the parallelograms to obtain the binary edge map after the straight lines are deleted.
And step S5, performing circle fitting by using RANSAC to obtain the specific position of the dial.
Specifically, in step S1, the three-channel RGB-format dial plate inspection image is converted into a grayscale image using formula (1):
where Y represents the pixel value in the grayscale map and R, G, B is the value of the three color channels of red, green, and blue of the image.
Specifically, in step S2, the calculation formula of the median filtering window is as follows:
wherein size represents the total number of pixels of the image and the window size isMod denotes a modulo operation.
Specifically, in step S5, the calculation formula of the circle is:
in the formula (I), the compound is shown in the specification,as the coordinate of the center of the circle, r is the radius of the circle.
Randomly selecting three points from white points of the binarized edge map after the straight line is deletedUsing them to define a circle, there are:
if it isIf 0, the fitting is considered to fail, and the next circle is directly fitted, ifIf not 0, a circle is obtained:
if 1200 points are taken according to this method, 400 circles can be fitted in the best case. The difference between the distance between the white point and the center of the circle in the image and the radius r of the circle is calculated for each circle using the following formulad i :
It is known whether the point sought is within the circle, wherein whend i If > 0, then pointOutside the circle, e.g.d i ≤0,Then point is reachedWithin a circle; and counting the number of white points falling into the circle of each circle, wherein the circle with the largest number of white points falling into the circle is the position of the dial.
Firstly, performing median filtering on an image and performing edge detection by using a Sobel core; then, integrating edge pixels by combining dial features; finally, a random sample consensus (RANSAC) method is used to remove the straight line and fit the dial; the method has the characteristics of small operation amount, high accuracy and no need of presetting a template.
Drawings
FIG. 1 is a flow chart of the present invention.
Detailed Description
In order to make the technical solutions of the present application better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly, completely and specifically described below.
Referring to fig. 1, a method for identifying a lightweight dial based on RANSAC includes the following steps:
and step S1, converting the dial plate inspection image into a gray scale image. Converting a dial plate inspection image in a three-channel RGB format into a gray scale image by using a formula (1):
wherein Y represents the pixel value in the grayscale map, and R, G, B is the values of the three color channels of red, green, and blue of the image;
and step S2, performing median filtering on the gray level map. Carrying out median filtering on the gray level image to reduce the extracted edge pixel points, wherein a calculation formula of a median filtering window is as follows:
wherein size represents the total number of pixels of the image and the window size isMod denotes a modulo operation.
And step S3, performing four convolutions between the four Sobel kernels and the median-filtered gray level image to obtain four binarization edge images, and synthesizing the four binarization edge images into one binarization edge image. Since the classical Canny edge detection algorithm needs to set a binarization threshold, and the edges are refined and connected, two problems are caused: firstly, different threshold parameters need to be proposed for different images, secondly, as few and effective edge information as possible is needed, and edge thinning and connection increase algorithm complexity. Therefore, only the first step of the Canny edge detection algorithm is used, namely four convolutions with the median filtered gray scale map using four Sobel kernels to obtain the gray scale variation of the image in the horizontal and vertical directionsRespectively as follows:
taking the pixel average value for the result of each convolutionAnd will be greater thanThe pixel of (1) is set to be 255, and the rest are 0, so that four binary edge images are obtained; the background in the binary edge image is pure black, lines consisting of white dots formed by dial edges, pointers, dial scales, numbers and telegraph pole edges (or other object edges) are arranged in the binary edge image, and the white dots on the lines have gray level changes due to the use of four Sobel cores for processing.
Analyzing the gray scale change of each point on the dial plate, and then the upper left point of the dial platep 1And the lower right pointp 4Satisfies the following conditions: the product of the respective lateral gray variation and longitudinal gray variation of the dots is greater than 0:
and the upper right pointp 2And the point at the lower leftp 3Satisfies the following conditions: the product of the respective lateral and longitudinal gray scale changes of a dot is less than 0:
in the formula (I), the compound is shown in the specification,S x (p) Is a pointp 1、p 2、p 3Orp 4The lateral gray-scale variation of (a),S y (p) Is a pointp 1、p 2、p 3Orp 4Longitudinal gray scale variation.
Therefore, the previous four binary edge images can be synthesized into one binary edge image according to the characteristic through the above logic; the synthesized binary edge image can remove most noise interference, and only continuous pixels on the dial and the periphery are reserved.
And step S4, removing the straight lines in the binary edge map. Because the dial is generally installed on the telegraph pole, the dial routing inspection image not only comprises the dial but also comprises the telegraph pole, and the straight line edge where the telegraph pole is located in the combined binary edge image is also reserved, because although the algorithm removes the straight lines with deflection angles of 0 and 90 degrees, the rest of the straight lines are not removed. To remove these lines, a RANSAC line fitting method is used. A straight line can be defined as:
in the formulak l ,b l Is a constant of a straight line; it can be used at any two points Expressed as:
applying the formula (6) and the formula (7) to the previous binary edge map, that is, any two white points (pixel points with the value of 255) can determine a straight line. If 500 white points are randomly chosen, then 250 lines can be fitted. For each straight line, calculating the distance between all white points in the binary edge map and the straight line according to the formula (8).
In the formula (I), the compound is shown in the specification,D i is as followsiDotThe distance between the two parallelograms at the two sides of the straight line can be countedThe number of the inner white points is the number of the points of any one fitted straight lineOutside the parallelogram interval there are. DotWithin the parallelogram interval sometimes. Is provided withWhereinwAndhrespectively the width and the height of the image. And after all the straight lines are voted, obtaining the straight lines which are 20% of the votes, and deleting points contained in the parallelograms to obtain the binary edge map after the straight lines are deleted.
And step S5, performing circle fitting by using RANSAC to obtain the specific position of the dial.
The formula for the circle is:
in the formula (I), the compound is shown in the specification,as the coordinate of the center of the circle, r is the radius of the circle.
Randomly selecting three points from white points of the binarized edge map after the straight line is deletedUsing them to define a circle, there are:
if it isIf 0, the fitting is considered to fail, and the next circle is directly fitted, ifIf not 0, a circle is obtained:
if 1200 points are taken according to this method, 400 circles can be fitted in the best case. The difference between the distance between the white point and the center of the circle in the image and the radius r of the circle is calculated for each circle using the following formulad i :
It is known whether the point sought is within the circle, wherein whend i If > 0, then pointOutside the circle, e.g.d i ≤0,Then point is reachedWithin a circle; and counting the number of white points falling into the circle of each circle, wherein the circle with the largest number of white points falling into the circle is the position of the dial.
And (3) comparative analysis: the dial plate inspection image collected by the robot is used for carrying out experiments. There are 118 dial patrol images containing dials of different backgrounds, sizes and orientations. The table 1 shows the comparison result of the proposed algorithm with the hough circle and several classical template matching algorithms, the calculation amount is small, the accuracy rate is high, no template needs to be preset, and the method is a light-weight and convenient dial plate identification method.
The foregoing has outlined rather broadly the principles and embodiments of the present invention so that the present disclosure may be better understood with reference to the accompanying drawings, which are included to illustrate and describe the principles and features of the invention.
Claims (4)
1. A RANSAC-based light dial plate identification method is characterized by comprising the following steps:
step S1, converting the dial plate inspection image into a gray scale image;
step S2, median filtering is carried out on the gray level image;
step S3, performing four convolutions by using four Sobel kernels and the gray level image after median filtering to obtain four binary edge images, and synthesizing the four binary edge images into one binary edge image;
performing four convolutions with the median-filtered gray scale map by using four Sobel kernels to obtain the gray scale change of the image in the transverse direction and the longitudinal direction, wherein the four Sobel kernels are respectively:
taking the pixel average value for the result of each convolutionAnd will be greater thanThe pixel of (1) is set to be 255, and the rest are 0, so that four binary edge images are obtained;
analyzing the gray scale change of each point on the dial plate, and then the upper left point of the dial platep 1And the lower right pointp 4Satisfies the following conditions: the product of the respective lateral gray scale variation and the longitudinal gray scale variation of the dots is greater than 0;
and the upper right pointp 2And the point at the lower leftp 3Satisfies the following conditions: the product of the respective lateral gray scale change and the longitudinal gray scale change of the dots is less than 0;
synthesizing the four binary edge images into a binary edge image;
step S4, removing straight lines in the binary edge image;
because the dial is arranged on the telegraph pole, the dial patrol inspection image not only comprises the dial but also comprises the telegraph pole, the straight line edge where the telegraph pole is located in the combined binary edge image is reserved, and the straight line formed by the position where the telegraph pole is located in the combined binary edge image is removed; the straight line is defined as:
in the formulak l ,b l Is a constant of a straight line; using a straight line with two arbitrary points Expressed as:
applying the formula (6) and the formula (7) to the binary edge map, namely determining a straight line by any two white points; for each straight line, calculating the distance between all white points in the binary edge image and the straight line according to the formula (8):
in the formula (I), the compound is shown in the specification,D i is as followsiDotThe distance between the two parallelograms at the two sides of the straight line is countedThe number of the inner white points is the number of the points of any one fitted straight lineOutside the parallelogram interval there are(ii) a DotWithin the parallelogram interval sometimes(ii) a Is provided withWhereinwAndhwidth and height of the image, respectively; after all straight lines are voted, straight lines which are 20% of the number of votes are obtained, points contained in a parallelogram of the straight lines are deleted, and a binary edge map after the straight lines are deleted is obtained;
and step S5, performing circle fitting by using RANSAC to obtain the specific position of the dial.
2. The RANSAC-based lightweight dial plate recognition method according to claim 1, wherein the three-channel RGB-format dial plate patrol inspection image is converted into a gray scale image using formula (1) in step S1:
where Y represents the pixel value in the grayscale map and R, G, B is the value of the three color channels of red, green, and blue of the image.
3. The RANSAC-based lightweight dial identification method according to claim 1, wherein in step S2, the gray-scale map is median-filtered to reduce the extracted edge pixels, and the calculation formula of the median-filtered window is as follows:
4. The RANSAC-based lightweight dial identification method according to claim 1, wherein in step S5, the calculation formula of the circle is:
in the formula (I), the compound is shown in the specification,as the coordinate of the center of the circle, r is the radius of the circle;
randomly selecting three points from white points of the binarized edge map after the straight line is deletedUsing them to define a circle, there are:
if it isIf 0, the fitting is considered to fail, and the next circle is directly fitted, ifIf not 0, a circle is obtained:
the difference between the distance between the white point and the center of the circle in the image and the radius r of the circle is calculated for each circle using the following formulad i :
Determining whether the point is within the circle, e.g.d i If > 0, then pointOutside the circle, e.g.d i ≤0,Then point is reachedWithin a circle; and counting the number of white points falling into the circle of each circle, wherein the circle with the largest number of white points falling into the circle is the position of the dial.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210195989.0A CN114332077A (en) | 2022-03-02 | 2022-03-02 | RANSAC-based light dial plate identification method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210195989.0A CN114332077A (en) | 2022-03-02 | 2022-03-02 | RANSAC-based light dial plate identification method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114332077A true CN114332077A (en) | 2022-04-12 |
Family
ID=81030245
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210195989.0A Pending CN114332077A (en) | 2022-03-02 | 2022-03-02 | RANSAC-based light dial plate identification method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114332077A (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1581209A (en) * | 2004-05-21 | 2005-02-16 | 清华大学 | Converting station circular/ellipsoid/square instrument monitoring method based object profile |
CN102609712A (en) * | 2012-02-24 | 2012-07-25 | 山东鲁能智能技术有限公司 | Reading method of round-like pointer instrument used for mobile robot |
CN104359404A (en) * | 2014-11-24 | 2015-02-18 | 南京航空航天大学 | Quick visual detection method for plenty of guide holes of small sizes in airplane parts |
CN106446913A (en) * | 2016-09-20 | 2017-02-22 | 山东省计量科学研究院 | Pointer position extracting method of multi-dial pointer type instrument |
CN108256524A (en) * | 2018-01-24 | 2018-07-06 | 国家电网公司 | A kind of automatic reading method of multilist index formula instrument |
CN110580480A (en) * | 2019-07-21 | 2019-12-17 | 天津大学 | Meter reading identification method based on image processing |
CN113192126A (en) * | 2021-04-19 | 2021-07-30 | 中国矿业大学(北京) | Distance measurement positioning method based on image circular object recognition |
CN113609984A (en) * | 2021-08-05 | 2021-11-05 | 国网山东省电力公司德州市陵城区供电公司 | Pointer instrument reading identification method and device and electronic equipment |
-
2022
- 2022-03-02 CN CN202210195989.0A patent/CN114332077A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1581209A (en) * | 2004-05-21 | 2005-02-16 | 清华大学 | Converting station circular/ellipsoid/square instrument monitoring method based object profile |
CN102609712A (en) * | 2012-02-24 | 2012-07-25 | 山东鲁能智能技术有限公司 | Reading method of round-like pointer instrument used for mobile robot |
CN104359404A (en) * | 2014-11-24 | 2015-02-18 | 南京航空航天大学 | Quick visual detection method for plenty of guide holes of small sizes in airplane parts |
CN106446913A (en) * | 2016-09-20 | 2017-02-22 | 山东省计量科学研究院 | Pointer position extracting method of multi-dial pointer type instrument |
CN108256524A (en) * | 2018-01-24 | 2018-07-06 | 国家电网公司 | A kind of automatic reading method of multilist index formula instrument |
CN110580480A (en) * | 2019-07-21 | 2019-12-17 | 天津大学 | Meter reading identification method based on image processing |
CN113192126A (en) * | 2021-04-19 | 2021-07-30 | 中国矿业大学(北京) | Distance measurement positioning method based on image circular object recognition |
CN113609984A (en) * | 2021-08-05 | 2021-11-05 | 国网山东省电力公司德州市陵城区供电公司 | Pointer instrument reading identification method and device and electronic equipment |
Non-Patent Citations (5)
Title |
---|
LIU SHUAI 等,: "Heterogeneous Iris One-to-One Certification with Universal Sensors Based On Quality Fuzzy Inference and Multi-Feature Fusion Lightweight Neural Network", 《SENSORS》 * |
张金玉 等,: "复杂环境指针式仪表自动辨识和示数提取", 《科技视界》 * |
石晓龙,: "用于DNA计算的微流控制系统中三维检测问题的研究", 《中国优秀博硕士学位论文全文数据库(博士)信息科技辑》 * |
陈蔓 等,: "隐低秩结合低秩表示的多聚焦图像融合", 《吉林大学学报(工学版)》 * |
高嘉巍,: "变电站巡检机器人智能读表方法研究", 《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115861135B (en) | Image enhancement and recognition method applied to panoramic detection of box body | |
CN115829883B (en) | Surface image denoising method for special-shaped metal structural member | |
CN111626190B (en) | Water level monitoring method for scale recognition based on clustering partition | |
CN110163853B (en) | Edge defect detection method | |
US20210334574A1 (en) | Commodity detection terminal, commodity detection method, system, computer device, and computer readable medium | |
CN103759758B (en) | A kind of method for detecting position of the automobile meter pointer based on mechanical angle and scale identification | |
CN110443128B (en) | Finger vein identification method based on SURF feature point accurate matching | |
CN110084241B (en) | Automatic ammeter reading method based on image recognition | |
CN107292310B (en) | Visual positioning and automatic reading method for circular pointer type dial plate | |
CN108764234B (en) | Liquid level meter reading identification method based on inspection robot | |
CN114549981A (en) | Intelligent inspection pointer type instrument recognition and reading method based on deep learning | |
CN116664559A (en) | Machine vision-based memory bank damage rapid detection method | |
CN114120051B (en) | Method for screening edge points of adhesive tapes | |
CN111382658B (en) | Road traffic sign detection method in natural environment based on image gray gradient consistency | |
CN116862910B (en) | Visual detection method based on automatic cutting production | |
CN117710399B (en) | Crack contour extraction method in geological survey based on vision | |
CN110807771A (en) | Defect detection method for road deceleration strip | |
CN114092468A (en) | Standard target counting method based on machine vision | |
CN117475327A (en) | Multi-target detection positioning method and system based on remote sensing image in city | |
CN115760860B (en) | Multi-type workpiece dimension visual measurement method based on DXF file import | |
CN104573698A (en) | Image texture main direction recognition method oriented to imaging measurement | |
CN114332077A (en) | RANSAC-based light dial plate identification method | |
CN113591875B (en) | High-precision pointer type instrument identification method | |
CN111160142A (en) | Certificate bill positioning detection method based on numerical prediction regression model | |
CN114898347A (en) | Machine vision identification method for pointer instrument |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20220412 |