CN116543175A - Automatic adjustment method of laser level - Google Patents
Automatic adjustment method of laser level Download PDFInfo
- Publication number
- CN116543175A CN116543175A CN202310819519.1A CN202310819519A CN116543175A CN 116543175 A CN116543175 A CN 116543175A CN 202310819519 A CN202310819519 A CN 202310819519A CN 116543175 A CN116543175 A CN 116543175A
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 42
- 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 16
- 230000000739 chaotic effect Effects 0.000 claims abstract description 13
- 238000012512 characterization method Methods 0.000 description 5
- 238000005259 measurement Methods 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 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 invention 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 invention can accurately correct the laser level meter.
Description
Technical Field
The invention 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 invention 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 value 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, the method comprises the steps of, 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 invention 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 invention, 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 invention 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 invention, 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 invention.
Detailed Description
In order to further describe the technical means and effects adopted by the present invention to achieve the preset purpose, the following detailed description of the specific embodiments, structures, features and effects thereof according to the present invention 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 invention belongs.
The specific scene aimed by the invention is as follows: the invention 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 invention 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, a plurality of criss-cross laser lines are displayed on the panel, and a gray level map is obtained, so that the number of non-edge points corresponding to the laser lines in the gray level map is greatly different from that of the non-edge points corresponding to the panel, namely, the number of the non-edge points corresponding to the panel is far more than that of the non-edge points corresponding to the laser lines, the gray values of the non-edge points corresponding to the panel tend to be consistent, the gray level of the non-edge points corresponding to the laser lines tend to be consistent, the gray level frequency of the non-edge points corresponding to the panel is far greater than that of the non-edge points corresponding to the laser lines, the region formed by the non-edge points corresponding to the panel is marked as a background region, and the region formed by the non-edge points corresponding to the laser lines is marked as a laser region; 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 similarity between the non-edge points in the set area corresponding to the non-edge point q is represented, and the higher the similarity is, the larger the first preferred value of the non-edge point q is indicated, namely the more likely the non-edge point q is a background clusterAnd a 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.Characterization except for background cluster center zThe larger the difference in gray value between the b-th non-edge point of (c) and the background cluster center z, the more likely the b-th non-edge point other than the background cluster center z is the laser cluster 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,as backgroundThe gray value of the clustering center z;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;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, sayThe more credible the difference of gray values between the bright non-edge point c and the jth background point in the current background points; 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 determination value characterizes the non-edge point as a laserThe larger the light spot probability is, the larger the probability that the non-edge point is the laser spot 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; most preferably, the first to fourthThe smaller the small distance is, the closer the boundary points obtained by clustering are to the edge points obtained by 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, the method comprises the steps of, 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 thanAnd selecting the edge point corresponding to the maximum detection effect to correct the laser level.
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 are not limiting; although the present application has been described in detail with reference to the foregoing embodiments, it should 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 scope of the embodiments of the present application, and are intended to be included within the scope of the present 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; />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.
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. The method for automatically calibrating a laser level according to claim 1, wherein the modified 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 true CN116543175A (en) | 2023-08-04 |
CN116543175B 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) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118135243A (en) * | 2024-05-07 | 2024-06-04 | 陕西优耐特机械有限公司 | 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 |
---|
夏清鹰: "基于激光测距的飞机着陆滑行灯靶板自动化校准***", 《新技术新仪器》, vol. 41, no. 6, pages 41 - 47 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118135243A (en) * | 2024-05-07 | 2024-06-04 | 陕西优耐特机械有限公司 | Light path stability detection method of laser cutting machine |
CN118135243B (en) * | 2024-05-07 | 2024-07-16 | 陕西优耐特机械有限公司 | Light path stability detection method of laser cutting machine |
Also Published As
Publication number | Publication date |
---|---|
CN116543175B (en) | 2023-08-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN116543175B (en) | Automatic adjustment method of laser level | |
US20050281376A1 (en) | Method of compensating for image faults in an x-ray image recording | |
CN104635428B (en) | A kind of focusing and leveling measurement apparatus and method based on image procossing | |
JP2010281638A (en) | Distance measuring device and distance measuring method | |
CN107356202A (en) | A kind of laser scanning measurement system target sights method automatically | |
CN102421279A (en) | Shape basic matching parameter adjusting device, adjusting method, and part installing device | |
TW201824068A (en) | Exposure Time Determination Method of Image Sensing | |
CN105117725A (en) | License plate self-correcting identification method based on license plate credibility | |
CN102706536A (en) | Device and method for automatically measuring distortion of optical system with wide field of view | |
CN106289678A (en) | A kind of cylinder abnormity drum song detection device and recognition methods | |
US10520424B2 (en) | Adaptive method for a light source for inspecting an article | |
CN113487539B (en) | Gel path quality analysis method, device, system and storage medium | |
CN112115896B (en) | Instrument panel pointer reading prediction method and device, computer equipment and storage medium | |
CN111638042B (en) | DLP optical characteristic test analysis method | |
CN113160223A (en) | Contour determination method, contour determination device, detection device and storage medium | |
CN111189840B (en) | Paper defect detection method with near-field uniform illumination | |
CN115205317B (en) | Bridge monitoring photoelectric target image light spot center point extraction method | |
CN115514943B (en) | Method for detecting imaging quality of free-form surface lens | |
CN111539329B (en) | Self-adaptive substation pointer instrument identification method | |
KR101406648B1 (en) | System and method for measuring strip deviation | |
CN115112015A (en) | Method, device and equipment for calibrating electron beam diaphragm and readable storage medium | |
CN113566792B (en) | Device and method for adjusting optical axis of lens to be vertical to test plane | |
US20230349687A1 (en) | Plant dimension measuring method | |
US11445162B2 (en) | Method and device for calibrating binocular camera | |
CN112785963B (en) | LED lamp bead positioning method and device and storage medium |
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 |