Method and apparatus for locating a center of a light spot
By determining the symmetry axis of the light spot based on the gray-level histogram and pixel correlation of the light spot image, the problem of low accuracy and efficiency in the existing technology of light spot center positioning is solved, and high-precision and efficient light spot center positioning is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-24
- Publication Date
- 2026-03-27
AI Technical Summary
Existing spot center localization methods have poor localization accuracy and are time-consuming when the spot shape is irregular and the gray level distribution is uneven, making them difficult to apply efficiently in the image data acquisition process.
The target region is determined by the gray-level histogram of the spot image, and the symmetry axis of the spot is determined in these regions by the pixel correlation. The intersection point is taken as the center position of the spot.
It improves the accuracy and efficiency of spot center positioning, is applicable to image data acquisition, and reduces algorithm running time.
Smart Images

Figure CN115272451B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of optical measurement technology, and in particular to a light spot center positioning method and device. BACKGROUND
[0002] Optical measurement is a high-tech measurement technology combining optoelectronic technology and mechanical measurement. It can achieve fast and accurate measurement under the premise of using computer technology, and thus has become a preferred measurement method in modern industrial detection.
[0003] Light spot center positioning is crucial in optical measurement, and it seriously affects the efficiency and accuracy of the entire measurement process. Current light spot center positioning methods mainly include the center of gravity method, the Hough transform method and the Gaussian fitting method, but each of them has the following shortcomings: in the case of irregular light spot shape and uneven gray scale distribution value, the positioning accuracy of the center of gravity method is poor; the Hough transform method needs to discretize the parameter space, which affects the actual detection accuracy of the algorithm; since laser is only Gaussian distributed when it is in the fundamental mode, and many lasers produced during manufacturing are not perfect Gaussian distribution, but are often deformed, the Gaussian fitting method for positioning the light spot center will produce a large error and is time-consuming.
[0004] Therefore, how to improve the accuracy and efficiency of light spot center positioning has become a problem that needs to be solved in the industry. SUMMARY
[0005] In view of the problems in the prior art, the present application provides a light spot center positioning method and device.
[0006] In a first aspect, the present application provides a light spot center positioning method, comprising:
[0007] determining a first target region and a second target region of the light spot image based on a gray scale histogram of the light spot image;
[0008] 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;
[0009] determining the intersection of the first light spot symmetry axis and the second light spot symmetry axis as the center position of the light spot.
[0010] Optionally, according to the light spot center positioning method provided by the present application, 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 comprises:
[0011] determine a first sub-region and a second sub-region of the first target region segmented by any first segmentation line, and obtain a first pixel correlation of the first sub-region and the second sub-region;
[0012] determine the first segmentation line corresponding to the maximum first pixel correlation among all first pixel correlations as the first spot symmetry axis;
[0013] determine a third sub-region and a fourth sub-region of the second target region segmented by any second segmentation line, and obtain a second pixel correlation of the third sub-region and the fourth sub-region;
[0014] determine the second segmentation line corresponding to the maximum second pixel correlation among all second pixel correlations as the second spot symmetry axis.
[0015] Optionally, according to the spot center positioning method provided by the application, based on the gray histogram of the spot image, a first target region and a second target region of the spot image are determined, which comprises:
[0016] determine a horizontal gray histogram and a vertical gray histogram of the spot image respectively, wherein the X coordinate of the horizontal gray histogram is the horizontal sequence number of the spot image pixels, and the Y coordinate is the total gray value of each row of the spot image pixels, and the X coordinate of the vertical gray histogram is the vertical sequence number of the spot image pixels, and the Y coordinate is the total gray value of each column of the spot image pixels;
[0017] determine the first target region based on the horizontal gray histogram, and determine the second target region based on the vertical gray histogram.
[0018] Optionally, according to the spot center positioning method provided by the application, the spot image is a ring-shaped spot image;
[0019] In the case of the ring-shaped spot image, the first target region is determined based on the horizontal gray histogram, and the second target region is determined based on the vertical gray histogram, which comprises:
[0020] determine two first trough points closest to the maximum peak point of the horizontal gray histogram based on the horizontal gray histogram;
[0021] determine the first target region based on the X coordinates corresponding to the two first trough points respectively;
[0022] determine two second trough points closest to the maximum peak point of the vertical gray histogram based on the vertical gray histogram;
[0023] Determine the second target region based on the X coordinates corresponding to the two second valley points.
[0024] Optionally, the application provides a light spot center positioning method, and the light spot image is a non-ring light spot image.
[0025] In the case that the light spot image is a non-ring light spot image, the first target region is determined based on the horizontal gray histogram, and the second target region is determined based on the vertical gray histogram, including:
[0026] In the horizontal gray histogram, a first target point and a second target point are determined, and the gray values corresponding to the first target point and the second target point are a preset multiple of the gray value corresponding to the maximum peak point of the horizontal gray histogram.
[0027] The first target region is determined based on the X coordinate of the first target point and the X coordinate of the second target point.
[0028] In the vertical gray histogram, a third target point and a fourth target point are determined, and the gray values corresponding to the third target point and the fourth target point are a preset multiple of the gray value corresponding to the maximum peak point of the vertical gray histogram.
[0029] The second target region is determined based on the X coordinate of the third target point and the X coordinate of the fourth target point.
[0030] Optionally, the application provides a light spot center positioning method, and the preset multiple is 1 / e, wherein e is a natural base.
[0031] In a second aspect, the application further provides a light spot center positioning device, including:
[0032] A first determining module is configured to determine a first target region and a second target region of a light spot image based on a gray histogram of the light spot image.
[0033] A second determining module is configured to determine 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.
[0034] A third determining module is configured to determine that the intersection of the first light spot symmetry axis and the second light spot symmetry axis is the center position of the light spot.
[0035] In a third aspect, the application further provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the program to implement the light spot center positioning method of the first aspect.
[0036] In a fourth aspect, the present application also provides a non-transitory computer readable storage medium having stored thereon a computer program, which, when executed by a processor, implements the light spot center positioning method according to the first aspect.
[0037] In a fifth aspect, the present application also provides a computer program product comprising a computer program, which, when executed by a processor, implements the light spot center positioning method according to the first aspect.
[0038] The light spot center positioning method and device provided by the present application can improve the efficiency of light spot center positioning, and can improve the accuracy of light spot center positioning by introducing pixel correlation into light spot center positioning. BRIEF DESCRIPTION OF DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the present application or the prior art, the following will briefly introduce the drawings needed in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.
[0040] Figure 1 is one of the flowcharts of the light spot center positioning method provided by the present application;
[0041] Figure 2 is another flowchart of the light spot center positioning method provided by the present application;
[0042] Figure 3 is a schematic diagram of a ring-shaped light spot image provided by the present application;
[0043] Figure 4 is a schematic diagram of a longitudinal gray level histogram of the ring-shaped light spot image provided by the present application;
[0044] Figure 5 is a schematic diagram of a transverse gray level histogram of the ring-shaped light spot image provided by the present application;
[0045] Figure 6 is a schematic diagram of a speckle image provided by the present application;
[0046] Figure 7 is a schematic diagram of a longitudinal gray level histogram of the speckle image provided by the present application;
[0047] Figure 8is a schematic diagram of a transverse gray level histogram of a speckle image provided by the present application;
[0048] Figure 9 is a structural schematic diagram of a light spot center positioning device provided by the present application;
[0049] Figure 10 is a physical structure schematic diagram of an electronic device provided by the present application. DETAILED DESCRIPTION
[0050] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below in combination with the drawings in the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0051] In order to facilitate a clearer understanding of the embodiments of the present application, some related background knowledge will be introduced as follows.
[0052] The current light spot center positioning methods include the barycenter method, the Hough transform method and the Gaussian fitting method, etc., but these methods have the following shortcomings: in the case of irregular light spot shape and uneven gray level distribution value, the positioning accuracy of the barycenter method is poor; the Hough transform method needs to perform discretization processing on the parameter space, which affects the actual detection accuracy of the algorithm; since the laser is Gaussian distribution only when the base mode is used, and the laser produced by many lasers during manufacturing is not perfect Gaussian distribution, but often has some deformation, the Gaussian fitting method for positioning the light spot center will produce a large error and is time-consuming, and is generally applied to the process of pre-processing the image data after the image data is collected.
[0053] The existing light spot center positioning methods mainly have the following defects:
[0054] (1) The light spot center positioning is not accurate, so that the local image containing more feature data cannot be accurately cropped in the whole image.
[0055] (2) For irregularly shaped light spots, the algorithm for directly using the histogram to determine the light spot center has the defects of difficult positioning of the center and large positioning error.
[0056] (3) The light spot center positioning algorithm with high positioning accuracy at present is not suitable for application in the image data collection process due to large amount of calculation, and is only suitable for use after the data is collected, that is, only suitable for use in the process of image data preprocessing.
[0057] In order to overcome the above-mentioned defects, the present application provides a light spot center positioning method and device, which will be described below in combination withFigures 1-10 The application provides a light spot center positioning method and device.
[0058] Figure 1 Figure 1 is a flowchart of the light spot center positioning method provided by the application, as shown in the figure, the method comprises the following steps: Figure 1
[0059] In step 100, based on a gray histogram of a light spot image, a first target region and a second target region of the light spot image are determined.
[0060] Specifically, the gray histogram of the light spot image can be obtained, and the first target region and the second target region of the light spot image are determined based on the gray histogram of the light spot image.
[0061] Optionally, the first target region and the second target region of the light spot image can be the effective regions of the light spot in the entire light spot image.
[0062] In step 110, based on pixel correlation, 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.
[0063] Specifically, after the first target region and the second target region of the light spot image are determined, the first light spot symmetry axis can be determined in the first target region, and the second light spot symmetry axis can be determined in the second target region based on pixel correlation.
[0064] It can be understood that the two symmetry axes of the light spot can be determined in the determined target region based on pixel correlation.
[0065] In step 120, the intersection of the first light spot symmetry axis and the second light spot symmetry axis is determined as the center position of the light spot.
[0066] Specifically, after the first light spot symmetry axis and the second light spot symmetry axis of the light spot are determined based on pixel correlation, the intersection of the first light spot symmetry axis and the second light spot symmetry axis can be determined, and the intersection is taken as the center position of the light spot.
[0067] In order to overcome the defects of low positioning accuracy and low positioning efficiency of the existing light spot center positioning method, the application determines the first target region and the second target region of the light spot image based on the gray histogram of the light spot image, then determines the first light spot symmetry axis in the first target region and the second light spot symmetry axis in the second target region based on pixel correlation, and finally determines the intersection of the first light spot symmetry axis and the second light spot symmetry axis as the center position of the light spot, which not only improves the efficiency of light spot center positioning, but also improves the accuracy of light spot center positioning by introducing pixel correlation into light spot center positioning.
[0068] The spot center positioning method provided by the application can improve the efficiency of spot center positioning, and can improve the accuracy of spot center positioning by introducing pixel correlation into the spot center positioning.
[0069] Optionally, the first spot symmetry axis is determined in the first target region and the second spot symmetry axis is determined in the second target region based on pixel correlation, comprising:
[0070] The first sub-region and the second sub-region are determined after the first target region is divided by any first division line, and the first pixel correlation of the first sub-region and the second sub-region is obtained;
[0071] The first division line corresponding to the maximum first pixel correlation in all first pixel correlations is determined as the first spot symmetry axis;
[0072] The third sub-region and the fourth sub-region are determined after the second target region is divided by any second division line, and the second pixel correlation of the third sub-region and the fourth sub-region is obtained;
[0073] The second division line corresponding to the maximum second pixel correlation in all second pixel correlations is determined as the second spot symmetry axis.
[0074] Specifically, the first sub-region and the second sub-region can be determined after the first target region is divided by any first division line, and the first pixel correlation of the first sub-region and the second sub-region is obtained; and the first division line corresponding to the maximum first pixel correlation in all first pixel correlations is determined as the first spot symmetry axis.
[0075] Optionally, the first division line can move every interval pixel in 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 is obtained.
[0076] Optionally, the first division line corresponding to the maximum first pixel correlation in all obtained first pixel correlations can be taken as the first spot symmetry axis.
[0077] Optionally, when the first pixel correlation of the first sub-region and the second sub-region is obtained, the smaller one of the first sub-region and the second sub-region can be taken as a reference, and the larger one of the first sub-region and the second sub-region can be cropped with the first split line as a symmetry axis, so that the two regions are of the same size and symmetric about the first split line, and then the first pixel correlation of the first sub-region and the second sub-region is determined.
[0078] Specifically, the third sub-region and the fourth sub-region after the second target region is divided by any one of the second split lines can be determined, and the second pixel correlation of the third sub-region and the fourth sub-region is obtained; and the second split line corresponding to the maximum second pixel correlation in all second pixel correlations is determined as the second spot symmetry axis.
[0079] Optionally, the second split line can be moved every whole pixel in 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 split line is obtained.
[0080] Optionally, the second split line corresponding to the maximum second pixel correlation in all obtained second pixel correlations can be taken as the second spot symmetry axis.
[0081] Optionally, when the second pixel correlation of the third sub-region and the fourth sub-region is obtained, the smaller one of the third sub-region and the fourth sub-region can be taken as a reference, and the larger one of the third sub-region and the fourth sub-region can be cropped with the second split line as a symmetry axis, so that the two regions are of the same size and symmetric about the second split line, and then the second pixel correlation of the third sub-region and the fourth sub-region is determined.
[0082] 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 can be obtained based on any one of the functions for calculating the correlation, such as the correlation coefficient function corr, which is not specifically limited in the present application.
[0083] The present application introduces pixel correlation into the spot center positioning, determines the symmetry axis of the spot based on the correlation of the pixels, and then determines the center position of the spot based on the symmetry axis of the spot, which not only improves the accuracy of the spot center positioning, but also reduces the running time of the algorithm and improves the efficiency of the spot center positioning.
[0084] Optionally, based on the gray histogram of the spot image, the first target region and the second target region of the spot image are determined, comprising:
[0085] determine a transverse gray level histogram of the spot image, wherein an X coordinate of the transverse gray level histogram is a transverse sequence number of a pixel of the spot image, and a Y coordinate of the transverse gray level histogram is a total gray level value of each row of pixels of the spot image; and determine a longitudinal gray level histogram of the spot image, wherein an X coordinate of the longitudinal gray level histogram is a longitudinal sequence number of a pixel of the spot image, and a Y coordinate of the longitudinal gray level histogram is a total gray level value of each column of pixels of the spot image.
[0086] determine the first target region based on the transverse gray level histogram, and determine the second target region based on the longitudinal gray level histogram.
[0087] Specifically, the transverse gray level histogram and the longitudinal gray level histogram of the spot image can be determined first, then the first target region of the spot image can be determined based on the transverse gray level histogram, and the second target region of the spot image can be determined based on the longitudinal gray level histogram.
[0088] wherein an X coordinate of the transverse gray level histogram is a transverse sequence number of a pixel of the spot image, and a Y coordinate of the transverse gray level histogram is a total gray level value of each row of pixels of the spot image, and an X coordinate of the longitudinal gray level histogram is a longitudinal sequence number of a pixel of the spot image, and a Y coordinate of the longitudinal gray level histogram is a total gray level value of each column of pixels of the spot image.
[0089] It can be understood that the X coordinate of the transverse gray level histogram is a row sequence number of each row of pixels of the spot image, and the Y coordinate of the transverse gray level histogram is a total gray level value of each row of pixels of the spot image, for example, if there are N rows of pixels in the spot image, then the transverse gray level histogram represents a histogram sequence of N values.
[0090] It can be understood that the X coordinate of the longitudinal gray level histogram is a column sequence number of each column of pixels of the spot image, and the Y coordinate of the longitudinal gray level histogram is a total gray level value of each column of pixels of the spot image, for example, if there are M columns of pixels in the spot image, then the longitudinal gray level histogram represents a histogram sequence of M values.
[0091] Optionally, the spot image is a ring-shaped spot image.
[0092] In the case that the spot image is a ring-shaped spot image, the first target region is determined based on the transverse gray level histogram, and the second target region is determined based on the longitudinal gray level histogram, comprising:
[0093] determining, based on the transverse gray level histogram, two first valley points closest to a maximum peak point of the transverse gray level histogram;
[0094] determining, based on the two first valley points respectively corresponding X coordinates, the first target region;
[0095] determining, based on the longitudinal gray level histogram, two second valley points closest to a maximum peak point of the longitudinal gray level histogram;
[0096] determine the second target region based on the X coordinates corresponding to the two second valley points respectively.
[0097] Optionally, in the embodiment of the present application, the light spot image can be a ring-shaped light spot image, i.e., a light spot image with a ring-shaped structure light spot.
[0098] Specifically, in the case of the light spot image being a ring-shaped light spot image, two first valley points closest to a maximum peak point of the horizontal gray histogram can be determined based on the horizontal gray histogram, and then a first target region can be determined based on the X coordinates corresponding to the two first valley points respectively.
[0099] Specifically, in the case of the light spot image being a ring-shaped light spot image, two second valley points closest to a maximum peak point of the vertical gray histogram can be determined based on the vertical gray histogram, and then a second target region can be determined based on the X coordinates corresponding to the two second valley points respectively.
[0100] Optionally, the light spot image is a non-ring-shaped light spot image.
[0101] In the case of the light spot image being a non-ring-shaped light spot image, the first target region is determined based on the horizontal gray histogram, and the second target region is determined based on the vertical gray histogram, including:
[0102] In the horizontal gray histogram, a first target point and a second target point are determined, and the gray values corresponding to the first target point and the second target point respectively are a preset multiple of the gray value corresponding to a maximum peak point of the horizontal gray histogram.
[0103] The first target region is determined based on the X coordinate of the first target point and the X coordinate of the second target point.
[0104] In the vertical gray histogram, a third target point and a fourth target point are determined, and the gray values corresponding to the third target point and the fourth target point respectively are a preset multiple of the gray value corresponding to a maximum peak point of the vertical gray histogram.
[0105] The second target region is determined based on the X coordinate of the third target point and the X coordinate of the fourth target point.
[0106] Optionally, in the embodiment of the present application, the light spot image can be a non-ring-shaped light spot image, i.e., a light spot image without a ring-shaped structure light spot.
[0107] Specifically, when the spot image is a non-circular spot image, the first target point and the second target point can be determined first in the horizontal gray-level histogram, wherein the gray values corresponding to the first target point and the second target point are respectively a preset multiple of the gray value corresponding to the maximum peak point of the horizontal gray-level histogram. Then, the first target area is determined based on the X coordinates of the first target point and the second target point.
[0108] Specifically, when the spot image is a non-circular spot image, the third target point and the fourth target point can be determined first in the vertical gray-level histogram. The gray values corresponding to the third target point and the fourth target point are respectively a preset multiple of the gray value corresponding to the maximum peak point of the vertical gray-level histogram. Then, the second target region is determined based on the X coordinates of the third target point and the fourth target point.
[0109] Optionally, in this embodiment of the invention, the gray values corresponding to the first target point and the second target point can be 1 / e of the gray value corresponding to the maximum peak point of the horizontal gray-level histogram, where e is the natural base.
[0110] Optionally, in this embodiment of the invention, the gray values corresponding to the third target point and the fourth target point can be 1 / e of the gray value corresponding to the maximum peak point of the vertical gray-level histogram, where e is the natural base.
[0111] Figure 2 This is a second schematic flowchart of the spot center positioning method provided by the present invention, as shown below. Figure 2 As shown, the process mainly includes determining the axis of symmetry of the light spot, specifically including the following steps 200-230:
[0112] Step 200: Calculate the grayscale histogram of the light spot image.
[0113] Optionally, the gray-level histograms in the Y and X directions of the spot image can be calculated, i.e., the horizontal and vertical gray-level histograms of the spot image.
[0114] Step 210: Determine the region where the light spot's axis of symmetry is located based on the grayscale histogram.
[0115] Figure 3 This is a schematic diagram of the annular light spot image provided by the present invention. Figure 4 This is a schematic diagram of the vertical grayscale histogram of the annular spot image provided by the present invention. Figure 5 This is a schematic diagram of the horizontal grayscale histogram of the annular spot image provided by the present invention, as shown below. Figures 3-5 As shown, for a spot image with a ring structure, the range m of the region where the spot symmetry axis is located is: between the two troughs closest to the maximum peak point of the histogram, that is, the spot symmetry axis can move from the beginning to the end of m.
[0116] Alternatively, the two minimum values closest to the maximum peak point of the distance histogram can be obtained by derivation in mathematics.
[0117] In step 220, any one of the split lines moves in the area where the light spot symmetry axis is located, and the correlation of the two areas on both sides of the split line is calculated according to the area with smaller range on both sides of the split line as a reference.
[0118] It can be understood that, since the size of the two areas for calculating the correlation is required to be consistent, the area with larger range on both sides of the split line can be cropped to be the same size as the area with smaller range on both sides of the split line, and after the cropping, the two areas are symmetrical about the split line.
[0119] In step 230, when the correlation is maximum, the position of the split line is determined as the position of the light spot symmetry axis.
[0120] Alternatively, any one of the first split lines can be determined to move from the beginning of m to the end of m as shown in FIG. Figure 4 , and the correlation of the areas on both sides of the first split line is calculated once for each movement, and when the correlation of the areas on both sides of the first split line is maximum, the position of the first split line at this time is determined as the position of the first light spot symmetry axis.
[0121] Alternatively, any one of the second split lines can be determined to move from the beginning of m to the end of m as shown in FIG. Figure 5 , and the correlation of the areas on both sides of the second split line is calculated once for each movement, and when the correlation of the areas on both sides of the second split line is maximum, the position of the second split line at this time is determined as the position of the second light spot symmetry axis.
[0122] Alternatively, the above steps 200 to 230 can be performed once in the left and right directions and the up and down directions of the two-dimensional light spot image respectively, so that two light spot symmetry axes are obtained, and the intersection of the two light spot symmetry axes is determined as the center position of the light spot.
[0123] Alternatively, in the embodiment of the present application, the sliding area of the light spot symmetry axis can be first determined through the gray scale histogram of the light spot image, and then the correlation of the images on both sides of the symmetry axis is calculated by the sliding symmetry axis method, and the symmetry axis with the maximum correlation is the symmetry axis of the light spot. Two symmetry axes of the light spot are determined in the horizontal and vertical directions of the two-dimensional light spot image by this method, and the intersection is the center of the light spot.
[0124] The light spot center positioning method provided by the embodiment of the present application introduces the correlation into the light spot center positioning, and can more accurately position the center of the irregular circular light spot.
[0125] Optionally, the light spot center positioning method provided by the embodiment of the present application is not limited to the positioning of the light spot center, but can also be applied to the center positioning of other images with symmetry characteristics. The following takes a speckle image as an example for illustration.
[0126] Figure 6 is a schematic diagram of a speckle image provided by the present application, Figure 7 is a schematic diagram of a longitudinal gray level histogram of a speckle image provided by the present application, Figure 8 is a schematic diagram of a transverse gray level histogram of a speckle image provided by the present application, as Figures 6-8 shown, the symmetry axis of the speckle and the center position of the speckle can still be determined based on the above steps 200 to 230. For a speckle image, the gray level values corresponding to the start and end of the range m of the region where the symmetry axis is located are the maximum peak value point of the transverse gray level histogram or a preset multiple of the gray level value corresponding to the maximum peak value point of the longitudinal gray level histogram. For example, the preset multiple can be 1 / e, where e is the natural base.
[0127] Optionally, the light spot center positioning method provided by the embodiment of the present application can be applied in the process of collecting image data to improve the positioning accuracy of the light spot center.
[0128] It can be understood that in the continuous light measurement images, the position of the light spot in the entire image is almost unchanged.
[0129] Therefore, in the embodiment of the present application, the center position of only part of the light spot images in the continuous light measurement images can be determined, or the light spot center position can be determined once every interval of a preset number of images, for example, the light spot center position can be determined once every interval of 10 images.
[0130] Optionally, in the case where the positioning accuracy of the light spot center position needs to be accurate to sub-pixels, after obtaining the light spot center position of integer pixels based on the light spot center positioning method described above, the center position of the light spot can be accurately determined to sub-pixels based on the light spot center position and the similarity coefficient fitting method.
[0131] Specifically, based on the light spot center position coordinates of integer pixels and the pixel position coordinates of the eight neighboring regions around the light spot center position of the integer pixels, the light spot center position of sub-pixels can be determined through a quadratic surface expression F(x,y)=a1x 2 +a2y 2 +a3x+a4y+a5xy+a6, where a1, a2, a3, a4, a5 and a6 are coefficients, and x, y are pixel position coordinates.
[0132] Specifically, the coordinates of the center position of the light spot of the integer pixel and the coordinates of the pixel position of the eight surrounding neighbors are substituted into the above quadratic surface expression respectively, and the size of each coefficient of the quadratic surface expression is obtained by solving the over-determined equation, then the derivative of the quadratic surface expression is calculated, and the minimum value is calculated. The coordinates corresponding to the minimum value are the center position of the sub-pixel light spot.
[0133] The light spot center positioning method provided by the application can not only improve the efficiency of light spot center positioning, but also improve the accuracy of light spot center positioning by introducing pixel correlation into the light spot center positioning.
[0134] The light spot center positioning device provided by the application is described below. The light spot center positioning device described below can be referred to in correspondence with the light spot center positioning method described above.
[0135] Figure 9 The light spot center positioning device provided by the application is described below. The light spot center positioning device described below can be referred to in correspondence with the light spot center positioning method described above. Figure 9 As shown in the figure, the device comprises a first determination module 910, a second determination module 920 and a third determination module 930; wherein:
[0136] The first determination module 910 is configured to determine a first target region and a second target region of a light spot image based on a gray level histogram of the light spot image.
[0137] The second determination module 920 is configured to determine 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.
[0138] The third determination module 930 is configured to determine the intersection of the first light spot symmetry axis and the second light spot symmetry axis as the center position of the light spot.
[0139] Specifically, the light spot center positioning device provided by the embodiment of the application can determine a first target region and a second target region of a light spot image based on a gray level histogram of the light spot image through the first determination module 910; then determine 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 through the second determination module 920; finally determine the intersection of the first light spot symmetry axis and the second light spot symmetry axis as the center position of the light spot through the third determination module 930.
[0140] The spot center positioning device provided by the application can improve the efficiency of spot center positioning, and can improve the accuracy of spot center positioning by introducing pixel correlation into the spot center positioning.
[0141] It should be noted that the device provided by the embodiment of the application can realize all the method steps realized by the spot center positioning method embodiment, and can achieve the same technical effects. Therefore, the same parts and beneficial effects of the method embodiment will not be described in detail.
[0142] Figure 10 The electronic device provided by the application is shown in the entity structure diagram of the electronic device, as shown in Figure 10 The electronic device can include a processor 1010, a communications interface 1020, a memory 1030 and a communications bus 1040, wherein the processor 1010, the communications interface 1020 and the memory 1030 can communicate with each other through the communications bus 1040. The processor 1010 can call the logical instructions in the memory 1030 to execute the spot center positioning method provided by each method, and the method includes:
[0143] Based on the gray level histogram of the spot image, the first target area and the second target area of the spot image are determined;
[0144] Based on the pixel correlation, the first spot symmetry axis is determined in the first target area, and the second spot symmetry axis is determined in the second target area;
[0145] The intersection of the first spot symmetry axis and the second spot symmetry axis is determined as the center position of the spot.
[0146] Moreover, the logic instructions in the memory 1030 described above can be implemented in the form of software function units and sold or used as independent products, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that make contributions to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0147] In another aspect, the present application also provides a computer program product, which comprises 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-mentioned methods, the method comprising:
[0148] determining a first target region and a second target region of the spot image based on a gray histogram of the spot image;
[0149] 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;
[0150] determining the intersection of the first spot symmetry axis and the second spot symmetry axis as the center position of the spot.
[0151] In yet another aspect, the present application also provides a non-transitory computer readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the spot center positioning method provided by the above-mentioned methods, the method comprising:
[0152] determining a first target region and a second target region of the spot image based on a gray histogram of the spot image;
[0153] 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;
[0154] determining the intersection of the first spot symmetry axis and the second spot symmetry axis as the center position of the spot.
[0155] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the modules can be selected to achieve the purposes of the embodiments according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0156] Through the description of the above embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and the necessary general hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0157] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for locating the center of a light spot, characterized in that, include: Based on the grayscale histogram of the spot image, the first target region and the second target region of the spot image are determined; Based on pixel correlation, a first spot symmetry axis is determined in the first target region, and a second spot symmetry axis is determined in the second target region; The intersection of the first light spot's axis of symmetry and the second light spot's axis of symmetry is determined as the center position of the light spot; Specifically, 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 includes: Determine the first sub-region and the second sub-region after dividing the first target region by any first dividing line, and obtain the first pixel correlation between the first sub-region and the second sub-region. The first segmentation line corresponding to the largest first pixel correlation among all first pixel correlations is determined as the first spot symmetry axis; Determine the third and fourth sub-regions after dividing the second target region by any second dividing line, and obtain the second pixel correlation of the third and fourth sub-regions; The second segmentation line corresponding to the largest second pixel correlation among all second pixel correlations is determined as the second spot symmetry axis; Based on the grayscale histogram of the spot image, the first target region and the second target region of the spot image are determined, including: The horizontal grayscale histogram and the vertical grayscale histogram of the spot image are determined respectively. The X-coordinate of the horizontal grayscale histogram is the horizontal sequence number of the spot image pixel, and the Y-coordinate is the total grayscale value of each row of pixels in the spot image. The X-coordinate of the vertical grayscale histogram is the vertical sequence number of the spot image pixel, and the Y-coordinate is the total grayscale value of each column of pixels in the spot image. Based on the horizontal grayscale histogram, the first target region is determined, and based on the vertical grayscale histogram, the second target region is determined.
2. The method for locating the center of a light spot according to claim 1, characterized in that, The light spot image is a ring-shaped light spot image; When the light spot image is a ring-shaped light spot image, determining the first target region based on the horizontal gray-level histogram and determining the second target region based on the vertical gray-level histogram includes: Based on the horizontal gray-level histogram, determine the two first troughs closest to the maximum peak point of the horizontal gray-level histogram; Based on the X coordinates corresponding to the two first trough points, the first target area is determined; Based on the vertical grayscale histogram, determine the two second troughs closest to the maximum peak point of the vertical grayscale histogram; The second target region is determined based on the X coordinates corresponding to the two second trough points.
3. The method for locating the center of a light spot according to claim 1, characterized in that, The light spot image is a non-circular light spot image; When the light spot image is a non-circular light spot image, determining the first target region based on the horizontal gray-level histogram and determining the second target region based on the vertical gray-level histogram includes: In the horizontal grayscale histogram, a first target point and a second target point are determined, and the grayscale values corresponding to the first target point and the second target point are respectively a preset multiple of the grayscale value corresponding to the maximum peak point of the horizontal grayscale histogram. The first target area is determined based on the X coordinates of the first target point and the second target point; In the vertical grayscale histogram, a third target point and a fourth target point are determined, and the grayscale values corresponding to the third target point and the fourth target point are respectively a preset multiple of the grayscale value corresponding to the maximum peak point of the vertical grayscale histogram; The second target region is determined based on the X coordinates of the third target point and the fourth target point.
4. The method for locating the center of a light spot according to claim 3, characterized in that, The preset multiple is 1 / e, where e is the natural base.
5. A light spot center positioning device, characterized in that, include: The first determining module is used to determine the first target region and the second target region of the spot image based on the gray-level histogram of the spot image; The second determining module is used to determine 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. The third determining module is used to determine the intersection of the first light spot symmetry axis and the second light spot symmetry axis as the center position of the light spot; Specifically, 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 includes: Determine the first sub-region and the second sub-region after dividing the first target region by any first dividing line, and obtain the first pixel correlation between the first sub-region and the second sub-region. The first segmentation line corresponding to the largest first pixel correlation among all first pixel correlations is determined as the first spot symmetry axis; Determine the third and fourth sub-regions after dividing the second target region by any second dividing line, and obtain the second pixel correlation of the third and fourth sub-regions; The second segmentation line corresponding to the largest second pixel correlation among all second pixel correlations is determined as the second spot symmetry axis; Based on the grayscale histogram of the spot image, the first target region and the second target region of the spot image are determined, including: The horizontal grayscale histogram and the vertical grayscale histogram of the spot image are determined respectively. The X-coordinate of the horizontal grayscale histogram is the horizontal sequence number of the spot image pixel, and the Y-coordinate is the total grayscale value of each row of pixels in the spot image. The X-coordinate of the vertical grayscale histogram is the vertical sequence number of the spot image pixel, and the Y-coordinate is the total grayscale value of each column of pixels in the spot image. Based on the horizontal grayscale histogram, the first target region is determined, and based on the vertical grayscale histogram, the second target region is determined.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the spot center localization method as described in any one of claims 1 to 4.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the spot center localization method as described in any one of claims 1 to 4.
8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the spot center localization method as described in any one of claims 1 to 4.