CN1987346A - Method and device for quick high precision positioning light spot image mass center - Google Patents
Method and device for quick high precision positioning light spot image mass center Download PDFInfo
- Publication number
- CN1987346A CN1987346A CN 200610161802 CN200610161802A CN1987346A CN 1987346 A CN1987346 A CN 1987346A CN 200610161802 CN200610161802 CN 200610161802 CN 200610161802 A CN200610161802 A CN 200610161802A CN 1987346 A CN1987346 A CN 1987346A
- Authority
- CN
- China
- Prior art keywords
- value
- pixel
- marking
- mark
- equivalent
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 69
- 238000004364 calculation method Methods 0.000 claims abstract description 36
- 238000001914 filtration Methods 0.000 claims description 11
- 238000003860 storage Methods 0.000 claims description 11
- 230000004807 localization Effects 0.000 claims description 4
- 230000003139 buffering effect Effects 0.000 claims description 2
- 230000001186 cumulative effect Effects 0.000 abstract description 25
- 239000003550 marker Substances 0.000 description 14
- 238000013500 data storage Methods 0.000 description 7
- 238000009825 accumulation Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 238000002372 labelling Methods 0.000 description 3
- 238000005259 measurement Methods 0.000 description 3
- 238000007781 pre-processing Methods 0.000 description 3
- 230000006835 compression Effects 0.000 description 2
- 238000007906 compression Methods 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 238000003909 pattern recognition Methods 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000035945 sensitivity Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
- 238000011179 visual inspection Methods 0.000 description 1
Images
Landscapes
- Image Analysis (AREA)
Abstract
本发明公开了一种快速高精度光斑图像质心定位方法,对像素灰度值进行高斯卷积运算,并判断经高斯卷积运算后的像素灰度值是否大于预设阈值,如果是则对当前像素进行标记,识别所属光斑,并计算当前像素灰度值和坐标值的乘积与已处理的同一光斑所有像素灰度值和坐标值乘积的累加值,当前像素的灰度值与已处理的同一光斑所有像素灰度值的累加值,保存得到的累加值,否则将当前像素标记为背景像素并处理;在处理完整个输出图像后,计算灰度值和坐标值乘积累加值与灰度值累加值之商,并将计算结果作为光斑图像质心坐标值输出。本发明还同时公开了一种质心定位装置,本发明能提高光斑图像质心定位中的数据处理速度和抗噪声能力,且能处理多个光斑图像。
The invention discloses a fast and high-precision spot image centroid positioning method, which performs Gaussian convolution operation on the pixel gray value, and judges whether the pixel gray value after the Gaussian convolution operation is greater than a preset threshold, and if so, the current Mark the pixels, identify the facula they belong to, and calculate the cumulative value of the product of the gray value of the current pixel and the coordinate value and the product of the gray value and coordinate value of all pixels of the same facula that have been processed. The gray value of the current pixel is the same as the processed one. The accumulated value of the gray value of all pixels of the spot, save the accumulated value, otherwise, mark the current pixel as a background pixel and process it; after processing the entire output image, calculate the accumulated value of the gray value and the cumulative value of the coordinate value and the accumulated value of the gray value The quotient of the value, and the calculation result is output as the coordinate value of the center of mass of the spot image. The invention also discloses a centroid positioning device at the same time. The invention can improve the data processing speed and anti-noise ability in the spot image centroid positioning, and can process multiple spot images.
Description
技术领域technical field
本发明涉及机器视觉检测技术,特别是涉及一种快速高精度光斑图像质心定位方法及装置。The invention relates to machine vision detection technology, in particular to a fast and high-precision spot image centroid positioning method and device.
背景技术Background technique
光斑图像是机器视觉和模式识别中常见的图像信息,光斑中心是光斑图像的特征。光斑中心被广泛应用于机器视觉中的目标跟踪,视觉检测中高精度三维测量的特征点提取,以及空间应用的深空激光通讯中激光光斑中心的定位、姿态测量部件星敏感器的星点定位、太阳敏感器的太阳光斑定位。The spot image is common image information in machine vision and pattern recognition, and the center of the spot is the feature of the spot image. Spot center is widely used in target tracking in machine vision, feature point extraction of high-precision three-dimensional measurement in visual inspection, positioning of laser spot center in deep space laser communication for space applications, star point positioning of star sensor of attitude measurement components, Sun spot positioning for sun sensors.
目前,对光斑中心的定位方法可分为两大类:基于灰度的定位方法和基于边缘的定位方法。其中,基于灰度的定位方法一般是利用目标光斑图像的灰度分布信息进行定位,可采用质心法、曲面拟合法等等;基于边缘的定位方法一般是利用目标光斑图像的边缘形状信息进行定位,包括:边缘圆(椭圆)拟合、哈夫(Hough)变换等等。At present, the localization methods for the spot center can be divided into two categories: grayscale-based localization methods and edge-based localization methods. Among them, the grayscale-based positioning method generally uses the gray-scale distribution information of the target spot image for positioning, and can use the centroid method, surface fitting method, etc.; the edge-based positioning method generally uses the edge shape information of the target spot image for positioning. , including: edge circle (ellipse) fitting, Hough transform, etc.
基于灰度的定位方法比基于边缘的定位方法具有更高的精度,通常,基于灰度的曲面拟合法采用高斯曲面对目标光斑图像的灰度分布进行拟合,但常用的二维高斯曲面函数的计算比较复杂,因此,质心法由于实现较为简单且定位精度较高,成为使用最多的一种定位方法。质心法有一些改进的形式,主要包括带阈值的质心法和平方加权质心法,其中,带阈值的质心法相当于将原图像与背景阈值相减,对原图像中大于阈值的像素点求质心;平方加权质心法采用灰度值的平方代替灰度值作为权值,该方法突出了离中心较近的较大灰度值像素点对中心位置的影响。The grayscale-based positioning method has higher accuracy than the edge-based positioning method. Usually, the grayscale-based surface fitting method uses a Gaussian surface to fit the grayscale distribution of the target spot image, but the commonly used two-dimensional Gaussian surface The calculation of the function is more complicated. Therefore, the centroid method has become the most widely used positioning method because of its relatively simple implementation and high positioning accuracy. There are some improved forms of the centroid method, mainly including the centroid method with a threshold and the square-weighted centroid method. Among them, the centroid method with a threshold is equivalent to subtracting the original image from the background threshold, and calculating the centroid for the pixels greater than the threshold in the original image. ; The square weighted centroid method uses the square of the gray value instead of the gray value as the weight. This method highlights the influence of the larger gray value pixels that are closer to the center on the center position.
现有技术中,在实时性要求较高的视觉动态跟踪、测量以及小型化要求的空间应用中,光斑中心定位是对大数据量的图像进行处理,且这些处理过程存在很大的并行性,包括操作并行、图像并行、邻域并行、像素位并行等。但是,目前光斑中心的定位方法主要是在计算机上由软件实现的,由于软件实现是按指令方式串行执行的,使得光斑中心定位成为图像数据预处理的瓶颈。故此,在实时光斑中心定位方面,美国的喷气动力实验室(JPL)提出了一种基于窗口的质心定位装置,该装置采用模拟电路实现并嵌入在图像传感器芯片中。这种质心定位装置可同时对多个窗口进行图像质心定位,但由于该装置主要采用的是模拟电路,且采用基于窗口的数据处理方式,所以在实现上存在以下缺陷:In the prior art, in space applications that require high real-time visual dynamic tracking, measurement, and miniaturization requirements, spot center positioning is to process images with a large amount of data, and these processing processes have great parallelism. Including operation parallelism, image parallelism, neighborhood parallelism, pixel bit parallelism, etc. However, at present, the spot center positioning method is mainly realized by software on the computer. Because the software implementation is serially executed according to instructions, the spot center positioning becomes the bottleneck of image data preprocessing. Therefore, in terms of real-time spot center positioning, the Jet Propulsion Laboratory (JPL) of the United States proposed a window-based centroid positioning device, which is realized by an analog circuit and embedded in an image sensor chip. This centroid positioning device can simultaneously locate the image centroid of multiple windows, but because the device mainly uses analog circuits and uses a window-based data processing method, there are the following defects in implementation:
1)光斑处理窗口设定不灵活,不能设定太大窗口,否则会将窗口中可能存在的两个以上光斑当作一个光斑进行处理,得到的结果有误差;1) The setting of the spot processing window is inflexible, and the window cannot be set too large, otherwise, more than two spots that may exist in the window will be treated as one spot, and the result obtained will be wrong;
2)必须预先知道光斑在图像中的大致位置和范围,才能进行窗口的设定;2) The approximate position and range of the light spot in the image must be known in advance before setting the window;
3)受到处理速度和传输速度的限制,不能设置太多的窗口,因此当图像中光斑数目多时,不能获取图像中所有的光斑;3) Limited by the processing speed and transmission speed, too many windows cannot be set, so when the number of spots in the image is large, all the spots in the image cannot be obtained;
4)由于采用模拟电路实现,该方法对噪声比较敏感,而噪声的存在会对定位产生较大的误差。4) Due to the implementation of analog circuits, this method is sensitive to noise, and the presence of noise will cause a large error in positioning.
发明内容Contents of the invention
有鉴于此,本发明的主要目的在于提供一种快速高精度光斑图像质心定位方法,能提高光斑图像质心定位中的数据处理速度和抗噪声能力,且能对任意大小的任意多个光斑图像进行处理。In view of this, the main purpose of the present invention is to provide a fast and high-precision spot image centroid positioning method, which can improve the data processing speed and anti-noise ability in spot image centroid positioning, and can perform any number of spot images of any size. deal with.
本发明的另一目的在于提供一种快速高精度光斑图像质心定位装置,能解决光斑图像质心定位中大数据量图像预处理的瓶颈问题和噪声敏感问题,并能对任意大小的任意多个光斑图像进行处理。Another object of the present invention is to provide a fast and high-precision spot image centroid positioning device, which can solve the bottleneck problem and noise sensitivity problem of image preprocessing with a large amount of data in spot image centroid positioning, and can detect any number of spots of any size The image is processed.
为达到上述目的,本发明的技术方案是这样实现的:In order to achieve the above object, technical solution of the present invention is achieved in that way:
一种快速高精度光斑图像质心定位方法,包括以下步骤:A fast and high-precision spot image centroid positioning method, comprising the following steps:
A、对像素灰度值进行高斯卷积运算,并判断经高斯卷积运算后的像素灰度值是否大于预设阈值,如果是,执行步骤B,否则,执行步骤C;A. Perform a Gaussian convolution operation on the pixel gray value, and judge whether the pixel gray value after the Gaussian convolution operation is greater than a preset threshold, if yes, perform step B, otherwise, perform step C;
B、对当前读取像素进行标记,识别当前像素所属光斑,并计算当前像素灰度值和坐标值的乘积与已处理的同一光斑所有像素灰度值和坐标值乘积的累加值,当前像素的灰度值与已处理的同一光斑所有像素灰度值的累加值,保存得到的累加值,执行步骤D;B. Mark the currently read pixel, identify the spot to which the current pixel belongs, and calculate the cumulative value of the product of the current pixel gray value and coordinate value and the product of all pixel gray values and coordinate values of the same spot that has been processed, the current pixel The cumulative value of the gray value and the processed gray value of all pixels of the same light spot, save the obtained cumulative value, and execute step D;
C、将当前像素标记为背景像素,并判断是否调整当前像素所属光斑的存储数据,如果是,则调整当前像素所属光斑的存储数据,否则执行步骤D;C. Mark the current pixel as a background pixel, and judge whether to adjust the stored data of the light spot to which the current pixel belongs, if yes, adjust the stored data of the light spot to which the current pixel belongs, otherwise perform step D;
D、判断是否处理完整个输出图像,如果未处理完,则返回步骤A,如果处理完,计算步骤B所得到的各个光斑灰度值和坐标值乘积的累加值与灰度值累加值之商,并将得到的商作为各个光斑图像质心坐标值输出。D. Judging whether to process the entire output image, if it is not processed, return to step A, if it is processed, calculate the quotient of the cumulative value of the product of the gray value of each spot obtained in step B and the coordinate value and the cumulative value of the gray value , and output the obtained quotient as the centroid coordinate value of each spot image.
其中,所述步骤B中,在标记的同时进一步包括合并同一光斑中等价标记的步骤。所述进行高斯卷积运算之前进一步包括:读取当前像素灰度值,并将当前所读的像素灰度值进行缓存。Wherein, in the step B, the step of merging equivalent marks in the same spot is further included while marking. Before performing the Gaussian convolution operation, it further includes: reading the gray value of the current pixel, and buffering the gray value of the currently read pixel.
上述方法中,步骤B所述对当前像素进行标记进一步包括:In the above method, marking the current pixel in step B further includes:
B11、判断当前像素左边像素的标记值是否为零,如果不为零,则将当前像素标记为左边像素的标记值,执行步骤B13,否则,执行步骤B12;B11, judging whether the mark value of the left pixel of the current pixel is zero, if not zero, then mark the current pixel as the mark value of the left pixel, and perform step B13, otherwise, perform step B12;
B12、判断当前像素上方像素的标记值是否不为零,如果是,则将当前像素标记为上方像素的标记值,执行步骤B13,否则,将当前像素标记为新标记值,并更新新标记值;B12. Determine whether the mark value of the pixel above the current pixel is not zero, if so, mark the current pixel as the mark value of the above pixel, and perform step B13, otherwise, mark the current pixel as a new mark value, and update the new mark value ;
B13、将当前像素标记值赋给左标记参数和上标记参数组中对应的标记参数。B13. Assign the current pixel marker value to the corresponding marker parameter in the left marker parameter and the upper marker parameter group.
上述方法中,所述合并同一光斑中等价标记进一步包括:In the above method, the merging of equivalent labels in the same spot further includes:
B21、判断当前像素左边像素和上方像素的标记值,如果均为零,则将当前像素对应的等价标记参数置为新等价标记值,更新新等价标记值,执行步骤B22;如果均不为零,且二者不相等,则将合并标记数+1,执行步骤B22;B21, judge the mark value of the pixel on the left side of the current pixel and the pixel above, if they are all zero, then set the equivalent mark parameter corresponding to the current pixel as a new equivalent mark value, update the new equivalent mark value, and perform step B22; is not zero, and the two are not equal, then the number of merged marks will be +1, and step B22 will be executed;
B22、判断合并标记数是否为1,如果合并标记数为1,则将当前像素左边像素的等价标记合并为当前像素上方像素的等价标记,并更新新等价标记值为前一新等价标记值;如果合并标记数不为1,则执行步骤B23;B22. Determine whether the number of merged marks is 1, if the number of merged marks is 1, then merge the equivalent marks of the pixel on the left side of the current pixel into the equivalent marks of the pixel above the current pixel, and update the new equivalent mark value to the previous new etc. value mark value; if the combined mark number is not 1, then execute step B23;
B23、判断当前像素左边像素的等价标记值与当前像素上方像素的等价标记值是否相等,如果不相等,则合并等价数据,并将当前像素上方像素的等价标记合并为当前像素左边像素的等价标记,如果相等,则不作处理。B23. Determine whether the equivalent mark value of the pixel on the left side of the current pixel is equal to the equivalent mark value of the pixel above the current pixel, if not, merge the equivalent data, and merge the equivalent mark value of the pixel above the current pixel into the left side of the current pixel Pixel equivalence marks, if equal, do not process.
上述方法中,所述步骤C进一步包括:将上标记参数组、左标记参数清零;步骤C所述判断为:判断当前像素左边像素的标记值是否大于零,如果是,则调整当前像素所属光斑的存储数据,否则不调整;所述调整为:将累加器的值累加到等价标记值对应的数据存储器中,并将累加器清零。In the above method, the step C further includes: clearing the upper mark parameter group and the left mark parameter to zero; the judgment in step C is: judge whether the mark value of the pixel to the left of the current pixel is greater than zero, and if so, adjust the value of the current pixel. The storage data of the light spot, otherwise no adjustment; the adjustment is: accumulating the value of the accumulator into the data memory corresponding to the equivalent mark value, and clearing the accumulator.
本发明还提供一种快速高精度光斑图像质心定位装置,包括高斯滤波单元、光斑识别单元和光斑质心计算单元,其中,高斯滤波单元,用于对输出图像像素的灰度值进行高斯滤波,并将经过高斯滤波处理的像素灰度值送至光斑质心计算单元;光斑识别单元,用于接收光斑质心计算单元输入的进行光斑识别的控制信号,完成光斑图像的像素标记;光斑质心计算单元,根据像素标记值进行不同光斑图像质心的计算,并将最后的计算结果输出。The present invention also provides a fast and high-precision spot image centroid positioning device, including a Gaussian filter unit, a spot recognition unit, and a spot centroid calculation unit, wherein the Gaussian filter unit is used to perform Gaussian filtering on the gray value of the output image pixel, and Send the pixel gray value processed by Gaussian filtering to the spot centroid calculation unit; the spot recognition unit is used to receive the control signal for spot recognition input by the spot centroid calculation unit, and complete the pixel marking of the spot image; the spot centroid calculation unit, according to The pixel mark value is used to calculate the centroid of different spot images, and the final calculation result is output.
所述光斑识别单元进一步包括:标记判断器、左标记寄存器、上标记寄存器组、当前标记寄存器、新标记寄存器;其中,标记判断器,用于对像素进行标记;左标记寄存器、上标记寄存器组、当前标记寄存器、新标记寄存器,用于存储并向标记判断器提供当前像素左边像素的标记值、当前像素上方像素的标记值、当前像素的标记值、新标记值。The spot recognition unit further includes: a mark judger, a left mark register, an upper mark register group, a current mark register, and a new mark register; wherein, the mark determiner is used to mark pixels; the left mark register, the upper mark register group , the current flag register, and the new flag register are used to store and provide the flag value of the pixel to the left of the current pixel, the flag value of the pixel above the current pixel, the flag value of the current pixel, and the new flag value to the flag judger.
所述光斑识别单元还包括:合并等价标记判断器、合并标记寄存器、新等价标记寄存器、等价标记缓存器;其中,合并等价标记判断器,用于对同一光斑中的等价标记进行合并;等价标记缓存器,用于存储合并后的等价标记值;合并标记寄存器,用于存储合并标记值;新等价标记寄存器,用于向合并等价标记判断器提供新等价标记值;左标记寄存器、上标记寄存器组、当前标记寄存器,进一步用于向合并等价标记判断器提供当前像素左边像素的标记值、当前像素上方像素的标记值、当前像素的标记值。The spot identification unit also includes: a merge equivalence mark judge, a merge mark register, a new equivalence mark register, and an equivalence mark buffer; wherein, the merge equivalence mark judger is used to identify the equivalence marks in the same spot Merge; equivalence mark cache, for storing the merged equivalent mark value; merge mark register, for storing merge mark value; new equivalence mark register, for providing new equivalence to the merge equivalence mark judger Flag value; left flag register, upper flag register group, and current flag register, which are further used to provide the flag value of the pixel to the left of the current pixel, the flag value of the pixel above the current pixel, and the flag value of the current pixel to the combined equivalent flag judger.
上述装置中,所述高斯滤波单元进一步包括:图像缓存和高斯卷积运算单元,其中,图像缓存,用于缓存所读出像素的灰度值,并提供给高斯卷积运算单元;高斯卷积运算单元,用于对缓存的像素灰度值完成高斯卷积运算,并将计算结果输出给光斑质心计算单元。In the above device, the Gaussian filtering unit further includes: an image cache and a Gaussian convolution operation unit, wherein the image cache is used to cache the gray value of the read pixel and provide it to the Gaussian convolution operation unit; the Gaussian convolution operation unit The computing unit is used to complete the Gaussian convolution operation on the cached pixel gray value, and output the calculation result to the spot centroid calculation unit.
所述光斑质心计算单元进一步包括:行列计数器,用于计算并提供每个像素点的坐标值;阈值比较器,用于比较高斯卷积运算单元输出的经过高斯卷积运算的像素灰度值和预设阈值,并将比较结果作为控制信号输出;第一和第二乘法器,分别用于计算像素灰度值和x坐标值的乘积、像素灰度值和y坐标值的乘积;第一和第二加法器,分别用于计算像素灰度值和x坐标值乘积的累加值、像素灰度值和y坐标值乘积的累加值,并将得到的累加值分别送至第一和第二数据存储器存储;第三加法器,用于计算像素灰度值的累加值,并将得到的累加值送至第三数据存储器存储;第一、第二和第三数据存储器,分别用于存储像素灰度值和x坐标值乘积的累加值、像素灰度值和y坐标值乘积的累加值、像素灰度值的累加值;第一除法器和第二除法器,分别用于计算像素灰度值和x坐标值乘积累加值与像素灰度值累加值之商、像素灰度值和y坐标值乘积累加值与像素灰度值累加值之商。The spot centroid calculation unit further includes: a row and column counter for calculating and providing the coordinate value of each pixel point; a threshold comparator for comparing the Gaussian convolution operation pixel gray value output by the Gaussian convolution operation unit and Presetting the threshold, and outputting the comparison result as a control signal; the first and second multipliers are respectively used to calculate the product of the pixel gray value and the x coordinate value, and the product of the pixel gray value and the y coordinate value; the first and The second adder is used to calculate the cumulative value of the product of the pixel gray value and the x coordinate value, the cumulative value of the product of the pixel gray value and the y coordinate value, and send the obtained cumulative value to the first and second data respectively memory storage; the third adder is used to calculate the cumulative value of the gray value of the pixel, and sends the obtained cumulative value to the third data memory for storage; the first, second and third data memory are respectively used to store the gray value of the pixel The cumulative value of the product of the degree value and the x coordinate value, the cumulative value of the product of the pixel gray value and the y coordinate value, and the cumulative value of the pixel gray value; the first divider and the second divider are used to calculate the pixel gray value respectively The quotient of the accumulated value multiplied by the x coordinate value and the accumulated value of the pixel gray value, the quotient of the accumulated value multiplied by the pixel gray value and the y coordinate value and the accumulated value of the pixel gray value.
本发明所提供的快速高精度光斑图像质心定位方法及装置,对输出图像的像素灰度值进行高斯滤波处理后,对输出图像的每个像素同时进行标记和计算处理,从而能快速地对一个或多于一个的光斑图像进行自动识别与处理。本发明具有以下优点:The fast and high-precision spot image centroid positioning method and device provided by the present invention perform Gaussian filter processing on the pixel gray value of the output image, and simultaneously mark and calculate each pixel of the output image, so that a or more than one spot image for automatic identification and processing. The present invention has the following advantages:
1)本发明采用高斯加权的质心定位方法,对输出的图像数据先进行高斯卷积运算,完成高斯滤波,再进行光斑识别,进而提高了该方法和装置的抗噪声能力,实现了高精度的定位。1) The present invention adopts the Gaussian weighted centroid positioning method, first performs Gaussian convolution operation on the output image data, completes Gaussian filtering, and then performs spot recognition, thereby improving the anti-noise ability of the method and device, and realizing high-precision position.
2)本发明是对整个输出图像的每个像素进行标记、处理,而不是采用窗口形式,因此可识别和处理图像中任意多个光斑,且光斑的大小和形状不受限制。2) The present invention marks and processes each pixel of the entire output image instead of using a window form, so any number of light spots in the image can be identified and processed, and the size and shape of the light spots are not limited.
3)本发明在光斑初始标记时,由于对同一光斑可能存在一个以上等价标记,使得同一光斑的图像数据存在一个以上数据缓存器中,因此,本发明在标记像素的同时对属于同一光斑的等价标记进行合并,通过合并等价标记及等价标记值的压缩,将属于同一光斑的图像数据缓存于同一数据缓存器中,能大大节省数据存储空间。3) When the present invention initially marks the light spot, since there may be more than one equivalent mark for the same light spot, the image data of the same light spot is stored in more than one data buffer. The equivalent marks are combined, and the image data belonging to the same light spot is cached in the same data buffer by merging the equivalent marks and compressing the equivalent mark values, which can greatly save data storage space.
4)由于本发明将标记像素、合并等价标记、对像素的累加计算并行实现,且采用FPGA硬件装置实时实现,因此解决了大数据量图像预处理的瓶颈问题,使得数据更新率最高能达到30MHz,可实现实时的质心提取。4) Since the present invention realizes marking pixels, merging equivalent marks, and cumulative calculation of pixels in parallel, and adopts an FPGA hardware device for real-time realization, it solves the bottleneck problem of image preprocessing with a large amount of data, so that the highest data update rate can reach 30MHz, which can realize real-time centroid extraction.
附图说明Description of drawings
图1为本发明光斑图像质心定位方法一具体实施例的流程图;Fig. 1 is a flow chart of a specific embodiment of the spot image centroid location method of the present invention;
图2为图1所示流程中进行像素标记的流程图;Fig. 2 is a flow chart of performing pixel marking in the process shown in Fig. 1;
图3为经过标记的一种光斑图像示意图;Fig. 3 is a schematic diagram of a marked spot image;
图4为图1所示流程中进行合并等价标记的流程图;Fig. 4 is the flow chart of merging equivalence marking in the flow process shown in Fig. 1;
图5为图3所示光斑图像进行等价标记合并后的光斑图像示意图;Fig. 5 is a schematic diagram of the spot image after equivalent labeling and merging of the spot image shown in Fig. 3;
图6为本发明光斑图像质心定位装置一具体实施例的组成结构示意图。FIG. 6 is a schematic diagram of the composition and structure of a specific embodiment of the spot image centroid positioning device of the present invention.
具体实施方式Detailed ways
本发明的基本思想是:先对输出图像的像素灰度值进行高斯滤波处理,再对输出图像的每个像素同时进行标记和计算处理,从而能对一个或多于一个的光斑图像进行自动识别和处理。The basic idea of the present invention is to firstly perform Gaussian filter processing on the pixel gray value of the output image, and then perform marking and calculation processing on each pixel of the output image at the same time, so that one or more than one spot images can be automatically identified and processing.
这里,所述标记和计算处理具体是:对每个输出像素进行比较,对每个光斑像素进行标记,并在需要时对同一光斑中的不同像素进行等价标记合并,以保证同一光斑的每个像素给予相同的标记,不同光斑像素标记不同;在标记、合并的同时对相同标记的像素进行灰度值和坐标值乘积的累加以及灰度值的累加处理;在整个图像数据输出结束后,将相同标记的像素的灰度值和坐标值乘积的累加值与灰度值的累加值相除,得到每个光斑的质心定位坐标。如此,即可实现对多光斑、大小形状不限的光斑的快速高精度光斑质心定位。Here, the marking and calculation process specifically includes: comparing each output pixel, marking each spot pixel, and combining equivalent marks for different pixels in the same spot when necessary, so as to ensure that each pixel of the same spot Each pixel is given the same mark, and different spot pixels have different marks; while marking and merging, the gray value and coordinate value product of the same marked pixel are accumulated and the gray value is accumulated; after the output of the entire image data is completed, The cumulative value of the product of the gray value and the coordinate value of the same marked pixel is divided by the cumulative value of the gray value to obtain the centroid positioning coordinates of each light spot. In this way, fast and high-precision spot centroid positioning for multi-spots with unlimited sizes and shapes can be realized.
从现有技术的质心定位过程可以看出,噪声对定位精度影响很大,因此,本发明中采用高斯加权质心定位方法,即:在质心定位时不采用原图像像素灰度值进行计算,而是通过公式(1)对原图像像素的灰度值进行高斯滤波,再采用原图像像素经过高斯滤波后的灰度值进行计算。It can be seen from the centroid positioning process of the prior art that noise has a great influence on the positioning accuracy. Therefore, the Gaussian weighted centroid positioning method is adopted in the present invention, that is, the gray value of the original image pixel is not used for calculation when the centroid is positioned, but Gaussian filtering is performed on the gray value of the original image pixel by formula (1), and then the gray value of the original image pixel after Gaussian filtering is used for calculation.
公式(1)中,F(x,y)表示输出图像数据灰度值,I(x,y)表示高斯卷积处理后输出图像数据的灰度值,g(i,j)表示高斯滤波系数。In formula (1), F(x, y) represents the gray value of the output image data, I(x, y) represents the gray value of the output image data after Gaussian convolution processing, and g(i, j) represents the Gaussian filter coefficient .
图1所示为本发明光斑图像质心定位方法一具体实施例的处理过程,参见图1,本实施例的光斑图像质心定位方法包括以下处理步骤:Fig. 1 shows the processing process of a specific embodiment of the method for locating the centroid of the spot image of the present invention, referring to Fig. 1, the method for locating the centroid of the spot image of the present embodiment includes the following processing steps:
步骤101:读取当前像素灰度值,并将当前所读取的像素灰度值进行缓存。Step 101: Read the current pixel gray value, and cache the currently read pixel gray value.
这里,所述缓存像素灰度值,一般是根据高斯卷积模版大小,即输出图像的行数据量来确定,比如:高斯卷积模版是7×7的,则每次缓存6行数据,读出第7行后再进行后续处理。Here, the cache pixel gray value is generally determined according to the size of the Gaussian convolution template, that is, the amount of row data of the output image. Subsequent processing is carried out after the 7th row.
步骤102~103:对缓存的灰度值进行高斯卷积运算,并将高斯卷积运算后得到的像素灰度值与预先设定的阈值进行比较,运算后像素灰度值是否大于设定阈值,如果是,则表示当前像素是光斑,执行步骤104进行光斑识别;否则,表示当前像素是背景,执行步骤107。Steps 102-103: Perform Gaussian convolution operation on the cached grayscale value, and compare the pixel grayscale value obtained after the Gaussian convolution operation with the preset threshold value, and check whether the pixel grayscale value after the operation is greater than the set threshold value , if yes, it means that the current pixel is a light spot, go to step 104 to identify the light spot; otherwise, it means that the current pixel is a background, go to step 107.
这里,所述进行高斯卷积运算也是根据高斯卷积模版确定,比如:对于7×7的高斯卷积模版,每次对输出图像的7行7列数据进行处理,处理顺序通常为以输出图像起始点为准,从左向右、从上向下;具体高斯卷积运算采用公式(1)的计算方式,实际上,具体的实现方式只要达到实现公式(1)的计算目的即可。所述阈值通常根据输出图像本身的灰度与背景的对比度来确定,一般光斑对比度越小,阈值设置越低;光斑对比度越大,阈值设置越高。Here, the Gaussian convolution operation is also determined according to the Gaussian convolution template, for example: for a 7×7 Gaussian convolution template, the 7 rows and 7 columns of the output image are processed each time, and the processing order is usually output image The starting point shall prevail, from left to right and from top to bottom; the specific Gaussian convolution operation adopts the calculation method of formula (1). In fact, the specific implementation method only needs to achieve the calculation purpose of formula (1). The threshold is usually determined according to the contrast between the grayscale of the output image itself and the background. Generally, the smaller the spot contrast, the lower the threshold setting; the larger the spot contrast, the higher the threshold setting.
步骤104:对当前读取的像素进行标记,并识别当前像素所属的光斑。Step 104: Mark the currently read pixel and identify the light spot to which the current pixel belongs.
其中,背景像素可以零标记,非背景像素以非零值标记。当然,在实际应用中,也可以将背景像素标记为其它值,相应的,非背景像素标记为非背景像素标记值,只要能区分背景和非背景以及不同光斑即可。为了计算和标记的方便,一般采用零和正整数作为可选标记值,当然,也可以采用负整数、小数等值。下面步骤以背景像素标记为零,非背景像素标记为非零的正整数为例进行说明。Among them, background pixels can be marked with zero, and non-background pixels can be marked with non-zero values. Of course, in practical applications, the background pixels can also be marked with other values, correspondingly, the non-background pixels can be marked with non-background pixel marking values, as long as the background and non-background and different light spots can be distinguished. For the convenience of calculation and marking, zero and positive integers are generally used as optional marking values. Of course, negative integers, decimals, etc. can also be used. The following steps are described by taking background pixels marked as zero and non-background pixels marked as non-zero positive integers as an example.
具体每个像素的标记过程如图2所示,包括以下步骤:The specific marking process of each pixel is shown in Figure 2, including the following steps:
步骤104~104b:判断当前像素左边像素的标记值是否为零,如果不为零,则将当前像素标记为左边像素的标记值,执行步骤104f,如果为零,执行步骤104c。Steps 104-104b: Determine whether the marked value of the pixel to the left of the current pixel is zero, if not, mark the current pixel as the marked value of the left pixel, execute step 104f, and if it is zero, execute step 104c.
步骤104c~104e:判断当前像素上方像素的标记值是否为零,如果不为零,则将当前像素标记为上方像素的标记值,执行步骤104f,如果为零,将当前像素标记为新标记值,并更新新标记值。Steps 104c-104e: Determine whether the mark value of the pixel above the current pixel is zero, if not, mark the current pixel as the mark value of the pixel above, execute step 104f, if it is zero, mark the current pixel as a new mark value , and update the new tag value.
这里,所述新标记值可采用专门的寄存器存储,用于给像素提供新的标记值,新标记值可以采用不同的方式进行更新,只要保证每次提供的新标记值不重复即可。比如:每次使用新标记值后,将新标记值加1重新保存,以供下次像素标记使用。Here, the new flag value can be stored in a special register to provide a new flag value for the pixel, and the new flag value can be updated in different ways, as long as the new flag value provided each time is not repeated. For example: after each use of the new tag value, add 1 to the new tag value and save it again for the next pixel tag use.
步骤104f:将当前像素标记值赋给左标记参数和上标记参数组中对应的标记参数,以备下一个像素和下一行像素标记使用。Step 104f: Assign the current pixel label value to the corresponding label parameter in the left label parameter and the upper label parameter group, so as to be used for labeling the next pixel and the next row of pixels.
这里,可由缓存器存储上标记参数组,由寄存器存储左标记参数。其中,左标记参数为一个标记值,初始化时置为零,上标记参数组用于保存一组标记参数值,可以采用一个数组,该组中每个标记分别对应一个像素,比如:一行有10个像素,该上标记参数组就是由10个标记组成的标记组,每个标记对应该行中的一个像素,该组标记参数的初始值均为零。相应的,在赋值时,就将当前像素的标记值赋给对应当前像素的上标记参数组中的标记参数,比如:一行有10个像素,上标记参数组包括10个标记参数,当前像素为所属行的第5个像素,那么,所述赋值就是指将当前像素的标记值赋给上标记参数组中的第5个标记参数。在进行判断时,所述当前像素的上方像素的标记值也是在上标记参数组中找与当前像素序号对应的标记参数进行判别。Here, the upper flag parameter group may be stored in the register, and the left flag parameter may be stored in the register. Among them, the left marker parameter is a marker value, which is set to zero during initialization, and the upper marker parameter group is used to save a group of marker parameter values. An array can be used, and each marker in this group corresponds to a pixel, for example: a row has 10 pixels, the upper marker parameter group is a marker group consisting of 10 markers, each marker corresponds to a pixel in the row, and the initial values of the marker parameters in this group are all zero. Correspondingly, when assigning a value, assign the tag value of the current pixel to the tag parameter in the upper tag parameter group corresponding to the current pixel, for example: there are 10 pixels in a line, the upper tag parameter group includes 10 tag parameters, and the current pixel is The 5th pixel of the row to which it belongs, then the assignment refers to assigning the tag value of the current pixel to the 5th tag parameter in the upper tag parameter group. When judging, the tag value of the pixel above the current pixel is also judged by finding the tag parameter corresponding to the serial number of the current pixel in the upper tag parameter group.
步骤104a~104f是一个像素的标记过程,重复执行104a~104f就可以对输出图像中的每个像素进行标记。比如:对于图3中第2行第4列的像素,先判断当前像素左边像素的标记值,因为等于零,所以再继续判断当前像素上方像素的标记值,也等于零,则将当前像素标记为新标记值,并更新新标记值。再比如:对于图3中第2行第5列的像素,先判断当前像素左边像素的标记值,因为等于2,所以直接将当前像素标记为2。Steps 104a-104f are a pixel marking process, and each pixel in the output image can be marked by repeating steps 104a-104f. For example: for the pixel in row 2 and column 4 in Figure 3, first judge the mark value of the pixel to the left of the current pixel, because it is equal to zero, so continue to judge the mark value of the pixel above the current pixel, which is also equal to zero, then mark the current pixel as new tag value, and update the new tag value. Another example: for the pixel in row 2 and column 5 in FIG. 3 , first judge the mark value of the pixel to the left of the current pixel. Since it is equal to 2, the current pixel is directly marked as 2.
步骤105:合并同一光斑中的等价标记。Step 105: Merge equivalent markers in the same light spot.
图3为一个采用图2方法进行标记后的图像示意图,图3中阴影覆盖的区域为光斑,图3中有四个光斑。从图3可以看出,对于同一个光斑,可能存在多个不同的标记,这些标记对于同一个光斑是等价的,因此,为了统一同一个光斑中的所有标记,本发明采用图4所示的流程进行等价标记的合并,给每个光斑赋予一个相同的等价标记值,在背景标记为零的情况下,等价标记值也是从1开始的正整数。等价标记合并的具体过程如图4所示,包括:Fig. 3 is a schematic diagram of an image marked by the method in Fig. 2. The area covered by the shadow in Fig. 3 is a light spot, and there are four light spots in Fig. 3 . It can be seen from Fig. 3 that for the same spot, there may be multiple different marks, which are equivalent to the same spot. Therefore, in order to unify all the marks in the same spot, the present invention adopts the method shown in Fig. 4 The process of merging the equivalent marks gives each spot the same equivalent mark value. When the background mark is zero, the equivalent mark value is also a positive integer starting from 1. The specific process of merging equivalent marks is shown in Figure 4, including:
步骤105a~105c:判断当前像素左边像素和上方像素的标记值,如果均为零,则将当前像素对应的等价标记参数置为新等价标记值,更新新等价标记值,执行步骤105d;如果均不为零,且二者不相等,则说明二者的标记是等价的,将合并标记数+1,执行步骤105d。Steps 105a-105c: Determine the tag values of the left pixel and the upper pixel of the current pixel, if they are all zero, set the equivalent tag parameter corresponding to the current pixel as the new equivalent tag value, update the new equivalent tag value, and execute step 105d ; If both are not zero, and the two are not equal, it means that the marks of the two are equivalent, and the number of merged marks will be +1, and step 105d will be executed.
这里,所述新等价标记值可采用专门的寄存器存储,用于给像素提供新的等价标记值,新等价标记值可以采用不同的方式进行更新,只要保证每次提供的新等价标记值不重复即可。比如:每次使用新等价标记值后,将新等价标记值加1重新保存,以供下次像素标记使用。合并标记数用于记录需要合并的等价标记个数,可由寄存器存储合并标记数的值,最终得到的等价标记值可采用专门的缓存器存储。Here, the new equivalent tag value can be stored in a special register to provide a new equivalent tag value for the pixel, and the new equivalent tag value can be updated in different ways, as long as the new equivalent tag value provided each time is guaranteed Tag values are not repeated. For example: after each use of the new equivalent tag value, add 1 to the new equivalent tag value and save it again for the next pixel tag use. The number of merge marks is used to record the number of equivalent marks that need to be merged, and the value of the number of merge marks can be stored by a register, and the value of the finally obtained equivalent marks can be stored in a special register.
步骤105d~105h:判断合并标记数是否等于1,如果是,则将当前像素左边像素的等价标记合并为当前像素上方像素的等价标记,并更新新等价标记值为前一新等价标记值。如果步骤105b中的更新新等价标记值是每次将新等价标记值加1,那么,这里更新新等价标记值为前一新等价标记值就是将当前新等价标记值减1。Steps 105d-105h: Determine whether the number of merged marks is equal to 1, if so, merge the equivalent marks of the pixel to the left of the current pixel into the equivalent marks of the pixel above the current pixel, and update the new equivalent mark to the previous new equivalent tag value. If the update new equivalent tag value in step 105b is to add 1 to the new equivalent tag value each time, then, here, updating the new equivalent tag value to the previous new equivalent tag value is to subtract 1 from the current new equivalent tag value .
由于在合并等价标记的过程中将新等价标记值更新为前一新等价标记值,压缩了等价标记值的范围,而等价标记值是数据存储器对应的地址,新等价标记范围的压缩大大节省了数据存储单元。如图3所示的光斑,不进行等价标记压缩时所使用的数据存储单元为19,一个像素标记对应一个数据存储单元,其中大部分的存储单元是空的没有用,而进行等价标记压缩后的光斑图像如图5所示,只需4个数据存储单元。Since the new equivalent tag value is updated to the previous new equivalent tag value in the process of merging the equivalent tag, the range of the equivalent tag value is compressed, and the equivalent tag value is the address corresponding to the data memory, and the new equivalent tag Compression of ranges saves data storage units considerably. As shown in Figure 3, the data storage unit used when the equivalent mark compression is not performed is 19, and one pixel mark corresponds to one data storage unit, and most of the storage units are empty and useless, and the equivalent mark is performed The compressed spot image is shown in Figure 5, only 4 data storage units are needed.
如果合并标记数不等于1,则进一步判断当前像素左边像素的等价标记值与当前像素上方像素的等价标记值是否相等,如果不相等,则进行等价数据的合并和等价标记的合并。这里,等价数据是指等价标记所对应的存储空间的数据。具体就是:将上方像素的等价标记对应的数据存储器空间的数据合并到左边像素的等价标记对应的存储空间中,将上方像素的等价标记对应的数据存储器空间清零,同时将当前像素上方像素的等价标记合并为当前像素左边像素的等价标记,如果相等,则不作处理。If the number of merged marks is not equal to 1, it is further judged whether the equivalent mark value of the pixel to the left of the current pixel is equal to the equivalent mark value of the pixel above the current pixel, and if they are not equal, merge the equivalent data and the merge of the equivalent marks . Here, the equivalent data refers to the data in the storage space corresponding to the equivalent tag. Specifically: merge the data in the data memory space corresponding to the equivalent mark of the upper pixel into the storage space corresponding to the equivalent mark of the left pixel, clear the data memory space corresponding to the equivalent mark of the upper pixel, and at the same time clear the data of the current pixel The equivalent marks of the upper pixel are merged into the equivalent marks of the left pixel of the current pixel, and if they are equal, they are not processed.
图3所示图像经过合并处理后的结果如图5所示,要说明的是,图5中每个像素上的标记实际为该像素所属光斑图像数据最终存储的数据存储器地址,比如:图5中左上方的光斑标记为1,表示此光斑的光斑图像数据存储于等价标记为1的数据存储器中。The result of the merged image shown in Figure 3 is shown in Figure 5. It should be noted that the mark on each pixel in Figure 5 is actually the address of the data memory where the spot image data to which the pixel belongs is finally stored, for example: Figure 5 The spot at the upper left of the center is marked as 1, which means that the spot image data of this spot is stored in the data memory equivalently marked as 1.
在实际应用中,如果一个光斑中的所有像素均已采用同一标记值,那就不需要进行等价标记合并;或者,如果不考虑减少存储空间的占用,也可以不做此步骤,所以步骤105是可选的。In practical applications, if all pixels in a spot have adopted the same tag value, then there is no need to perform equivalent tag merging; or, if the reduction of storage space is not considered, this step can also be omitted, so step 105 is optional.
步骤106:将当前像素灰度值和坐标值的乘积与已处理的同一光斑所有像素灰度值和坐标值乘积的累加值进行累加,并将当前像素的灰度值与已处理的同一光斑所有像素的灰度累加值进行累加,保存得到的累加值,执行步骤110。Step 106: Accumulate the product of the gray value of the current pixel and the coordinate value and the accumulated value of the product of the gray value of all pixels of the same spot that has been processed and the coordinate value, and combine the gray value of the current pixel with all the gray values of the same spot that have been processed Accumulate the accumulated gray value of the pixel, save the obtained accumulated value, and execute step 110 .
本发明中,上述步骤104、105和106对于每个像素而言是并行实现的,如此,可以大大提高处理速度。In the present invention, the above-mentioned steps 104, 105 and 106 are implemented in parallel for each pixel, so that the processing speed can be greatly improved.
步骤107:将当前像素标记为背景像素,本实施例中将当前像素标记为零,并将上标记参数组、左标记参数清零。Step 107: mark the current pixel as a background pixel. In this embodiment, mark the current pixel as zero, and clear the upper mark parameter group and the left mark parameter to zero.
这里,所述上标记参数组、左标记参数的定义与步骤104f所述完全相同。Here, the definitions of the upper label parameter group and the left label parameter are exactly the same as those described in step 104f.
步骤108~109:判断当前像素左边像素的标记值是否大于零,如果不是,则直接执行步骤110;如果是,则调整当前像素所属光斑的存储数据,具体操作是:将累加器的值累加到等价标记值对应的数据存储器中,并将累加器清零。Steps 108-109: Determine whether the mark value of the pixel to the left of the current pixel is greater than zero, if not, directly execute step 110; if yes, adjust the stored data of the light spot to which the current pixel belongs, the specific operation is: add the value of the accumulator to equivalent tag value in data memory and clears the accumulator.
步骤110:判断是否处理完整个输出图像,如果是,则执行步骤111,否则返回步骤101。这里,可根据是否读到当前输出图像的结束标志确定是否处理完该输出图像。Step 110: Judging whether the entire output image has been processed, if yes, execute step 111, otherwise return to step 101. Here, it may be determined whether the output image is processed completely according to whether the end flag of the current output image is read.
步骤111:按照公式(2)将步骤106计算得到的灰度值和坐标值乘积的累加值与灰度值的累加值相除,将得到的商作为光斑图像质心坐标值输出。Step 111: According to the formula (2), divide the accumulated value of the product of the gray value and the coordinate value calculated in step 106 by the accumulated value of the gray value, and output the obtained quotient as the coordinate value of the center of mass of the spot image.
公式(2)中,I(x,y)表示高斯卷积处理后输出图像数据的灰度值;x0、y0为光斑图像质心的x、y坐标值。In formula (2), I(x, y) represents the gray value of the output image data after Gaussian convolution processing; x 0 and y 0 are the x and y coordinate values of the centroid of the spot image.
为实现上述方法,本发明提出一种相应的光斑图像质心定位装置,如图6所示,本发明的光斑图像质心定位装置包括:光斑识别单元61、高斯滤波单元62、光斑质心计算单元63。其中,光斑识别单元61用于接收光斑质心计算单元63中阈值比较器632输入的进行光斑识别的控制信号,完成光斑图像的像素标记、同一光斑的等价标记合并。光斑识别单元61进一步包括标记判断器611、合并等价标记判断器612、左标记寄存器613、上标记寄存器组614、当前标记寄存器615、新标记寄存器616、合并标记寄存器617、新等价标记寄存器618、等价标记缓存器619。In order to realize the above method, the present invention proposes a corresponding spot image centroid positioning device. As shown in FIG. Wherein, the spot identification unit 61 is used to receive the control signal for spot identification input from the
其中,标记判断器611用于对像素进行标记,具体标记过程采用图2所示的过程,结合当前标记寄存器615、左标记寄存器613、上标记寄存器组614、新标记寄存器616保存的标记值完成对当前像素的标记。Wherein, the marking determiner 611 is used to mark the pixels, and the specific marking process adopts the process shown in FIG. A marker for the current pixel.
合并等价标记判断器612用于对同一光斑中的等价标记进行合并,具体合并过程采用图4所示的过程,结合左标记寄存器613、上标记寄存器组614、合并标记寄存器617以及新等价标记寄存器618完成对同一光斑不同像素的等价标记合并并将等价标记值保存在等价标记缓存器619中。The merging equivalence mark judging unit 612 is used for merging the equivalent marks in the same spot. The specific merging process adopts the process shown in FIG. The
当前标记寄存器615、左标记寄存器613、上标记寄存器组614、新标记寄存器616、合并标记寄存器617、新等价标记寄存器618、等价标记缓存器619分别用于存储并向标记判断器611、合并等价标记判断器612提供当前像素的标记值、当前像素左边像素的标记值、当前像素上方像素的标记值、新标记值、合并标记值、新等价标记值和最终的等价标记值。其中,上标记寄存器组614和等价标记缓存器619用于存储一组标记参数值,比如:一行像素的标记值,其余寄存器中仅存储一个标记值。等价标记缓存器619还将合并后每个光斑的等价标记作为地址提供给光斑质心计算单元63中的数据存储器635a、635b和635c,以便将每个光斑的图像数据最终存储在合并后的等价标记对应的数据存储器中。
如果不做等价标记合并,则合并等价标记判断器612、合并标记寄存器617、新等价标记寄存器618和等价标记缓存器619可省略。If the equivalence mark merge is not performed, the merge equivalence mark determiner 612, the merge mark register 617, the new equivalence mark register 618 and the equivalence mark register 619 can be omitted.
高斯滤波单元62用于对输出图像像素的灰度值进行高斯滤波,并将经过高斯滤波处理的像素灰度值送至光斑质心计算单元63;高斯滤波单元62进一步包括图像缓存621和高斯卷积运算单元622,其中,图像缓存621用于缓存所读出像素的灰度值,并提供给高斯卷积运算单元622;高斯卷积运算单元622用于对缓存的像素灰度值完成高斯卷积运算,并将计算结果输出给光斑质心计算单元63中的阈值比较器632、乘法器633a和633b、加法器634c。The Gaussian filter unit 62 is used to perform Gaussian filtering on the grayscale value of the output image pixel, and send the pixel grayscale value processed by the Gaussian filter to the spot centroid calculation unit 63; the Gaussian filter unit 62 further includes an
光斑质心计算单元63用于计算光斑图像的质心,并将最后的计算结果输出。光斑质心计算单元63进一步包括:行列计数器631,用于计算并提供每个像素点的坐标值,将每个像素的x、y坐标值分别输入给乘法器633a和633b;阈值比较器632,用于接收高斯卷积运算单元622输出的经过高斯卷积运算的像素灰度值、以及单独输入的预设阈值,将两者进行比较,并将比较结果作为控制信号发送给标记判断器611、合并等价标记判断器612、加法器634a、634b和634c。The spot centroid calculation unit 63 is used to calculate the centroid of the spot image, and output the final calculation result. The spot centroid calculation unit 63 further includes: a row and column counter 631, which is used to calculate and provide the coordinate value of each pixel, and input the x and y coordinate values of each pixel to the multipliers 633a and 633b respectively; the
光斑质心计算单元63还包括:乘法器633a和633b,加法器634a、634b和634c,数据存储器635a、635b和635c,以及除法器636a和636b。其中,乘法器633a、633b接收高斯卷积运算单元622输出的经过高斯滤波的像素灰度值、以及行列计数器输入的x、y坐标值,输出像素灰度值与坐标值的乘积;加法器634a、634b和634c接收阈值比较器632的输出结果、自身的累加结果,并分别接收乘法器633a、633b和高斯卷积运算单元622输出的结果进行累加运算。实际上,乘法器633a和加法器634a用于计算同一光斑所有像素x坐标值与像素灰度值乘积的累加值,并将计算结果存储于数据存储器635a中;乘法器633b和加法器634b用于计算同一光斑所有像素y坐标值与像素灰度值乘积的累加值,并将计算结果存储于数据存储器635b中;加法器634c用于计算同一光斑所有像素灰度值的累加值,并将计算结果存储于数据储器635c中。除法器636a和636b分别用于计算x坐标值和像素灰度值乘积的累加值与像素灰度值累加值之商、y坐标值和像素灰度值乘积的累加值与像素灰度值累加值之商,得到光斑质心的x坐标值和y坐标值。乘法器633a和633b、加法器634a、634b和634c、数据存储器635a、635b和635c、除法器636a和636b就是用于完成公式(2)的计算。The spot centroid calculation unit 63 further includes: multipliers 633a and 633b,
本发明的光斑图像质心定位装置可采用现场可编程门阵列(FPGA,Fieldprogrammable gate array)、或专用集成电路(ASIC,Application Specific IntegratedCircuit)实现。The device for locating the spot image centroid of the present invention can be realized by using a field programmable gate array (FPGA, Field programmable gate array) or an application specific integrated circuit (ASIC, Application Specific Integrated Circuit).
在对输出图像进行光斑质心定位时,图6所示装置从当前输出图像中读取当前像素灰度值,并将当前所读入的像素灰度值缓存在图像缓存621中,之后,图像缓存621中的像素灰度值被送入高斯卷积运算单元622进行高斯卷积运算,完成高斯滤波;经过高斯卷积运算的像素灰度值被输入到阈值比较器632中,与单独输入的预设阈值进行比较,再根据比较结果确定是否进行光斑识别,如果是,则将阈值比较结果作为控制信号输入给光斑识别单元61中的标记判断器611和合并等价标记判断器612,启动对光斑像素点的标记以及等价标记的合并,具体标记和合并过程通过标记判断器611、合并等价标记判断器612、左标记寄存器613、上标记寄存器组614、当前标记寄存器615、新标记寄存器616、合并标记寄存器617、新等价标记寄存器618及等价标记缓存器619之间的配合,按图2和图4所示的流程完成;同时,通过乘法器633a和633b、加法器634a、634b和634c、数据存储器635a、635b和635c完成像素灰度值与坐标值乘积的累加以及像素灰度值的累加和存储;在确定处理完整个输出图像后,通过除法器636a和636b计算出光斑质心的x、y坐标值。其中,每个像素的x、y坐标值由行列计数器631提供。When performing spot centroid positioning on the output image, the device shown in FIG. 6 reads the current pixel gray value from the current output image, and caches the currently read pixel gray value in the
以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention.
Claims (11)
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2006101618026A CN100371676C (en) | 2006-11-01 | 2006-12-01 | Fast and high-precision spot image centroid location method and device |
US11/687,338 US8068673B2 (en) | 2006-12-01 | 2007-03-16 | Rapid and high precision centroiding method and system for spots image |
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200610114199.6 | 2006-11-01 | ||
CN200610114199 | 2006-11-01 | ||
CNB2006101618026A CN100371676C (en) | 2006-11-01 | 2006-12-01 | Fast and high-precision spot image centroid location method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1987346A true CN1987346A (en) | 2007-06-27 |
CN100371676C CN100371676C (en) | 2008-02-27 |
Family
ID=38184230
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB2006101618026A Expired - Fee Related CN100371676C (en) | 2006-11-01 | 2006-12-01 | Fast and high-precision spot image centroid location method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100371676C (en) |
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100580365C (en) * | 2008-09-17 | 2010-01-13 | 北京航空航天大学 | A dual-channel centroid-following imaging method and device |
CN101349541B (en) * | 2007-07-20 | 2010-09-29 | 华硕电脑股份有限公司 | Specific image searching method and image deviation compensation method |
CN101968342A (en) * | 2010-09-21 | 2011-02-09 | 哈尔滨工业大学 | Orthogonal fine scanning based method for measuring mass centers of tiny light spots |
CN102081738A (en) * | 2011-01-06 | 2011-06-01 | 西北工业大学 | Method for positioning mass center of spatial object star image |
CN102193819A (en) * | 2010-08-03 | 2011-09-21 | 北京航空航天大学 | Single-point noise resistant method and device for positioning light spot center |
CN102331795A (en) * | 2011-08-26 | 2012-01-25 | 浙江中控太阳能技术有限公司 | Method for controlling sunlight reflecting device to automatically track sun based on facula identification |
CN102496015A (en) * | 2011-11-22 | 2012-06-13 | 南京航空航天大学 | High-precision method for quickly positioning centers of two-dimensional Gaussian distribution spot images |
CN103353387A (en) * | 2013-06-28 | 2013-10-16 | 哈尔滨工业大学 | Light-spot image processing detection system and method for detecting light-spot gray scale centroid and conventional gray-scale image-noise removal effect |
CN103630299A (en) * | 2013-11-29 | 2014-03-12 | 北京航空航天大学 | Positioning method and device for real time centroid of large-pixel light spot image |
CN104034353A (en) * | 2014-06-06 | 2014-09-10 | 中国科学院长春光学精密机械与物理研究所 | Computing method of digital sun sensor centroid based on detecting window |
CN104316049A (en) * | 2014-10-28 | 2015-01-28 | 中国科学院长春光学精密机械与物理研究所 | High-precision and low-signal-to-noise-ratio elliptic star spot subdivision location method |
CN107133627A (en) * | 2017-04-01 | 2017-09-05 | 深圳市欢创科技有限公司 | Infrared light spot center point extracting method and device |
CN107796323A (en) * | 2017-11-06 | 2018-03-13 | 东南大学 | A kind of micro- change detecting system of bridge based on hot spot vision signal intellectual analysis |
CN109949204A (en) * | 2019-03-29 | 2019-06-28 | 江苏亿通高科技股份有限公司 | The asterism mass center of pipeline organization extracts circuit |
CN113658241A (en) * | 2021-08-16 | 2021-11-16 | 北京的卢深视科技有限公司 | Monocular structured light depth recovery method, electronic device and storage medium |
CN116381708A (en) * | 2023-06-07 | 2023-07-04 | 深圳市圳阳精密技术有限公司 | High-precision laser triangular ranging system |
CN117788269A (en) * | 2024-02-27 | 2024-03-29 | 季华实验室 | A method for quickly locating the centroid of a light spot based on FPGA and related equipment |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2889659B2 (en) * | 1990-05-31 | 1999-05-10 | 株式会社リコー | Optical function element |
JP3111434B2 (en) * | 1992-03-31 | 2000-11-20 | オムロン株式会社 | Image processing device |
CN100491899C (en) * | 2005-11-22 | 2009-05-27 | 北京航空航天大学 | A fast and high-precision extraction method for the center of structured light stripes |
-
2006
- 2006-12-01 CN CNB2006101618026A patent/CN100371676C/en not_active Expired - Fee Related
Cited By (26)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101349541B (en) * | 2007-07-20 | 2010-09-29 | 华硕电脑股份有限公司 | Specific image searching method and image deviation compensation method |
CN100580365C (en) * | 2008-09-17 | 2010-01-13 | 北京航空航天大学 | A dual-channel centroid-following imaging method and device |
CN102193819A (en) * | 2010-08-03 | 2011-09-21 | 北京航空航天大学 | Single-point noise resistant method and device for positioning light spot center |
CN101968342A (en) * | 2010-09-21 | 2011-02-09 | 哈尔滨工业大学 | Orthogonal fine scanning based method for measuring mass centers of tiny light spots |
CN101968342B (en) * | 2010-09-21 | 2012-07-25 | 哈尔滨工业大学 | Orthogonal fine scanning based method for measuring mass centers of tiny light spots |
CN102081738B (en) * | 2011-01-06 | 2012-11-21 | 西北工业大学 | Method for positioning mass center of spatial object star image |
CN102081738A (en) * | 2011-01-06 | 2011-06-01 | 西北工业大学 | Method for positioning mass center of spatial object star image |
CN102331795A (en) * | 2011-08-26 | 2012-01-25 | 浙江中控太阳能技术有限公司 | Method for controlling sunlight reflecting device to automatically track sun based on facula identification |
CN102496015A (en) * | 2011-11-22 | 2012-06-13 | 南京航空航天大学 | High-precision method for quickly positioning centers of two-dimensional Gaussian distribution spot images |
CN102496015B (en) * | 2011-11-22 | 2013-08-21 | 南京航空航天大学 | High-precision method for quickly positioning centers of two-dimensional Gaussian distribution spot images |
CN103353387A (en) * | 2013-06-28 | 2013-10-16 | 哈尔滨工业大学 | Light-spot image processing detection system and method for detecting light-spot gray scale centroid and conventional gray-scale image-noise removal effect |
CN103353387B (en) * | 2013-06-28 | 2015-08-19 | 哈尔滨工业大学 | Light spot image process detection system and adopt the method for this systems axiol-ogy hot spot gray scale barycenter and existing gray level image noise remove effect |
CN103630299A (en) * | 2013-11-29 | 2014-03-12 | 北京航空航天大学 | Positioning method and device for real time centroid of large-pixel light spot image |
CN103630299B (en) * | 2013-11-29 | 2015-10-28 | 北京航空航天大学 | A kind of real-time method for positioning mass center of large pixel count light spot image and device |
CN104034353A (en) * | 2014-06-06 | 2014-09-10 | 中国科学院长春光学精密机械与物理研究所 | Computing method of digital sun sensor centroid based on detecting window |
CN104316049A (en) * | 2014-10-28 | 2015-01-28 | 中国科学院长春光学精密机械与物理研究所 | High-precision and low-signal-to-noise-ratio elliptic star spot subdivision location method |
CN107133627A (en) * | 2017-04-01 | 2017-09-05 | 深圳市欢创科技有限公司 | Infrared light spot center point extracting method and device |
WO2018176938A1 (en) * | 2017-04-01 | 2018-10-04 | 深圳市欢创科技有限公司 | Method and device for extracting center of infrared light spot, and electronic device |
US10719954B2 (en) | 2017-04-01 | 2020-07-21 | Shenzhen Camsense Technologies Co., Ltd | Method and electronic device for extracting a center position of an infrared spot |
CN107796323A (en) * | 2017-11-06 | 2018-03-13 | 东南大学 | A kind of micro- change detecting system of bridge based on hot spot vision signal intellectual analysis |
CN109949204A (en) * | 2019-03-29 | 2019-06-28 | 江苏亿通高科技股份有限公司 | The asterism mass center of pipeline organization extracts circuit |
CN109949204B (en) * | 2019-03-29 | 2023-08-15 | 江苏亿通高科技股份有限公司 | Star point centroid extraction circuit of pipeline structure |
CN113658241A (en) * | 2021-08-16 | 2021-11-16 | 北京的卢深视科技有限公司 | Monocular structured light depth recovery method, electronic device and storage medium |
CN116381708A (en) * | 2023-06-07 | 2023-07-04 | 深圳市圳阳精密技术有限公司 | High-precision laser triangular ranging system |
CN117788269A (en) * | 2024-02-27 | 2024-03-29 | 季华实验室 | A method for quickly locating the centroid of a light spot based on FPGA and related equipment |
CN117788269B (en) * | 2024-02-27 | 2024-05-07 | 季华实验室 | FPGA-based spot centroid quick positioning method and related equipment thereof |
Also Published As
Publication number | Publication date |
---|---|
CN100371676C (en) | 2008-02-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN1987346A (en) | Method and device for quick high precision positioning light spot image mass center | |
JP7073247B2 (en) | Methods for generating lane boundary detection models, methods for detecting lane boundaries, devices for generating lane boundary detection models, devices for detecting lane boundaries, equipment, computers readable Storage media and computer programs | |
CN108629231B (en) | Obstacle detection method, apparatus, device and storage medium | |
CN111860060B (en) | Target detection method, device, terminal device and computer-readable storage medium | |
CN107610176A (en) | A kind of pallet Dynamic Recognition based on Kinect and localization method, system and medium | |
CN107636727A (en) | Target detection method and device | |
CN103017654B (en) | Multi-path centroid positioning method and device for light spot image | |
CN100580365C (en) | A dual-channel centroid-following imaging method and device | |
CN107909571A (en) | A kind of weld beam shape method, system, equipment and computer-readable storage medium | |
CN110570442A (en) | Contour detection method under complex background, terminal device and storage medium | |
Gluhaković et al. | Vehicle detection in the autonomous vehicle environment for potential collision warning | |
CN115937203A (en) | Visual detection method, device, equipment and medium based on template matching | |
US8068673B2 (en) | Rapid and high precision centroiding method and system for spots image | |
CN111259890A (en) | Water level identification method, device and equipment of water level gauge | |
CN102193819B (en) | Single-point noise resistant method and device for positioning light spot center | |
CN114519714B (en) | Method and system for judging smudgy defect of display screen | |
CN111444964A (en) | Multi-target rapid image matching method based on self-adaptive ROI (region of interest) division | |
CN110207702B (en) | Target positioning method and device | |
CN114862929A (en) | Three-dimensional target detection method and device, computer readable storage medium and robot | |
CN113158864B (en) | Method and device for determining included angle between truck head and trailer | |
CN115690051A (en) | PCB defect detection method and device, computer equipment and storage medium | |
CN106022694B (en) | A kind of system of scattered groceries field stacker-reclaimer localization method and realization the method based on Point Cloud Processing technology | |
CN113469087A (en) | Method, device, equipment and medium for detecting picture frame in building drawing | |
CN116681753A (en) | Method and system for extracting center of line structured light based on spatial gray-scale center of gravity advancement | |
CN109801428B (en) | Method and device for detecting edge straight line of paper money and terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20080227 Termination date: 20201201 |