CN115272451A - Light spot center positioning method and device - Google Patents
Light spot center positioning method and device Download PDFInfo
- Publication number
- CN115272451A CN115272451A CN202210731240.3A CN202210731240A CN115272451A CN 115272451 A CN115272451 A CN 115272451A CN 202210731240 A CN202210731240 A CN 202210731240A CN 115272451 A CN115272451 A CN 115272451A
- Authority
- CN
- China
- Prior art keywords
- light spot
- determining
- target
- histogram
- gray
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/70—Determining position or orientation of objects or cameras
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20112—Image segmentation details
- G06T2207/20132—Image cropping
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Length Measuring Devices By Optical Means (AREA)
Abstract
The invention provides a method and a device for positioning a light spot center, wherein the method comprises the following steps: determining a first target area and a second target area of the light spot image based on the gray level histogram of the light spot image; determining a first light spot symmetry axis in the first target region and a second light spot symmetry axis in the second target region based on the pixel correlation; and determining the intersection point of the first light spot symmetry axis and the second light spot symmetry axis as the center position of the light spot. The method and the device for positioning the center of the light spot not only can improve the efficiency of positioning the center of the light spot, but also can improve the accuracy of positioning the center of the light spot by introducing the pixel correlation into the positioning of the center of the light spot.
Description
Technical Field
The invention relates to the technical field of optical measurement, in particular to a method and a device for positioning a light spot center.
Background
Optical measurement is a high-tech measurement technology combining photoelectric technology and mechanical measurement, and can realize quick and accurate measurement on the premise of borrowing computer technology, so that optical measurement also becomes a more favored measurement mode for modern industrial detection.
The positioning of the spot center is crucial in optical measurements, which seriously affects the efficiency and accuracy of the whole measurement process. The current light spot center positioning method mainly comprises a gravity center method, a Hough transformation method and a Gaussian fitting method, but the methods have the following defects: under the conditions that the shape of the light spot is irregular and the gray distribution value is not uniform, the positioning accuracy of the gravity center method is poor; the Hough transformation method needs discretization processing on a parameter space, and influences the actual detection precision of the algorithm; because the laser is only in Gaussian distribution in the fundamental mode, and the laser generated by a plurality of lasers in the manufacturing process is not in perfect Gaussian distribution and is often deformed to some extent, a Gaussian fitting method is adopted to position the center of the light spot, so that a large error is generated, and the time is consumed.
Therefore, how to improve the accuracy and efficiency of the spot center positioning is an urgent problem to be solved in the industry.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a method and a device for positioning the center of a light spot.
In a first aspect, the present invention provides a method for positioning a spot center, including:
determining a first target area and a second target area of a light spot image based on a gray level histogram of the light spot image;
determining a first light spot symmetry axis in the first target region and a second light spot symmetry axis in the second target region based on pixel correlation;
and determining the intersection point of the first light spot symmetry axis and the second light spot symmetry axis as the center position of the light spot.
Optionally, according to a spot center positioning method provided by the present invention, determining a first spot symmetry axis in the first target region and a second spot symmetry axis in the second target region based on the pixel correlation includes:
determining a first sub-area and a second sub-area obtained by segmenting the first target area by any one first segmentation line, and acquiring a first pixel correlation degree of the first sub-area and the second sub-area;
determining a first dividing line corresponding to the maximum first pixel correlation degree in all the first pixel correlation degrees as the first light spot symmetry axis;
determining a third sub-area and a fourth sub-area obtained by dividing the second target area by any one second dividing line, and acquiring a second pixel correlation degree of the third sub-area and the fourth sub-area;
and determining a second dividing line corresponding to the largest second pixel correlation in all the second pixel correlations as the second light spot symmetry axis.
Optionally, according to a light spot center positioning method provided by the present invention, determining a first target area and a second target area of a light spot image based on a gray histogram of the light spot image includes:
respectively determining a transverse gray level histogram and a longitudinal gray level histogram of a light spot image, wherein the X coordinate of the transverse gray level histogram is the transverse serial number of pixels of the light spot image, the Y coordinate is the total gray level of each row of pixels of the light spot image, the X coordinate of the longitudinal gray level histogram is the longitudinal serial number of the pixels of the light spot image, and the Y coordinate is the total gray level of each row of pixels of the light spot image;
determining the first target region based on the horizontal gray histogram and determining the second target region based on the vertical gray histogram.
Optionally, according to the light spot center positioning method provided by the present invention, the light spot image is an annular light spot image;
in a case that the light spot image is an annular light spot image, determining the first target region based on the transverse gray histogram, and determining the second target region based on the longitudinal gray histogram, including:
determining two first valley points closest to the maximum peak point of the transverse gray level histogram based on the transverse gray level histogram;
determining the first target area based on the X coordinates corresponding to the two first valley points respectively;
determining two second valley points closest to the maximum peak point of the longitudinal gray level histogram based on the longitudinal gray level histogram;
and determining the second target area based on the X coordinates corresponding to the two second valley points respectively.
Optionally, according to the light spot center positioning method provided by the present invention, the light spot image is a non-annular light spot image;
in a case that the light spot image is a non-annular light spot image, determining the first target region based on the horizontal gray histogram and determining the second target region based on the vertical gray histogram, including:
determining a first target point and a second target point in the transverse gray-scale histogram, wherein gray values corresponding to the first target point and the second target point are preset multiples of a gray value corresponding to a maximum peak point of the transverse gray-scale histogram;
determining the first target area based on the X-coordinate of the first target point and the X-coordinate of the second target point;
determining a third target point and a fourth target point in the longitudinal gray histogram, wherein gray values corresponding to the third target point and the fourth target point are preset multiples of a gray value corresponding to a maximum peak point of the longitudinal gray histogram;
determining the second target area based on the X-coordinate of the third target point and the X-coordinate of the fourth target point.
Optionally, according to the method for positioning the center of the light spot provided by the present invention, the preset multiple is 1/e, where e is a natural base number.
In a second aspect, the present invention further provides a device for positioning a center of a light spot, including:
the first determining module is used for determining a first target area and a second target area of the light spot image based on the gray level histogram of the light spot image;
a second determination module for determining a first spot symmetry axis in the first target region and a second spot symmetry axis in the second target region based on pixel correlation;
and the third determining module is used for determining that the intersection point of the first light spot symmetry axis and the second light spot symmetry axis is the central position of the light spot.
In a third aspect, the present invention further provides an electronic device, which includes a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the spot center positioning method according to the first aspect.
In a fourth aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, which computer program, when executed by a processor, implements the spot center positioning method according to the first aspect.
In a fifth aspect, the present invention also provides a computer program product comprising a computer program which, when executed by a processor, implements the spot-centering method according to the first aspect.
According to the method and the device for positioning the center of the light spot, the first target area and the second target area of the light spot image are determined based on the gray level histogram of the light spot image, the first light spot symmetry axis is determined in the first target area based on the pixel correlation, the second light spot symmetry axis is determined in the second target area, and finally the intersection point of the first light spot symmetry axis and the second light spot symmetry axis is determined as the center position of the light spot.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a spot center positioning method according to the present invention;
FIG. 2 is a second schematic flowchart of the method for positioning the center of a light spot according to the present invention;
FIG. 3 is a schematic view of an annular light spot image provided by the present invention;
FIG. 4 is a schematic diagram of a vertical gray level histogram of an annular light spot image provided by the present invention;
FIG. 5 is a schematic diagram of a horizontal gray-scale histogram of an annular light spot image provided by the present invention;
FIG. 6 is a schematic diagram of a speckle image provided by the present invention;
FIG. 7 is a schematic diagram of a longitudinal gray histogram of a speckle image provided by the present invention;
FIG. 8 is a schematic diagram of a transverse grayscale histogram of a speckle image provided by the present invention;
fig. 9 is a schematic structural diagram of a spot center positioning device provided by the invention;
fig. 10 is a schematic physical structure diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to facilitate a clearer understanding of embodiments of the present invention, some relevant background information is first presented below.
The existing light spot center positioning method comprises a gravity center method, a Hough transformation method, a Gaussian fitting method and the like, but the methods have the following defects: under the conditions that the light spot is irregular in shape and the gray distribution value is not uniform, the positioning accuracy of the gravity center method is poor; the Hough transformation method needs discretization processing on a parameter space, and influences the actual detection precision of the algorithm; because the laser is only in Gaussian distribution in the fundamental mode, and the laser generated by a plurality of lasers is not in perfect Gaussian distribution during manufacturing, the lasers are often deformed to some extent, and a Gaussian fitting method is adopted to position the center of a light spot, so that a large error is generated, the time is consumed, and the method is generally applied to the process of preprocessing image data after the image data is acquired.
The existing spot center positioning method mainly has the following defects:
(1) The center of the light spot is not accurately positioned, so that a local image with more characteristic data cannot be accurately cut in the whole image.
(2) For the light spots with irregular shapes, the algorithm for determining the centers of the light spots by directly using the histogram has the defects of difficult center positioning and large positioning error.
(3) The current spot center positioning algorithm with high positioning accuracy is not suitable for being applied to the image data acquisition process due to large calculation amount, and is only suitable for being used after data acquisition, namely only suitable for the image data preprocessing process.
In order to overcome the above-mentioned drawbacks, the present invention provides a method and an apparatus for positioning the center of a light spot, and the method and the apparatus for positioning the center of a light spot provided by the present invention are described below with reference to fig. 1 to 10.
Fig. 1 is a schematic flow chart of a spot center positioning method provided by the present invention, as shown in fig. 1, the method includes:
Specifically, a gray histogram of the light spot image may be acquired, and the first target region and the second target region of the light spot image may be determined based on the gray histogram of the light spot image.
Alternatively, the first and second target areas of the spot image may be substantially active areas of the spots in the entire spot image.
Specifically, after the first target region and the second target region of the spot image are determined, a first spot symmetry axis may be determined in the first target region and a second spot symmetry axis may be determined in the second target region based on the pixel correlation.
It will be appreciated that two axes of symmetry of the spot in the determined target region may be determined based on the pixel correlation.
And 120, determining the intersection point of the first light spot symmetry axis and the second light spot symmetry axis as the center position of the light spot.
Specifically, after the first and second spot symmetry axes of the spot are determined based on the pixel correlation, an intersection point of the first and second spot symmetry axes may be determined and used as the center position of the spot.
In order to overcome the defects of low positioning accuracy and positioning efficiency of the conventional light spot center positioning method, the invention determines a first target area and a second target area of a light spot image based on a gray level histogram of the light spot image, determines a first light spot symmetry axis in the first target area and a second light spot symmetry axis in the second target area based on pixel correlation, and finally determines the intersection point of the first light spot symmetry axis and the second light spot symmetry axis as the center position of a light spot.
According to the spot center positioning method provided by the invention, the first target area and the second target area of the spot image are determined based on the gray level histogram of the spot image, the first spot symmetry axis is determined in the first target area based on the pixel correlation, the second spot symmetry axis is determined in the second target area, and finally the intersection point of the first spot symmetry axis and the second spot symmetry axis is determined as the center position of the spot, so that the spot center positioning efficiency can be improved, and the spot center positioning accuracy can be improved by introducing the pixel correlation into the spot center positioning.
Optionally, determining a first spot symmetry axis in the first target region and a second spot symmetry axis in the second target region based on the pixel correlation comprises:
determining a first sub-area and a second sub-area obtained by segmenting the first target area by any one first segmentation line, and acquiring a first pixel correlation degree of the first sub-area and the second sub-area;
determining a first dividing line corresponding to the maximum first pixel correlation degree in all the first pixel correlation degrees as the first light spot symmetry axis;
determining a third sub-area and a fourth sub-area obtained by segmenting the second target area by any one second segmentation line, and acquiring a second pixel correlation degree of the third sub-area and the fourth sub-area;
and determining a second dividing line corresponding to the largest second pixel correlation in all the second pixel correlations as the second light spot symmetry axis.
Specifically, a first sub-region and a second sub-region obtained by segmenting the first target region by any one first segmentation line may be determined, and a first pixel correlation degree of the first sub-region and the second sub-region may be obtained; and determining a first dividing line corresponding to the maximum first pixel correlation degree in all the first pixel correlation degrees as a first light spot symmetry axis.
Alternatively, the first division line may be moved once every full pixel within the range of the first target region, and the first pixel correlation of the first sub-region and the second sub-region divided by the first division line may be obtained.
Optionally, a first dividing line corresponding to the largest first pixel correlation among all the acquired first pixel correlations may be taken as the first spot symmetry axis.
Optionally, when the first pixel correlation degree of the first sub-region and the second sub-region is obtained, the larger region of the first sub-region and the second sub-region may be cut with the smaller region of the first sub-region and the second sub-region as a reference and the first dividing line as a symmetry axis, so that the two regions have the same size and are symmetrical about the first dividing line, and then the first pixel correlation degree of the first sub-region and the second sub-region may be determined.
Specifically, a third sub-region and a fourth sub-region obtained by segmenting the second target region by any one second segmentation line may be determined, and a second pixel correlation degree of the third sub-region and the fourth sub-region may be obtained; and determining a second dividing line corresponding to the largest second pixel correlation degree in all the second pixel correlation degrees as a second light spot symmetry axis.
Alternatively, the second division line may be moved once every other integer pixel within the range of the second target region, and the second pixel correlation of the third sub-region and the fourth sub-region divided by the second division line may be acquired.
Optionally, a second dividing line corresponding to a maximum second pixel correlation among all the acquired second pixel correlations may be used as the second spot symmetry axis.
Optionally, when the second pixel correlation degree of the third sub-region and the fourth sub-region is obtained, the smaller region of the third sub-region and the fourth sub-region may be taken as a reference, and the second dividing line may be taken as a symmetry axis, the larger region of the third sub-region and the fourth sub-region is cut, so that the two regions have the same size and are symmetrical about the second dividing line, and then the second pixel correlation degree of the third sub-region and the fourth sub-region is determined.
Optionally, the first pixel correlation of the first sub-region and the second sub-region, and the second pixel correlation of the third sub-region and the fourth sub-region, such as the correlation coefficient function corr, may be obtained based on any one of functions for calculating the correlation, which is not specifically limited in the present invention.
According to the invention, the pixel correlation is introduced into the light spot center positioning, the symmetry axis of the light spot is determined based on the correlation degree of the pixel, and the center position of the light spot is further determined based on the symmetry axis of the light spot, so that the accuracy of the light spot center positioning can be improved, the operation time of an algorithm can be reduced, and the efficiency of the light spot center positioning can be improved.
Optionally, determining a first target region and a second target region of the light spot image based on the gray histogram of the light spot image includes:
respectively determining a transverse gray level histogram and a longitudinal gray level histogram of a light spot image, wherein the X coordinate of the transverse gray level histogram is the transverse serial number of pixels of the light spot image, the Y coordinate is the total gray level of each row of pixels of the light spot image, the X coordinate of the longitudinal gray level histogram is the longitudinal serial number of the pixels of the light spot image, and the Y coordinate is the total gray level of each row of pixels of the light spot image;
determining the first target region based on the horizontal gray histogram and determining the second target region based on the vertical gray histogram.
Specifically, a horizontal gray histogram and a vertical gray histogram of the light spot image may be determined first, and then a first target region of the light spot image may be determined based on the horizontal gray histogram and a second target region of the light spot image may be determined based on the vertical gray histogram.
The X coordinate of the horizontal gray level histogram is the horizontal serial number of the light spot image pixel, the Y coordinate is the total gray level of each row of pixels of the light spot image, the X coordinate of the vertical gray level histogram is the vertical serial number of the light spot image pixel, and the Y coordinate is the total gray level of each row of pixels of the light spot image.
It is understood that the X coordinate of the horizontal gray histogram is the row sequence number of each row of pixels of the spot image, the Y coordinate is the total gray value of each row of pixels of the spot image, for example, if there are N rows of pixels of the spot image, the horizontal gray histogram represents a histogram sequence of N values.
It is understood that the X coordinate of the vertical gray histogram is the column serial number of each column of pixels of the light spot image, the Y coordinate is the total gray value of each column of pixels of the light spot image, for example, the pixels of the light spot image have M columns, and the vertical gray histogram represents a histogram sequence of M values.
Optionally, the light spot image is an annular light spot image;
in a case that the light spot image is an annular light spot image, determining the first target region based on the transverse gray histogram, and determining the second target region based on the longitudinal gray histogram, including:
determining two first valley points closest to the maximum peak point of the transverse gray level histogram based on the transverse gray level histogram;
determining the first target area based on the X coordinates corresponding to the two first valley points respectively;
determining two second valley points closest to the maximum peak point of the longitudinal gray level histogram based on the longitudinal gray level histogram;
and determining the second target area based on the X coordinates corresponding to the two second valley points respectively.
Alternatively, in the embodiment of the present invention, the light spot image may be an annular light spot image, that is, a light spot image having a light spot with an annular structure.
Specifically, in the case that the light spot image is an annular light spot image, two first valley points closest to the maximum peak point of the transverse gray histogram may be first determined based on the transverse gray histogram, and then the first target region may be determined based on X coordinates corresponding to the two first valley points, respectively.
Specifically, in the case that the light spot image is an annular light spot image, two second valley points closest to the maximum peak point of the vertical gray histogram may be determined based on the vertical gray histogram, and then the second target region may be determined based on the X coordinates corresponding to the two second valley points, respectively.
Optionally, the light spot image is a non-annular light spot image;
in a case that the light spot image is a non-annular light spot image, determining the first target region based on the horizontal gray histogram and determining the second target region based on the vertical gray histogram, including:
determining a first target point and a second target point in the transverse gray histogram, wherein gray values corresponding to the first target point and the second target point are preset multiples of a gray value corresponding to a maximum peak point of the transverse gray histogram;
determining the first target area based on the X coordinate of the first target point and the X coordinate of the second target point;
determining a third target point and a fourth target point in the longitudinal gray level histogram, wherein gray values corresponding to the third target point and the fourth target point are preset multiples of a gray value corresponding to a maximum peak point of the longitudinal gray level histogram;
determining the second target area based on the X-coordinate of the third target point and the X-coordinate of the fourth target point.
Alternatively, in the embodiment of the present invention, the spot image may be a non-annular spot image, that is, a spot image without a ring-shaped structure spot.
Specifically, in a case that the light spot image is a non-annular light spot image, a first target point and a second target point may be first determined in the transverse gray-scale histogram, where gray values corresponding to the first target point and the second target point respectively are preset multiples of a gray value corresponding to a maximum peak point of the transverse gray-scale histogram, and then the first target area may be determined based on an X coordinate of the first target point and an X coordinate of the second target point.
Specifically, in a case that the light spot image is a non-annular light spot image, a third target point and a fourth target point may be first determined in the longitudinal gray histogram, where gray values corresponding to the third target point and the fourth target point respectively are preset multiples of a gray value corresponding to a maximum peak point of the longitudinal gray histogram, and then the second target area is determined based on an X coordinate of the third target point and an X coordinate of the fourth target point.
Optionally, in the embodiment of the present invention, the gray scale values respectively corresponding to the first target point and the second target point may be 1/e of the gray scale value corresponding to the maximum peak point of the horizontal gray scale histogram, where e is a natural base number.
Optionally, in the embodiment of the present invention, the gray scale values respectively corresponding to the third target point and the fourth target point may be 1/e of the gray scale value corresponding to the maximum peak point of the longitudinal gray scale histogram, where e is a natural base number.
Fig. 2 is a second schematic flow chart of the spot center positioning method provided by the present invention, and as shown in fig. 2, the method mainly includes a flow chart of determining a symmetry axis of a spot, and specifically includes the following steps 200 to 230:
and 200, calculating a gray level histogram of the light spot image.
Alternatively, a Y-direction grayscale histogram and an X-direction grayscale histogram of the spot image, that is, a horizontal grayscale histogram and a vertical grayscale histogram of the spot image, may be calculated.
And step 210, determining the area where the light spot symmetry axis is located according to the gray level histogram.
Fig. 3 is a schematic view of an annular light spot image provided by the present invention, fig. 4 is a schematic view of a longitudinal gray level histogram of the annular light spot image provided by the present invention, fig. 5 is a schematic view of a transverse gray level histogram of the annular light spot image provided by the present invention, and as shown in fig. 3 to fig. 5, for a light spot image with an annular structure, a range m of a region where a light spot symmetry axis is located is: the symmetry axis of the light spot between two wave troughs closest to the maximum peak point of the histogram, namely, can move from the beginning end to the end of m.
Alternatively, two minimum values closest to the maximum peak point of the histogram may be obtained by a derivation method in mathematics, that is, two valley points closest to the maximum peak point of the histogram may be obtained.
And step 220, moving any dividing line in the area where the light spot symmetry axis is located, and performing correlation calculation on the areas on the two sides of the dividing line according to the area with the small range on the two sides of the dividing line as a reference.
It can be understood that, since the two regions for calculating the correlation are required to be identical in size, the regions with larger ranges on both sides of the dividing line may be cropped to be the same size as the smaller regions with reference to the regions with smaller ranges on both sides of the dividing line, and after the cropping, the two regions are symmetrical about the dividing line.
And step 230, when the correlation degree is maximum, determining the position of the dividing line as the position of the symmetry axis of the light spot.
Alternatively, it may be determined that any one of the first dividing lines moves every full pixel from the beginning to the end of m shown in fig. 4, and the correlation of the regions on both sides of the first dividing line is calculated once every movement, and when the correlation of the regions on both sides of the first dividing line is maximum, the position where the first dividing line is located at this time may be determined as the position of the first spot symmetry axis.
Alternatively, it may be determined that any one of the second dividing lines moves every full pixel from the beginning to the end of m shown in fig. 5, and the correlation of the regions on both sides of the second dividing line is calculated every time the second dividing line moves every full pixel, and when the correlation of the regions on both sides of the second dividing line is maximum, the position where the second dividing line is located at this time may be determined as the position of the symmetry axis of the second spot.
Alternatively, the above steps 200 to 230 may be performed once in both the left-right direction and the up-down direction of the two-dimensional spot image, so that two spot symmetry axes are obtained, and the intersection point of the two spot symmetry axes may be determined as the center position of the spot.
Optionally, in the embodiment of the present invention, a sliding region of a symmetry axis of the light spot may be determined by using a gray level histogram of the light spot image, then, a correlation calculation may be performed on images on the left and right sides of the symmetry axis by using a method of sliding the symmetry axis, the symmetry axis with the maximum correlation is a symmetry axis of the light spot, and two symmetry axes of the light spot are determined in the transverse direction and the longitudinal direction of the two-dimensional light spot image by using the method, and an intersection point is a center of the light spot.
The light spot center positioning method provided by the embodiment of the invention introduces the correlation into the light spot center positioning, and can more accurately position the center of the irregular circular light spot.
Optionally, the light spot center positioning method provided by the embodiment of the present invention is not limited to positioning the light spot center, and may also be applied to other center positioning scenes with symmetric characteristic images, where a speckle image is taken as an example for description below.
Fig. 6 is a schematic diagram of a speckle image provided by the present invention, fig. 7 is a schematic diagram of a longitudinal grayscale histogram of the speckle image provided by the present invention, and fig. 8 is a schematic diagram of a transverse grayscale histogram of the speckle image provided by the present invention, as shown in fig. 6 to 8, the symmetry axis of the speckle can still be determined based on the above steps 200 to 230, and then the center position of the speckle is determined, for the speckle image, the gray values corresponding to the beginning and end of the range m of the region where the symmetry axis is located are preset multiples of the gray value corresponding to the maximum peak point of the transverse grayscale histogram or the maximum peak point of the longitudinal grayscale histogram, for example, the preset multiples may be 1/e, where e is a natural base number.
Optionally, the light spot center positioning method provided by the embodiment of the invention can be applied to the process of acquiring image data, so that the positioning accuracy of the light spot center is improved.
It will be appreciated that in successive photometric images, the position of the spot is almost constant over the whole image.
Thus, in embodiments of the invention, the center positions of only a part of the spot images in successive photometric images may be determined, or the spot center positions may be determined once every preset number of images, for example 10 images.
Alternatively, in the case where the positioning accuracy of the spot center position needs to be accurate to a sub-pixel, the spot center position of the spot may be accurate to the sub-pixel based on the spot center position and the similarity coefficient fitting method after the spot center position of the integer-bit pixel is obtained based on the spot center positioning method described above.
Specifically, the pixel position coordinates of the eight neighborhoods around the spot center position of the integer bit pixel and the spot center position of the integer bit pixel may be based on the quadratic surface expression F (x, y) = a1x2+a2y2+a3x+a4y+a5xy+a6Determining the spot center position of the sub-pixel, wherein a1、a2、a3、a4、a5And a6Is a coefficient, and x and y are pixel position coordinates.
Specifically, the spot center position coordinates of the integer-bit pixel and the pixel position coordinates of the surrounding eight neighborhoods may be respectively substituted into the above-mentioned quadric expression, and the overdetermined equation is solved to obtain the magnitude of each coefficient of the quadric expression, and then the quadric expression is subjected to derivation to calculate the minimum value, and the coordinate corresponding to the minimum value is the spot center position of the sub-pixel.
According to the spot center positioning method provided by the invention, the first target area and the second target area of the spot image are determined based on the gray level histogram of the spot image, the first spot symmetry axis is determined in the first target area based on the pixel correlation, the second spot symmetry axis is determined in the second target area, and finally the intersection point of the first spot symmetry axis and the second spot symmetry axis is determined as the center position of the spot, so that the spot center positioning efficiency can be improved, and the spot center positioning accuracy can be improved by introducing the pixel correlation into the spot center positioning.
The following describes the spot center positioning device provided by the present invention, and the spot center positioning device described below and the spot center positioning method described above may be referred to in correspondence with each other.
Fig. 9 is a schematic structural diagram of a spot center positioning apparatus provided by the present invention, and as shown in fig. 9, the apparatus includes: a first determination module 910, a second determination module 920, and a third determination module 930; wherein:
the first determining module 910 is configured to determine a first target area and a second target area of a light spot image based on a gray histogram of the light spot image;
the second determining module 920 is configured to determine a first light spot symmetry axis in the first target region and determine a second light spot symmetry axis in the second target region based on the pixel correlation;
the third determining module 930 is configured to determine that an intersection point of the first spot symmetry axis and the second spot symmetry axis is a center position of the spot.
Specifically, the light spot center positioning apparatus provided in the embodiment of the present invention may determine, by the first determining module 910, a first target area and a second target area of the light spot image based on the gray histogram of the light spot image; then, a first light spot symmetry axis is determined in the first target region and a second light spot symmetry axis is determined in the second target region based on the pixel correlation through a second determination module 920; finally, the intersection point of the first light spot symmetry axis and the second light spot symmetry axis is determined as the center position of the light spot by the third determining module 930.
According to the light spot center positioning device, the first target area and the second target area of the light spot image are determined based on the gray level histogram of the light spot image, the first light spot symmetry axis is determined in the first target area based on the pixel correlation, the second light spot symmetry axis is determined in the second target area, and finally the intersection point of the first light spot symmetry axis and the second light spot symmetry axis is determined as the center position of the light spot.
It should be noted that, the apparatus provided in the embodiment of the present invention can implement all the method steps implemented by the embodiment of the spot center positioning method, and can achieve the same technical effect, and details of the same parts and beneficial effects as those of the embodiment of the method are not described herein again.
Fig. 10 is a schematic physical structure diagram of an electronic device provided in the present invention, and as shown in fig. 10, the electronic device may include: a processor (processor) 1010, a communication Interface (Communications Interface) 1020, a memory (memory) 1030, and a communication bus 1040, wherein the processor 1010, the communication Interface 1020, and the memory 1030 communicate with each other via the communication bus 1040. Processor 1010 may invoke logic instructions in memory 1030 to perform the spot-centering methods provided by the methods described above, including:
determining a first target area and a second target area of a light spot image based on a gray level histogram of the light spot image;
determining a first spot symmetry axis in the first target region and a second spot symmetry axis in the second target region based on pixel correlation;
and determining the intersection point of the first light spot symmetry axis and the second light spot symmetry axis as the center position of the light spot.
Furthermore, the logic instructions in the memory 1030 can be implemented in software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, and various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the spot center positioning method provided by the above methods, the method comprising:
determining a first target area and a second target area of the light spot image based on the gray level histogram of the light spot image;
determining a first spot symmetry axis in the first target region and a second spot symmetry axis in the second target region based on pixel correlation;
and determining the intersection point of the first light spot symmetry axis and the second light spot symmetry axis as the center position of the light spot.
In yet another aspect, the present invention also provides a non-transitory computer-readable storage medium having stored thereon a computer program, which when executed by a processor, is implemented to perform the spot-centering method provided above, the method comprising:
determining a first target area and a second target area of a light spot image based on a gray level histogram of the light spot image;
determining a first spot symmetry axis in the first target region and a second spot symmetry axis in the second target region based on pixel correlation;
and determining the intersection point of the first light spot symmetry axis and the second light spot symmetry axis as the center position of the light spot.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment may be implemented by software plus a necessary general hardware platform, and may also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, and not to limit it; although the present invention 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 solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A method of spot centering, comprising:
determining a first target area and a second target area of the light spot image based on the gray level histogram of the light spot image;
determining a first light spot symmetry axis in the first target region and a second light spot symmetry axis in the second target region based on pixel correlation;
and determining the intersection point of the first light spot symmetry axis and the second light spot symmetry axis as the central position of the light spot.
2. The method according to claim 1, wherein determining a first axis of spot symmetry in the first target region and a second axis of spot symmetry in the second target region based on pixel correlation comprises:
determining a first sub-area and a second sub-area obtained by segmenting the first target area by any one first segmentation line, and acquiring a first pixel correlation degree of the first sub-area and the second sub-area;
determining a first dividing line corresponding to the maximum first pixel correlation degree in all the first pixel correlation degrees as the first light spot symmetry axis;
determining a third sub-area and a fourth sub-area obtained by dividing the second target area by any one second dividing line, and acquiring a second pixel correlation degree of the third sub-area and the fourth sub-area;
and determining a second dividing line corresponding to the largest second pixel correlation in all the second pixel correlations as the second light spot symmetry axis.
3. The method for positioning the center of a light spot according to claim 1 or 2, wherein determining the first target area and the second target area of the light spot image based on the gray histogram of the light spot image comprises:
respectively determining a transverse gray level histogram and a longitudinal gray level histogram of a light spot image, wherein the X coordinate of the transverse gray level histogram is the transverse serial number of pixels of the light spot image, the Y coordinate is the total gray level of each row of pixels of the light spot image, the X coordinate of the longitudinal gray level histogram is the longitudinal serial number of the pixels of the light spot image, and the Y coordinate is the total gray level of each row of pixels of the light spot image;
determining the first target region based on the horizontal gray histogram and determining the second target region based on the vertical gray histogram.
4. The spot center positioning method according to claim 3, wherein the spot image is an annular spot image;
in a case that the light spot image is an annular light spot image, determining the first target region based on the horizontal gray histogram and determining the second target region based on the vertical gray histogram, including:
determining two first valley points closest to the maximum peak point of the transverse gray level histogram based on the transverse gray level histogram;
determining the first target area based on the X coordinates corresponding to the two first valley points respectively;
determining two second valley points closest to the maximum peak point of the longitudinal gray level histogram based on the longitudinal gray level histogram;
and determining the second target area based on the X coordinates corresponding to the two second valley points respectively.
5. The spot centering method according to claim 3, wherein the spot image is a non-annular spot image;
in a case that the light spot image is a non-annular light spot image, determining the first target region based on the horizontal gray histogram and determining the second target region based on the vertical gray histogram, including:
determining a first target point and a second target point in the transverse gray-scale histogram, wherein gray values corresponding to the first target point and the second target point are preset multiples of a gray value corresponding to a maximum peak point of the transverse gray-scale histogram;
determining the first target area based on the X-coordinate of the first target point and the X-coordinate of the second target point;
determining a third target point and a fourth target point in the longitudinal gray histogram, wherein gray values corresponding to the third target point and the fourth target point are preset multiples of a gray value corresponding to a maximum peak point of the longitudinal gray histogram;
determining the second target area based on the X-coordinate of the third target point and the X-coordinate of the fourth target point.
6. The method according to claim 5, wherein the predetermined multiple is 1/e, where e is a natural base number.
7. A spot centering device, comprising:
the first determining module is used for determining a first target area and a second target area of the light spot image based on the gray level histogram of the light spot image;
a second determination module for determining a first spot symmetry axis in the first target region and a second spot symmetry axis in the second target region based on pixel correlation;
and the third determining module is used for determining that the intersection point of the first light spot symmetry axis and the second light spot symmetry axis is the central position of the light spot.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program implements the spot centre positioning method according to any of claims 1 to 6.
9. A non-transitory computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the spot center positioning method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the spot centering method of any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210731240.3A CN115272451A (en) | 2022-06-24 | 2022-06-24 | Light spot center positioning method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210731240.3A CN115272451A (en) | 2022-06-24 | 2022-06-24 | Light spot center positioning method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115272451A true CN115272451A (en) | 2022-11-01 |
Family
ID=83760558
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210731240.3A Pending CN115272451A (en) | 2022-06-24 | 2022-06-24 | Light spot center positioning method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115272451A (en) |
-
2022
- 2022-06-24 CN CN202210731240.3A patent/CN115272451A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8422759B2 (en) | Image processing method and image processing device | |
JP2018136896A (en) | Information processor, system, information processing method, and manufacturing method of article | |
CN112017232A (en) | Method, device and equipment for positioning circular pattern in image | |
CN113112490B (en) | Three-dimensional medical image mark point extraction method and system | |
CN111391327B (en) | Printing error determination method, printing error determination device, electronic equipment and storage medium | |
CN116681753A (en) | Line structure light center extraction method and system based on space gray level gravity center propulsion | |
CN114332237A (en) | Method for calculating conversion relation between camera coordinate system and laser coordinate system | |
CN117036364B (en) | Image processing method and device, storage medium and computing equipment | |
CN113878592A (en) | Workpiece cutting method and device based on laser position finding and cutting robot | |
CN116542926B (en) | Method, device, equipment and storage medium for identifying defects of two-dimension codes of battery | |
CN117372663A (en) | Method, device, equipment and storage medium for supplementing log end face shielding | |
CN115511718A (en) | PCB image correction method and device, terminal equipment and storage medium | |
CN115272451A (en) | Light spot center positioning method and device | |
CN111462216A (en) | Method for determining circle center pixel coordinates in circular array calibration plate | |
CN115546016A (en) | Method for acquiring and processing 2D (two-dimensional) and 3D (three-dimensional) images of PCB (printed Circuit Board) and related device | |
CN116125489A (en) | Indoor object three-dimensional detection method, computer equipment and storage medium | |
CN116399262A (en) | Workpiece precision detection method, system and equipment | |
CN115018735A (en) | Fracture width identification method and system for correcting two-dimensional code image based on Hough transform | |
CN115100225A (en) | Method and device for determining error field of camera view field, electronic equipment and medium | |
CN114862816A (en) | Glitch detection method, system, and computer-readable storage medium | |
CN111768384A (en) | Cell counting method and system based on three-dimensional scanning imaging | |
CN113048899A (en) | Thickness measuring method and system based on line structured light | |
CN111839580A (en) | Dental film image generation method and device, electronic equipment and storage medium | |
CN117807875B (en) | Three-dimensional data reverse reconstruction and dimension measurement system and method for quartz device | |
CN116958152B (en) | Part size measurement method, device, equipment and 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 |