CN116543175B - Automatic adjustment method of laser level - Google Patents
Automatic adjustment method of laser level Download PDFInfo
- Publication number
- CN116543175B CN116543175B CN202310819519.1A CN202310819519A CN116543175B CN 116543175 B CN116543175 B CN 116543175B CN 202310819519 A CN202310819519 A CN 202310819519A CN 116543175 B CN116543175 B CN 116543175B
- Authority
- CN
- China
- Prior art keywords
- laser
- point
- background
- edge
- value
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 238000001514 detection method Methods 0.000 claims abstract description 65
- 230000000694 effects Effects 0.000 claims abstract description 42
- 238000012937 correction Methods 0.000 claims abstract description 17
- 230000000739 chaotic effect Effects 0.000 claims abstract description 13
- 238000012512 characterization method Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 238000005259 measurement Methods 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 3
- 238000003708 edge detection Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/44—Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01C—MEASURING DISTANCES, LEVELS OR BEARINGS; SURVEYING; NAVIGATION; GYROSCOPIC INSTRUMENTS; PHOTOGRAMMETRY OR VIDEOGRAMMETRY
- G01C15/00—Surveying instruments or accessories not provided for in groups G01C1/00 - G01C13/00
- G01C15/002—Active optical surveying means
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01C—MEASURING DISTANCES, LEVELS OR BEARINGS; SURVEYING; NAVIGATION; GYROSCOPIC INSTRUMENTS; PHOTOGRAMMETRY OR VIDEOGRAMMETRY
- G01C25/00—Manufacturing, calibrating, cleaning, or repairing instruments or devices referred to in the other groups of this subclass
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/762—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using clustering, e.g. of similar faces in social networks
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Multimedia (AREA)
- Remote Sensing (AREA)
- Radar, Positioning & Navigation (AREA)
- Computing Systems (AREA)
- Databases & Information Systems (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Software Systems (AREA)
- Manufacturing & Machinery (AREA)
- Artificial Intelligence (AREA)
- Health & Medical Sciences (AREA)
- Image Analysis (AREA)
Abstract
The application relates to the technical field of control or regulation, in particular to an automatic adjustment method of a laser level meter, which comprises the following steps: acquiring a gray level image, and acquiring edge points and non-edge points in the gray level image through a canny operator; calculating the gray frequency, the chaotic degree and the similarity of each non-edge point; obtaining a first preferred value and a second preferred value of each non-edge point, and obtaining a background clustering center and a laser clustering center; calculating a background judgment value and a laser judgment value of each non-edge point to divide each non-edge point into a background point and a laser point; calculating a detection effect according to the background points, the laser points and the edge points; when the detection effect is greater than the detection threshold, correcting the laser level according to the edge point; when the detection effect is smaller than or equal to the detection threshold, correcting the low threshold in the canny operator according to the detection effect until the detection effect is larger than the detection threshold, stopping correction, and correcting the laser level according to the edge point. The application can accurately correct the laser level meter.
Description
Technical Field
The application relates to the technical field of control or regulation, in particular to an automatic adjustment method of a laser level meter.
Background
The laser level is a measuring instrument which is formed by installing and fixing a laser device on a telescope tube of a common level, and in the using process, the laser level enables the laser beam to form a laser surface through a prism light guide system so as to project a horizontal and vertical laser line, thereby realizing the purpose of measurement. When the measurement result of the laser level meter is inaccurate, the laser level meter can be corrected by the laser line projected on the measurement object, so that whether the laser line of the laser level meter is accurate directly influences the performance of the laser level meter or not is significant for automatic adjustment of the laser level meter.
In the prior art, a threshold value is generally utilized to process an image containing a laser line to obtain the laser line, for example, a pixel point corresponding to the laser line is marked as a pixel point corresponding to the laser line, so as to obtain the laser line. Therefore, a method is needed to accurately acquire the laser line, and further accurately realize the automatic adjustment of the laser level.
Disclosure of Invention
In order to solve the technical problems, the application aims to provide an automatic adjustment method of a laser level, which adopts the following technical scheme:
collecting an image to obtain a gray level image corresponding to the image; acquiring edge points and non-edge points in the gray level map through a canny operator; calculating the gray frequency of each non-edge point;
randomly selecting a non-edge point, taking the non-edge point as a center to obtain a set area corresponding to the non-edge point, and calculating the confusion degree and similarity corresponding to the non-edge point according to each non-edge point in the set area;
according to the gray frequency, the similarity and the chaotic degree, calculating a first preferred value of each non-edge point, and taking the non-edge point corresponding to the maximum first preferred value as a background clustering center;
according to the background clustering center and each non-edge point, calculating a second preferred value of each non-edge point, and taking the non-edge point corresponding to the maximum second preferred value as a laser clustering center;
obtaining a background judgment value of each non-edge point based on each non-edge point and a background clustering center; obtaining laser judgment values of the non-edge points based on the non-edge points and the laser clustering center; dividing each non-edge point into a background point and a laser point according to the background judgment value and the laser judgment value;
calculating a detection effect according to the background points, the laser points and the edge points;
when the detection effect is greater than the detection threshold, correcting the laser level according to the edge point;
when the detection effect is smaller than or equal to the detection threshold, correcting the low threshold in the canny operator according to the detection effect, and re-acquiring the edge point and the non-edge point in the gray level by using the corrected low threshold until the detection effect is larger than the detection threshold, stopping correction, and correcting the laser level according to the edge point.
Preferably, the method for calculating the confusion degree and the similarity corresponding to the non-edge points according to the non-edge points in the set area includes: calculating gray value differences between other non-edge points except the non-edge point in the set area and the non-edge point, and determining the degree of confusion according to the gray value differences;
the similarity is as follows:
wherein ,is a non-edge pointIs a function of the similarity of the sequences,is a non-edge pointGray values of (2);to set the non-edge points in the areaGray values of the other i-th non-edge points;to set the non-edge points in the areaGray frequencies of the other i-th non-edge points;is a non-edge pointIs a gray scale frequency of (2);to set the non-edge points in the areaThe degree of confusion of the ith non-edge point outside;is a non-edge pointIs a degree of confusion of (2);to set the non-edge points in the areaTotal number of non-edge points outside;is a natural constant;as a function of the maximum value;to a function that finds the absolute value.
Preferably, the method for calculating the first preferred value of each non-edge point according to the gray frequency, the similarity and the degree of confusion specifically includes: and (3) marking the sum of the chaotic degree and the non-0 constant as a first characteristic value, marking the ratio of the gray frequency to the first characteristic value as a second characteristic value, and marking the product of the second characteristic value and the similarity as a first preferred value.
Preferably, the second preferred value is:
wherein ,for the second preferred value of the b-th non-edge point except the background cluster center z,gray values of the b-th non-edge points except the background cluster center z;the degree of confusion of the b-th non-edge point except the background cluster center z;the gray value of the background clustering center z is obtained;as a function of the maximum value;to a function that finds the absolute value.
Preferably, the background judgment value of each non-edge point is obtained based on each non-edge point and the background clustering center; obtaining laser judgment values of the non-edge points based on the non-edge points and the laser clustering center; the method for dividing each non-edge point into a background point and a laser point according to the background judgment value and the laser judgment value comprises the following specific steps:
obtaining the distance from each non-edge pixel point to the background clustering center, arranging the distances in order from small to large, and calculating the background judgment value and the laser judgment value of the edge point from the minimum distance; comparing the background judgment value with the laser judgment value, and when the laser judgment value is larger than the background judgment value, the non-edge point is a laser point; when the laser judgment value is smaller than or equal to the background judgment value, the non-edge point is a background point; dividing each non-edge point into a background point and a laser point;
the background determination value is:
wherein ,is a non-edge pointBackground judgment value of (2);is the gray value of the non-edge point c,the gray value of the background clustering center z is obtained;the gray value of the jth background point in the current background points is used as the gray value of the jth background point;the distance between the jth background point in the current background points and the background clustering center z is the distance between the jth background point and the background clustering center z;the maximum value of the distance between the current background point and the background clustering center z;for the number of current background points,is a natural constant;a function for obtaining an absolute value;
the laser judgment value is as follows:
wherein ,is a non-edge pointIs a laser determination value of (2);is the gray value of the non-edge point c,the gray value of the laser clustering center o;the gray value of the kth laser point in the current laser points is obtained;the distance between the kth laser point in the current laser points and the laser clustering center o is the distance between the kth laser point and the laser clustering center o;the maximum value of the distance between the current laser point and the laser clustering center o;for the number of laser points present,is a natural constant;to a function that finds the absolute value.
Preferably, the method for calculating the detection effect according to the background point, the laser point and the edge point specifically includes: acquiring a laser area according to the laser points, wherein the laser area is formed by the laser points; marking laser points positioned at the boundary of the laser region as laser boundary points; obtaining a background area according to background points, wherein the background area is formed by the background points, and the background points positioned at the boundary of the background area are marked as background boundary points; and the background boundary point and the laser boundary point are collectively called as boundary points, and the detection effect is determined according to the minimum distance between each boundary point and the edge point.
Preferably, the modified low threshold is:, wherein ,in order to correct the low threshold value after the correction,is a low threshold value and is set to be a low threshold value,is the detection effect.
The embodiment of the application has at least the following beneficial effects:
according to the method, edge points and non-edge points in the gray level map are obtained through a canny operator; calculating the corresponding chaotic degree, similarity and gray frequency of each non-edge point; when the similarity is calculated, the gray value, the gray frequency and the chaotic degree are all considered, and considered factors are comprehensive, so that a more accurate similarity calculation result can be obtained. Further acquiring a first preferred value and a second preferred value of each non-edge point, acquiring a laser clustering center and a background clustering center according to the first preferred value and the second preferred value, and dividing each non-edge point into a background point and a laser point; the laser clustering center and the background clustering center are acquired through the first preferred value and the second preferred value instead of the random blind acquisition, so that the dividing result of each non-edge point can be accurately obtained; calculating a detection effect according to the background points, the laser points and the edge points; when the detection effect is greater than the detection threshold, correcting the laser level according to the edge point; when the detection effect is smaller than or equal to the detection threshold, correcting the low threshold in the canny operator according to the detection effect to obtain a corrected low threshold, and stopping correcting the low threshold in the canny operator until the detection effect is larger than the detection threshold. According to the application, the low threshold value in the canny operator is continuously corrected through the detection effect, so that the edge point can be acquired more accurately, the influence of the detection precision of the edge point on the detection precision of the laser line is avoided, the detection precision and the detection efficiency of the laser line are improved, and the automatic adjustment efficiency and the automatic adjustment accuracy of the laser level meter are improved.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions and advantages of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments of the application, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for automatically calibrating a laser level according to an embodiment of the present application.
Detailed Description
In order to further describe the technical means and effects adopted by the present application to achieve the preset purpose, the following detailed description of the specific embodiments, structures, features and effects thereof according to the present application is given with reference to the accompanying drawings and the preferred embodiments. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.
The specific scene aimed by the application is as follows: the application aims at the laser level to be delivered from a factory, and the adjustment work is needed to be completed before delivery from the factory.
Referring to fig. 1, a method flowchart of a method for automatically calibrating a laser level according to an embodiment of the application is shown, the method includes the following steps:
step 1, acquiring an image to obtain a gray level image corresponding to the image; acquiring edge points and non-edge points in the gray level map through a canny operator; and calculating the gray frequency of each non-edge pixel point.
Specifically, an image formed on a panel by laser lines emitted by a laser level meter is collected by an industrial camera, the image not only comprises the panel but also comprises more than two laser lines generated by the laser level meter, and the laser lines comprise horizontal laser lines and vertical laser lines, wherein a fixed light source irradiation mode is adopted when the image is collected.
Because the images acquired by the industrial camera are RGB images, in order to reduce the calculation amount, the images are subjected to graying processing by using a weighted graying method, so that gray images corresponding to the images are obtained. The weighted gray scale is a known technique and will not be described in detail.
Then, edge detection is carried out on the gray level image through a canny operator, and edge points and non-edge points in the gray level image are obtained; the canny operator has two thresholds in the edge detection process; i.e. high thresholdAnd a low thresholdManually selecting a high threshold value and a low threshold value; if the pixel point gradient in the gray level diagram is larger than or equal to the high threshold value, the corresponding pixel point is considered to be a strong edge point, and if the pixel point gradient in the gray level diagram is larger than the low threshold value and smaller than the high threshold value, the corresponding pixel point is considered to be a weak edge point; if the gradient of the pixel points in the gray level map is smaller than or equal to the low threshold value, the corresponding pixel points are considered to be non-edge points and are restrained. Wherein, the strong edge point and the weak edge point are both edge points.
The pixel points in the gray level image are divided into two types of pixel points through a canny operator, wherein one type of pixel points are edge points, and the other type of pixel points are non-edge points.
According to the gray values of the non-edge points, the gray frequency of each non-edge point is calculated, specifically, the gray values of all the non-edge points are counted, the number of times of each gray value in the gray map is counted, and the ratio of the number of times to the total number of all the non-edge points is recorded as the gray frequency of the corresponding non-edge point.
Step 2, arbitrarily selecting a non-edge point, and taking the non-edge point as a center to obtain a set area corresponding to the non-edge point; and calculating the confusion degree and the similarity corresponding to the non-edge points according to the non-edge points in the set area.
According to each non-edge point in the set area, calculating the confusion degree and similarity corresponding to the non-edge point, including: calculating gray value differences between other non-edge points except the non-edge point in the setting area and the non-edge point, determining the confusion degree according to the gray value differences, and expressing the confusion degree as follows by a formula:
wherein ,is a non-edge pointIs used for the degree of confusion of the (a),is a non-edge pointGray values of (2);to set the non-edge points in the areaThe gray values of the other i-th non-edge points,to set the non-edge points in the areaTotal number of non-edge points outside;to a function that finds the absolute value.
The chaotic degree represents the discrete degree of gray value distribution of non-edge points in the set area;characterization of non-edge pointsAnd set up the area unless the edge pointThe larger the difference of gray values among the ith non-edge points is, the larger the difference is, which means that the larger the discrete degree of the gray value distribution of the non-edge points in the setting area is, the larger the chaotic degree is; the less likely the non-edge point q is the background cluster center or laser cluster center in the subsequent process.
The similarity is as follows:
wherein ,is a non-edge pointIs a function of the similarity of the sequences,is a non-edge pointGray values of (2);to set the non-edge points in the areaGray values of the other i-th non-edge points;to set the non-edge points in the areaGray frequencies of the other i-th non-edge points;is a non-edge pointIs a gray scale frequency of (2);to set the non-edge points in the areaThe degree of confusion of the ith non-edge point outside;is a non-edge pointIs a degree of confusion of (2);to set the non-edge points in the areaTotal number of non-edge points outside;is a natural constant;as a function of the maximum value;to a function that finds the absolute value.
The similarity characterizes the degree of similarity between the non-edge points in the set region, the higher the degree of similarity,the larger the value of the non-edge point q is, the better the corresponding clustering effect is when the non-edge point q is a background clustering center or a laser clustering center in the subsequent process.Characterization of non-edge pointsAnd set up the area unless the edge pointThe larger the difference in gray value between the i-th non-edge points outside, the lower the degree of similarity between the non-edge points in the set region,the smaller the value of (2);characterization of non-edge pointsAnd set up the area unless the edge pointGray frequency differences between the other i-th non-edge points; the greater the difference, the lower the degree of similarity between the non-edge points within the set region,the smaller the value of (2);characterization of non-edge pointsAnd set up the area unless the edge pointThe degree of confusion between the i-th non-edge points outside the set area is greater, the degree of similarity between the non-edge points in the set area is lower,the smaller the value of (2); when the similarity is calculated, the gray value, the gray frequency and the chaotic degree are all considered, the considered factors are comprehensive, and a more accurate calculation result can be obtained.
The size of the setting area in this embodiment is 5×5, and the practitioner can set the size of the setting area according to the actual situation.
Step 3, calculating a first preferred value of each non-edge point according to the gray frequency, the similarity and the chaotic degree, and taking the non-edge point corresponding to the maximum first preferred value as a background clustering center; and calculating a second preferred value of each non-edge point according to the background clustering center and each non-edge point, and taking the non-edge point corresponding to the maximum second preferred value as a laser clustering center.
The method for calculating the first preferred value of each non-edge point according to the gray frequency, the similarity and the chaotic degree specifically comprises the following steps: marking the sum of the chaotic degree and the non-0 constant as a first characteristic value, marking the ratio of the gray frequency to the first characteristic value as a second characteristic value, and marking the product of the second characteristic value and the similarity as a first preferred value; expressed by the formula:,is the first preferred value for the non-edge point q,is the gray frequency of the non-edge point q,to the extent of confusion of the non-edge points q,is a constant other than 0, in this embodiment=1, the practitioner can adjust according to the specific situationThe value of (2) ensures that the denominator in the formula is not 0.
According to common knowledge, the laser lines emitted by the laser level instrument have small width, the laser lines are projected onto the panel, and a plurality of criss-cross laser lines are displayed on the panel to obtain a gray level diagram, so that the number of non-edge points corresponding to the laser lines in the gray level diagram is equal to the number of non-edge points corresponding to the panelThe number of points is greatly different, namely the number of non-edge points corresponding to the panel is far more than the number of non-edge points corresponding to the laser line, the gray values of the non-edge points corresponding to the panel tend to be consistent, so that the gray frequencies of the non-edge points corresponding to the panel are far more than those of the non-edge points corresponding to the laser line, the area formed by the non-edge points corresponding to the panel is marked as a background area, and the area formed by the non-edge points corresponding to the laser line is marked as a laser area; therefore, the gray frequency corresponding to the non-edge point is used as a reference factor for calculating the first preferred value corresponding to the non-edge point, and the larger the gray frequency is, the larger the first preferred value corresponding to the non-edge point is, the more likely the first preferred value is to be the background clustering center.Representing the discrete degree of gray value distribution of non-edge points in a set area corresponding to the non-edge point q, wherein the larger the discrete degree is, the smaller the first preferred value of the non-edge point q is, the less likely the non-edge point q is to be a background clustering center;the degree of similarity between the non-edge points in the set area corresponding to the non-edge point q is represented, and the higher the degree of similarity is, the larger the first preferred value of the non-edge point q is, namely the more likely the non-edge point q is a background clustering center.
The second preferred value is:
wherein ,for the second preferred value of the b-th non-edge point except the background cluster center z,gray values of the b-th non-edge points except the background cluster center z;the degree of confusion of the b-th non-edge point except the background cluster center z;the gray value of the background clustering center z is obtained;as a function of the maximum value;to a function that finds the absolute value.
The second preferred value characterizes the possibility that the corresponding non-edge point is the laser clustering center, and the larger the value of the second preferred value is, the more likely the second preferred value is the laser clustering center;the characteristic is the discrete degree of the gray value distribution of the non-edge points in the set area corresponding to the b-th non-edge point except the background clustering center z, and the gray values of the non-edge points corresponding to the laser lines tend to be consistent, so that the larger the discrete degree is, the more unlikely the b-th non-edge point except the background clustering center z is the laser clustering center.The difference of gray values of the b-th non-edge point except the background clustering center z and the background clustering center z is characterized, and the larger the difference is, the more likely the b-th non-edge point except the background clustering center z is a laser clustering center. While the present embodiment is throughThe difference is normalized, so that the magnitude of the second optimal value can be compared more conveniently, and the laser clustering center can be acquired accurately.
Step 4, obtaining a background judgment value of each non-edge point based on each non-edge point and a background clustering center; obtaining laser judgment values of the non-edge points based on the non-edge points and the laser clustering center; and dividing each non-edge point into a background point and a laser point according to the background judgment value and the laser judgment value.
Specifically, the distances from each non-edge pixel point to the background clustering center are obtained, the distances are arranged in the order from small to large, and the background judgment value and the laser judgment value of the edge point are calculated from the minimum distance; comparing the background judgment value with the laser judgment value, and when the laser judgment value is larger than the background judgment value, the non-edge point is a laser point; when the laser judgment value is smaller than or equal to the background judgment value, the non-edge point is a background point; dividing each non-edge point into a background point and a laser point;
the background determination value is:
wherein ,is a non-edge pointBackground judgment value of (2);is the gray value of the non-edge point c,the gray value of the background clustering center z is obtained;the gray value of the jth background point in the current background points is used as the gray value of the jth background point;the distance between the jth background point in the current background points and the background clustering center z is the distance between the jth background point and the background clustering center z;the maximum value of the distance between the current background point and the background clustering center z;as the wayThe number of foreground and background points is determined,is a natural constant;to a function that finds the absolute value.
The background judgment value characterizes the possibility that the non-edge point is a background point, and the larger the value of the background judgment value is, the larger the possibility that the non-edge point is the background point is;the gray value difference between the non-edge point c and the background clustering center z is represented, and the larger the difference is, the smaller the value of the background judgment value is, namely the non-edge point c is less likely to be a background point;the gray value difference between the non-edge point c and the jth background point in the current background points is represented, the larger the difference is, the smaller the value of the background judgment value is, i.e. the non-edge point c is less likely to be the background point,taking the distance between the jth background point in the current background point and the background clustering center z as a correction coefficient of the gray value difference between the non-edge point c and the jth background point in the current background point; the closer the distance is, the more credible the gray value difference between the non-edge point c and the jth background point in the current background points is; the background judgment value of the non-edge point can be calculated more accurately, and an accurate judgment result can be obtained.
The laser judgment value is as follows:
wherein ,is a non-edge pointIs a laser determination value of (2);is the gray value of the non-edge point c,the gray value of the laser clustering center o;the gray value of the kth laser point in the current laser points is obtained;the distance between the kth laser point in the current laser points and the laser clustering center o is the distance between the kth laser point and the laser clustering center o;the maximum value of the distance between the current laser point and the laser clustering center o;for the number of laser points present,is a natural constant;to a function that finds the absolute value.
The laser judgment value characterizes the possibility that the non-edge point is a laser point, and the larger the value of the laser judgment value is, the larger the possibility that the non-edge point is the laser point is;the gray value difference between the non-edge point c and the laser clustering center o is represented, and the larger the difference is, the smaller the value of the laser judgment value is, namely the less likely the non-edge point c is the laser point;the gray value difference between the non-edge point c and the kth laser point in the current laser points is characterized, the larger the difference is, the smaller the value of the laser judgment value is, namely the less likely the non-edge point c is the laser point,taking the distance between the kth laser point in the current laser point and the laser clustering center o as a correction coefficient of gray value difference between the non-edge point c and the kth background point in the current laser point; the closer the distance is, the more credible the gray value difference between the non-edge point c and the kth laser point in the current laser points is; the laser judgment value of the non-edge point can be calculated more accurately.
It should be noted that, since there are multiple laser lines in the image, the laser lines will divide the background area, if the distance measurement is directly used for judging, the background point far away from the background clustering center is most likely to be misjudged as the laser point, if the gray value difference is directly used for judging, the judgment is easily interfered by external factors, such as uneven illumination, and further misjudgment occurs, so when judging each non-edge point, the misjudgment probability of the remaining non-edge point is reduced, and the judgment of each non-edge point is more accurately completed by the judging result (the number of the current background points and the number of the current laser points) of the non-edge point which has already been judged participating in the class judgment of the remaining non-edge point.
When the number of the non-edge points corresponding to each distance is at least two, sequentially calculating a background judgment value and a laser judgment value of each non-edge point according to the sequence from top to bottom and from left to right; in this embodiment, only the distance from each non-edge pixel point to the background clustering center is introduced as a selection criterion, and the background determination value and the laser determination value of each non-edge point are calculated, that is, the background clustering center is used as a starting point to cluster each non-edge point to obtain a laser point and a background point, and an operator can also use the distance from each non-edge point to the laser clustering center as a selection criterion in a specific operation process to calculate the background determination value and the laser determination value of each non-edge point, that is, the laser clustering center is used as a starting point to cluster each non-edge point to obtain a laser point and a background point; of course, the implementer may cluster each non-edge point by using the laser cluster center and the background cluster center as the starting points. The different starting points are selected by taking the distance as a selection criterion, and the specific selection process is consistent with the process of taking the background clustering center as the starting point, and is not repeated.
And 5, calculating the detection effect according to the background point, the laser point and the edge point.
Specifically, a laser area is obtained according to laser points, and the laser area is formed by the laser points; marking laser points positioned at the boundary of the laser region as laser boundary points; obtaining a background area according to background points, wherein the background area is formed by the background points, and the background points positioned at the boundary of the background area are marked as background boundary points; the background boundary point and the laser boundary point are collectively called as boundary points, and the detection effect is determined according to the minimum distance between each boundary point and the edge point; the formula is as follows:
wherein ,for the number of boundary points,is the minimum distance between the s-th boundary point and the edge point.Maximum value of minimum distance between all boundary points and edge points; the smaller the minimum distance is, the closer the boundary points obtained by clustering are to the edge points obtained by the detection of the canny operator, namely, the better the detection effect of the canny operator is, the more accurate the selection of the high threshold and the low threshold is.
Step 6, correcting the laser level according to the edge point when the detection effect is greater than the detection threshold; when the detection effect is smaller than or equal to the detection threshold, correcting the low threshold in the canny operator according to the detection effect, and re-acquiring the edge point and the non-edge point in the gray level by using the corrected low threshold until the detection effect is larger than the detection threshold, stopping correction, and correcting the laser level according to the edge point.
Specifically, when the detection effect is greater than the detection threshold, the value of the detection threshold in this embodiment is 0.8, and the practitioner can set the value of the detection threshold according to the actual situation; and obtaining the laser line by using a Hough straight line detection algorithm on the edge points, further obtaining the offset, levelness and verticality of the laser line, and automatically adjusting the laser level group mode according to the offset, levelness and verticality. The hough straight line detection algorithm is a known technology, and the method for obtaining the offset, the levelness and the verticality and the method for automatically adjusting the laser level group module according to the offset, the levelness and the verticality are known technologies and are not described in detail.
The modified low threshold is:, wherein ,in order to correct the low threshold value after the correction,is a low threshold value and is set to be a low threshold value,is the detection effect. The detection effect is utilized to correct the low threshold value, so that a more accurate low threshold value can be obtained, and further, the offset, the levelness and the verticality of the laser line can be accurately obtained, and the correction of the laser level meter is accurately realized.
wherein ,should be smaller than,The method comprises the steps that a high threshold value in a canny operator is manually selected in the step 1; when the corrected low threshold is greater thanSelecting the edge point corresponding to the maximum detection effect to perform laser level meterAnd (5) row correction.
It should be noted that, in this embodiment, only the low threshold after the first correction is described, when the low threshold is corrected for the second time, the corrected low threshold is the low threshold after the first correction, that is, when each correction is performed, the corrected low threshold is the current low threshold, and when the first correction is performed, the current low threshold is the low threshold in the canny operator manually selected in step 1; in the second correction, the current low threshold value is the low threshold value after the first correction; and the like, stopping correction until the detection effect is larger than the detection threshold value.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the application and are intended to be included within the scope of the application.
Claims (7)
1. An automatic adjustment method of a laser level meter is characterized by comprising the following steps:
collecting an image to obtain a gray level image corresponding to the image; acquiring edge points and non-edge points in the gray level map through a canny operator; calculating the gray frequency of each non-edge point;
randomly selecting a non-edge point, taking the non-edge point as a center to obtain a set area corresponding to the non-edge point, and calculating the confusion degree and similarity corresponding to the non-edge point according to each non-edge point in the set area;
according to the gray frequency, the similarity and the chaotic degree, calculating a first preferred value of each non-edge point, and taking the non-edge point corresponding to the maximum first preferred value as a background clustering center;
according to the background clustering center and each non-edge point, calculating a second preferred value of each non-edge point, and taking the non-edge point corresponding to the maximum second preferred value as a laser clustering center;
obtaining a background judgment value of each non-edge point based on each non-edge point and a background clustering center; obtaining laser judgment values of the non-edge points based on the non-edge points and the laser clustering center; dividing each non-edge point into a background point and a laser point according to the background judgment value and the laser judgment value;
calculating a detection effect according to the background points, the laser points and the edge points;
when the detection effect is greater than the detection threshold, correcting the laser level according to the edge point;
when the detection effect is smaller than or equal to the detection threshold, correcting the low threshold in the canny operator according to the detection effect, and re-acquiring the edge point and the non-edge point in the gray level by using the corrected low threshold until the detection effect is larger than the detection threshold, stopping correction, and correcting the laser level according to the edge point.
2. The method for automatically calibrating a laser level according to claim 1, wherein the method for calculating the degree of confusion and the similarity corresponding to the non-edge points according to the non-edge points in the set area comprises: calculating gray value differences between other non-edge points except the non-edge point in the set area and the non-edge point, and determining the degree of confusion according to the gray value differences;
the similarity is as follows:
wherein ,is a non-edge point->Similarity of->Is a non-edge point->Gray values of (2); />To set the area except for the edge point>Gray values of the other i-th non-edge points; />To set the area except for the edge point>Gray frequencies of the other i-th non-edge points; />Is a non-edge point->Is a gray scale frequency of (2); />To set the area except for the edge point>The degree of confusion of the ith non-edge point outside; />Is a non-edge point->Is a degree of confusion of (2); />To set the area except for the edge point>Total number of non-edge points outside; />Is a natural constant; />As a function of the maximum value; />To a function that finds the absolute value.
3. The method for automatically calibrating a laser level according to claim 1, wherein the method for calculating the first preferred value of each non-edge point according to the gray scale frequency, the similarity and the degree of confusion is specifically as follows: and (3) marking the sum of the chaotic degree and the non-0 constant as a first characteristic value, marking the ratio of the gray frequency to the first characteristic value as a second characteristic value, and marking the product of the second characteristic value and the similarity as a first preferred value.
4. The method of claim 1, wherein the second preferred value is:
wherein ,for the second preferred value of the b-th non-edge point except the background cluster center z,/o>Gray values of the b-th non-edge points except the background cluster center z; />Is the b non-edge point except the background cluster center zDegree of confusion; />The gray value of the background clustering center z is obtained; />As a function of the maximum value; />To a function that finds the absolute value.
5. The automatic calibration method of a laser level according to claim 1, wherein the background determination value of each non-edge point is obtained based on each non-edge point and a background cluster center; obtaining laser judgment values of the non-edge points based on the non-edge points and the laser clustering center; the method for dividing each non-edge point into a background point and a laser point according to the background judgment value and the laser judgment value comprises the following specific steps:
obtaining the distance from each non-edge pixel point to the background clustering center, arranging the distances in order from small to large, and calculating the background judgment value and the laser judgment value of the edge point from the minimum distance; comparing the background judgment value with the laser judgment value, and when the laser judgment value is larger than the background judgment value, the non-edge point is a laser point; when the laser judgment value is smaller than or equal to the background judgment value, the non-edge point is a background point; dividing each non-edge point into a background point and a laser point;
the background determination value is:
wherein ,is a non-edge point->Background judgment value of (2); />Gray value of non-edge point c, +.>The gray value of the background clustering center z is obtained; />The gray value of the jth background point in the current background points is used as the gray value of the jth background point; />The distance between the jth background point in the current background points and the background clustering center z is the distance between the jth background point and the background clustering center z; />The maximum value of the distance between the current background point and the background clustering center z; />For the number of current background spots, +.>Is a natural constant; />A function for obtaining an absolute value;
the laser judgment value is as follows:
wherein ,is a non-edge point->Is a laser determination value of (2); />Gray value of non-edge point c, +.>The gray value of the laser clustering center o; />The gray value of the kth laser point in the current laser points is obtained; />The distance between the kth laser point in the current laser points and the laser clustering center o is the distance between the kth laser point and the laser clustering center o; />The maximum value of the distance between the current laser point and the laser clustering center o; />For the number of current laser spots +.>Is a natural constant; />To a function that finds the absolute value.
6. The automatic calibration method of a laser level according to claim 1, wherein the method for calculating the detection effect according to the background point, the laser point and the edge point specifically comprises: acquiring a laser area according to the laser points, and marking the laser points positioned at the boundary of the laser area as laser boundary points; acquiring a background area according to the background points, and marking the background points positioned at the boundary of the background area as background boundary points; and determining the detection effect according to the minimum distance between each boundary point and each edge point.
7. According to the weightsThe method for automatically calibrating a laser level according to claim 1, wherein the corrected low threshold is:, wherein ,/>For a modified low threshold, +.>Is of low threshold value, +.>Is the detection effect.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310819519.1A CN116543175B (en) | 2023-07-06 | 2023-07-06 | Automatic adjustment method of laser level |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310819519.1A CN116543175B (en) | 2023-07-06 | 2023-07-06 | Automatic adjustment method of laser level |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116543175A CN116543175A (en) | 2023-08-04 |
CN116543175B true CN116543175B (en) | 2023-08-29 |
Family
ID=87458212
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310819519.1A Active CN116543175B (en) | 2023-07-06 | 2023-07-06 | Automatic adjustment method of laser level |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116543175B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118135243B (en) * | 2024-05-07 | 2024-07-16 | 陕西优耐特机械有限公司 | Light path stability detection method of laser cutting machine |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109788279A (en) * | 2018-11-27 | 2019-05-21 | 佛山市奥策科技有限公司 | A kind of linear light source and line-scan digital camera calibration method and device |
CN109919159A (en) * | 2019-01-22 | 2019-06-21 | 西安电子科技大学 | A kind of semantic segmentation optimization method and device for edge image |
CN112991536A (en) * | 2021-04-20 | 2021-06-18 | 中国科学院软件研究所 | Automatic extraction and vectorization method for geographic surface elements of thematic map |
-
2023
- 2023-07-06 CN CN202310819519.1A patent/CN116543175B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109788279A (en) * | 2018-11-27 | 2019-05-21 | 佛山市奥策科技有限公司 | A kind of linear light source and line-scan digital camera calibration method and device |
CN109919159A (en) * | 2019-01-22 | 2019-06-21 | 西安电子科技大学 | A kind of semantic segmentation optimization method and device for edge image |
CN112991536A (en) * | 2021-04-20 | 2021-06-18 | 中国科学院软件研究所 | Automatic extraction and vectorization method for geographic surface elements of thematic map |
Non-Patent Citations (1)
Title |
---|
基于激光测距的飞机着陆滑行灯靶板自动化校准系统;夏清鹰;《新技术新仪器》;第第41卷卷(第第6期期);第41-47页 * |
Also Published As
Publication number | Publication date |
---|---|
CN116543175A (en) | 2023-08-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN116543175B (en) | Automatic adjustment method of laser level | |
CN108833912A (en) | A kind of measurement method and system of video camera machine core optical axis center and field angle | |
CN105976767A (en) | Area source brightness uniformity adjusting method, device and system | |
JP2010281638A (en) | Distance measuring device and distance measuring method | |
CN104635428A (en) | Focusing and leveling measurement apparatus based on image processing and method thereof | |
CN113487539B (en) | Gel path quality analysis method, device, system and storage medium | |
CN103559484A (en) | Fast recognition method for measuring instrument scale lines | |
CN113160223A (en) | Contour determination method, contour determination device, detection device and storage medium | |
CN106289678A (en) | A kind of cylinder abnormity drum song detection device and recognition methods | |
CN113936580B (en) | Display screen brightness measurement model generation method and related device | |
US10520424B2 (en) | Adaptive method for a light source for inspecting an article | |
CN112484846B (en) | Method and device for measuring target radiation illuminance of aerial point by utilizing infrared band | |
CN117821907A (en) | Coating correction system and method for electron beam evaporation coating machine | |
CN115205317B (en) | Bridge monitoring photoelectric target image light spot center point extraction method | |
CN111638042A (en) | DLP optical characteristic test analysis method | |
KR102344054B1 (en) | A diagnostic method of a multi-optical vision system using a reference target | |
CN111539329B (en) | Self-adaptive substation pointer instrument identification method | |
CN114111622B (en) | Method for detecting depth of bar rolling pass based on image processing | |
CN115112015A (en) | Method, device and equipment for calibrating electron beam diaphragm and readable storage medium | |
CN113379816B (en) | Structure change detection method, electronic device, and storage medium | |
US20230349687A1 (en) | Plant dimension measuring method | |
CN113566792B (en) | Device and method for adjusting optical axis of lens to be vertical to test plane | |
CN115420386A (en) | Unstable pixel testing method of infrared focal plane device based on relative current | |
CN114170319A (en) | Method and device for adjusting test target | |
CN106413280A (en) | Automatic surface mounting machine feeder element position correction device and automatic correction method based on image processing |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |