[go: up one dir, main page]

CN112330611B - FPGA-oriented high-parallelism light spot segmentation method - Google Patents

FPGA-oriented high-parallelism light spot segmentation method Download PDF

Info

Publication number
CN112330611B
CN112330611B CN202011137224.9A CN202011137224A CN112330611B CN 112330611 B CN112330611 B CN 112330611B CN 202011137224 A CN202011137224 A CN 202011137224A CN 112330611 B CN112330611 B CN 112330611B
Authority
CN
China
Prior art keywords
pixel
label
spot
tuple
steps
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011137224.9A
Other languages
Chinese (zh)
Other versions
CN112330611A (en
Inventor
柏利志
张丽艳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing University of Aeronautics and Astronautics
Original Assignee
Nanjing University of Aeronautics and Astronautics
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Nanjing University of Aeronautics and Astronautics filed Critical Nanjing University of Aeronautics and Astronautics
Priority to CN202011137224.9A priority Critical patent/CN112330611B/en
Publication of CN112330611A publication Critical patent/CN112330611A/en
Application granted granted Critical
Publication of CN112330611B publication Critical patent/CN112330611B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2200/00Indexing scheme for image data processing or generation, in general
    • G06T2200/28Indexing scheme for image data processing or generation, in general involving image processing hardware
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to a high-parallelism facula segmentation method facing FPGA, which belongs to the field of image processing, and sequentially reads in 2X 2 pixel areas from left to right and from top to bottom, the 2X 2 pixel areas are marked as a tuple, a current tuple is marked as c, an upper tuple is marked as t, a right upper tuple is marked as tr, a left Fang Yuan group is marked as l, each tuple comprises 1, 2, 3 and 4 pixels, and based on the characteristic of parallelism of FPGA, the method comprises the following main steps: the spot numbers of the pixels of each tuple are determined according to the connected areas, and data are integrated according to the number relevance; the invention has the characteristics of flexibility, parallelism and integration, can realize image acquisition and processing, and greatly improves the speed of image processing.

Description

一种面向FPGA的高并行性光斑分割方法A high parallel spot segmentation method for FPGA

技术领域Technical Field

本发明涉及图像处理领域,具体为一种面向FPGA的高并行性光斑分割方法。The invention relates to the field of image processing, and in particular to a high-parallelism spot segmentation method oriented to FPGA.

背景技术Background technique

光斑是图像处理中常见的图像信息,光斑质心是光斑图像的重要特征,常用于视觉测量领域目标靶点的定位,高精度定位光斑质心的前提是准确地分割出光斑。Light spot is a common image information in image processing. The centroid of the light spot is an important feature of the light spot image and is often used to locate target points in the field of visual measurement. The premise of high-precision positioning of the centroid of the light spot is to accurately segment the light spot.

光斑分割方法有基于软件的方法和基于硬件的方法,基于软件的方法大多是图像采集完成后对整体图像进行分割操作,但是当图像分辨率较高或图像中光斑较多时,该类方法的实时性很难保证。此外,这类方法一般需要较大的数据存储空间来保存待处理的图像,尤其是在存储空间本身就有限的嵌入式系统中,更不适合该类方法。现有的基于硬件的方法能够实现对低分辨率图像边采集边处理,并且所需存储空间较小,但是该类方法一次只处理一个像素,因此当图像分辨率较高时,该类方法的高效性也很难保证。There are two types of spot segmentation methods: software-based methods and hardware-based methods. Most software-based methods segment the entire image after image acquisition is completed. However, when the image resolution is high or there are many spots in the image, the real-time performance of this type of method is difficult to guarantee. In addition, this type of method generally requires a large data storage space to save the image to be processed, especially in embedded systems where the storage space itself is limited. Existing hardware-based methods can realize the acquisition and processing of low-resolution images, and the required storage space is small, but this type of method only processes one pixel at a time. Therefore, when the image resolution is high, the efficiency of this type of method is also difficult to guarantee.

发明内容Summary of the invention

本发明针对现有技术中存在的问题,公开了一种面向FPGA的高并行性光斑分割方法,该方法每次同时处理4个像素,并将当前4个像素作为一个区域,通过分析该区域上方,右上方以及左方区域的属性,判断当前区域所有像素的光斑属性,最后分割出图像中的所有光斑,该方法解决了现有技术中的缺陷。In view of the problems existing in the prior art, the present invention discloses a high-parallelism light spot segmentation method for FPGA. The method processes 4 pixels simultaneously each time and regards the current 4 pixels as a region. By analyzing the properties of the regions above, to the upper right and to the left of the region, the light spot properties of all pixels in the current region are judged, and finally all the light spots in the image are segmented. The method solves the defects in the prior art.

本发明是这样实现的:The present invention is achieved in that:

一种面向FPGA的高并行性光斑分割方法,其特征在于,按照从左到右、从上到下依次读入2×2的像素区域,将这2×2的像素区域记为一个元组,当前元组记为c,上方元组记为t,右上方元组记为tr,左方元组记为l,每个元组包含1、2、3、4共4个像素,并且每次并行处理当前元组中的4个像素,通过分析当前元组上方,右上方以及左方元组的属性,判断当前元组中所有像素的光斑属性,最后分割出图像中的所有光斑;具体步骤包括:根据连通区域确定各元组像素的光斑编号、根据编号关联性整合数据、图像中所有元组处理完成后像素编号相同的属于同一光斑。A high-parallelism spot segmentation method for FPGA is characterized in that a 2×2 pixel area is read in sequence from left to right and from top to bottom, the 2×2 pixel area is recorded as a tuple, the current tuple is recorded as c, the upper tuple is recorded as t, the upper right tuple is recorded as tr, the left tuple is recorded as l, each tuple contains 4 pixels, 1, 2, 3, 4, and 4 pixels in the current tuple are processed in parallel each time, the spot attributes of all pixels in the current tuple are judged by analyzing the attributes of the tuples above, upper right and left of the current tuple, and finally all the spots in the image are segmented; the specific steps include: determining the spot number of each tuple pixel according to the connected area, integrating data according to the number correlation, and after all tuples in the image are processed, the pixels with the same pixel number belong to the same spot.

进一步,所述的确定各元组像素的光斑编号的具体步骤为:Furthermore, the specific steps of determining the spot number of each tuple pixel are:

步骤1:判断当前元组中c1像素是否为光斑像素:若c1像素的灰度大于预设阈值T,则其为光斑像素,否则为背景像素并编号为0;Step 1: Determine whether the c1 pixel in the current tuple is a light spot pixel: if the grayscale of the c1 pixel is greater than the preset threshold T, it is a light spot pixel, otherwise it is a background pixel and is numbered 0;

步骤2:若当前元组中c1像素为光斑像素,则根据连通区域确定c1像素的光斑编号label_c1;依次根据c1像素上方、右上方、右右上方、左方、左下方像素编号(label_t3,label_t4,label_tr3,label_l2,label_l4)确定c1像素的光斑编号label_c1;Step 2: If the c1 pixel in the current tuple is a spot pixel, determine the spot number label_c1 of the c1 pixel according to the connected area; determine the spot number label_c1 of the c1 pixel according to the pixel numbers above, above right, above right, to the left, and below left of the c1 pixel (label_t3, label_t4, label_tr3, label_l2, label_l4);

步骤3:判断当前元组中c2像素是否为光斑像素:若c2像素的灰度大于预设阈值T,则其为光斑像素,否则为背景像素并编号为0;Step 3: Determine whether the c2 pixel in the current tuple is a light spot pixel: if the grayscale of the c2 pixel is greater than the preset threshold T, it is a light spot pixel, otherwise it is a background pixel and is numbered 0;

步骤4:若当前元组中c2像素为光斑像素,则根据连通区域确定c2像素的光斑编号label_c2。依次根据c2像素上方、右上方、左方、左左下方像素编号(label_t4,label_tr3,label_c1,label_l4)确定c2像素的光斑编号label_c2;Step 4: If the c2 pixel in the current tuple is a spot pixel, determine the spot number label_c2 of the c2 pixel according to the connected area. Determine the spot number label_c2 of the c2 pixel according to the pixel numbers above, above right, to the left, and below the left left of the c2 pixel (label_t4, label_tr3, label_c1, label_l4);

步骤5:判断当前元组中c3像素是否为光斑像素:若c3像素的灰度大于预设阈值T,则其为光斑像素,否则为背景像素并编号为0;Step 5: Determine whether the c3 pixel in the current tuple is a light spot pixel: if the grayscale of the c3 pixel is greater than the preset threshold T, it is a light spot pixel, otherwise it is a background pixel and is numbered 0;

步骤6:若当前元组中c3像素为光斑像素,则根据连通区域确定c3像素的光斑编号label_c3;依次根据c3像素上方、右上方、左方像素编号(label_c1,label_c2,label_l4)确定c3像素的光斑编号label_c3;Step 6: If the c3 pixel in the current tuple is a spot pixel, determine the spot number label_c3 of the c3 pixel according to the connected area; determine the spot number label_c3 of the c3 pixel according to the pixel numbers above, above right, and to the left of the c3 pixel (label_c1, label_c2, label_l4);

步骤7:判断当前元组中c4像素是否为光斑像素:若c4像素的灰度大于预设阈值T,则其为光斑像素,否则为背景像素并编号为0;Step 7: Determine whether the c4 pixel in the current tuple is a light spot pixel: if the grayscale of the c4 pixel is greater than the preset threshold T, it is a light spot pixel, otherwise it is a background pixel and is numbered 0;

步骤8:若当前元组中c4像素为光斑像素,则根据连通区域确定c4像素的光斑编号label_c4;依次根据c4像素上方、左方像素编号(label_c2,label_c3)确定c4像素的光斑编号label_c4;Step 8: If the c4 pixel in the current tuple is a spot pixel, determine the spot number label_c4 of the c4 pixel according to the connected area; determine the spot number label_c4 of the c4 pixel according to the pixel numbers above and to the left of the c4 pixel (label_c2, label_c3);

进一步,所述的步骤1~步骤8中,步骤1、2,步骤3、4,步骤5、6,步骤7、8是并行的,其中:Further, in the steps 1 to 8, steps 1 and 2, steps 3 and 4, steps 5 and 6, and steps 7 and 8 are performed in parallel, wherein:

确定c1像素的光斑编号label_c1的具体步骤为:若上方像素为光斑像素,则label_c1=label_t3;否则,若右上方像素为光斑像素,则label_c1=label_t4;否则,若c2像素和tr3像素灰度均大于阈值T,则label_c1=label_tr3;否则,若左方像素为光斑像素,则label_c1=label_l2;否则,若左下方像素为光斑像素,则label_c1=label_l4;否则,c1像素为新的光斑像素,使用新的标签对其编号;The specific steps of determining the spot number label_c1 of the c1 pixel are as follows: if the upper pixel is a spot pixel, label_c1=label_t3; otherwise, if the upper right pixel is a spot pixel, label_c1=label_t4; otherwise, if the grayscales of the c2 pixel and the tr3 pixel are both greater than the threshold T, label_c1=label_tr3; otherwise, if the left pixel is a spot pixel, label_c1=label_l2; otherwise, if the lower left pixel is a spot pixel, label_c1=label_l4; otherwise, the c1 pixel is a new spot pixel and is numbered with a new label;

确定c2像素的光斑编号label_c2的步骤具体为:若上方像素为光斑像素,则label_c2=label_t4;否则,若右上方像素为光斑像素,则label_c2=label_tr3;否则,若左方像素为光斑像素,则label_c2=label_c1,在这一过程中需要通过步骤1、2判断c1像素是否为光斑像素,并确定c1像素的编号;否则,若c3像素和l4像素灰度均大于阈值T,则label_c2=label_l4;否则,c2像素为新的光斑像素,使用新的标签对其编号;The specific steps of determining the spot number label_c2 of the c2 pixel are: if the upper pixel is a spot pixel, label_c2=label_t4; otherwise, if the upper right pixel is a spot pixel, label_c2=label_tr3; otherwise, if the left pixel is a spot pixel, label_c2=label_c1. In this process, it is necessary to determine whether the c1 pixel is a spot pixel through steps 1 and 2, and determine the number of the c1 pixel; otherwise, if the grayscales of the c3 pixel and the l4 pixel are both greater than the threshold T, label_c2=label_l4; otherwise, the c2 pixel is a new spot pixel and is numbered with a new label;

确定c3像素的光斑编号label_c3的具体步骤为:若上方像素为光斑像素,则label_c3=label_c1,在这一过程中需要通过步骤1、2判断c1像素是否为光斑像素,并确定c1像素的编号;否则,若右上方像素为光斑像素,则label_c3=label_c2,在这一过程中需要通过步骤3、4判断c2像素是否为光斑像素,并确定c2像素的编号;否则,若左方像素为光斑像素,则label_c3=label_l4;否则,c3像素为新的光斑像素,使用新的标签对其编号;The specific steps of determining the spot number label_c3 of the c3 pixel are as follows: if the upper pixel is a spot pixel, label_c3=label_c1. In this process, it is necessary to determine whether the c1 pixel is a spot pixel through steps 1 and 2, and determine the number of the c1 pixel; otherwise, if the upper right pixel is a spot pixel, label_c3=label_c2. In this process, it is necessary to determine whether the c2 pixel is a spot pixel through steps 3 and 4, and determine the number of the c2 pixel; otherwise, if the left pixel is a spot pixel, label_c3=label_l4; otherwise, the c3 pixel is a new spot pixel, and a new label is used to number it;

确定c4像素的光斑编号label_c4的具体步骤为:若上方像素为光斑像素,则label_c4=label_c2,在这一过程中需要通过步骤3、4判断c2像素是否为光斑像素,并确定c2像素的编号;否则,若左方像素为光斑像素,则label_c4=label_c3,在这一过程中需要通过步骤5、6判断c3像素是否为光斑像素,并确定c3像素的编号;否则,c4像素为新的光斑像素,使用新的标签对其编号。The specific steps for determining the spot number label_c4 of the c4 pixel are: if the upper pixel is a spot pixel, then label_c4=label_c2. In this process, it is necessary to determine whether the c2 pixel is a spot pixel through steps 3 and 4, and determine the number of the c2 pixel; otherwise, if the left pixel is a spot pixel, then label_c4=label_c3. In this process, it is necessary to determine whether the c3 pixel is a spot pixel through steps 5 and 6, and determine the number of the c3 pixel; otherwise, the c4 pixel is a new spot pixel and is numbered with a new label.

进一步,所述的根据编号关联性整合数据过程如下:当前元组中所有像素编号完成后,从该元组开始向左取3个连续的元组,比较3个元组中的编号,若不同,则将较大的编号更改为3个元组中最小的编号。Furthermore, the process of integrating data according to the association of numbers is as follows: after all pixels in the current tuple are numbered, 3 consecutive tuples are taken from the tuple to the left, and the numbers in the 3 tuples are compared. If they are different, the larger number is changed to the smallest number in the 3 tuples.

本发明与现有技术相比其有益效果在于:本发明中的方法能够实现高分辨率图像的边采集边处理,该方法利用FPGA高并行性的特点,每次并行处理同一区域中的4个像素,极大地提高了图像处理速度。同时,基于该方法在线处理的特点,使用较小内存便能满足需求。Compared with the prior art, the present invention has the following beneficial effects: the method of the present invention can realize simultaneous acquisition and processing of high-resolution images, and the method utilizes the high parallelism of FPGA to process four pixels in the same area in parallel each time, which greatly improves the image processing speed. At the same time, based on the online processing characteristics of the method, the use of a relatively small memory can meet the demand.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1为本发明一种面向FPGA的高并行性光斑分割方法中的光斑元组划分示意图;FIG1 is a schematic diagram of light spot tuple division in a high-parallelism light spot segmentation method for FPGA of the present invention;

图2为本发明一种面向FPGA的高并行性光斑分割方法中确定c1像素编号流程图;FIG2 is a flowchart of determining the c1 pixel number in a high-parallel spot segmentation method for FPGA of the present invention;

图3为本发明一种面向FPGA的高并行性光斑分割方法中确定c2像素编号流程图;FIG3 is a flow chart of determining the c2 pixel number in a high-parallelism spot segmentation method for FPGA of the present invention;

图4为本发明一种面向FPGA的高并行性光斑分割方法中确定c3像素编号流程图;FIG4 is a flow chart of determining the c3 pixel number in a high-parallelism spot segmentation method for FPGA of the present invention;

图5为本发明一种面向FPGA的高并行性光斑分割方法中确定c4像素编号流程图;FIG5 is a flow chart of determining the c4 pixel number in a high-parallelism spot segmentation method for FPGA of the present invention;

图6为本发明实施例中数据整合前编号示意图;FIG6 is a schematic diagram of data numbering before data integration according to an embodiment of the present invention;

图7为本发明实施例中数据整合后编号示意图。FIG. 7 is a schematic diagram of numbering after data integration in an embodiment of the present invention.

具体实施方式Detailed ways

为使本发明的目的、技术方案及效果更加清楚,明确,以下列举实例对本发明进一步详细说明。应当指出此处所描述的具体实施仅用以解释本发明,并不用于限定本发明。In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail by enumerating examples below. It should be noted that the specific implementation described here is only used to explain the present invention and is not used to limit the present invention.

本发明一种面向FPGA的高并行性光斑分割方法为:按照从左到右、从上到下依次读入2×2的像素区域,将这2×2的像素区域记为一个元组,当前元组记为c,上方元组记为t,右上方元组记为tr,左方元组记为l,每个元组包含1、2、3、4共4个像素,具体如图1所示。基于FPGA并行性的特点,该方法在每次并行处理当前元组中的4个像素,主要包括以下步骤:根据连通区域确定各元组像素的光斑编号、根据编号关联性整合数据。The present invention provides a high-parallel spot segmentation method for FPGA: read in a 2×2 pixel area from left to right and from top to bottom, record the 2×2 pixel area as a tuple, record the current tuple as c, the upper tuple as t, the upper right tuple as tr, the left tuple as l, and each tuple contains 4 pixels, 1, 2, 3, and 4, as shown in Figure 1. Based on the characteristics of FPGA parallelism, the method processes 4 pixels in the current tuple in parallel each time, and mainly includes the following steps: determine the spot number of each tuple pixel according to the connected area, and integrate data according to the number correlation.

确定各元组像素的光斑编号步骤如下:The steps to determine the spot number of each tuple pixel are as follows:

步骤1:判断当前元组中c1像素是否为光斑像素。若c1像素的灰度大于预设阈值T,则其为光斑像素,否则为背景像素并编号为0;Step 1: Determine whether the c1 pixel in the current tuple is a light spot pixel. If the grayscale of the c1 pixel is greater than the preset threshold T, it is a light spot pixel, otherwise it is a background pixel and is numbered 0;

步骤2:若当前元组中c1像素为光斑像素,则根据连通区域确定c1像素的光斑编号label_c1。依次根据c1像素上方、右上方、右右上方、左方、左下方像素编号(label_t3,label_t4,label_tr3,label_l2,label_l4)确定c1像素的光斑编号label_c1。具体为:若上方像素为光斑像素,则label_c1=label_t3;否则,若右上方像素为光斑像素,则label_c1=label_t4;否则,若c2像素和tr3像素灰度均大于阈值T,则label_c1=label_tr3;否则,若左方像素为光斑像素,则label_c1=label_l2;否则,若左下方像素为光斑像素,则label_c1=label_l4;否则,c1像素为新的光斑像素,使用新的标签对其编号。该过程流程图如图2所示。Step 2: If the c1 pixel in the current tuple is a spot pixel, the spot number label_c1 of the c1 pixel is determined according to the connected area. The spot number label_c1 of the c1 pixel is determined according to the pixel numbers above, above right, above right, to the left, and below left of the c1 pixel (label_t3, label_t4, label_tr3, label_l2, label_l4). Specifically: if the upper pixel is a spot pixel, label_c1 = label_t3; otherwise, if the upper right pixel is a spot pixel, label_c1 = label_t4; otherwise, if the grayscale of the c2 pixel and the tr3 pixel is greater than the threshold T, label_c1 = label_tr3; otherwise, if the left pixel is a spot pixel, label_c1 = label_l2; otherwise, if the lower left pixel is a spot pixel, label_c1 = label_l4; otherwise, the c1 pixel is a new spot pixel and is numbered with a new label. The process flow chart is shown in Figure 2.

步骤3:判断当前元组中c2像素是否为光斑像素。若c2像素的灰度大于预设阈值T,则其为光斑像素,否则为背景像素并编号为0;Step 3: Determine whether the c2 pixel in the current tuple is a light spot pixel. If the grayscale of the c2 pixel is greater than the preset threshold T, it is a light spot pixel, otherwise it is a background pixel and is numbered 0;

步骤4:若当前元组中c2像素为光斑像素,则根据连通区域确定c2像素的光斑编号label_c2。依次根据c2像素上方、右上方、左方、左左下方像素编号(label_t4,label_tr3,label_c1,label_l4)确定c2像素的光斑编号label_c2。具体为:若上方像素为光斑像素,则label_c2=label_t4;否则,若右上方像素为光斑像素,则label_c2=label_tr3;否则,若左方像素为光斑像素,则label_c2=label_c1,在这一过程中需要通过步骤1、2判断c1像素是否为光斑像素,并确定c1像素的编号;否则,若c3像素和l4像素灰度均大于阈值T,则label_c2=label_l4;否则,c2像素为新的光斑像素,使用新的标签对其编号。该过程流程图如图3所示。Step 4: If the c2 pixel in the current tuple is a spot pixel, the spot number label_c2 of the c2 pixel is determined according to the connected area. The spot number label_c2 of the c2 pixel is determined according to the pixel numbers above, above right, to the left, and below the left left of the c2 pixel (label_t4, label_tr3, label_c1, label_l4). Specifically: if the upper pixel is a spot pixel, label_c2 = label_t4; otherwise, if the upper right pixel is a spot pixel, label_c2 = label_tr3; otherwise, if the left pixel is a spot pixel, label_c2 = label_c1. In this process, it is necessary to determine whether the c1 pixel is a spot pixel through steps 1 and 2, and determine the number of the c1 pixel; otherwise, if the grayscale of the c3 pixel and the l4 pixel is greater than the threshold T, label_c2 = label_l4; otherwise, the c2 pixel is a new spot pixel and is numbered with a new label. The process flow chart is shown in Figure 3.

步骤5:判断当前元组中c3像素是否为光斑像素。若c3像素的灰度大于预设阈值T,则其为光斑像素,否则为背景像素并编号为0;Step 5: Determine whether the c3 pixel in the current tuple is a light spot pixel. If the grayscale of the c3 pixel is greater than the preset threshold T, it is a light spot pixel, otherwise it is a background pixel and is numbered 0;

步骤6:若当前元组中c3像素为光斑像素,则根据连通区域确定c3像素的光斑编号label_c3。依次根据c3像素上方、右上方、左方像素编号(label_c1,label_c2,label_l4)确定c3像素的光斑编号label_c3。具体为:若上方像素为光斑像素,则label_c3=label_c1,在这一过程中需要通过步骤1、2判断c1像素是否为光斑像素,并确定c1像素的编号;否则,若右上方像素为光斑像素,则label_c3=label_c2,在这一过程中需要通过步骤3、4判断c2像素是否为光斑像素,并确定c2像素的编号;否则,若左方像素为光斑像素,则label_c3=label_l4;否则,c3像素为新的光斑像素,使用新的标签对其编号。该过程流程图如图4所示。Step 6: If the c3 pixel in the current tuple is a spot pixel, the spot number label_c3 of the c3 pixel is determined according to the connected area. The spot number label_c3 of the c3 pixel is determined according to the pixel numbers above, above right, and to the left of the c3 pixel (label_c1, label_c2, label_l4). Specifically: if the upper pixel is a spot pixel, label_c3 = label_c1. In this process, it is necessary to determine whether the c1 pixel is a spot pixel through steps 1 and 2, and determine the number of the c1 pixel; otherwise, if the upper right pixel is a spot pixel, label_c3 = label_c2. In this process, it is necessary to determine whether the c2 pixel is a spot pixel through steps 3 and 4, and determine the number of the c2 pixel; otherwise, if the left pixel is a spot pixel, label_c3 = label_l4; otherwise, the c3 pixel is a new spot pixel, and it is numbered with a new label. The process flow chart is shown in Figure 4.

步骤7:判断当前元组中c4像素是否为光斑像素。若c4像素的灰度大于预设阈值T,则其为光斑像素,否则为背景像素并编号为0;Step 7: Determine whether the c4 pixel in the current tuple is a light spot pixel. If the grayscale of the c4 pixel is greater than the preset threshold T, it is a light spot pixel, otherwise it is a background pixel and is numbered 0;

步骤8:若当前元组中c4像素为光斑像素,则根据连通区域确定c4像素的光斑编号label_c4。依次根据c4像素上方、左方像素编号(label_c2,label_c3)确定c4像素的光斑编号label_c4。具体为:若上方像素为光斑像素,则label_c4=label_c2,在这一过程中需要通过步骤3、4判断c2像素是否为光斑像素,并确定c2像素的编号;否则,若左方像素为光斑像素,则label_c4=label_c3,在这一过程中需要通过步骤5、6判断c3像素是否为光斑像素,并确定c3像素的编号;否则,c4像素为新的光斑像素,使用新的标签对其编号。该过程流程图如图5所示。根据编号关联性整合数据过程如下:如图6所示,当前元组中所有像素编号完成后,从该元组开始向左取3个连续的元组,比较3个元组中的编号,若不同,则将较大的编号更改为3个元组中最小的编号,如图7所示。图像中所有元组处理完成后像素编号相同的属于同一光斑。Step 8: If the c4 pixel in the current tuple is a spot pixel, the spot number label_c4 of the c4 pixel is determined according to the connected area. The spot number label_c4 of the c4 pixel is determined according to the pixel numbers above and to the left of the c4 pixel (label_c2, label_c3). Specifically: if the upper pixel is a spot pixel, label_c4 = label_c2. In this process, it is necessary to determine whether the c2 pixel is a spot pixel through steps 3 and 4, and determine the number of the c2 pixel; otherwise, if the left pixel is a spot pixel, label_c4 = label_c3. In this process, it is necessary to determine whether the c3 pixel is a spot pixel through steps 5 and 6, and determine the number of the c3 pixel; otherwise, the c4 pixel is a new spot pixel, and it is numbered with a new label. The process flow chart is shown in Figure 5. The process of integrating data according to the number association is as follows: as shown in Figure 6, after all pixels in the current tuple are numbered, 3 consecutive tuples are taken from the tuple to the left, and the numbers in the 3 tuples are compared. If they are different, the larger number is changed to the smallest number in the 3 tuples, as shown in Figure 7. After all tuples in the image are processed, the pixels with the same number belong to the same light spot.

以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进,这些改进也应视为本发明的保护范围。The above description is only a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements without departing from the principle of the present invention, and these improvements should also be regarded as within the protection scope of the present invention.

Claims (3)

1.一种面向FPGA的高并行性光斑分割方法,其特征在于,按照从左到右、从上到下依次读入2×2的像素区域,将这2×2的像素区域记为一个元组,当前元组记为c,上方元组记为t,右上方元组记为tr,左方元组记为l,每个元组包含1、2、3、4共4个像素,并且每次并行处理当前元组中的4个像素,通过分析当前元组上方,右上方以及左方元组的属性,判断当前元组中所有像素的光斑属性,最后分割出图像中的所有光斑;具体步骤包括:根据连通区域确定各元组中像素的光斑编号、根据编号关联性整合数据、图像中所有元组处理完成后像素编号相同的属于同一光斑;所述的确定各元组中像素的光斑编号的具体步骤为:1. A high-parallelism spot segmentation method for FPGA, characterized in that a 2×2 pixel area is read in sequence from left to right and from top to bottom, the 2×2 pixel area is recorded as a tuple, the current tuple is recorded as c, the upper tuple is recorded as t, the upper right tuple is recorded as tr, and the left tuple is recorded as l, each tuple contains 4 pixels, 1, 2, 3, and 4, and 4 pixels in the current tuple are processed in parallel each time, and the spot attributes of all pixels in the current tuple are judged by analyzing the attributes of the tuples above, upper right, and left of the current tuple, and finally all the spots in the image are segmented; the specific steps include: determining the spot number of the pixels in each tuple according to the connected area, integrating data according to the number correlation, and after all tuples in the image are processed, the pixels with the same pixel number belong to the same spot; the specific steps of determining the spot number of the pixels in each tuple are: 步骤1:判断当前元组中c1像素是否为光斑像素:若c1像素的灰度大于预设阈值T,则其为光斑像素,否则为背景像素并编号为0;Step 1: Determine whether the c1 pixel in the current tuple is a light spot pixel: if the grayscale of the c1 pixel is greater than the preset threshold T, it is a light spot pixel, otherwise it is a background pixel and is numbered 0; 步骤2:若当前元组中c1像素为光斑像素,则根据连通区域确定c1像素的光斑编号label_c1;依次根据c1像素上方、右上方、右右上方、左方、左下方像素编号(label_t3,label_t4,label_tr3,label_l2,label_l4)确定c1像素的光斑编号label_c1;Step 2: If the c1 pixel in the current tuple is a spot pixel, determine the spot number label_c1 of the c1 pixel according to the connected area; determine the spot number label_c1 of the c1 pixel according to the pixel numbers above, above right, above right, to the left, and below left of the c1 pixel (label_t3, label_t4, label_tr3, label_l2, label_l4); 步骤3:判断当前元组中c2像素是否为光斑像素:若c2像素的灰度大于预设阈值T,则其为光斑像素,否则为背景像素并编号为0;Step 3: Determine whether the c2 pixel in the current tuple is a light spot pixel: if the grayscale of the c2 pixel is greater than the preset threshold T, it is a light spot pixel, otherwise it is a background pixel and is numbered 0; 步骤4:若当前元组中c2像素为光斑像素,则根据连通区域确定c2像素的光斑编号label_c2,依次根据c2像素上方、右上方、左方、左左下方像素编号(label_t4,label_tr3,label_c1,label_l4)确定c2像素的光斑编号label_c2;Step 4: If the c2 pixel in the current tuple is a spot pixel, determine the spot number label_c2 of the c2 pixel according to the connected area, and determine the spot number label_c2 of the c2 pixel according to the pixel numbers above, above right, to the left, and below the left left of the c2 pixel (label_t4, label_tr3, label_c1, label_l4); 步骤5:判断当前元组中c3像素是否为光斑像素:若c3像素的灰度大于预设阈值T,则其为光斑像素,否则为背景像素并编号为0;Step 5: Determine whether the c3 pixel in the current tuple is a light spot pixel: if the grayscale of the c3 pixel is greater than the preset threshold T, it is a light spot pixel, otherwise it is a background pixel and is numbered 0; 步骤6:若当前元组中c3像素为光斑像素,则根据连通区域确定c3像素的光斑编号label_c3;依次根据c3像素上方、右上方、左方像素编号(label_c1,label_c2,label_l4)确定c3像素的光斑编号label_c3;Step 6: If the c3 pixel in the current tuple is a spot pixel, determine the spot number label_c3 of the c3 pixel according to the connected area; determine the spot number label_c3 of the c3 pixel according to the pixel numbers above, above right, and to the left of the c3 pixel (label_c1, label_c2, label_l4); 步骤7:判断当前元组中c4像素是否为光斑像素:若c4像素的灰度大于预设阈值T,则其为光斑像素,否则为背景像素并编号为0;Step 7: Determine whether the c4 pixel in the current tuple is a light spot pixel: if the grayscale of the c4 pixel is greater than the preset threshold T, it is a light spot pixel, otherwise it is a background pixel and is numbered 0; 步骤8:若当前元组中c4像素为光斑像素,则根据连通区域确定c4像素的光斑编号label_c4;依次根据c4像素上方、左方像素编号(label_c2,label_c3)确定c4像素的光斑编号label_c4;Step 8: If the c4 pixel in the current tuple is a spot pixel, determine the spot number label_c4 of the c4 pixel according to the connected area; determine the spot number label_c4 of the c4 pixel according to the pixel numbers above and to the left of the c4 pixel (label_c2, label_c3); 利用FPGA高并行性的特点,每次并行处理同一区域中的4个像素,极大地提高了图像处理速度。By taking advantage of the high parallelism of FPGA, 4 pixels in the same area are processed in parallel each time, which greatly improves the image processing speed. 2.根据权利要求1所述的一种面向FPGA的高并行性光斑分割方法,其特征在于,所述的步骤1~步骤8中,步骤1、2,步骤3、4,步骤5、6,步骤7、8是并行的,其中:2. The high-parallel spot segmentation method for FPGA according to claim 1, characterized in that, in the steps 1 to 8, steps 1 and 2, steps 3 and 4, steps 5 and 6, and steps 7 and 8 are performed in parallel, wherein: 确定c1像素的光斑编号label_c1的具体步骤为:若上方像素为光斑像素,则label_c1=label_t3;否则,若右上方像素为光斑像素,则label_c1=label_t4;否则,若c2像素和tr3像素灰度均大于阈值T,则label_c1=label_tr3;否则,若左方像素为光斑像素,则label_c1=label_l2;否则,若左下方像素为光斑像素,则label_c1=label_l4;否则,c1像素为新的光斑像素,使用新的标签对其编号;The specific steps of determining the spot number label_c1 of the c1 pixel are as follows: if the upper pixel is a spot pixel, label_c1=label_t3; otherwise, if the upper right pixel is a spot pixel, label_c1=label_t4; otherwise, if the grayscales of the c2 pixel and the tr3 pixel are both greater than the threshold T, label_c1=label_tr3; otherwise, if the left pixel is a spot pixel, label_c1=label_l2; otherwise, if the lower left pixel is a spot pixel, label_c1=label_l4; otherwise, the c1 pixel is a new spot pixel and is numbered with a new label; 确定c2像素的光斑编号label_c2的步骤具体为:若上方像素为光斑像素,则label_c2=label_t4;否则,若右上方像素为光斑像素,则label_c2=label_tr3;否则,若左方像素为光斑像素,则label_c2=label_c1,在这一过程中需要通过步骤1、2判断c1像素是否为光斑像素,并确定c1像素的编号;否则,若c3像素和l4像素灰度均大于阈值T,则label_c2=label_l4;否则,c2像素为新的光斑像素,使用新的标签对其编号;The specific steps of determining the spot number label_c2 of the c2 pixel are: if the upper pixel is a spot pixel, label_c2=label_t4; otherwise, if the upper right pixel is a spot pixel, label_c2=label_tr3; otherwise, if the left pixel is a spot pixel, label_c2=label_c1. In this process, it is necessary to determine whether the c1 pixel is a spot pixel through steps 1 and 2, and determine the number of the c1 pixel; otherwise, if the grayscales of the c3 pixel and the l4 pixel are both greater than the threshold T, label_c2=label_l4; otherwise, the c2 pixel is a new spot pixel and is numbered with a new label; 确定c3像素的光斑编号label_c3的具体步骤为:若上方像素为光斑像素,则label_c3=label_c1,在这一过程中需要通过步骤1、2判断c1像素是否为光斑像素,并确定c1像素的编号;否则,若右上方像素为光斑像素,则label_c3=label_c2,在这一过程中需要通过步骤3、4判断c2像素是否为光斑像素,并确定c2像素的编号;否则,若左方像素为光斑像素,则label_c3=label_l4;否则,c3像素为新的光斑像素,使用新的标签对其编号;The specific steps of determining the spot number label_c3 of the c3 pixel are as follows: if the upper pixel is a spot pixel, label_c3=label_c1. In this process, it is necessary to determine whether the c1 pixel is a spot pixel through steps 1 and 2, and determine the number of the c1 pixel; otherwise, if the upper right pixel is a spot pixel, label_c3=label_c2. In this process, it is necessary to determine whether the c2 pixel is a spot pixel through steps 3 and 4, and determine the number of the c2 pixel; otherwise, if the left pixel is a spot pixel, label_c3=label_l4; otherwise, the c3 pixel is a new spot pixel, and a new label is used to number it; 确定c4像素的光斑编号label_c4的具体步骤为:若上方像素为光斑像素,则label_c4=label_c2,在这一过程中需要通过步骤3、4判断c2像素是否为光斑像素,并确定c2像素的编号;否则,若左方像素为光斑像素,则label_c4=label_c3,在这一过程中需要通过步骤5、6判断c3像素是否为光斑像素,并确定c3像素的编号;否则,c4像素为新的光斑像素,使用新的标签对其编号。The specific steps for determining the spot number label_c4 of the c4 pixel are: if the upper pixel is a spot pixel, then label_c4=label_c2. In this process, it is necessary to determine whether the c2 pixel is a spot pixel through steps 3 and 4, and determine the number of the c2 pixel; otherwise, if the left pixel is a spot pixel, then label_c4=label_c3. In this process, it is necessary to determine whether the c3 pixel is a spot pixel through steps 5 and 6, and determine the number of the c3 pixel; otherwise, the c4 pixel is a new spot pixel and is numbered with a new label. 3.根据权利要求1所述的一种面向FPGA的高并行性光斑分割方法,其特征在于,所述的根据编号关联性整合数据过程如下:当前元组中所有像素编号完成后,从该元组开始向左取3个连续的元组,比较3个元组中的编号,若不同,则将较大的编号更改为3个元组中最小的编号。3. According to the high-parallelism spot segmentation method for FPGA described in claim 1, it is characterized in that the process of integrating data according to the number correlation is as follows: after all pixels in the current tuple are numbered, 3 consecutive tuples are taken from the tuple to the left, and the numbers in the 3 tuples are compared. If they are different, the larger number is changed to the smallest number in the 3 tuples.
CN202011137224.9A 2020-10-22 2020-10-22 FPGA-oriented high-parallelism light spot segmentation method Active CN112330611B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011137224.9A CN112330611B (en) 2020-10-22 2020-10-22 FPGA-oriented high-parallelism light spot segmentation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011137224.9A CN112330611B (en) 2020-10-22 2020-10-22 FPGA-oriented high-parallelism light spot segmentation method

Publications (2)

Publication Number Publication Date
CN112330611A CN112330611A (en) 2021-02-05
CN112330611B true CN112330611B (en) 2024-07-05

Family

ID=74311251

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011137224.9A Active CN112330611B (en) 2020-10-22 2020-10-22 FPGA-oriented high-parallelism light spot segmentation method

Country Status (1)

Country Link
CN (1) CN112330611B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115685247B (en) * 2022-10-31 2024-05-31 哈尔滨工业大学 Method for obtaining the centroid position of light spot in single-line fringe image

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101363718A (en) * 2008-09-17 2009-02-11 北京航空航天大学 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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103017654B (en) * 2012-11-29 2015-07-15 北京航空航天大学 Multi-path centroid positioning method and device for light spot image

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101363718A (en) * 2008-09-17 2009-02-11 北京航空航天大学 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

Also Published As

Publication number Publication date
CN112330611A (en) 2021-02-05

Similar Documents

Publication Publication Date Title
CN103761743B (en) A kind of solid wooden floor board detection method of surface flaw based on image co-registration segmentation
CN105205488B (en) Word area detection method based on Harris angle points and stroke width
CN110414309A (en) A method for automatic identification of vehicle nameplates
CN103870790A (en) Recognition method and device of two-dimensional bar code
CN112308854B (en) Automatic detection method and system for chip surface flaws and electronic equipment
CN113657339A (en) A machine vision-based meter pointer counting reading method and medium
CN112861736B (en) Document table content identification and information extraction method based on image processing
CN111739029B (en) Deep learning convolutional neural network-based electric bucket tooth falling detection method
CN111626145A (en) Simple and effective incomplete form identification and page-crossing splicing method
CN111814576A (en) A deep learning-based image recognition method for shopping receipts
CN101930544B (en) Run adjacency table-based staff quick connected domain analysis method
CN112330611B (en) FPGA-oriented high-parallelism light spot segmentation method
CN115019310B (en) Image-text identification method and equipment
CN110310278A (en) Sliding window scanning method based on margin cutting method
CN114429577A (en) A flag detection method, system and device based on high-confidence labeling strategy
WO2025066865A1 (en) Image search method and apparatus, and product, device and medium
CN110443811B (en) A fully automatic segmentation method for leaf images with complex background
CN109241306A (en) A kind of date storage method suitable for image deflects mark
CN113793303A (en) Water leakage detection method and system based on image processing
CN111723793B (en) A real-time rigid catenary positioning point identification method
CN110377640A (en) One kind is based on deep learning ballot statistical method
CN115841671A (en) Calligraphy character skeleton correction method, system and storage medium
CN115717887A (en) Fast star point extraction method based on gray distribution histogram
CN111640122B (en) Spot location and segmentation method for LED special-shaped display screen based on connected domain
CN111104934A (en) Engine label detection method, electronic device and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant