WO2020198997A1 - Connected domain processing method, data processing device and computer readable storage medium - Google Patents

Connected domain processing method, data processing device and computer readable storage medium Download PDF

Info

Publication number
WO2020198997A1
WO2020198997A1 PCT/CN2019/080583 CN2019080583W WO2020198997A1 WO 2020198997 A1 WO2020198997 A1 WO 2020198997A1 CN 2019080583 W CN2019080583 W CN 2019080583W WO 2020198997 A1 WO2020198997 A1 WO 2020198997A1
Authority
WO
WIPO (PCT)
Prior art keywords
label
pixel
connected domain
analyzed
target
Prior art date
Application number
PCT/CN2019/080583
Other languages
French (fr)
Chinese (zh)
Inventor
李泽祥
高明明
杨康
李涛
Original Assignee
深圳市大疆创新科技有限公司
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 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2019/080583 priority Critical patent/WO2020198997A1/en
Priority to CN201980005003.5A priority patent/CN111213178A/en
Publication of WO2020198997A1 publication Critical patent/WO2020198997A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/60Memory management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • G06V10/267Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds

Definitions

  • the present invention relates to the field of computer technology, in particular to a connected domain processing method, data processing equipment and computer-readable storage medium.
  • Connected domain processing is an important part of image recognition technology.
  • connected domain processing can be performed on images to realize license plate recognition, text recognition, caption recognition, vehicle tracking, and pedestrian intrusion detection.
  • the connected domain processing method widely used in the industry is the connected domain processing method based on "seed diffusion".
  • the connected domain processing method based on "seed diffusion” is adopted, once inter-bank processing occurs, an off-chip double-rate synchronous dynamic random access memory (Double Data Rate, DDR) read request needs to be initiated. Since frequent access to DDR will take up a lot of bandwidth resources, in actual use, the connected domain processing is usually performed on smaller images (such as 640*360 pixels) based on "seed diffusion".
  • the embodiment of the present invention discloses a connected domain processing method, data processing equipment, and computer-readable storage medium, which can not only effectively reduce the number of DDR read requests, but also realize the multiplexing of statistical data, effectively saving storage space and computing resources, Expand the application scenarios of connected domain processing.
  • the first aspect of the embodiments of the present invention discloses a connected domain processing method, and the method includes:
  • the first type of statistical data is recorded for the target connected component label in the connected component statistical information, so The first type of statistical data is number data, and the number data is used to indicate the number of pixels marked as the target connected domain label and the marked connected domain label pointing to the target connected domain label; if the target is connected If the domain label is an intermediate node label, then the second type of statistical data is recorded for the target connected domain label in the connected domain statistical information, the second type of statistical data is pointer data, and the pointer data is used to indicate the The label of the root node pointed to by the target connected domain label.
  • the second aspect of the embodiments of the present invention discloses a data processing device, which includes a memory and a processor,
  • the memory is used to store program instructions
  • the processor is configured to execute program instructions stored in the memory, and when the program instructions are executed, the processor is configured to:
  • the first type of statistical data is recorded for the target connected component label in the connected component statistical information, so The first type of statistical data is number data, and the number data is used to indicate the number of pixels marked as the target connected domain label and the marked connected domain label pointing to the target connected domain label; if the target is connected If the domain label is an intermediate node label, then the second type of statistical data is recorded for the target connected domain label in the connected domain statistical information, the second type of statistical data is pointer data, and the pointer data is used to indicate the The label of the root node pointed to by the target connected domain label.
  • a third aspect of the embodiments of the present invention discloses a computer-readable storage medium in which a computer program is stored, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented .
  • the connected component analysis is performed on the pixel to be analyzed first, and the target connected component label is recorded in the label map for the pixel to be analyzed according to the analysis result; then the connected component statistical information is updated according to the target connected component label; where, if If the target connected domain label is the root node label, the first type of statistical data is recorded in the connected domain statistical information, and if the target connected domain label is an intermediate node label, the second type of statistical data is recorded in the connected domain statistical information.
  • Fig. 1 is a schematic diagram of a connected domain disclosed in the first embodiment of the present invention
  • FIG. 2 is a schematic diagram of a label map disclosed in an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of a polytree disclosed in an embodiment of the present invention.
  • FIG. 4 is a schematic flowchart of a connected domain processing method disclosed in the first embodiment of the present invention.
  • Fig. 5 is a schematic structural diagram of connected domain statistical information disclosed in the first embodiment of the present invention.
  • Fig. 6 is a schematic diagram of the result after the connected domain analysis of the pixels in the first row of Fig. 1 is completed;
  • Fig. 7 is a schematic diagram of the result after the connected domain analysis of the second row of pixels in Fig. 1 is completed;
  • FIG. 8 is a schematic flowchart of a connected domain processing method disclosed in the second embodiment of the present invention.
  • FIG. 9 is a schematic diagram of a connected domain disclosed in the second embodiment of the present invention.
  • FIG. 10 is a schematic diagram of row label information disclosed in an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of connected domain statistical information disclosed in the second embodiment of the present invention.
  • FIG. 12 is a schematic diagram of a connected domain disclosed in the third embodiment of the present invention.
  • FIG. 13 is a schematic structural diagram of connected domain statistical information disclosed in the third embodiment of the present invention.
  • 15 is a schematic structural diagram of connected domain statistical information disclosed in the fifth embodiment of the present invention.
  • Fig. 16 is a schematic structural diagram of a data processing device disclosed in an embodiment of the present invention.
  • the connected domain processing method in the embodiment of the present invention is implemented based on the connected domain analysis method of "pixel labeling".
  • the connected domain analysis method based on "pixel marking” can directly operate on the original image, mainly to reduce the number of DDR read requests during the connected domain analysis process. Taking four-connectivity analysis as an example, this method can only judge whether the pixel to be analyzed is The pixel points adjacent to the "up" direction position and/or the "left" direction position of its position are connected.
  • the data needed in the connected domain analysis process includes: 1. Connected domain statistical data, which can be recorded as result, which can be used to record the number of pixels marked as connected domain labels.
  • the maximum value of the connected domain label is determined according to experience.
  • the pointer data whose depth is consistent with the maximum value of the connected domain label can be recorded as pointer_list, which is used to form the connected domain into a polytree.
  • the label map of the image to be analyzed can be recorded as intlabel_list. The depth of the label map is consistent with the size of the image to be analyzed, and is used to store the connected domain label of each pixel in the image to be analyzed.
  • FIG. 1 is a schematic diagram of a connected domain provided by the first embodiment of the present invention.
  • Figure 1 shows the image to be analyzed, and each grid in the figure represents a pixel of the image to be analyzed. According to the position of the grid in the image to be analyzed, or according to the position of the pixel indicated by the grid in the image to be analyzed, mark information is set for each grid.
  • the marking information is used to indicate the number of rows and columns of the pixels represented by the grid or the grid in the image to be analyzed, that is, the coordinate information; the first identifier in the marking information is used to indicate the number of rows, the second in the marking information Bit identification is used to indicate the number of columns.
  • the marking information 22 indicates that the position of the grid or the pixel represented by the grid is the second row and the second column in the image to be analyzed; for example, the marking information 1b indicates that the position of the pixel represented by the grid or the grid is in the image to be analyzed.
  • the shaded grid in the figure represents the effective pixels in the image to be analyzed, and the unshaded grid (or white grid) represents the invalid pixel in the image to be analyzed; the multiple grids filled with shadow constitute the majority of the image to be analyzed.
  • Connected domains In the process of analyzing the image to be analyzed based on the connected domain analysis method of "pixel labeling", the effective pixels in the image to be analyzed are not connected with the invalid pixels, and the connected domain labels of the invalid pixels in the image to be analyzed can be directly Determine as an invalid connected domain label (for example, a value of 0); determine the valid pixel in the image to be analyzed as the pixel to be analyzed.
  • the pixel to be analyzed determines whether the pixel to be analyzed is connected to the pixel that has been assigned a connected domain label. If the pixel to be analyzed is connected to the pixel that has been assigned a connected domain label, then from the connected domain label of the pixel connected to the pixel to be analyzed , To determine the target connected domain label of the pixel to be analyzed; if the pixel to be analyzed is not connected to the pixel that has been assigned a connected domain label, a new connected domain label is assigned to the pixel to be analyzed, and the pixel to be analyzed The given connected component label is determined as the target connected component label of the pixel to be analyzed.
  • the pixel 11 at the "left" position of the pixel 12 is an invalid pixel and is not connected with the pixel 12; At this time, a new connected component label needs to be assigned to the pixel 12, and the connected component label 1 can be determined as the target connected component label of the pixel 12. Then the connected component statistical data result[1] corresponding to the connected component label 1 is set to 1, and the pointer data point_list[1] corresponding to the connected component label 1 is set to 1, indicating that the connected component label 1 is a root node label. Further, please also refer to FIG.
  • FIG. 2 which is a schematic diagram of a label map provided by an embodiment of the present invention, specifically the label map of the image to be analyzed shown in FIG. 1.
  • the connected domain label 1 can be recorded for the pixel 12 in the label map of the image to be analyzed as shown in Figure 2, that is, the label image
  • the label_list[1][2] in the first row and second column position in the label is 1.
  • the connected component analysis is performed on the pixels 16 and 19, by analogy, it can be determined that the target connected component labels of the pixels 16 and 19 are 2 and 3, respectively.
  • the pixel point 1a because the pixel point 1a is connected to the pixel point 19 adjacent to the "left" direction of its location, and the target connected domain label of the pixel point 19 is 3; then the pixel point 1a The target connected domain label is also determined to be 3. And adjust the connected component statistical data result[3] corresponding to connected component label 3 to 2 (that is, two pixels of 19 and 1a).
  • the target connected component label of the pixel 21 is 4.
  • the pixel point 22 When the connected domain analysis is performed on the pixel point 22, the pixel point 22 is connected with the pixel point 12 adjacent to the "up" direction of its location, and connected with the pixel point 21 adjacent to the "left" direction of its location;
  • the target connected domain label of pixel 12 is 1, and the target connected domain label of pixel 21 is 4; it indicates that pixel 12 and pixel 21 belong to the same connected domain.
  • connected domain labels 1 and 4 also belong to the same connected domain. Connected domain.
  • the target connected component label of the pixel 22 is determined to be 1 with a smaller label value, and the two connected components corresponding to the connected component label 1 and the connected component label 4 need to be merged.
  • the pointer data point_list[4] corresponding to connected component label 4 can be adjusted to 1, indicating that connected component label 4 is an intermediate node label and points to root node label 1.
  • the connected component statistical data corresponding to connected component label 1 Adjust result[1] to 3 (that is, 12, 21, and 22 pixels).
  • the connected domain statistical data result[4] corresponding to the connected domain label 4 can be adjusted to 1 at the same time, or adjusted to the value 3 recorded in result[1]. It should be noted that the processing procedures not mentioned in the above connected domain analysis process can refer to related descriptions in the connected domain analysis process for the pixel 12, and will not be repeated here.
  • the connected domain analysis of the image to be analyzed is completed by the above processing method, and the label map of the image to be analyzed as shown in FIG. 2 can be obtained, and the polytree shown in FIG. 3 can be obtained according to the recorded pointer data point_list.
  • the connected domain label of each pixel in the image to be analyzed can be determined, and the relationship between the connected domain labels used to mark the pixel to be analyzed can be determined based on the multi-branch tree.
  • connected domain labels 1, 6, and 8 are root node labels, connected domain labels 2, 3, 4, 5, 7, and 9 all point to root node label 1, and connected domain label 10 points to root node label 8.
  • the number of pixels marked as connected component label 1 and the labeled connected component label pointing to connected component label 1 is 36
  • the number of pixels marked as connected component label 8 and labeled connected component The number of pixels where the connected domain label points to the connected domain label 8 is 5, and the number of pixels marked as connected domain label 6 is 1.
  • the image to be analyzed can be processed continuously, for example, pixels in the connected domain whose number of connected pixels in the image to be analyzed are less than a preset value are filtered.
  • the connected domain analysis method based on "pixel tagging” can effectively reduce the problem of too many DDR read requests and a large amount of DDR bandwidth based on the connected domain processing method based on "seed diffusion”; thus, the connected domain analysis based on "pixel tagging”
  • the method can also perform connected domain processing on larger images.
  • each connected domain label needs to be assigned a pointer data or connected domain statistical data; both pointer data and connected domain statistical data need to be continuously read and written when scanning images, and stored in the on-chip memory; therefore, it will take up a lot of storage Space, to a certain extent, limits the application scenarios of connected domain analysis based on "pixel labeling".
  • the embodiments of the present invention provide a connected domain processing method, which can not only effectively reduce the number of DDR read requests, but also realize the multiplexing of statistical data, effectively save storage space and computing resources, and expand the connected domain processing Application scenarios. Detailed descriptions are given below.
  • FIG. 4 is a schematic flowchart of a connected domain processing method according to the first embodiment of the present invention.
  • the connected domain processing method described in the embodiment of the present invention may include:
  • the data processing device acquires an image to be analyzed, and performs connected domain analysis on the current pixel to be analyzed in the image to be analyzed.
  • the data processing device first obtains an image to be analyzed, and the image to be analyzed includes a plurality of pixels, and the plurality of pixels includes valid pixels and invalid pixels.
  • the effective pixels and invalid pixels in the image to be analyzed are not connected.
  • the image to be analyzed may be any one of a plurality of depth images collected by a multi-lens camera taking a picture of the subject at a time.
  • the pixel at that position in the image to be analyzed is determined as the effective pixel; otherwise, the pixel in the image to be analyzed is determined The pixel at this position is determined to be an invalid pixel; where the contrast depth image is the depth image excluding the image to be analyzed among the multiple depth images.
  • the image to be analyzed may be any one of two depth images collected by a binocular camera at a time by taking pictures of the subject.
  • the first matching result is used to indicate the pixel points between the image to be analyzed and the contrast depth image at the same position The first matching value.
  • the contrast depth image is used to indicate the pixel points between the image to be analyzed and the contrast depth image at the same position The second matching value.
  • the pixel at that position in the image to be analyzed is determined as an effective pixel Point; otherwise, the pixel at that position in the image to be analyzed is determined as an invalid pixel.
  • the contrast depth image is the other one of the two depth images except the image to be analyzed.
  • the data processing device may first directly determine the connected domain label of the invalid pixel in the image to be analyzed as the invalid connected domain label, for example, the value 0;
  • the effective pixels in the analysis image are determined as the pixels to be analyzed, and then only the pixels to be analyzed in the image to be analyzed are subjected to connected domain analysis to reduce the amount of data processing, and save software and hardware resources and processing time.
  • the data processing device performs connected domain analysis on the current pixel to be analyzed in the image to be analyzed to obtain an analysis result; the analysis result includes the target connected domain label of the pixel to be analyzed.
  • the data processing equipment first determines the adjacent pixels adjacent to the pixel to be analyzed from the image to be analyzed, and then performs connected domain analysis on the pixel to be analyzed based on the adjacent pixel to determine the target connected domain of the pixel to be analyzed label.
  • the adjacent pixels adjacent to the pixel to be analyzed include: the first pixel adjacent to the pixel to be analyzed in the same column in the upper direction, and/or, the pixel to be analyzed The second pixel point adjacent to the left in the same row.
  • the data processing device performs a connected domain analysis on the pixel to be analyzed based on the first pixel and the second pixel, and determines whether the pixel to be analyzed is connected to the first pixel and the second pixel. If it is determined that the pixel to be analyzed is connected to the first pixel, the connected domain label of the first pixel is used as the target connected domain label of the pixel to be analyzed.
  • the connected domain label of the second pixel is used as the target connected domain label of the pixel to be analyzed. If it is determined that the pixel to be analyzed is connected to the first pixel and the second pixel, the connected domain label with the smallest value among the connected domain labels of the first pixel and the connected domain labels of the second pixel is used as the connected domain label to be analyzed The target connected domain label of the pixel. If it is determined that the pixel to be analyzed is not connected to the first pixel and the second pixel, then an unused connected component label among the preset connected component labels is used as the target connected component label of the pixel to be analyzed .
  • the way to determine whether the pixel to be analyzed is connected to the first pixel and the second pixel may be: first obtain the value corresponding to the pixel to be analyzed, the first pixel and the second pixel, and the value may be depth Value; then compare the value corresponding to the pixel to be analyzed with the value corresponding to the first pixel to obtain the first comparison result; compare the value corresponding to the pixel to be analyzed with the value corresponding to the second pixel , Get the second comparison result.
  • the first comparison result indicates that the difference between the value corresponding to the pixel to be analyzed and the value corresponding to the first pixel is less than or equal to the preset threshold, it is determined that the pixel to be analyzed is connected to the first pixel; otherwise, It is determined that the pixel to be analyzed is not connected to the first pixel.
  • the second comparison result indicates that the difference between the value corresponding to the pixel to be analyzed and the value corresponding to the second pixel is less than or equal to the preset threshold, it is determined that the pixel to be analyzed is connected to the second pixel ; Otherwise, it is determined that the pixel to be analyzed is not connected with the second pixel.
  • the data processing device performs connected domain analysis on the pixel to be analyzed based on the first pixel to determine whether the pixel to be analyzed is connected to the first pixel; if it is determined that the pixel to be analyzed is connected to the first pixel, Then the connected domain label of the first pixel is used as the target connected domain label of the pixel to be analyzed. If it is determined that the pixel to be analyzed is not connected to the first pixel, an unused connected domain label among the preset connected domain labels is used as the target connected domain label of the pixel to be analyzed.
  • the data processing device performs connected domain analysis on the pixel to be analyzed based on the second pixel to determine whether the pixel to be analyzed is connected to the second pixel; if it is determined that the pixel to be analyzed is connected to the second pixel, Then, the connected domain label of the second pixel is used as the target connected domain label of the pixel to be analyzed. If it is determined that the pixel to be analyzed is not connected to the second pixel, an unused connected domain label among the preset connected domain labels is used as the target connected domain label of the pixel to be analyzed.
  • the adjacent pixels adjacent to the pixel to be analyzed include: the first pixel adjacent to the pixel to be analyzed in the same column and in the upper direction, and in the same row as the pixel to be analyzed One or more of the second pixel point adjacent to the left direction, the third pixel point adjacent to the pixel to be analyzed in the upper left direction, and the fourth pixel point adjacent to the pixel to be analyzed in the upper right direction .
  • the third pixel is the pixel that is adjacent to the left in the same row as the first pixel
  • the fourth pixel is the pixel that is adjacent to the right in the same row as the first pixel. point.
  • the data processing device performs a connected domain analysis on the pixel to be analyzed according to the first pixel, the second pixel, the third pixel, and the fourth pixel, and determines whether the pixel to be analyzed is the same as the first pixel, The second pixel point, the third pixel point and the fourth pixel point are connected. If it is determined that the pixel to be analyzed is connected to one of the first pixel, the second pixel, the third pixel, and the fourth pixel, the connected domain label of the pixel connected to the pixel to be analyzed is taken as The target connected domain label of the pixel to be analyzed.
  • the connected component label with the smallest label value is used as the target connected component label of the pixel to be analyzed. If it is determined that the pixel to be analyzed is not connected with the first pixel, the second pixel, the third pixel, and the fourth pixel, then the unused connected domain label among the preset connected domain labels As the target connected domain label of the pixel to be analyzed.
  • this solution also modifies the scanning process in the connected domain analysis method based on "pixel labeling", and adds the line buffer operation, that is, to record line label information and line label information. It is used to record the connected domain label of the currently analyzed pixel.
  • the depth of the line label information is the same as the number of pixels in a line of the image to be analyzed.
  • the connected domain label recorded by the row label information includes: the connected domain label of the first pixel adjacent to the upper direction in the same column as the pixel to be analyzed, and the pixel located in the left direction of the same row of the pixel to be analyzed The connected component label of and the connected component label of the pixel in the right direction in the same row of the first pixel.
  • the row label information is updated according to the determined target connected domain label of the pixel to be analyzed. Specifically, the recorded connected domain label of the first pixel can be adjusted to the target connected domain label of the pixel to be analyzed in the row label information.
  • the row label information can be stored in on-chip registers.
  • the data processing device records a target connected domain label for the pixel to be analyzed in the label map of the image to be analyzed according to the analysis result.
  • the label map of the image to be analyzed is used to record the target connected domain label of each pixel in the image to be analyzed.
  • the data processing device After the data processing device performs connected domain analysis on the current pixel to be analyzed in the image to be analyzed to obtain the analysis result, it records the target connected domain label indicated by the analysis result for the pixel to be analyzed in the label map of the image to be analyzed.
  • the size of the label map is consistent with the size of the image to be analyzed, and the position of the target connected domain label in the label map is the same as the position of the pixel to be analyzed in the image to be analyzed.
  • the label image is stored in the DDR of the data processing device.
  • the data processing device updates the connected-domain statistical information of the image to be analyzed according to the target connected-domain label; wherein, when the connected-domain statistical information is updated, if the target connected-domain label is the root node Tag, the first type of statistical data is recorded in the connected domain statistical information for the target connected domain tag, the first type of statistical data is number data, and the number data is used to indicate that the tag is the target connected domain
  • the label and the number of pixels where the labeled connected component label points to the target connected component label if the target connected component label is an intermediate node label, it is recorded as the target connected component label in the connected component statistical information
  • the second type of statistical data, the second type of statistical data is pointer data, and the pointer data is used to indicate the root node label to which the target connected domain label points.
  • the connected domain statistical information includes a first identification bit and a data bit, the first identification bit is used to indicate the type of statistical data recorded by the data bit, and the data bit is used to indicate the statistical data recorded as the target connected domain label;
  • the first identification bit is the first identification
  • the data bit is the target connected domain label and records the first type of statistical data.
  • the first identification bit is the second identification
  • the data bit is the target connected domain label and records the second Class statistics.
  • the first identifier may be the identifier "0"
  • the second identifier may be the identifier "1".
  • the first identification bit may be the highest bit of the statistical information of the connected domain, and may also be the lowest bit of the statistical information of the connected domain, which is not limited in the embodiment of the present invention.
  • the connected domain statistical information can be stored in the on-chip random access memory (Random Access Memory, RAM), or a statistical data multiplexing memory can be specially set up to store the connected domain statistical information.
  • the connected domain processing method in the embodiment of the present invention multiplexes the number data and pointer data on the basis of the connected domain analysis method based on "pixel marking", and only needs to add a 1-bit identification bit to distinguish the connected domain statistical information Whether the statistical data recorded for the target connected domain label is number data or pointer data.
  • the on-chip storage space required by the above method is greatly reduced, and the storage space can be reduced by about half.
  • FIG. 5 is a schematic structural diagram of connected domain statistical information provided by the first embodiment of the present invention. As shown in Figure 5, each square in the figure represents 1 bit, and 11 squares in each row, that is, 11 bits correspond to a connected domain label.
  • the 11-bit data in the first row is connected domain label 1.
  • the first square of each row, or the highest bit indicates the first identifier of the connected domain statistical information, and is used to indicate the type of statistical data recorded by the data bit of the connected domain statistical information.
  • the second to eleventh squares in each row represent the data bits of the connected domain statistical information, which are used to represent the statistical data recorded by the connected domain label.
  • the first square in the first row records 0, that is, the first identification bit of the connected component statistical information of connected component label 1 is 0, which means that the second to the eleventh square in the first row
  • the grid is connected domain label 1 records the number data, that is, the data bit of connected domain statistical information of connected domain label 1 is connected domain label 1 records the number data; thus indirectly indicates that connected domain label 1 is the root node label.
  • the number data is 26 (11010), which means that the number of pixels marked as connected domain label 1 and the marked connected domain label points to connected domain label 1 is 26.
  • the first square in the third row records 1, that is, the first identification bit of the connected component statistical information of the connected component label 3 is 1, which means that the second to the 11th square in the first row
  • One square is connected domain label 3, which records the pointer data, that is, the data bit of connected domain statistical information of connected domain label 3 is the connected domain label 3 records pointer data; thus, it also indicates that connected domain label 3 is an intermediate node label.
  • the pointer data is 1 (01), which means that the root node label pointed to by the connected component label 3 is the connected component label 1.
  • the data processing device when the data processing device performs connected analysis of the pixel to be analyzed based on the first pixel and the second pixel, if it is determined that the pixel to be analyzed is not connected to the first pixel and the second pixel , if it is determined that the pixel to be analyzed is not connected to the first pixel and the second pixel , When the unused connected component label among the preset multiple connected component labels is used as the target connected component label of the pixel to be analyzed, the target connected component label is used as the root node label.
  • the connected domain label with the smallest value among the connected domain labels of the first pixel and the connected domain labels of the second pixel is used as the connected domain label to be analyzed
  • the connected component label of the connected component label of the first pixel and the connected component label of the second pixel with the largest label value is determined as the intermediate node label pointing to the target connected component label. Further, the data processing device changes the connected domain label with the largest label value in the connected domain statistical information.
  • the first identification bit corresponding to the connected component label with the largest label value in the connected component statistical information is adjusted to the second identifier, and the data bit corresponding to the connected component label with the largest label value in the connected component statistical information is
  • the connected domain label with the largest label value records the second type of statistical data, and the recorded second type of statistical data indicates that the connected domain label with the largest label value points to the target connected domain label.
  • step S401 includes the first pixel, the second pixel, the third pixel, and the fourth pixel
  • the pixel to be analyzed is determined The point is connected to at least two of the first pixel, the second pixel, the third pixel, and the fourth pixel.
  • the connected domain label of the at least two pixels that will be connected to the pixel to be analyzed After the connected component label with the smallest label value is used as the target connected component label of the pixel to be analyzed, the connected component labels of at least two pixels connected to the pixel to be analyzed, except for the connected component label with the smallest label value
  • the domain labels are all determined as intermediate node labels that point to the target connected domain labels.
  • the data processing device changes the statistical data recorded in the connected domain statistical information for the connected domain labels other than the connected domain label with the smallest label value.
  • the specific modification method please refer to the foregoing description and will not be repeated here.
  • Figure 1 is still used as an example to describe the connected domain processing method in the embodiment of the present invention.
  • the data required for this solution includes: 1.
  • the connected domain statistical information that supports the maximum connected domain label can be recorded as record_result_list.
  • the data structure is shown in Figure 5.
  • Connected domain statistical information can be used to record statistical data for connected domain labels, including number data or pointer data. Since the maximum supported connected domain label is 16, the maximum number of statistics is 1024, plus 1 bit of the first identification bit, the total storage space required for connected domain statistics is 16*11 bits, which can be stored in the on-chip RAM. 2.
  • the row label information can be recorded as root_pointers; the depth of the row label information is the same as the number of pixels in a line of the image to be analyzed, and the width is the number of bits that support the maximum connected domain label; since the maximum supported connected domain label is 16, The width is 4 bits; the number of pixels in a row of the image to be analyzed in Figure 1 is 12, and the storage space required for the row label information is 12*4 bits in total, which can be stored in the on-chip register. 3.
  • the label map of the image to be analyzed can be recorded as label_list; it is used to store the connected domain label of each pixel in the image to be analyzed.
  • the depth of the label image is consistent with the size of the image to be analyzed, and the width is set according to the maximum connected domain label; the total storage space required for the label image is 12*8*4bits, which can be stored in off-chip DDR.
  • the four-connectivity analysis is used as an example to illustrate.
  • the connected component analysis is performed on the pixel to be analyzed in Figure 1 in the order from left to right and top to bottom, that is, the pixel indicated by the shadow filled grid. It can be seen from Figure 1 that the first pixel to be analyzed (or effective pixel) of the image to be analyzed is the pixel indicated by the shadow filling grid with the label information of 12.
  • pixel 12 It is referred to as pixel 12 in the following description. And so on. Since there is no pixel in the "up" direction where the pixel 12 is located in the image to be analyzed, the pixel 11 at the "left" position of the pixel 12 is an invalid pixel and is not connected with the pixel 12; At this time, a new connected component label needs to be assigned to the pixel 12, the connected component label 1 can be determined as the target connected component label of the pixel 12, and the connected component label 1 is the root node label.
  • Figure 6 is a schematic diagram of the results of the connected domain analysis of the first row of pixels in Figure 1, which specifically includes three parts: label map, row label information, and connected domain statistical information.
  • the target connected domain label of the pixel 12 is determined to be 1
  • the target connected domain label 1 of the pixel 12 is recorded at the position of the first row and second column in the label_list of the image to be analyzed. Record the target connected domain label 1 for the pixel 12 at the position indicated by the second square in the row label information root_pointers, so that the pixel 22 and the pixel 13 can quickly find the connected domain of the pixel 12 according to the row label information label.
  • the data structure of the connected component statistical information in Figure 6 is a simplified schematic diagram from the data structure shown in Figure 5.
  • the 16 squares in the connected component statistical information in the figure correspond to connected component labels from left to right. 1 to connected component label 16, the data in each grid indicates that the connected component statistical information is the statistical data recorded by the connected component label.
  • the value on the left of "/" in each piece of data represents the value of the first identification bit, and the value on the right of "/" represents the data recorded by the data bit.
  • the connected component analysis is performed on the pixels 16 and 19, by analogy, it can be determined that the target connected component labels of the pixels 16 and 19 are 2 and 3, respectively.
  • the pixel point 1a is connected to the pixel point 19 adjacent to the "left" direction of the position of the pixel point 1a, and the pixel point 19 can be quickly found according to the recorded row label information root_pointers
  • the target connected component label of is 3; then the target connected component label of pixel 1a is also determined to be 3.
  • the pixel point 1a and the pixel point 19 have the same information in the label map label and the row label information root_pointers; then at the position indicated by the third square of the connected field statistical information record_result_list, the connected field label 3 corresponds to the first identification position Adjust to 0, and the data bit indicated in the third square is connected domain label 3 record number data 2, so the data in the third square is expressed as "0/2".
  • the target connected component label of the pixel 22 is 4.
  • the connected domain analysis is performed on the pixel point 22, since the pixel point 22 is connected to the pixel point 12 adjacent to its position in the "up" direction, and is connected to the pixel point 21 adjacent to its position in the "left” direction.
  • the target connected domain label of the pixel 12 can be quickly found as 1, and the target connected domain label of the pixel 21 is 4, indicating the connected domain Labels 1 and 4 also belong to the same connected domain.
  • the target connected component label of the pixel 22 is determined to be 1 with a smaller label value, and the two connected components corresponding to the connected component label 1 and the connected component label 4 need to be merged.
  • Figure 7 is a schematic diagram of the results of the connected domain analysis of the second row of pixels in Figure 1, including the label map, row label information and connected domain statistical information.
  • the target connected component label of the pixel 22 is determined to be 1
  • the position of the second row and second column in the label map label_list of the image to be analyzed is the pixel 22 and its target connected component label 1 is recorded.
  • the position indicated by the second square in the row label information root_pointers is the pixel 22 to record its target connected domain label 1.
  • Adjust the first identification bit corresponding to connected domain label 1 to 0 at the position indicated by the first square of the connected domain statistical information record_result_list, and the data bit indicated in the first square is connected domain label 1 record number data 3.
  • the label information in the row of Figure 7 records the data after all the pixels in the second row have been processed, the data in the first square is expressed as "0/4", and the connected domain label is 1 also includes pixels 23 . Adjust the first identification bit corresponding to connected domain label 4 to 1 at the position indicated by the fourth square of the connected domain statistical information record_result_list, and the data bit indicated in the fourth square is the connected domain label 4 record pointer Data 1 indicates that the connected domain label 4 is an intermediate node label and points to the root node label 1, so the data in the fourth square is expressed as "1/1". The above-mentioned processing method is adopted until the analysis of the connected domain of the image to be analyzed is completed, which is not repeated here.
  • the two shadow-filled squares in the row label information in Figure 7. Take the first shadow-filled square from left to right as an example.
  • the shadow-filled square records the pixel 21
  • the target connected component label after the connected component analysis of the pixel 21 is completed, it is determined that the target connected component label of the pixel 21 is 4, and the connected component label 4 is the root node label.
  • the connected area label 4 that was originally the root node label is adjusted to an intermediate node label pointing to the root node label 1. If the connected domain label 4 is directly used as the root node when the connected domain analysis is performed on the pixels in the third row of the image to be analyzed, an error may be caused.
  • the pixel to be analyzed in the process of analyzing the connected domain of the pixel to be analyzed in each row of the image to be analyzed, if it is necessary to directly obtain from the row label information root_pointers, the pixel to be analyzed is adjacent to the pixel to be analyzed in the same column.
  • the root node label can be judged on the connected domain label of the pixel point in the same column that is adjacent to the pixel to be analyzed in the upper direction obtained from the row label information root_pointers; If the connected component label is the root node label, the target connected component label of the pixel to be analyzed is determined based on the connected component label; if it is determined that the connected component label is not the root node label, search from the connected component statistical information record_result_list The root node label pointed to by the connected component label is derived, and the target connected component label of the pixel to be analyzed is determined based on the root node label pointed to by the connected component label.
  • the connected domain label recorded in the row label information is an intermediate node label, and generally only one or two searches can find the root node label pointed to by the intermediate node label in the row label information.
  • the processing speed of connected domains has little effect; in the process of connected domain analysis, recording row label information and analyzing connected domains based on the row label information can effectively improve the processing speed of connected domains.
  • the connected component analysis is performed on the pixel to be analyzed first, and the target connected component label is recorded in the label map for the pixel to be analyzed according to the analysis result; then the connected component statistical information is updated according to the target connected component label; where, if If the target connected domain label is the root node label, the first type of statistical data is recorded in the connected domain statistical information, and if the target connected domain label is an intermediate node label, the second type of statistical data is recorded in the connected domain statistical information.
  • a connected domain processing method provided in another embodiment further includes the following steps after step S403:
  • the data processing device determines a growing label and a non-growing label from the multiple connected domain labels according to the row label information currently recorded.
  • the connected component label needs to be checked. Recycle and reuse.
  • a growing label is a connected component label that may continue to extend downward, which has a greater impact on subsequent connected component analysis, and should not support recycling and reuse;
  • a non-growing label is a connected component label that will not continue to extend downward, for subsequent connected component analysis The impact is small and can be recycled and reused.
  • the data processing device may determine the growing label and the non-growing label from a plurality of preset connected domain labels according to the row label information currently recorded.
  • the data processing device determines the first label existing in the row label information of the current record from a plurality of preset connected domain labels, and determines the first label as a growth label; A second label that does not exist in the row label information of the current record is determined among the connected domain labels, and the second label is determined as a non-growing label.
  • the data processing device determines the first label existing in the row label information of the current record from a plurality of preset connected domain labels, and determines the first label that does not exist in the row label information of the current record.
  • the second label then according to the recorded connected domain statistics, from the preset multiple connected domain labels, determine the root node label or the third label of the intermediate node label of the first label; finally remove the second label Tags other than the third tag are determined to be non-growth tags, and the first tag and the third tag are determined to be growing tags.
  • the method described in this embodiment is to use the second label except the third label as the label.
  • Non-growth label the non-growth label determined in this way can ensure to a certain extent that it has no effect on subsequent connected domain analysis.
  • the connected domain statistical information further includes a second identification bit
  • the second identification bit is used to record the growth identification of the connected domain label, and when the second identification bit is the third identification, it indicates that the connected domain label is a non-growing label, When the second identification bit is the fourth identification, it indicates that the connected domain label is a growth label.
  • the third identifier may be the identifier "0"
  • the fourth identifier may be the identifier "1”.
  • the second identification bit can be the highest bit of the statistical information of the connected domain, or the lowest bit of the statistical information of the connected domain; the second identification bit can be adjacent to the first identification bit or not adjacent to the first identification bit .
  • the second identification position When the second identification position is adjacent to the first identification position, the second identification position may be located adjacent to the left of the first identification position, or may be located adjacent to the right of the first identification position.
  • S405 The data processing device performs connected domain analysis on pixels in the image to be analyzed that have not completed connected domain analysis according to the non-growth tag.
  • the pixel to be analyzed in the image to be analyzed has not completed the connected domain analysis, if it is determined that the pixel to be analyzed is connected to one of its neighboring pixels, it will be connected to the pixel to be analyzed.
  • the connected domain label of the adjacent pixels connected by the dot is used as the target connected domain label of the pixel to be analyzed. If it is determined that the pixel to be analyzed is connected to at least two of its neighboring pixels, then among the connected domain labels of at least two neighboring pixels connected to the pixel to be analyzed, the connected domain label with the smallest label value is used as the to-be-analyzed pixel. Analyze the target connected domain label of the pixel.
  • an unused connected region label in the non-growth label is used as the target connected region label of the pixel to be analyzed.
  • the recovery and reuse of connected domain labels can be realized.
  • the processing of the image to be analyzed can still be completed when the largest supported connected domain label is small; the storage space occupied by the recovered labels remains unchanged, so The processing of the image to be analyzed can be completed with a small storage space, effectively saving storage space.
  • FIG. 9 is a schematic diagram of a connected domain according to the second embodiment of the present invention, which is the result after the analysis is completed according to the connected domain analysis method described above.
  • Figure 9 shows the image to be analyzed, and each grid in the figure represents a pixel of the image to be analyzed.
  • the shaded grids in the figure represent the effective pixels in the image to be analyzed, and the unshaded grids represent the invalid pixels in the image to be analyzed.
  • the effective pixels and the invalid pixels are not connected; the multiple grids filled with shadow constitute the Analyze multiple connected domains of the image.
  • the mark information in the unshaded filled grid in the figure represents the coordinate information of the corresponding pixel in the image to be analyzed
  • the mark information in the shaded grid in the figure represents the coordinate information of the corresponding pixel in the image to be analyzed, and the connected domain Connected domain label determined after analysis.
  • the value on the left of "/" indicates the coordinate information of the pixel in the image to be analyzed
  • the value on the right of "/" indicates the connected domain label of the pixel.
  • recovery means to determine non-growth labels, and reuse means to use non-growth labels for subsequent connected-domain analysis mainly based on a certain segmentation line of the image to be analyzed, if If a certain part of the connected domain in the analysis image does not cross the dividing line, all connected domain labels corresponding to pixels in this part of the connected domain will not appear below the dividing line.
  • Such connected domain labels can be regarded as non-growing labels , And recycle and reuse.
  • the labels in the connected domains that no longer grow before the line of the dotted box will not appear in the area below the dotted box, for example, the connected domain composed of connected domain labels 1 and 4 , And the connected domain composed of connected domain labels 2 and 5 will no longer grow downward, and the connected domain labels 1, 2, 4, and 5 will not appear in the area below the dashed box.
  • the connected domains composed of the connected domain labels in the dashed frame are likely to continue to grow, so the connected domain labels in the dashed frame may appear in the area below the dashed frame, for example, the connected domain labels 3 and 7 are in the dashed frame.
  • connected domain tags 1, 2, 4, and 5 can all be recycled, and can be reused in the part below the dashed box without affecting them.
  • FIG. 10 is a schematic diagram of a row label information provided by an embodiment of the present invention.
  • the row label information shown in Figure 10 is sorted out once, as long as the root node label appears in the row label information, it is possible to continue to grow downward, and the root node label that does not appear in the row label information points to All connected domain labels in the connected domains can be recycled. Based on the row label information in Figure 10, it can be found that the root node labels that may continue to grow downward are 3, 7, and 6, and then the root node labels 3, 7, and 6 are grown in the connected domain statistics.
  • FIG. 11 is a schematic diagram of connected domain statistical information provided by the second embodiment of the present invention. Specifically, the connected domain statistical information corresponding to the image to be analyzed shown in FIG. 9 is sorted before the connected domain label is recovered. Schematic.
  • the first identification bit is used to indicate the type of statistical data stored in the data bit
  • the second identification bit is used to record the growth identification of the connected domain tag.
  • the second identification bit is "0" it indicates the connected domain
  • the label is a non-growing label.
  • the second identification bit is "1”, it indicates that the connected domain label is a growing label. It can be seen that the connected domain label 4 points to the root node label 1 (that is, 01), the connected domain label 5 points to the root node label 2 (that is, 10), and the connected domain labels 3, 6, and 7 are growth labels.
  • the connected domain statistical information is sorted, and all intermediate node labels are changed to point to the root node label. It should be noted that in this example, before and after the row label information shown in FIG. 10 is combed, the recorded connected domain statistical information remains unchanged, and they are all connected domain statistical information shown in FIG. 11.
  • the combing process is illustrated as follows: suppose that a linked list of 10->9->8->7->6 is recorded in the connected domain statistics information, and 7->6 indicates that the connected domain label 7 points to the connected domain label 6, from the linked list It can be seen that starting from the connected component label 10, it can be determined that the connected component label 6 is the root node label, and then the connected component labels 10, 9, and 8 are all modified to the first-level intermediate node label pointing to the root node label 6, which is 10- >6,9->6,8->6,7->6.
  • a traversal is performed on the connected component statistical information shown in FIG. 11, and the root node label whose growth mark is "0" and the first-level intermediate node labels pointing to these root node labels are determined.
  • the above two types of connected component labels are also It is a non-growth label.
  • four non-growth tags 1, 2, 4, and 5 can be determined.
  • the non-growth tags 1, 2, 4, and 5 can be stored in the preset storage space. Further, based on the non-growth labels 1, 2, 4, and 5, the subsequent connected domain analysis of the pixel to be analyzed is continued starting from the pixel 47.
  • FIG. 12 is a schematic diagram of a connected domain provided by the third embodiment of the present invention. Specifically, the connected domain label recovery and reuse method described above is used to complete the connected domain analysis result of all pixels in FIG. As shown in Figure 12, the pixel point 46 and the pixel point before it, that is, the part of the grid that is not shown in bold in the figure, is the part marked by the preset 7 connected domain labels 1 to 7, that is, It is the part before the recycling and reuse of connected domain labels.
  • Pixel 47 and the following pixels, that is, the part shown in bold squares in the figure, are the parts marked with the recycled non-growth tags, that is, the parts reused by the connected domain tags.
  • the above two parts can be distinguished by the recorded recovery position pixels 46.
  • the connected component labels corresponding to pixels 49, 4a, 59, 69 are non-growth label 1
  • the connected component labels corresponding to pixels 52, 53, 54, 55, 56, 62, and 65 are non-growth label 2.
  • the connected domain label corresponding to 6b and 6c is the non-growth label 4. It can be seen that the three connected domain labels 1, 2, and 4 out of the 4 non-growth labels recovered are all label reused.
  • the data processing device may also determine, according to the recorded connected domain statistical information and the label map, that the image to be analyzed does not meet the preset conditions Connected domains, and filter pixels in the connected domains that do not meet the preset conditions.
  • not satisfying the preset condition means that the number of connected pixels in the connected domain is less than the preset value.
  • FIG. 13 is a schematic diagram of connected domain statistical information provided by the third embodiment of the present invention. Specifically, the connection recorded after the connected domain analysis of all pixels in FIG. 9 is completed using the above-mentioned connected domain label recovery and reuse method Domain statistics. As shown in FIG. 13, the data corresponding to the connected domain labels 1, 2, and 4 in the connected domain statistical information are all recorded for the part of pixels shown in bold in FIG. 12. It can be seen that connected component label 3 points to root node label 1, connected component labels 5 and 7 both point to root node label 2, the number data corresponding to connected component label 1 is 8, the number data corresponding to connected component label 2 is 8, and the connected component label 4 The corresponding number data is 2.
  • FIG. 14 is a schematic diagram of a connected domain statistical information provided by a fourth embodiment of the present invention. Specifically, it is the result of the connected domain statistical information traversal shown in FIG. The connected domains in the thick part are analyzed.
  • the number data corresponding to the connected component label 4 is less than 5, it is necessary to filter out the pixels with the connected component label 4 in the bold part of the grid; combine the connected component labeling result shown in Figure 12, or the recorded image to be analyzed corresponding It can be determined that the pixels with the connected domain label of 4 in the thickened part of the grid are 6b and 6c, so the pixels 6b and 6c in the image to be analyzed shown in Figure 9 can be filtered out.
  • FIG. 15 is a schematic diagram of connected domain statistical information provided by the fifth embodiment of the present invention. Specifically, the connected domain label 1, 4, 2, and 5 read out different addresses for the connected domain shown in FIG.
  • the connected domain label read from the first preset storage unit indicates that the number of connected pixels in the corresponding connected domain is greater than or equal to 5, which cannot be filtered
  • the connected domain read from the second preset storage unit The domain label indicates that the number of connected pixels in the corresponding connected domain is less than 5 and can be filtered.
  • the number data in the connected domain statistical information corresponding to the connected domain tags 1, 4 read from the first preset storage unit is directly modified to 5 (that is, 101), and the second The number data in the connected domain statistical information corresponding to the connected domain tags 2 and 5 read from the preset storage unit is modified to 0 to facilitate subsequent judgment.
  • the number data corresponding to connected domain labels 2, 5, and 6 is less than 5, it is necessary to filter out pixels with connected domain labels 2, 5, and 6 in the unbold part of the grid; combined with the connected domain labels shown in Figure 12 As a result, or the label image corresponding to the recorded image to be analyzed, it can be determined that the pixels with the connected domain labels 2, 5, and 6 in the unbold part of the grid are 16, 26, 27, 25, 3c, so the image can be changed The pixels 16, 26, 27, 25, 3c in the image to be analyzed shown in 9 are filtered out. With the above method, the pixels in the connected domain whose number of connected pixels in the image to be analyzed are less than the preset value can be filtered.
  • the backed-up connected domain statistics can be realized from top to bottom. Analyze connected components in the order of bottom and left to right.
  • FIG. 16 is a schematic structural diagram of a data processing device provided by an embodiment of the present invention.
  • the data processing device described in the embodiment of the present invention includes a processor 1601, a communication interface 1602, and a memory 1603.
  • the processor 1601, the communication interface 1602, and the memory 1603 may be connected through a bus or other methods.
  • the embodiment of the present invention takes the connection through a bus as an example.
  • the processor 1601 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and an NP.
  • the processor 1601 may also be a multi-core CPU or a core used to implement communication identification binding in a multi-core NP.
  • the processor 1601 may be a hardware chip.
  • the hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof.
  • the PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a general array logic (generic array logic, GAL) or any combination thereof.
  • the communication interface 1602 can be used for the exchange of sending and receiving information or signaling, as well as the reception and transmission of signals.
  • the memory 1603 may mainly include a storage program area and a storage data area.
  • the storage program area can store an operating system and a storage program required by at least one function (such as a text storage function, a location storage function, etc.); the storage data area can store Data (such as image data, text data) created according to the use of the device, etc., and may include application storage programs, etc.
  • the memory 1603 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
  • the memory 1603 is also used to store program instructions.
  • the processor 1601 is configured to execute program instructions stored in the memory 1603, and when the program instructions are executed, the processor 1601 is configured to:
  • the domain statistical information records the first type of statistical data for the target connected domain label, where the first type of statistical data is number data, and the number data is used to indicate the target connected domain label and the marked connected domain label The number of pixels pointing to the target connected domain label; if the target connected domain label is an intermediate node label, record the second type of statistical data for the target connected domain label in the connected domain statistical information, so The second type of statistical data is pointer data, and the pointer data is used to indicate the root node label pointed to by the target connected domain label.
  • the connected domain statistical information includes a first identification bit and a data bit, wherein the first identification bit is used to indicate the type of statistical data recorded by the data bit, and the data bit is used to indicate Is the statistical data recorded for the target connected domain label; when the first identification bit is the first identifier, the data bit is the first type of statistical data recorded for the target connected domain label, when the first When the identification bit is the second identification, the data bit is the second type of statistical data recorded by the target connected domain tag.
  • the processor 1601 when the processor 1601 performs a connected domain analysis on the current pixel to be analyzed in the image to be analyzed, it is specifically configured to: determine from the image to be analyzed that the pixel to be analyzed is current Adjacent adjacent pixels; performing connected domain analysis on the pixel to be analyzed according to the adjacent pixel to determine the target connected domain label of the pixel to be analyzed.
  • the adjacent pixel points include: a first pixel point that is adjacent in the upper direction in the same column as the pixel point to be analyzed, and/or is in the same row as the pixel point to be analyzed The second pixel point adjacent in the center-left direction.
  • the processor 1601 when the processor 1601 performs connected domain analysis on the pixel to be analyzed according to the adjacent pixels, and determines the target connected domain label of the pixel to be analyzed, it is specifically configured to: The first pixel performs connected domain analysis on the pixel to be analyzed; if it is determined that the pixel to be analyzed is connected to the first pixel, then the connected domain label of the first pixel is used as the The target connected domain label of the pixel to be analyzed.
  • the processor 1601 when the processor 1601 performs connected domain analysis on the pixel to be analyzed according to the adjacent pixels, and determines the target connected domain label of the pixel to be analyzed, it is specifically configured to: The second pixel performs connected domain analysis on the pixel to be analyzed; if it is determined that the pixel to be analyzed is connected to the second pixel, then the connected domain label of the second pixel is used as the The target connected domain label of the pixel to be analyzed.
  • the processor 1601 when the processor 1601 performs connected domain analysis on the pixel to be analyzed according to the adjacent pixels, and determines the target connected domain label of the pixel to be analyzed, it is specifically configured to: The first pixel and the second pixel perform a connected domain analysis on the pixel to be analyzed; if it is determined that the pixel to be analyzed is connected to the first pixel and the second pixel , The connected component label of the connected component of the first pixel and the connected component of the connected component label of the second pixel are used as the target connected component label of the pixel to be analyzed.
  • the processor 1601 is further configured to: determine the connected component label with the largest label value among the connected component labels of the first pixel and the connected component labels of the second pixel as pointing to the The intermediate node label of the target connected domain label; the connected domain label with the largest label value in the connected domain statistical information is changed.
  • the processor 1601 when the processor 1601 changes the connected component label with the largest label value in the connected component statistical information, it is specifically configured to: change the connected component statistical information with the largest label value.
  • the first identification bit corresponding to the connected domain label is adjusted to the second identification; the data bit corresponding to the connected domain label with the largest label value in the connected domain statistical information is the connected domain label record with the largest label value.
  • the second type of statistical data the recorded second type of statistical data indicates that the connected component label with the largest label value points to the target connected component label.
  • the processor 1601 is further configured to: if it is determined that the pixel to be analyzed is not connected with the first pixel and the second pixel, connect a plurality of preset An unused connected domain label in the domain labels is used as the target connected domain label of the pixel to be analyzed.
  • the connected domain label of the first pixel that is adjacent in the upper direction in the same column as the pixel to be analyzed is recorded in the row label information; the row label information further includes The connected domain label of the pixel in the left direction in the same row of the pixel to be analyzed, and the connected domain label of the pixel in the right direction in the same row of the first pixel.
  • the processor 1601 is further configured to: after the connected domain analysis of the pixel to be analyzed is completed, perform the row label information on the line label information according to the determined target connected domain label of the pixel to be analyzed Update.
  • the processor 1601 is further configured to: after a plurality of preset connected domain labels are used up, determine a growth label and a non-information from the plurality of connected domain labels according to the currently recorded row label information. Growing label; according to the non-growing label, the connected area analysis is performed on the pixels in the image to be analyzed that have not completed the connected area analysis.
  • the processor 1601 when the processor 1601 determines a growing label and a non-growing label from the plurality of connected domain labels according to the row label information currently recorded, it is specifically configured to: Determine the first label that exists in the line label information of the current record, and determine the first label as a growth label; determine from the plurality of connected domain labels that are not present in the line label information of the current record A second label, and determining the second label as a non-growth label.
  • the processor 1601 when the processor 1601 determines a growing label and a non-growing label from the plurality of connected domain labels according to the row label information currently recorded, it is specifically configured to: Determine the first label that exists in the line label information of the current record, and determine the second label that does not exist in the line label information of the current record; according to the connected domain statistical information, from the plurality of connected domain labels Is determined as the root node label of the first label or the third label of the intermediate node label; the labels other than the third label in the second label are determined as non-growth labels, and the first label The label and the third label are determined to be growth labels.
  • the connected domain statistical information includes a second identification bit, the second identification bit is used to record the growth identification of the connected domain label, and when the second identification bit is the third identification, it indicates the connected domain label It is a non-growth tag, and when the second identification bit is a fourth tag, it indicates that the connected domain tag is a growth tag.
  • the processor 1601 is further configured to: determine, according to the connected domain statistical information and the label map, a connected domain that does not meet a preset condition in the image to be analyzed; Set the pixels in the connected domain of the condition to filter.
  • not satisfying the preset condition means that the number of connected pixels in the connected domain is less than the preset value.
  • the connected domain statistical information is stored in an on-chip random access memory RAM, and/or the row label information is stored in an on-chip register, and/or, the label map is stored in a chip External double-rate synchronous dynamic random access memory DDR.
  • the processor 1601, the communication interface 1602, and the memory 1603 described in the embodiment of the present invention can execute the implementation described in the method for processing a connected domain provided in the embodiment of the present invention, and details are not described herein again.
  • the connected component analysis is performed on the pixel to be analyzed first, and the target connected component label is recorded in the label map for the pixel to be analyzed according to the analysis result; then the connected component statistical information is updated according to the target connected component label; where, if If the target connected domain label is the root node label, the first type of statistical data is recorded in the connected domain statistical information, and if the target connected domain label is an intermediate node label, the second type of statistical data is recorded in the connected domain statistical information.
  • An embodiment of the present invention also provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the connected domain processing method described in the foregoing method embodiment is implemented.
  • the embodiment of the present invention also provides a computer program product containing instructions, which when run on a computer, causes the computer to execute the connected domain processing method described in the foregoing method embodiment.
  • the program can be stored in a computer-readable storage medium, and the storage medium can include: Flash disk, read-only memory (Read-Only Memory, ROM), random access device (Random Access Memory, RAM), magnetic disk or optical disk, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

A connected domain processing method, a data processing device and a computer readable storage medium, wherein the method comprises: obtaining an image to be analyzed, performing a connected domain analysis on the current pixel points to be analyzed in the image to be analyzed, and recording a target connected domain label for the pixel points to be analyzed in a label map of the image to be analyzed according to an analysis result; updating connected domain statistical information of the image to be analyzed according to the target connected domain label; if the target connected domain label is a root node label, recording first-type statistical data for the target connected domain label in the connected domain statistical information, wherein the first-type statistical data is number data; and if the target connected domain label is an intermediate node label, recording second-type statistical data for the target connected domain label in the connected domain statistical information, wherein the second-type statistical data is pointer data. The present invention not only can effectively reduce the number of read requests for DDR, but also can realize the multiplexing of the statistical data, thereby effectively saving the storage space and computing resources, and enlarging the application scenes of the connected domain processing.

Description

连通域处理方法、数据处理设备及计算机可读存储介质Connected domain processing method, data processing equipment and computer readable storage medium 技术领域Technical field
本发明涉及计算机技术领域,尤其涉及一种连通域处理方法、数据处理设备及计算机可读存储介质。The present invention relates to the field of computer technology, in particular to a connected domain processing method, data processing equipment and computer-readable storage medium.
背景技术Background technique
连通域处理是图像识别技术的重要组成部分,例如可以对图像进行连通域处理以实现车牌识别、文本识别、字幕识别、车辆跟踪、行人入侵检测等。目前业界广泛使用的连通域处理方法是基于“种子扩散”的连通域处理方式。但采用基于“种子扩散”的连通域处理方式时,一旦出现跨行处理,就需要发起片外双倍速率同步动态随机存储器(Double Data Rate,DDR)的读请求。由于频繁的访问DDR会占用大量带宽资源,因此实际使用时通常只采用基于“种子扩散”的方式对尺寸较小的图像(例如640*360pixel)进行连通域处理。而对于尺寸较大的图像则需要进行降采样后才能使用基于“种子扩散”的方式进行连通域处理,例如将尺寸为1280*720pixel的图像降采样到640*360pixel后进行处理。但降采样操作会降低图像的精度,会对处理结果的准确性造成影响。可见,基于“种子扩散”的连通域处理方式需要大量的DDR读请求,应用场景十分受限。Connected domain processing is an important part of image recognition technology. For example, connected domain processing can be performed on images to realize license plate recognition, text recognition, caption recognition, vehicle tracking, and pedestrian intrusion detection. At present, the connected domain processing method widely used in the industry is the connected domain processing method based on "seed diffusion". However, when the connected domain processing method based on "seed diffusion" is adopted, once inter-bank processing occurs, an off-chip double-rate synchronous dynamic random access memory (Double Data Rate, DDR) read request needs to be initiated. Since frequent access to DDR will take up a lot of bandwidth resources, in actual use, the connected domain processing is usually performed on smaller images (such as 640*360 pixels) based on "seed diffusion". For larger images, downsampling is required before connected domain processing can be performed based on "seed diffusion", for example, an image with a size of 1280*720pixel is downsampled to 640*360pixel for processing. However, the down-sampling operation will reduce the accuracy of the image and affect the accuracy of the processing result. It can be seen that the connected domain processing method based on "seed diffusion" requires a large number of DDR read requests, and the application scenarios are very limited.
发明内容Summary of the invention
本发明实施例公开了一种连通域处理方法、数据处理设备及计算机可读存储介质,不仅可以有效降低DDR的读请求次数,还可以实现统计数据的复用,有效节省存储空间以及计算资源,扩大连通域处理的应用场景。The embodiment of the present invention discloses a connected domain processing method, data processing equipment, and computer-readable storage medium, which can not only effectively reduce the number of DDR read requests, but also realize the multiplexing of statistical data, effectively saving storage space and computing resources, Expand the application scenarios of connected domain processing.
本发明实施例第一方面公开了一种连通域处理方法,所述方法包括:The first aspect of the embodiments of the present invention discloses a connected domain processing method, and the method includes:
获取待分析图像,对所述待分析图像中当前的待分析像素点进行连通域分析,并根据分析结果在所述待分析图像的标签图中为所述待分析像素点记录目标连通域标签;Acquiring an image to be analyzed, performing a connected domain analysis on the current pixel to be analyzed in the image to be analyzed, and recording a target connected domain label for the pixel to be analyzed in the label map of the image to be analyzed according to the analysis result;
根据所述目标连通域标签更新所述待分析图像的连通域统计信息;Updating the connected domain statistical information of the image to be analyzed according to the target connected domain label;
其中,在对所述连通域统计信息进行更新时,若所述目标连通域标签为根节点标签,则在所述连通域统计信息中为所述目标连通域标签记录第一类统计数据,所述第一类统计数据为数目数据,所述数目数据用于指示标记为所述目标连通域标签以及标记的连通域标签指向所述目标连通域标签的像素点的个数;若所述目标连通域标签为中间节点标签,则在所述连通域统计信息中为所述目标连通域标签记录第二类统计数据,所述第二类统计数据为指针数据,所述指针数据用于指示所述目标连通域标签所指向的根节点标签。Wherein, when the connected component statistical information is updated, if the target connected component label is a root node label, then the first type of statistical data is recorded for the target connected component label in the connected component statistical information, so The first type of statistical data is number data, and the number data is used to indicate the number of pixels marked as the target connected domain label and the marked connected domain label pointing to the target connected domain label; if the target is connected If the domain label is an intermediate node label, then the second type of statistical data is recorded for the target connected domain label in the connected domain statistical information, the second type of statistical data is pointer data, and the pointer data is used to indicate the The label of the root node pointed to by the target connected domain label.
本发明实施例第二方面公开了一种数据处理设备,包括:存储器和处理器,The second aspect of the embodiments of the present invention discloses a data processing device, which includes a memory and a processor,
所述存储器,用于存储程序指令;The memory is used to store program instructions;
所述处理器,用于执行所述存储器存储的程序指令,当所述程序指令被执行时,所述处理器用于:The processor is configured to execute program instructions stored in the memory, and when the program instructions are executed, the processor is configured to:
获取待分析图像,对所述待分析图像中当前的待分析像素点进行连通域分析,并根据分析结果在所述待分析图像的标签图中为所述待分析像素点记录目标连通域标签;Acquiring an image to be analyzed, performing a connected domain analysis on the current pixel to be analyzed in the image to be analyzed, and recording a target connected domain label for the pixel to be analyzed in the label map of the image to be analyzed according to the analysis result;
根据所述目标连通域标签更新所述待分析图像的连通域统计信息;Updating the connected domain statistical information of the image to be analyzed according to the target connected domain label;
其中,在对所述连通域统计信息进行更新时,若所述目标连通域标签为根节点标签,则在所述连通域统计信息中为所述目标连通域标签记录第一类统计数据,所述第一类统计数据为数目数据,所述数目数据用于指示标记为所述目标连通域标签以及标记的连通域标签指向所述目标连通域标签的像素点的个数;若所述目标连通域标签为中间节点标签,则在所述连通域统计信息中为所述目标连通域标签记录第二类统计数据,所述第二类统计数据为指针数据,所述指针数据用于指示所述目标连通域标签所指向的根节点标签。Wherein, when the connected component statistical information is updated, if the target connected component label is a root node label, then the first type of statistical data is recorded for the target connected component label in the connected component statistical information, so The first type of statistical data is number data, and the number data is used to indicate the number of pixels marked as the target connected domain label and the marked connected domain label pointing to the target connected domain label; if the target is connected If the domain label is an intermediate node label, then the second type of statistical data is recorded for the target connected domain label in the connected domain statistical information, the second type of statistical data is pointer data, and the pointer data is used to indicate the The label of the root node pointed to by the target connected domain label.
本发明实施例第三方面公开了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,所述计算机程序被处理器执行时实现如上述第一方面所述方法的步骤。A third aspect of the embodiments of the present invention discloses a computer-readable storage medium in which a computer program is stored, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented .
本发明实施例中,首先对待分析像素点进行连通域分析,并根据分析结果在标签图中为待分析像素点记录目标连通域标签;然后根据目标连通域标签更新连通域统计信息;其中,若目标连通域标签为根节点标签,则在连通域统计信息中记录第一类统计数据,若目标连通域标签为中间节点标签,则在连通域 统计信息中记录第二类统计数据。采用上述方式,不仅可以有效降低DDR的读请求次数,还可以实现统计数据的复用,有效节省存储空间以及计算资源,扩大连通域处理的应用场景。In the embodiment of the present invention, the connected component analysis is performed on the pixel to be analyzed first, and the target connected component label is recorded in the label map for the pixel to be analyzed according to the analysis result; then the connected component statistical information is updated according to the target connected component label; where, if If the target connected domain label is the root node label, the first type of statistical data is recorded in the connected domain statistical information, and if the target connected domain label is an intermediate node label, the second type of statistical data is recorded in the connected domain statistical information. By adopting the above method, not only can the number of DDR read requests be effectively reduced, but also the multiplexing of statistical data can be realized, storage space and computing resources can be effectively saved, and the application scenarios of connected domain processing can be expanded.
附图说明Description of the drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions in the embodiments of the present invention more clearly, the following will briefly introduce the drawings needed in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative labor, other drawings can be obtained from these drawings.
图1是本发明第一实施例公开的一种连通域的示意图;Fig. 1 is a schematic diagram of a connected domain disclosed in the first embodiment of the present invention;
图2是本发明实施例公开的一种标签图的示意图;2 is a schematic diagram of a label map disclosed in an embodiment of the present invention;
图3是本发明实施例公开的一种多叉树的示意图;FIG. 3 is a schematic diagram of a polytree disclosed in an embodiment of the present invention;
图4是本发明第一实施例公开的一种连通域处理方法的流程示意图;4 is a schematic flowchart of a connected domain processing method disclosed in the first embodiment of the present invention;
图5是本发明第一实施例公开的一种连通域统计信息的结构示意图;Fig. 5 is a schematic structural diagram of connected domain statistical information disclosed in the first embodiment of the present invention;
图6是图1第一行像素点连通域分析完成后的结果示意图;Fig. 6 is a schematic diagram of the result after the connected domain analysis of the pixels in the first row of Fig. 1 is completed;
图7是图1第二行像素点连通域分析完成后的结果示意图;Fig. 7 is a schematic diagram of the result after the connected domain analysis of the second row of pixels in Fig. 1 is completed;
图8是本发明第二实施例公开的一种连通域处理方法的流程示意图;8 is a schematic flowchart of a connected domain processing method disclosed in the second embodiment of the present invention;
图9是本发明第二实施例公开的一种连通域的示意图;9 is a schematic diagram of a connected domain disclosed in the second embodiment of the present invention;
图10是本发明实施例公开的一种行标签信息的示意图;FIG. 10 is a schematic diagram of row label information disclosed in an embodiment of the present invention;
图11是本发明第二实施例公开的一种连通域统计信息的结构示意图;11 is a schematic structural diagram of connected domain statistical information disclosed in the second embodiment of the present invention;
图12是本发明第三实施例公开的一种连通域的示意图;12 is a schematic diagram of a connected domain disclosed in the third embodiment of the present invention;
图13是本发明第三实施例公开的一种连通域统计信息的结构示意图;FIG. 13 is a schematic structural diagram of connected domain statistical information disclosed in the third embodiment of the present invention;
图14是本发明第四实施例公开的一种连通域统计信息的结构示意图;14 is a schematic structural diagram of connected domain statistical information disclosed in the fourth embodiment of the present invention;
图15是本发明第五实施例公开的一种连通域统计信息的结构示意图;15 is a schematic structural diagram of connected domain statistical information disclosed in the fifth embodiment of the present invention;
图16是本发明实施例公开的一种数据处理设备的结构示意图。Fig. 16 is a schematic structural diagram of a data processing device disclosed in an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention.
本发明实施例中的连通域处理方法是基于“像素标记”的连通域分析方式实现的,为更好的理解本方案,下面首先对基于“像素标记”的连通域分析方式进行说明。基于“像素标记”的连通域分析方式能够直接对原图像进行操作,主要是为了降低连通域分析过程中DDR的读请求次数,以四连通分析为例,该方式可以只判断待分析像素点是否与其所在位置的“上”方向位置和/或“左”方向位置相邻的像素点连通。连通域分析过程中所需要的数据包括:1、连通域统计数据,可以记为result,可以用于记录标记为连通域标签的像素点的数目。通常连通域标签的最大值按照经验进行取值。2、深度与连通域标签最大值一致的指针数据,可以记为pointer_list,用于将连通域组成一颗多叉树。3、待分析图像的标签图,可以记为intlabel_list,标签图的深度与待分析图像大小一致,用于存放待分析图像中每一个像素点的连通域标签。The connected domain processing method in the embodiment of the present invention is implemented based on the connected domain analysis method of "pixel labeling". To better understand this solution, the following first describes the connected domain analysis method based on "pixel labeling". The connected domain analysis method based on "pixel marking" can directly operate on the original image, mainly to reduce the number of DDR read requests during the connected domain analysis process. Taking four-connectivity analysis as an example, this method can only judge whether the pixel to be analyzed is The pixel points adjacent to the "up" direction position and/or the "left" direction position of its position are connected. The data needed in the connected domain analysis process includes: 1. Connected domain statistical data, which can be recorded as result, which can be used to record the number of pixels marked as connected domain labels. Generally, the maximum value of the connected domain label is determined according to experience. 2. The pointer data whose depth is consistent with the maximum value of the connected domain label can be recorded as pointer_list, which is used to form the connected domain into a polytree. 3. The label map of the image to be analyzed can be recorded as intlabel_list. The depth of the label map is consistent with the size of the image to be analyzed, and is used to store the connected domain label of each pixel in the image to be analyzed.
下面对基于“像素标记”的连通域分析方式进行举例说明,具体以四连通分析为例。请一并参见图1,是本发明第一实施例提供的一种连通域的示意图。如图1所示,图1表示待分析图像,图中的每个格子表示待分析图像的一个像素点。按照格子在待分析图像中的位置,或者说按照格子所表示像素点在待分析图像中的位置,对每一个格子设置标记信息。标记信息用于指示格子或者格子所表示的像素点在待分析图像中的行列数,也即是坐标信息;标记信息中的第一位标识用于指示所在的行数,标记信息中的第二位标识用于指示所在的列数。例如标记信息22指示格子或者格子所表示的像素点所在位置为待分析图像中的第二行第二列;又例如标记信息1b指示格子或者格子所表示的像素点所在位置为待分析图像中的第一行第十一列。The following is an example of a connected domain analysis method based on "pixel labeling", specifically taking four connected analysis as an example. Please also refer to FIG. 1, which is a schematic diagram of a connected domain provided by the first embodiment of the present invention. As shown in Figure 1, Figure 1 shows the image to be analyzed, and each grid in the figure represents a pixel of the image to be analyzed. According to the position of the grid in the image to be analyzed, or according to the position of the pixel indicated by the grid in the image to be analyzed, mark information is set for each grid. The marking information is used to indicate the number of rows and columns of the pixels represented by the grid or the grid in the image to be analyzed, that is, the coordinate information; the first identifier in the marking information is used to indicate the number of rows, the second in the marking information Bit identification is used to indicate the number of columns. For example, the marking information 22 indicates that the position of the grid or the pixel represented by the grid is the second row and the second column in the image to be analyzed; for example, the marking information 1b indicates that the position of the pixel represented by the grid or the grid is in the image to be analyzed. The first row and the eleventh column.
图中阴影填充的格子表示待分析图像中的有效像素点,未阴影填充的格子(或者说白色格子)表示待分析图像中的无效像素点;阴影填充的多个格子组成了待分析图像的多个连通域。在基于“像素标记”的连通域分析方式对待分析图像进行分析的过程中,待分析图像中的有效像素点与无效像素点不连通,可以将待分析图像中的无效像素点的连通域标签直接确定为无效连通域标签(例如数值0);将待分析图像中的有效像素点确定为待分析像素点。然后判断待分析像素点是否与已经赋予连通域标签的像素点连通,如果待分析像素点与已经赋予连通域标签的像素点连通,则从与待分析像素点连通的像素点的连 通域标签中,确定出待分析像素点的目标连通域标签;如果待分析像素点不与已经赋予连通域标签的像素点连通,则赋予待分析像素点一个新的连通域标签,并将给待分析像素点赋予的连通域标签,确定为待分析像素点的目标连通域标签。The shaded grid in the figure represents the effective pixels in the image to be analyzed, and the unshaded grid (or white grid) represents the invalid pixel in the image to be analyzed; the multiple grids filled with shadow constitute the majority of the image to be analyzed. Connected domains. In the process of analyzing the image to be analyzed based on the connected domain analysis method of "pixel labeling", the effective pixels in the image to be analyzed are not connected with the invalid pixels, and the connected domain labels of the invalid pixels in the image to be analyzed can be directly Determine as an invalid connected domain label (for example, a value of 0); determine the valid pixel in the image to be analyzed as the pixel to be analyzed. Then determine whether the pixel to be analyzed is connected to the pixel that has been assigned a connected domain label. If the pixel to be analyzed is connected to the pixel that has been assigned a connected domain label, then from the connected domain label of the pixel connected to the pixel to be analyzed , To determine the target connected domain label of the pixel to be analyzed; if the pixel to be analyzed is not connected to the pixel that has been assigned a connected domain label, a new connected domain label is assigned to the pixel to be analyzed, and the pixel to be analyzed The given connected component label is determined as the target connected component label of the pixel to be analyzed.
具体地,首先将连通域统计数据result、指针数据pointer_list、标签图intlabel_list初始化为0。假设支持的最大连通域标签的取值为10,则表示可以使用的连通域标签为数值1至10。在对图1所示的待分析图像进行连通域分析的过程中,按照从左向右,从上到下的顺序。从图1可以看出,待分析图像中的第一个有效像素点是标记信息为12的阴影填充格子所指示的像素点,以下简称为像素点12,后续描述则以此类推。由于待分析图像中像素点12所在位置的“上”方向位置处不存在像素点,像素点12所在位置的“左”方向位置处的像素点11为无效像素点,与像素点12不连通;此时,需要为像素点12分配一个新的连通域标签,可以将连通域标签1确定为像素点12的目标连通域标签。然后将连通域标签1所对应的连通域统计数据result[1]置为1,将连通域标签1所对应的指针数据point_list[1]置为1,表示连通域标签1是一个根节点标签。进一步地,请一并参见图2,为本发明实施例提供的一种标签图的示意图,具体为图1所示待分析图像的标签图。如图2所示,在确定出像素点12的目标连通域标签为1之后,可以在图2所示待分析图像的标签图中为像素点12记录连通域标签1,也即是将标签图中第一行第二列位置的label_list[1][2]标记为1。Specifically, first initialize the connected domain statistical data result, pointer data pointer_list, and label map intlabel_list to 0. Assuming that the value of the largest supported connected component label is 10, it means that the available connected component labels are values 1-10. In the process of analyzing the connected domains of the image to be analyzed shown in Fig. 1, the sequence is from left to right and top to bottom. It can be seen from Fig. 1 that the first effective pixel in the image to be analyzed is the pixel indicated by the shaded filled grid with the label information 12, which is hereinafter referred to as pixel 12, and the following description is analogous to this. Since there is no pixel in the "up" direction where the pixel 12 is located in the image to be analyzed, the pixel 11 at the "left" position of the pixel 12 is an invalid pixel and is not connected with the pixel 12; At this time, a new connected component label needs to be assigned to the pixel 12, and the connected component label 1 can be determined as the target connected component label of the pixel 12. Then the connected component statistical data result[1] corresponding to the connected component label 1 is set to 1, and the pointer data point_list[1] corresponding to the connected component label 1 is set to 1, indicating that the connected component label 1 is a root node label. Further, please also refer to FIG. 2, which is a schematic diagram of a label map provided by an embodiment of the present invention, specifically the label map of the image to be analyzed shown in FIG. 1. As shown in Figure 2, after the target connected domain label of the pixel 12 is determined to be 1, the connected domain label 1 can be recorded for the pixel 12 in the label map of the image to be analyzed as shown in Figure 2, that is, the label image The label_list[1][2] in the first row and second column position in the label is 1.
进一步地,在对像素点16和19进行连通域分析时,则以此类推,可以确定出像素点16和19的目标连通域标签分别为2和3。在对像素点1a进行连通域分析时,由于像素点1a与其所在位置的“左”方向位置相邻的像素点19连通,且像素点19的目标连通域标签为3;则将像素点1a的目标连通域标签也确定为3。并将连通域标签3所对应的连通域统计数据result[3]调整为2(也即是19、1a两个像素点)。在对像素点21进行连通域分析时,可以确定出像素点21的目标连通域标签为4。在对像素点22进行连通域分析时,由于像素点22与其所在位置的“上”方向位置相邻的像素点12连通,且与其所在位置的“左”方向位置相邻的像素点21连通;像素点12的目标连通域标签为1,像素点21的目标连通域标签为4;则表明像素点12和像素点21属于同一个连通域,相应地,连通域标签1 和4也属于同一个连通域。此时将像素点22的目标连通域标签确定为标签值较小的1,同时需要合并连通域标签1和连通域标签4所对应的两个连通域。可以将连通域标签4所对应的指针数据point_list[4]调整为1,表示连通域标签4是一个中间节点标签,且指向根节点标签1;同时将连通域标签1所对应的连通域统计数据result[1]调整为3(也即是12、21、22三个像素点)。其中,可以同时将连通域标签4所对应的连通域统计数据result[4]调整为1,或者调整为result[1]中记录的数值3。需要说明的是,上述连通域分析过程中未提及的处理过程可参照对像素点12进行连通域分析过程中的相关描述,此处不再赘述。Further, when the connected component analysis is performed on the pixels 16 and 19, by analogy, it can be determined that the target connected component labels of the pixels 16 and 19 are 2 and 3, respectively. When analyzing the connected domain of the pixel point 1a, because the pixel point 1a is connected to the pixel point 19 adjacent to the "left" direction of its location, and the target connected domain label of the pixel point 19 is 3; then the pixel point 1a The target connected domain label is also determined to be 3. And adjust the connected component statistical data result[3] corresponding to connected component label 3 to 2 (that is, two pixels of 19 and 1a). When analyzing the connected component of the pixel 21, it can be determined that the target connected component label of the pixel 21 is 4. When the connected domain analysis is performed on the pixel point 22, the pixel point 22 is connected with the pixel point 12 adjacent to the "up" direction of its location, and connected with the pixel point 21 adjacent to the "left" direction of its location; The target connected domain label of pixel 12 is 1, and the target connected domain label of pixel 21 is 4; it indicates that pixel 12 and pixel 21 belong to the same connected domain. Correspondingly, connected domain labels 1 and 4 also belong to the same connected domain. Connected domain. At this time, the target connected component label of the pixel 22 is determined to be 1 with a smaller label value, and the two connected components corresponding to the connected component label 1 and the connected component label 4 need to be merged. The pointer data point_list[4] corresponding to connected component label 4 can be adjusted to 1, indicating that connected component label 4 is an intermediate node label and points to root node label 1. At the same time, the connected component statistical data corresponding to connected component label 1 Adjust result[1] to 3 (that is, 12, 21, and 22 pixels). Among them, the connected domain statistical data result[4] corresponding to the connected domain label 4 can be adjusted to 1 at the same time, or adjusted to the value 3 recorded in result[1]. It should be noted that the processing procedures not mentioned in the above connected domain analysis process can refer to related descriptions in the connected domain analysis process for the pixel 12, and will not be repeated here.
采用上述处理方式对待分析图像连通域分析完成,可以得到图2所示的待分析图像的标签图,同时可以根据记录的指针数据point_list得到图3所示的多叉树。基于标签图可以确定待分析图像中各个像素点的连通域标签,基于多叉树可以确定出用于标记待分析像素点的各个连通域标签之间的关系。如图3所示,可见连通域标签1、6、8均为根节点标签,连通域标签2、3、4、5、7、9均指向根节点标签1,连通域标签10指向根节点标签8。另外,根据记录的连通域统计数据result或者标签图可知,标记为连通域标签1以及标记的连通域标签指向连通域标签1的像素点的个数为36,标记为连通域标签8以及标记的连通域标签指向连通域标签8的像素点的个数为5,标记为连通域标签6的像素点的个数为1。基于上述连通域处理得到的数据,可以继续对待分析图像进行处理,例如对待分析图像中相连通的像素点的数量小于预设数值的连通域中的像素点进行过滤。The connected domain analysis of the image to be analyzed is completed by the above processing method, and the label map of the image to be analyzed as shown in FIG. 2 can be obtained, and the polytree shown in FIG. 3 can be obtained according to the recorded pointer data point_list. Based on the label map, the connected domain label of each pixel in the image to be analyzed can be determined, and the relationship between the connected domain labels used to mark the pixel to be analyzed can be determined based on the multi-branch tree. As shown in Figure 3, it can be seen that connected domain labels 1, 6, and 8 are root node labels, connected domain labels 2, 3, 4, 5, 7, and 9 all point to root node label 1, and connected domain label 10 points to root node label 8. In addition, according to the recorded connected component statistical data result or label map, the number of pixels marked as connected component label 1 and the labeled connected component label pointing to connected component label 1 is 36, and the number of pixels marked as connected component label 8 and labeled connected component The number of pixels where the connected domain label points to the connected domain label 8 is 5, and the number of pixels marked as connected domain label 6 is 1. Based on the data obtained by the above-mentioned connected domain processing, the image to be analyzed can be processed continuously, for example, pixels in the connected domain whose number of connected pixels in the image to be analyzed are less than a preset value are filtered.
需要说明的是,由于与待分析像素点在其所在位置的“上”方向位置和“左”方向位置相邻的两个像素点可以从DDR连续的已编码数据流中获获取,所以采用上述方式完成一整图像的标记仅仅需要发起一次DDR读请求。可见,基于“像素标记”的连通域分析方式,可以有效降低基于“种子扩散”的连通域处理方式DDR读请求次数过多以及大量占用DDR带宽的问题;从而基于“像素标记”的连通域分析方式也可以对尺寸较大的图像进行连通域处理。但采用基于“像素标记”的连通域分析方式时,针对对当前的待分析像素点不与已经赋予标签的像素点相连通时,就需要对当前的待分析像素点赋予一个新的标签;从而导致一张图像需要使用到的连通域标签的数量很多,也即是一张图 像需要的连通域标签最大值非常大。例如,在处理尺寸大小为1280*720pixel的图像时需要用到的连通域标签数量达到了33000以上。同时,每一个连通域标签都需要分配一个指针数据或者连通域统计数据;指针数据和连通域统计数据都需要在扫描图像时不断读写,并存放在片内存储器中;故而会占用大量的存储空间,在一定程度上限制基于“像素标记”的连通域分析方式的应用场景。It should be noted that, since the two pixels adjacent to the "up" and "left" positions of the pixel to be analyzed can be obtained from the continuous encoded data stream of DDR, the above is adopted To complete the marking of an entire image, only one DDR read request needs to be initiated. It can be seen that the connected domain analysis method based on "pixel tagging" can effectively reduce the problem of too many DDR read requests and a large amount of DDR bandwidth based on the connected domain processing method based on "seed diffusion"; thus, the connected domain analysis based on "pixel tagging" The method can also perform connected domain processing on larger images. However, when the connected domain analysis method based on "pixel labeling" is used, when the current pixel to be analyzed is not connected to the pixel that has been assigned a label, a new label needs to be assigned to the current pixel to be analyzed; As a result, an image needs to use a large number of connected domain labels, that is, the maximum value of connected domain labels required by an image is very large. For example, the number of connected domain tags that need to be used when processing an image with a size of 1280*720pixel reaches more than 33,000. At the same time, each connected domain label needs to be assigned a pointer data or connected domain statistical data; both pointer data and connected domain statistical data need to be continuously read and written when scanning images, and stored in the on-chip memory; therefore, it will take up a lot of storage Space, to a certain extent, limits the application scenarios of connected domain analysis based on "pixel labeling".
为解决上述问题,本发明实施例提供了一种连通域处理方法,不仅可以有效降低DDR的读请求次数,还可以实现统计数据的复用,有效节省存储空间以及计算资源,扩大连通域处理的应用场景。以下分别进行详细说明。In order to solve the above problems, the embodiments of the present invention provide a connected domain processing method, which can not only effectively reduce the number of DDR read requests, but also realize the multiplexing of statistical data, effectively save storage space and computing resources, and expand the connected domain processing Application scenarios. Detailed descriptions are given below.
请参阅图4,为本发明第一实施例提供的一种连通域处理方法的流程示意图。本发明实施例中所描述的连通域处理方法可以包括:Refer to FIG. 4, which is a schematic flowchart of a connected domain processing method according to the first embodiment of the present invention. The connected domain processing method described in the embodiment of the present invention may include:
S401、数据处理设备获取待分析图像,对所述待分析图像中当前的待分析像素点进行连通域分析。S401: The data processing device acquires an image to be analyzed, and performs connected domain analysis on the current pixel to be analyzed in the image to be analyzed.
本发明实施例中,数据处理设备首先获取待分析图像,待分析图像中包括多个像素点,该多个像素点中包括有效像素点和无效像素点。待分析图像中的有效像素点与无效像素点不连通。在一实施例中,待分析图像可以是多目摄像机针对拍摄对象拍照一次采集到的多张深度图像中的任意一张。如果待分析图像与对比深度图像在同一位置上的像素点之间的深度信息在误差范围内,则将待分析图像中该位置上的像素点确定为有效像素点;反之则将待分析图像中该位置上的像素点确定为无效像素点;其中,该对比深度图像为该多张深度图像中除待分析图像之外的深度图像。在另一实施例中,待分析图像可以是双目摄像机针对拍摄对象拍照一次采集到的两张深度图像中的任意一张。首先将待分析图像作为基准图像、对比深度图像作为匹配图像进行深度信息匹配操作,得到第一匹配结果;第一匹配结果用于指示待分析图像与对比深度图像在相同位置上的像素点之间的第一匹配值。然后将对比深度图像作为基准图像、待分析图像作为匹配图像进行深度信息匹配操作,得到第二匹配结果;第二匹配结果用于指示待分析图像与对比深度图像在相同位置上的像素点之间的第二匹配值。如果待分析图像与对比深度图像在同一位置上的像素点之间的第一匹配值和第二匹配值相同或者在误差范围内,则将待分析图像中该位置上的像素点确 定为有效像素点;反之则将待分析图像中该位置上的像素点确定为无效像素点。其中,该对比深度图像为该两张深度图像中除待分析图像之外的另一张。In the embodiment of the present invention, the data processing device first obtains an image to be analyzed, and the image to be analyzed includes a plurality of pixels, and the plurality of pixels includes valid pixels and invalid pixels. The effective pixels and invalid pixels in the image to be analyzed are not connected. In an embodiment, the image to be analyzed may be any one of a plurality of depth images collected by a multi-lens camera taking a picture of the subject at a time. If the depth information between the pixels in the same position of the image to be analyzed and the contrast depth image is within the error range, the pixel at that position in the image to be analyzed is determined as the effective pixel; otherwise, the pixel in the image to be analyzed is determined The pixel at this position is determined to be an invalid pixel; where the contrast depth image is the depth image excluding the image to be analyzed among the multiple depth images. In another embodiment, the image to be analyzed may be any one of two depth images collected by a binocular camera at a time by taking pictures of the subject. First, use the image to be analyzed as the reference image and the contrast depth image as the matching image to perform the depth information matching operation to obtain the first matching result; the first matching result is used to indicate the pixel points between the image to be analyzed and the contrast depth image at the same position The first matching value. Then use the contrast depth image as the reference image and the image to be analyzed as the matching image to perform the depth information matching operation to obtain the second matching result; the second matching result is used to indicate the pixel points between the image to be analyzed and the contrast depth image at the same position The second matching value. If the first matching value and the second matching value between the pixels at the same position of the image to be analyzed and the contrast depth image are the same or within the error range, the pixel at that position in the image to be analyzed is determined as an effective pixel Point; otherwise, the pixel at that position in the image to be analyzed is determined as an invalid pixel. Wherein, the contrast depth image is the other one of the two depth images except the image to be analyzed.
在一实施例中,数据处理设备在对待分析图像进行连通域分析的过程中,可以先将待分析图像中的无效像素点的连通域标签直接确定为无效连通域标签,例如数值0;将待分析图像中的有效像素点确定为待分析像素点,后续则只对待分析图像中的待分析像素点进行连通域分析,以降低数据处理量,节省软硬件资源以及处理时间。进一步地,数据处理设备对待分析图像中当前的待分析像素点进行连通域分析,得到分析结果;该分析结果包括待分析像素点的目标连通域标签。数据处理设备首先从待分析图像中确定出与待分析像素点相邻的相邻像素点,然后根据该相邻像素点对待分析像素点进行连通域分析,确定出待分析像素点的目标连通域标签。In an embodiment, the data processing device may first directly determine the connected domain label of the invalid pixel in the image to be analyzed as the invalid connected domain label, for example, the value 0; The effective pixels in the analysis image are determined as the pixels to be analyzed, and then only the pixels to be analyzed in the image to be analyzed are subjected to connected domain analysis to reduce the amount of data processing, and save software and hardware resources and processing time. Further, the data processing device performs connected domain analysis on the current pixel to be analyzed in the image to be analyzed to obtain an analysis result; the analysis result includes the target connected domain label of the pixel to be analyzed. The data processing equipment first determines the adjacent pixels adjacent to the pixel to be analyzed from the image to be analyzed, and then performs connected domain analysis on the pixel to be analyzed based on the adjacent pixel to determine the target connected domain of the pixel to be analyzed label.
在一实施例中,与待分析像素点相邻的相邻像素点包括:与待分析像素点在同一列中上方向上相邻的第一像素点,和/或,与待分析像素点在同一行中左方向上相邻的第二像素点。在一实施例中,数据处理设备根据第一像素点以及第二像素点对待分析像素点进行连通域分析,判断待分析像素点是否与第一像素点以及第二像素点连通。若确定出待分析像素点与第一像素点连通,则将第一像素点的连通域标签作为待分析像素点的目标连通域标签。若确定出待分析像素点与第二像素点连通,则将第二像素点的连通域标签作为待分析像素点的目标连通域标签。若确定出待分析像素点与第一像素点以及第二像素点均连通,则将第一像素点的连通域标签以及第二像素点的连通域标签中标签值最小的连通域标签作为待分析像素点的目标连通域标签。若确定出待分析像素点与第一像素点以及第二像素点均不连通,则将预设的多个连通域标签中未被使用的一个连通域标签作为待分析像素点的目标连通域标签。In an embodiment, the adjacent pixels adjacent to the pixel to be analyzed include: the first pixel adjacent to the pixel to be analyzed in the same column in the upper direction, and/or, the pixel to be analyzed The second pixel point adjacent to the left in the same row. In an embodiment, the data processing device performs a connected domain analysis on the pixel to be analyzed based on the first pixel and the second pixel, and determines whether the pixel to be analyzed is connected to the first pixel and the second pixel. If it is determined that the pixel to be analyzed is connected to the first pixel, the connected domain label of the first pixel is used as the target connected domain label of the pixel to be analyzed. If it is determined that the pixel to be analyzed is connected to the second pixel, the connected domain label of the second pixel is used as the target connected domain label of the pixel to be analyzed. If it is determined that the pixel to be analyzed is connected to the first pixel and the second pixel, the connected domain label with the smallest value among the connected domain labels of the first pixel and the connected domain labels of the second pixel is used as the connected domain label to be analyzed The target connected domain label of the pixel. If it is determined that the pixel to be analyzed is not connected to the first pixel and the second pixel, then an unused connected component label among the preset connected component labels is used as the target connected component label of the pixel to be analyzed .
其中,判断待分析像素点是否与第一像素点以及第二像素点连通的方式可以为:首先获取待分析像素点、第一像素点以及第二像素点分别对应的值,该值可以是深度值;然后将待分析像素点所对应的值与第一像素点所对应的值进行比较,得到第一比较结果;将待分析像素点所对应的值与第二像素点所对应的值进行比较,得到第二比较结果。若第一比较结果指示待分析像素点所对应的值与第一像素点所对应的值之间的差值小于或者等于预设阈值,则确定待分 析像素点与第一像素点连通;反之则确定待分析像素点与第一像素点不连通。同理,若第二比较结果指示待分析像素点所对应的值与第二像素点所对应的值之间的差值小于或者等于预设阈值,则确定待分析像素点与第二像素点连通;反之则确定待分析像素点与第二像素点不连通。Among them, the way to determine whether the pixel to be analyzed is connected to the first pixel and the second pixel may be: first obtain the value corresponding to the pixel to be analyzed, the first pixel and the second pixel, and the value may be depth Value; then compare the value corresponding to the pixel to be analyzed with the value corresponding to the first pixel to obtain the first comparison result; compare the value corresponding to the pixel to be analyzed with the value corresponding to the second pixel , Get the second comparison result. If the first comparison result indicates that the difference between the value corresponding to the pixel to be analyzed and the value corresponding to the first pixel is less than or equal to the preset threshold, it is determined that the pixel to be analyzed is connected to the first pixel; otherwise, It is determined that the pixel to be analyzed is not connected to the first pixel. Similarly, if the second comparison result indicates that the difference between the value corresponding to the pixel to be analyzed and the value corresponding to the second pixel is less than or equal to the preset threshold, it is determined that the pixel to be analyzed is connected to the second pixel ; Otherwise, it is determined that the pixel to be analyzed is not connected with the second pixel.
在一实施例中,数据处理设备根据第一像素点对待分析像素点进行连通域分析,判断待分析像素点是否与第一像素点连通;若确定出待分析像素点与第一像素点连通,则将第一像素点的连通域标签作为待分析像素点的目标连通域标签。若确定出待分析像素点与第一像素点不连通,则将预设的多个连通域标签中未被使用的一个连通域标签作为待分析像素点的目标连通域标签。在一实施例中,数据处理设备根据第二像素点对待分析像素点进行连通域分析,判断待分析像素点是否与第二像素点连通;若确定出待分析像素点与第二像素点连通,则将第二像素点的连通域标签作为待分析像素点的目标连通域标签。若确定出待分析像素点与第二像素点不连通,则将预设的多个连通域标签中未被使用的一个连通域标签作为待分析像素点的目标连通域标签。In one embodiment, the data processing device performs connected domain analysis on the pixel to be analyzed based on the first pixel to determine whether the pixel to be analyzed is connected to the first pixel; if it is determined that the pixel to be analyzed is connected to the first pixel, Then the connected domain label of the first pixel is used as the target connected domain label of the pixel to be analyzed. If it is determined that the pixel to be analyzed is not connected to the first pixel, an unused connected domain label among the preset connected domain labels is used as the target connected domain label of the pixel to be analyzed. In one embodiment, the data processing device performs connected domain analysis on the pixel to be analyzed based on the second pixel to determine whether the pixel to be analyzed is connected to the second pixel; if it is determined that the pixel to be analyzed is connected to the second pixel, Then, the connected domain label of the second pixel is used as the target connected domain label of the pixel to be analyzed. If it is determined that the pixel to be analyzed is not connected to the second pixel, an unused connected domain label among the preset connected domain labels is used as the target connected domain label of the pixel to be analyzed.
在另一实施例中,与待分析像素点相邻的相邻像素点包括:与待分析像素点在同一列中上方向上相邻的第一像素点,与待分析像素点在同一行中左方向上相邻的第二像素点,与待分析像素点在左上方向上相邻的第三像素点,与待分析像素点在右上方向上相邻的第四像素点中的一个或者多个。其中,第三像素点也即是与第一像素点在同一行中左方向上相邻的像素点,第四像素点也即是与第一像素点在同一行中右方向上相邻的像素点。在一实施例中,数据处理设备根据第一像素点、第二像素点、第三像素点以及第四像素点对待分析像素点进行连通域分析,判断待分析像素点是否与第一像素点、第二像素点、第三像素点以及第四像素点连通。若确定出待分析像素点与第一像素点、第二像素点、第三像素点以及第四像素点中的一个像素点连通,则将与待分析像素点连通的像素点的连通域标签作为待分析像素点的目标连通域标签。若确定出待分析像素点与第一像素点、第二像素点、第三像素点以及第四像素点中的至少两个像素点连通,则将与待分析像素点连通的至少两个像素点的连通域标签中标签值最小的连通域标签作为待分析像素点的目标连通域标签。若确定出待分析像素点与第一像素点、第二像素点、第三像素点以及第四像素点均不连通,则 将预设的多个连通域标签中未被使用的一个连通域标签作为待分析像素点的目标连通域标签。In another embodiment, the adjacent pixels adjacent to the pixel to be analyzed include: the first pixel adjacent to the pixel to be analyzed in the same column and in the upper direction, and in the same row as the pixel to be analyzed One or more of the second pixel point adjacent to the left direction, the third pixel point adjacent to the pixel to be analyzed in the upper left direction, and the fourth pixel point adjacent to the pixel to be analyzed in the upper right direction . Among them, the third pixel is the pixel that is adjacent to the left in the same row as the first pixel, and the fourth pixel is the pixel that is adjacent to the right in the same row as the first pixel. point. In an embodiment, the data processing device performs a connected domain analysis on the pixel to be analyzed according to the first pixel, the second pixel, the third pixel, and the fourth pixel, and determines whether the pixel to be analyzed is the same as the first pixel, The second pixel point, the third pixel point and the fourth pixel point are connected. If it is determined that the pixel to be analyzed is connected to one of the first pixel, the second pixel, the third pixel, and the fourth pixel, the connected domain label of the pixel connected to the pixel to be analyzed is taken as The target connected domain label of the pixel to be analyzed. If it is determined that the pixel to be analyzed is connected to at least two of the first pixel, the second pixel, the third pixel, and the fourth pixel, then at least two pixels connected to the pixel to be analyzed will be Among the connected component labels, the connected component label with the smallest label value is used as the target connected component label of the pixel to be analyzed. If it is determined that the pixel to be analyzed is not connected with the first pixel, the second pixel, the third pixel, and the fourth pixel, then the unused connected domain label among the preset connected domain labels As the target connected domain label of the pixel to be analyzed.
在一实施例中,本方案还对基于“像素标记”的连通域分析方式中的扫描过程进行了修改,增加了行缓冲(Line Buffer)的操作,也即是记录行标签信息,行标签信息用于记录当前已分析过的像素点的连通域标签,行标签信息的深度与待分析图像一行中的像素点数目相同。其中,行标签信息记录的连通域标签包括:与待分析像素点在同一列中上方向上相邻的第一像素点的连通域标签、位于待分析像素点同一行中左方向上的像素点的连通域标签、以及位于第一像素点同一行中右方向上的像素点的连通域标签。在对待分析图像中的当前的待分析像素点进行连通域分析的过程中,如需获取与待分析像素点相邻的像素点的连通域标签,则可以直接从行标签信息中快速获取,相比查找链表的方式,可以有效加快查找速度,提高连通域分析的效率。进一步地,在待分析像素点连通域分析完成之后,根据确定出的待分析像素点的目标连通域标签对行标签信息进行更新。具体地,可以在行标签信息中将记录的第一像素点的连通域标签调整为待分析像素点的目标连通域标签。其中,行标签信息可以保存在片内寄存器中。In one embodiment, this solution also modifies the scanning process in the connected domain analysis method based on "pixel labeling", and adds the line buffer operation, that is, to record line label information and line label information. It is used to record the connected domain label of the currently analyzed pixel. The depth of the line label information is the same as the number of pixels in a line of the image to be analyzed. Wherein, the connected domain label recorded by the row label information includes: the connected domain label of the first pixel adjacent to the upper direction in the same column as the pixel to be analyzed, and the pixel located in the left direction of the same row of the pixel to be analyzed The connected component label of and the connected component label of the pixel in the right direction in the same row of the first pixel. In the process of performing connected domain analysis on the current pixel to be analyzed in the image to be analyzed, if you need to obtain the connected domain label of the pixel adjacent to the pixel to be analyzed, you can quickly obtain it directly from the row label information. Compared with the way of searching the linked list, it can effectively speed up the search and improve the efficiency of connected domain analysis. Further, after the analysis of the connected domain of the pixel to be analyzed is completed, the row label information is updated according to the determined target connected domain label of the pixel to be analyzed. Specifically, the recorded connected domain label of the first pixel can be adjusted to the target connected domain label of the pixel to be analyzed in the row label information. Among them, the row label information can be stored in on-chip registers.
S402、所述数据处理设备根据分析结果在所述待分析图像的标签图中为所述待分析像素点记录目标连通域标签。S402: The data processing device records a target connected domain label for the pixel to be analyzed in the label map of the image to be analyzed according to the analysis result.
本发明实施例中,待分析图像的标签图用于记录待分析图像中每一个像素点的目标连通域标签。数据处理设备在对待分析图像中当前的待分析像素点进行连通域分析得到分析结果之后,在待分析图像的标签图中为待分析像素点记录该分析结果所指示的目标连通域标签。在一实施例中,该标签图的大小与待分析图像的大小一致,该目标连通域标签在标签图中的位置,与待分析像素点在待分析图像中的位置相同。该标签图保存在数据处理设备的DDR中。In the embodiment of the present invention, the label map of the image to be analyzed is used to record the target connected domain label of each pixel in the image to be analyzed. After the data processing device performs connected domain analysis on the current pixel to be analyzed in the image to be analyzed to obtain the analysis result, it records the target connected domain label indicated by the analysis result for the pixel to be analyzed in the label map of the image to be analyzed. In an embodiment, the size of the label map is consistent with the size of the image to be analyzed, and the position of the target connected domain label in the label map is the same as the position of the pixel to be analyzed in the image to be analyzed. The label image is stored in the DDR of the data processing device.
S203、所述数据处理设备根据所述目标连通域标签更新所述待分析图像的连通域统计信息;其中,在对所述连通域统计信息进行更新时,若所述目标连通域标签为根节点标签,则在所述连通域统计信息中为所述目标连通域标签记录第一类统计数据,所述第一类统计数据为数目数据,所述数目数据用于指示标记为所述目标连通域标签以及标记的连通域标签指向所述目标连通域标签 的像素点的个数;若所述目标连通域标签为中间节点标签,则在所述连通域统计信息中为所述目标连通域标签记录第二类统计数据,所述第二类统计数据为指针数据,所述指针数据用于指示所述目标连通域标签所指向的根节点标签。S203. The data processing device updates the connected-domain statistical information of the image to be analyzed according to the target connected-domain label; wherein, when the connected-domain statistical information is updated, if the target connected-domain label is the root node Tag, the first type of statistical data is recorded in the connected domain statistical information for the target connected domain tag, the first type of statistical data is number data, and the number data is used to indicate that the tag is the target connected domain The label and the number of pixels where the labeled connected component label points to the target connected component label; if the target connected component label is an intermediate node label, it is recorded as the target connected component label in the connected component statistical information The second type of statistical data, the second type of statistical data is pointer data, and the pointer data is used to indicate the root node label to which the target connected domain label points.
本发明实施例中,连通域统计信息包括第一标识位和数据位,第一标识位用于表示数据位记录的统计数据的类型,数据位用于表示为目标连通域标签记录的统计数据;当第一标识位为第一标识时,数据位为目标连通域标签记录的是第一类统计数据,当第一标识位为第二标识时,数据位为目标连通域标签记录的是第二类统计数据。在一实施例中,第一标识可以是标识“0”,第二标识可以是标识“1”。第一标识位可以是连通域统计信息的最高比特位,也可以是连通域统计信息的最低比特位,本发明实施例不作限定。可以将连通域统计信息保存在片内随机存取存储器(Random Access Memory,RAM)中,也可以专门设置一个统计数据复用存储器来存储连通域统计信息。In the embodiment of the present invention, the connected domain statistical information includes a first identification bit and a data bit, the first identification bit is used to indicate the type of statistical data recorded by the data bit, and the data bit is used to indicate the statistical data recorded as the target connected domain label; When the first identification bit is the first identification, the data bit is the target connected domain label and records the first type of statistical data. When the first identification bit is the second identification, the data bit is the target connected domain label and records the second Class statistics. In an embodiment, the first identifier may be the identifier "0", and the second identifier may be the identifier "1". The first identification bit may be the highest bit of the statistical information of the connected domain, and may also be the lowest bit of the statistical information of the connected domain, which is not limited in the embodiment of the present invention. The connected domain statistical information can be stored in the on-chip random access memory (Random Access Memory, RAM), or a statistical data multiplexing memory can be specially set up to store the connected domain statistical information.
本发明实施例中的连通域处理方法在基于“像素标记”的连通域分析方式的基础上将数目数据和指针数据进行数据复用,只需增加一个1比特的标识位来区别连通域统计信息为目标连通域标签记录的统计数据是数目数据还是指针数据。相对基于“像素标记”的连通域分析方式,采用上述方式所需的片内存储空间大大减少,大概可以降低一半的存储空间。请一并参见图5,为本发明第一实施例提供的一种连通域统计信息的结构示意图。如图5所示,图中的每1个方格表示1比特,每一行的11个方格,也即是11比特对应一个连通域标签,例如第一行的11比特数据为连通域标签1的连通域统计信息。每一行的第1个方格,或者说最高位表示连通域统计信息的第一标识,用于表示连通域统计信息的数据位记录的统计数据的类型。每一行的第2个方格至第11个方格表示连通域统计信息的数据位,用于表示为连通域标签记录的统计数据。例如第一行的第一个方格记录的是0,也即是连通域标签1的连通域统计信息的第一标识位为0,则表示第一行的第2个方格至第11个方格为连通域标签1记录的是数目数据,也即是连通域标签1的连通域统计信息的数据位为连通域标签1记录的是数目数据;从而也间接表示连通域标签1为根节点标签。数目数据为26(11010),则表示标记为连通域标签1以及标记的连通域标签指向连通域标签1的像素点的个数为26。又例如第三行的第一个方格记录的是1,也即是连通域标签3的连 通域统计信息的第一标识位为1,则表示第一行的第2个方格至第11个方格为连通域标签3记录的是指针数据,也即是连通域标签3的连通域统计信息的数据位为连通域标签3记录的是指针数据;从而也表示连通域标签3为中间节点标签。指针数据为1(01),则表示连通域标签3所指向的根节点标签为连通域标签1。The connected domain processing method in the embodiment of the present invention multiplexes the number data and pointer data on the basis of the connected domain analysis method based on "pixel marking", and only needs to add a 1-bit identification bit to distinguish the connected domain statistical information Whether the statistical data recorded for the target connected domain label is number data or pointer data. Compared with the connected domain analysis method based on "pixel labeling", the on-chip storage space required by the above method is greatly reduced, and the storage space can be reduced by about half. Please also refer to FIG. 5, which is a schematic structural diagram of connected domain statistical information provided by the first embodiment of the present invention. As shown in Figure 5, each square in the figure represents 1 bit, and 11 squares in each row, that is, 11 bits correspond to a connected domain label. For example, the 11-bit data in the first row is connected domain label 1. Connected domain statistics. The first square of each row, or the highest bit, indicates the first identifier of the connected domain statistical information, and is used to indicate the type of statistical data recorded by the data bit of the connected domain statistical information. The second to eleventh squares in each row represent the data bits of the connected domain statistical information, which are used to represent the statistical data recorded by the connected domain label. For example, the first square in the first row records 0, that is, the first identification bit of the connected component statistical information of connected component label 1 is 0, which means that the second to the eleventh square in the first row The grid is connected domain label 1 records the number data, that is, the data bit of connected domain statistical information of connected domain label 1 is connected domain label 1 records the number data; thus indirectly indicates that connected domain label 1 is the root node label. The number data is 26 (11010), which means that the number of pixels marked as connected domain label 1 and the marked connected domain label points to connected domain label 1 is 26. For another example, the first square in the third row records 1, that is, the first identification bit of the connected component statistical information of the connected component label 3 is 1, which means that the second to the 11th square in the first row One square is connected domain label 3, which records the pointer data, that is, the data bit of connected domain statistical information of connected domain label 3 is the connected domain label 3 records pointer data; thus, it also indicates that connected domain label 3 is an intermediate node label. The pointer data is 1 (01), which means that the root node label pointed to by the connected component label 3 is the connected component label 1.
在一实施例中,数据处理设备在根据第一像素点以及第二像素点对待分析像素点进行连通域分析时,若确定出待分析像素点与第一像素点以及第二像素点均不连通,则在将预设的多个连通域标签中未被使用的一个连通域标签作为待分析像素点的目标连通域标签时,将目标连通域标签作为根节点标签。若确定出待分析像素点与第一像素点以及第二像素点均连通,在将第一像素点的连通域标签以及第二像素点的连通域标签中标签值最小的连通域标签作为待分析像素点的目标连通域标签之后,将第一像素点的连通域标签以及第二像素点的连通域标签中标签值最大的连通域标签确定为指向目标连通域标签的中间节点标签。进一步地,数据处理设备对连通域统计信息中上述标签值最大的连通域标签进行更改。具体地,将连通域统计信息中上述标签值最大的连通域标签对应的第一标识位调整为第二标识,并在连通域统计信息中上述标签值最大的连通域标签对应的数据位,为上述标签值最大的连通域标签记录第二类统计数据,记录的第二类统计数据指示标签值最大的连通域标签指向上述目标连通域标签。In one embodiment, when the data processing device performs connected analysis of the pixel to be analyzed based on the first pixel and the second pixel, if it is determined that the pixel to be analyzed is not connected to the first pixel and the second pixel , When the unused connected component label among the preset multiple connected component labels is used as the target connected component label of the pixel to be analyzed, the target connected component label is used as the root node label. If it is determined that the pixel to be analyzed is connected to the first pixel and the second pixel, the connected domain label with the smallest value among the connected domain labels of the first pixel and the connected domain labels of the second pixel is used as the connected domain label to be analyzed After the target connected component label of the pixel, the connected component label of the connected component label of the first pixel and the connected component label of the second pixel with the largest label value is determined as the intermediate node label pointing to the target connected component label. Further, the data processing device changes the connected domain label with the largest label value in the connected domain statistical information. Specifically, the first identification bit corresponding to the connected component label with the largest label value in the connected component statistical information is adjusted to the second identifier, and the data bit corresponding to the connected component label with the largest label value in the connected component statistical information is The connected domain label with the largest label value records the second type of statistical data, and the recorded second type of statistical data indicates that the connected domain label with the largest label value points to the target connected domain label.
需要说明的是,对于步骤S401中与待分析像素点相邻的相邻像素点包括第一像素点、第二像素点、第三像素点以及第四像素点的情况,若确定出待分析像素点与第一像素点、第二像素点、第三像素点以及第四像素点中的至少两个像素点连通,在将与待分析像素点连通的至少两个像素点的连通域标签中,标签值最小的连通域标签作为待分析像素点的目标连通域标签之后,将与待分析像素点连通的至少两个像素点的连通域标签中,除标签值最小的连通域标签之外的连通域标签均确定为指向目标连通域标签的中间节点标签。进一步地,数据处理设备对连通域统计信息中为上述除标签值最小的连通域标签之外的连通域标签记录的统计数据进行更改,具体更改方式可参考前文描述,此处不再赘述。It should be noted that for the case where adjacent pixels adjacent to the pixel to be analyzed in step S401 include the first pixel, the second pixel, the third pixel, and the fourth pixel, if the pixel to be analyzed is determined The point is connected to at least two of the first pixel, the second pixel, the third pixel, and the fourth pixel. In the connected domain label of the at least two pixels that will be connected to the pixel to be analyzed, After the connected component label with the smallest label value is used as the target connected component label of the pixel to be analyzed, the connected component labels of at least two pixels connected to the pixel to be analyzed, except for the connected component label with the smallest label value The domain labels are all determined as intermediate node labels that point to the target connected domain labels. Further, the data processing device changes the statistical data recorded in the connected domain statistical information for the connected domain labels other than the connected domain label with the smallest label value. For the specific modification method, please refer to the foregoing description and will not be repeated here.
为更好的理解本方案,下面依然以图1为例对本发明实施例中的连通域处 理方法进行说明。假设支持的最大连通域标签为16,最大统计数目为1024,则本方案需要使用的数据包括:1、支持最大连通域标签的连通域统计信息,可以记为record_result_list,数据结构如图5所示;连通域统计信息可以用于为连通域标签记录统计数据,包括数目数据或者指针数据。由于支持的最大连通域标签为16,最大统计数目为1024,加上第一标识位的1bit,则连通域统计信息所需要的存储空间总计为16*11bits,可以存放在片内RAM中。2、行标签信息,可以记为root_pointers;行标签信息的深度与待分析图像一行中的像素点数目相同,宽度为支持指向最大连通域标签的比特数;由于支持的最大连通域标签为16,则宽度为4bits;图1所示待分析图像一行中的像素点数目为12,则行标签信息所需要的存储空间总计为12*4bits,可以存放在片内寄存器中。3、待分析图像的标签图,可以记为label_list;用于存放待分析图像中每一个像素点的连通域标签。标签图的深度与待分析图像大小一致,宽度根据最大连通域标签进行设置;标签图所需的存储空间总计为12*8*4bits,可以存放在片外DDR中。In order to better understand this solution, Figure 1 is still used as an example to describe the connected domain processing method in the embodiment of the present invention. Assuming that the maximum connected domain label supported is 16, and the maximum statistical number is 1024, the data required for this solution includes: 1. The connected domain statistical information that supports the maximum connected domain label can be recorded as record_result_list. The data structure is shown in Figure 5. ; Connected domain statistical information can be used to record statistical data for connected domain labels, including number data or pointer data. Since the maximum supported connected domain label is 16, the maximum number of statistics is 1024, plus 1 bit of the first identification bit, the total storage space required for connected domain statistics is 16*11 bits, which can be stored in the on-chip RAM. 2. The row label information can be recorded as root_pointers; the depth of the row label information is the same as the number of pixels in a line of the image to be analyzed, and the width is the number of bits that support the maximum connected domain label; since the maximum supported connected domain label is 16, The width is 4 bits; the number of pixels in a row of the image to be analyzed in Figure 1 is 12, and the storage space required for the row label information is 12*4 bits in total, which can be stored in the on-chip register. 3. The label map of the image to be analyzed can be recorded as label_list; it is used to store the connected domain label of each pixel in the image to be analyzed. The depth of the label image is consistent with the size of the image to be analyzed, and the width is set according to the maximum connected domain label; the total storage space required for the label image is 12*8*4bits, which can be stored in off-chip DDR.
具体以四连通分析为例进行说明,首先将标签图label_list全部初始化为0;连通域统计信息record_result_list第一标识位初始化为0,数据位初始化为0;行标签信息root_pointers全部初始化为0。在对待分析图像进行连通域分析的过程中,按照从左向右,从上到下的顺序针对图1中的待分析像素点,也即是阴影填充格子所指示的像素点进行连通域分析。从图1可以看出,待分析图像的第一个待分析像素点(或者说有效像素点)是标记信息为12的阴影填充格子所指示的像素点,以下简称为像素点12,后续描述则以此类推。由于待分析图像中像素点12所在位置的“上”方向位置处不存在像素点,像素点12所在位置的“左”方向位置处的像素点11为无效像素点,与像素点12不连通;此时,需要为像素点12分配一个新的连通域标签,可以将连通域标签1确定为像素点12的目标连通域标签,连通域标签1为根节点标签。Specifically, the four-connectivity analysis is used as an example to illustrate. First, initialize all the label map label_list to 0; initialize the first identification bit of the connected domain statistical information record_result_list to 0, initialize the data bit to 0; initialize the row label information root_pointers to all 0. In the process of analyzing the connected component of the image to be analyzed, the connected component analysis is performed on the pixel to be analyzed in Figure 1 in the order from left to right and top to bottom, that is, the pixel indicated by the shadow filled grid. It can be seen from Figure 1 that the first pixel to be analyzed (or effective pixel) of the image to be analyzed is the pixel indicated by the shadow filling grid with the label information of 12. It is referred to as pixel 12 in the following description. And so on. Since there is no pixel in the "up" direction where the pixel 12 is located in the image to be analyzed, the pixel 11 at the "left" position of the pixel 12 is an invalid pixel and is not connected with the pixel 12; At this time, a new connected component label needs to be assigned to the pixel 12, the connected component label 1 can be determined as the target connected component label of the pixel 12, and the connected component label 1 is the root node label.
请一并参见图6,图6为图1第一行像素点连通域分析完成后的结果示意图,具体包括标签图、行标签信息和连通域统计信息三个部分。如图6所示,在确定出像素点12的目标连通域标签为1之后,在待分析图像的标签图label_list中第一行第二列的位置为像素点12记录其目标连通域标签1。在行标签信息 root_pointers中的第2个方格所指示位置处为像素点12记录其目标连通域标签1,以便于像素点22以及像素点13根据行标签信息快速查找到像素点12的连通域标签。在连通域统计信息record_result_list的第一个方格所指示位置处将连通域标签1对应的第一标识位调整为0,并在第一个方格所指示数据位为连通域标签1记录数目数据1,故第一个方格中的数据表示为“0/1”。需要说明的是,图6中的连通域统计信息的数据结构为相对图5所示数据结构简化后的示意图,图中连通域统计信息中的16个方格从左至又依次对应连通域标签1至连通域标签16,每一个方格中的数据表示连通域统计信息为连通域标签记录的统计数据。每一个数据中位于“/”左侧的数值表示第一标识位的取值,位于“/”右侧的数值表示数据位所记录的数据。Please refer to Figure 6 together. Figure 6 is a schematic diagram of the results of the connected domain analysis of the first row of pixels in Figure 1, which specifically includes three parts: label map, row label information, and connected domain statistical information. As shown in FIG. 6, after the target connected domain label of the pixel 12 is determined to be 1, the target connected domain label 1 of the pixel 12 is recorded at the position of the first row and second column in the label_list of the image to be analyzed. Record the target connected domain label 1 for the pixel 12 at the position indicated by the second square in the row label information root_pointers, so that the pixel 22 and the pixel 13 can quickly find the connected domain of the pixel 12 according to the row label information label. Adjust the first identification bit corresponding to connected domain label 1 to 0 at the position indicated by the first square of the connected domain statistical information record_result_list, and the data bit indicated in the first square is connected domain label 1 record number data 1, so the data in the first square is expressed as "0/1". It should be noted that the data structure of the connected component statistical information in Figure 6 is a simplified schematic diagram from the data structure shown in Figure 5. The 16 squares in the connected component statistical information in the figure correspond to connected component labels from left to right. 1 to connected component label 16, the data in each grid indicates that the connected component statistical information is the statistical data recorded by the connected component label. The value on the left of "/" in each piece of data represents the value of the first identification bit, and the value on the right of "/" represents the data recorded by the data bit.
进一步地,在对像素点16和19进行连通域分析时,则以此类推,可以确定出像素点16和19的目标连通域标签分别为2和3。在对像素点1a进行连通域分析时,由于像素点1a与像素点1a所在位置的“左”方向位置相邻的像素点19连通,且根据记录的行标签信息root_pointers可快速查找到像素点19的目标连通域标签为3;则将像素点1a的目标连通域标签也确定为3。像素点1a与像素点19在标签图label和行标签信息root_pointers中的信息保持一致;然后在连通域统计信息record_result_list的第三个方格所指示位置处将连通域标签3对应的第一标识位调整为0,并在第三个方格所指示数据位为连通域标签3记录数目数据2,故第三个方格中的数据表示为“0/2”。Further, when the connected component analysis is performed on the pixels 16 and 19, by analogy, it can be determined that the target connected component labels of the pixels 16 and 19 are 2 and 3, respectively. When analyzing the connected domain of the pixel point 1a, the pixel point 1a is connected to the pixel point 19 adjacent to the "left" direction of the position of the pixel point 1a, and the pixel point 19 can be quickly found according to the recorded row label information root_pointers The target connected component label of is 3; then the target connected component label of pixel 1a is also determined to be 3. The pixel point 1a and the pixel point 19 have the same information in the label map label and the row label information root_pointers; then at the position indicated by the third square of the connected field statistical information record_result_list, the connected field label 3 corresponds to the first identification position Adjust to 0, and the data bit indicated in the third square is connected domain label 3 record number data 2, so the data in the third square is expressed as "0/2".
在对像素点21进行连通域分析时,可以确定出像素点22的目标连通域标签为4。在对像素点22进行连通域分析时,由于像素点22与其所在位置的“上”方向位置相邻的像素点12连通,且与其所在位置的“左”方向位置相邻的像素点21连通,表明像素点12和像素点21属于同一个连通域;另外根据记录的行标签信息可快速查找到像素点12的目标连通域标签为1,像素点21的目标连通域标签为4,表明连通域标签1和4也属于同一个连通域。此时将像素点22的目标连通域标签确定为标签值较小的1,同时需要合并连通域标签1和连通域标签4所对应的两个连通域。When analyzing the connected component of the pixel 21, it can be determined that the target connected component label of the pixel 22 is 4. When the connected domain analysis is performed on the pixel point 22, since the pixel point 22 is connected to the pixel point 12 adjacent to its position in the "up" direction, and is connected to the pixel point 21 adjacent to its position in the "left" direction. Indicates that the pixel 12 and the pixel 21 belong to the same connected domain; in addition, according to the recorded row label information, the target connected domain label of the pixel 12 can be quickly found as 1, and the target connected domain label of the pixel 21 is 4, indicating the connected domain Labels 1 and 4 also belong to the same connected domain. At this time, the target connected component label of the pixel 22 is determined to be 1 with a smaller label value, and the two connected components corresponding to the connected component label 1 and the connected component label 4 need to be merged.
请一并参见图7,图7为图1第二行像素点连通域分析完成后的结果示意图,也包括标签图、行标签信息和连通域统计信息三个部分。如图7所示,在确定 出像素点22的目标连通域标签为1之后,在待分析图像的标签图label_list中第二行第二列的位置为像素点22记录其目标连通域标签1。在行标签信息root_pointers中的第2个方格所指示位置为像素点22记录其目标连通域标签1。在连通域统计信息record_result_list的第一个方格所指示位置处将连通域标签1对应的第一标识位调整为0,并在第一个方格所指示数据位为连通域标签1记录数目数据3。由于图7行标签信息中记录的是第二行像素点均处理完之后的数据,故第一个方格中的数据表示为“0/4”,连通域标签为1的还包括像素点23。在连通域统计信息record_result_list的第四个方格所指示位置处将连通域标签4对应的第一标识位调整为1,并在第四个方格所指示的数据位为连通域标签4记录指针数据1,表示连通域标签4为中间节点标签,且指向根节点标签1,故第四个方格中的数据表示为“1/1”。采用上述处理方式直至对待分析图像连通域分析完成,此处不再赘述。Please refer to Figure 7 together. Figure 7 is a schematic diagram of the results of the connected domain analysis of the second row of pixels in Figure 1, including the label map, row label information and connected domain statistical information. As shown in Fig. 7, after the target connected component label of the pixel 22 is determined to be 1, the position of the second row and second column in the label map label_list of the image to be analyzed is the pixel 22 and its target connected component label 1 is recorded. The position indicated by the second square in the row label information root_pointers is the pixel 22 to record its target connected domain label 1. Adjust the first identification bit corresponding to connected domain label 1 to 0 at the position indicated by the first square of the connected domain statistical information record_result_list, and the data bit indicated in the first square is connected domain label 1 record number data 3. Since the label information in the row of Figure 7 records the data after all the pixels in the second row have been processed, the data in the first square is expressed as "0/4", and the connected domain label is 1 also includes pixels 23 . Adjust the first identification bit corresponding to connected domain label 4 to 1 at the position indicated by the fourth square of the connected domain statistical information record_result_list, and the data bit indicated in the fourth square is the connected domain label 4 record pointer Data 1 indicates that the connected domain label 4 is an intermediate node label and points to the root node label 1, so the data in the fourth square is expressed as "1/1". The above-mentioned processing method is adopted until the analysis of the connected domain of the image to be analyzed is completed, which is not repeated here.
需要说明的是,请参见图7中行标签信息中阴影填充的两个方格,以从左至右第一个阴影填充的方格为例,该阴影填充的方格记录的是像素点21的目标连通域标签,在对像素点21进行连通域分析完成之后,确定出像素点21的目标连通域标签为4,且连通域标签4为根节点标签。但由于在对像素点22进行连通域分析过程中,将原本为根节点标签的连通域标签4调整成一个指向根节点标签1的中间节点标签。如果在对待分析图像第三行的像素点进行连通域分析时直接以连通域标签4作为根节点,则可能导致出错。因此在一实施例中,在对待分析图像每行的待分析像素点进行连通域分析的过程中,如果需要从行标签信息root_pointers中直接获取与待分析像素点在同一列中上方向上相邻的像素点的连通域标签时,则可以对从行标签信息root_pointers中获取到的与待分析像素点在同一列中上方向上相邻的像素点的连通域标签进行根节点标签判断;如果判断出该连通域标签为根节点标签,则基于该连通域标签确定出待分析像素点的目标连通域标签;如果判断出该连通域标签不为根节点标签,则从连通域统计信息record_result_list中查找出该连通域标签所指向的根节点标签,并基于该连通域标签所指向的根节点标签确定出待分析像素点的目标连通域标签。经实践发现,行标签信息中记录的连通域标签为中间节点标签的情况出现次数不多,并且一般只需一两次查找即可找到行标签信息中中间节点标签所指向的 根节点标签,对连通域的处理速度影响不太;在连通域分析过程中,记录行标签信息,并基于行标签信息进行连通域分析,可以有效提高连通域处理速度。It should be noted that, please refer to the two shadow-filled squares in the row label information in Figure 7. Take the first shadow-filled square from left to right as an example. The shadow-filled square records the pixel 21 The target connected component label, after the connected component analysis of the pixel 21 is completed, it is determined that the target connected component label of the pixel 21 is 4, and the connected component label 4 is the root node label. However, in the process of analyzing the connected area of the pixel 22, the connected area label 4 that was originally the root node label is adjusted to an intermediate node label pointing to the root node label 1. If the connected domain label 4 is directly used as the root node when the connected domain analysis is performed on the pixels in the third row of the image to be analyzed, an error may be caused. Therefore, in an embodiment, in the process of analyzing the connected domain of the pixel to be analyzed in each row of the image to be analyzed, if it is necessary to directly obtain from the row label information root_pointers, the pixel to be analyzed is adjacent to the pixel to be analyzed in the same column. When the connected domain label of the pixel point of the pixel point, the root node label can be judged on the connected domain label of the pixel point in the same column that is adjacent to the pixel to be analyzed in the upper direction obtained from the row label information root_pointers; If the connected component label is the root node label, the target connected component label of the pixel to be analyzed is determined based on the connected component label; if it is determined that the connected component label is not the root node label, search from the connected component statistical information record_result_list The root node label pointed to by the connected component label is derived, and the target connected component label of the pixel to be analyzed is determined based on the root node label pointed to by the connected component label. It has been found through practice that there are not many cases where the connected domain label recorded in the row label information is an intermediate node label, and generally only one or two searches can find the root node label pointed to by the intermediate node label in the row label information. The processing speed of connected domains has little effect; in the process of connected domain analysis, recording row label information and analyzing connected domains based on the row label information can effectively improve the processing speed of connected domains.
本发明实施例中,首先对待分析像素点进行连通域分析,并根据分析结果在标签图中为待分析像素点记录目标连通域标签;然后根据目标连通域标签更新连通域统计信息;其中,若目标连通域标签为根节点标签,则在连通域统计信息中记录第一类统计数据,若目标连通域标签为中间节点标签,则在连通域统计信息中记录第二类统计数据。采用上述方式,不仅可以有效降低DDR的读请求次数,还可以实现统计数据的复用,有效节省存储空间以及计算资源,扩大连通域处理的应用场景。In the embodiment of the present invention, the connected component analysis is performed on the pixel to be analyzed first, and the target connected component label is recorded in the label map for the pixel to be analyzed according to the analysis result; then the connected component statistical information is updated according to the target connected component label; where, if If the target connected domain label is the root node label, the first type of statistical data is recorded in the connected domain statistical information, and if the target connected domain label is an intermediate node label, the second type of statistical data is recorded in the connected domain statistical information. By adopting the above method, not only can the number of DDR read requests be effectively reduced, but also the multiplexing of statistical data can be realized, storage space and computing resources can be effectively saved, and the application scenarios of connected domain processing can be expanded.
请参见图8,在另一实施方式所提供的一种连通域处理方法较之图4所示的方法在步骤S403之后还包括以下步骤:Referring to FIG. 8, compared with the method shown in FIG. 4, a connected domain processing method provided in another embodiment further includes the following steps after step S403:
S404、所述数据处理设备在预设的多个连通域标签使用完之后,根据当前记录的行标签信息从所述多个连通域标签中确定出生长标签和非生长标签。S404: After the multiple preset connected domain labels are used up, the data processing device determines a growing label and a non-growing label from the multiple connected domain labels according to the row label information currently recorded.
本发明实施例中,在预设的多个连通域标签使用完之后,也即是预设的多个连通域标签全分配给待分析图像中的待分析像素点之后,需要进行连通域标签的回收和重用。生长标签是有可能继续向下延伸的连通域标签,对后续连通域分析影响较大,应不支持回收和重用;非生长标签是不会继续向下延伸的连通域标签,对后续连通域分析影响很小,可以回收和重用。具体地,数据处理设备可以根据当前记录的行标签信息从预设的多个连通域标签中确定出生长标签和非生长标签。在一实施例中,数据处理设备从预设的多个连通域标签中确定出存在于当前记录的行标签信息中的第一标签,并将第一标签确定为生长标签;从预设的多个连通域标签中确定出不存在于当前记录的行标签信息中的第二标签,并将第二标签确定为非生长标签。In the embodiment of the present invention, after the multiple preset connected component labels are used up, that is, after the multiple preset connected component labels are all allocated to the pixels to be analyzed in the image to be analyzed, the connected component label needs to be checked. Recycle and reuse. A growing label is a connected component label that may continue to extend downward, which has a greater impact on subsequent connected component analysis, and should not support recycling and reuse; a non-growing label is a connected component label that will not continue to extend downward, for subsequent connected component analysis The impact is small and can be recycled and reused. Specifically, the data processing device may determine the growing label and the non-growing label from a plurality of preset connected domain labels according to the row label information currently recorded. In one embodiment, the data processing device determines the first label existing in the row label information of the current record from a plurality of preset connected domain labels, and determines the first label as a growth label; A second label that does not exist in the row label information of the current record is determined among the connected domain labels, and the second label is determined as a non-growing label.
在另一实施例中,数据处理设备从预设的多个连通域标签中确定出存在于当前记录的行标签信息中的第一标签,并确定出不存在于当前记录的行标签信息中的第二标签;然后根据记录的连通域统计信息,从预设的多个连通域标签中确定出为该第一标签的根节点标签或者中间节点标签的第三标签;最后将第二标签中除第三标签之外的标签确定为非生长标签,将所述第一标签以及所述 第三标签确定为生长标签。相对于前文所述的直接将不存在于当前记录的行标签信息中的第二标签作为非生长标签,本实施例中所述的方式是将第二标签中除去第三标签之外的标签作为非生长标签,采用此方式确定出的非生长标签可以在一定程度上保证对后续连通域分析没有影响。In another embodiment, the data processing device determines the first label existing in the row label information of the current record from a plurality of preset connected domain labels, and determines the first label that does not exist in the row label information of the current record. The second label; then according to the recorded connected domain statistics, from the preset multiple connected domain labels, determine the root node label or the third label of the intermediate node label of the first label; finally remove the second label Tags other than the third tag are determined to be non-growth tags, and the first tag and the third tag are determined to be growing tags. In contrast to the aforementioned direct use of the second label that does not exist in the row label information of the current record as the non-growth label, the method described in this embodiment is to use the second label except the third label as the label. Non-growth label, the non-growth label determined in this way can ensure to a certain extent that it has no effect on subsequent connected domain analysis.
在一实施例中,连通域统计信息还包括第二标识位,第二标识位用于记录连通域标签的生长标识,当第二标识位为第三标识时表示连通域标签为非生长标签,当第二标识位为第四标识时表示连通域标签为生长标签。其中,第三标识可以是标识“0”,第四标识可以是标识“1”。第二标识位可以是连通域统计信息的最高比特位,也可以是连通域统计信息的最低比特位;第二标识位可以与第一标识位相邻,也可以与第一标识位不相邻。当第二标识位与第一标识位相邻时,第二标识位可以位于第一标识位的左相邻位置,也可以位于第一标识位的右相邻位置。In an embodiment, the connected domain statistical information further includes a second identification bit, the second identification bit is used to record the growth identification of the connected domain label, and when the second identification bit is the third identification, it indicates that the connected domain label is a non-growing label, When the second identification bit is the fourth identification, it indicates that the connected domain label is a growth label. Among them, the third identifier may be the identifier "0", and the fourth identifier may be the identifier "1". The second identification bit can be the highest bit of the statistical information of the connected domain, or the lowest bit of the statistical information of the connected domain; the second identification bit can be adjacent to the first identification bit or not adjacent to the first identification bit . When the second identification position is adjacent to the first identification position, the second identification position may be located adjacent to the left of the first identification position, or may be located adjacent to the right of the first identification position.
S405、所述数据处理设备根据所述非生长标签对所述待分析图像中未完成连通域分析的像素点进行连通域分析。S405: The data processing device performs connected domain analysis on pixels in the image to be analyzed that have not completed connected domain analysis according to the non-growth tag.
本发明实施例中,在对待分析图像中未完成连通域分析的待分析像素点进行连通域分析时,若确定出待分析像素点与其相邻像素点中的一个连通,则将与待分析像素点连通的相邻像素点的连通域标签作为待分析像素点的目标连通域标签。若确定出待分析像素点与其相邻像素点中的至少两个连通,则将与待分析像素点连通的至少两个相邻像素点的连通域标签中,标签值最小的连通域标签作为待分析像素点的目标连通域标签。若确定出待分析像素点与其相邻像素点均不连通,则将非生长标签中未被使用的一个连通域标签作为待分析像素点的目标连通域标签。具体处理方式可参考前文描述,此处不再赘述。采用上述方式,可以实现连通域标签的回收和重用,可以在支持的最大连通域标签较小的情况下,依然可以完成对待分析图像的处理;由于回收的标签占用的存储空间不变,从而可以利用较小的存储空间即可完成对待分析图像的处理,有效节省存储空间。In the embodiment of the present invention, when the pixel to be analyzed in the image to be analyzed has not completed the connected domain analysis, if it is determined that the pixel to be analyzed is connected to one of its neighboring pixels, it will be connected to the pixel to be analyzed. The connected domain label of the adjacent pixels connected by the dot is used as the target connected domain label of the pixel to be analyzed. If it is determined that the pixel to be analyzed is connected to at least two of its neighboring pixels, then among the connected domain labels of at least two neighboring pixels connected to the pixel to be analyzed, the connected domain label with the smallest label value is used as the to-be-analyzed pixel. Analyze the target connected domain label of the pixel. If it is determined that the pixel to be analyzed is not connected with its neighboring pixels, then an unused connected region label in the non-growth label is used as the target connected region label of the pixel to be analyzed. For the specific processing method, please refer to the previous description, which will not be repeated here. Using the above method, the recovery and reuse of connected domain labels can be realized. The processing of the image to be analyzed can still be completed when the largest supported connected domain label is small; the storage space occupied by the recovered labels remains unchanged, so The processing of the image to be analyzed can be completed with a small storage space, effectively saving storage space.
为更好的理解本方案中连通域标签的回收和重用方法,下面举例进行详细说明。请一并参见图9,为本发明第二实施例提供的一种连通域的示意图,为按照前文所述连通域分析方法分析完成之后的结果。如图9所示,图9表示待分 析图像,图中的每个格子表示待分析图像的一个像素点。图中阴影填充的格子表示待分析图像中的有效像素点,未阴影填充的格子表示待分析图像中的无效像素点,有效像素点与无效像素点不连通;阴影填充的多个格子组成了待分析图像的多个连通域。图中未阴影填充的格子中的标记信息表示相应像素点在待分析图像中的坐标信息,图中阴影填充的格子中的标记信息表示相应像素点在待分析图像中的坐标信息,以及连通域分析之后确定出的连通域标签。具体是位于“/”左侧的数值表示像素点在待分析图像中的坐标信息,位于“/”右侧的数值表示像素点的连通域标签。In order to better understand the recovery and reuse methods of connected domain labels in this solution, the following examples are used for detailed description. Please also refer to FIG. 9, which is a schematic diagram of a connected domain according to the second embodiment of the present invention, which is the result after the analysis is completed according to the connected domain analysis method described above. As shown in Figure 9, Figure 9 shows the image to be analyzed, and each grid in the figure represents a pixel of the image to be analyzed. The shaded grids in the figure represent the effective pixels in the image to be analyzed, and the unshaded grids represent the invalid pixels in the image to be analyzed. The effective pixels and the invalid pixels are not connected; the multiple grids filled with shadow constitute the Analyze multiple connected domains of the image. The mark information in the unshaded filled grid in the figure represents the coordinate information of the corresponding pixel in the image to be analyzed, and the mark information in the shaded grid in the figure represents the coordinate information of the corresponding pixel in the image to be analyzed, and the connected domain Connected domain label determined after analysis. Specifically, the value on the left of "/" indicates the coordinate information of the pixel in the image to be analyzed, and the value on the right of "/" indicates the connected domain label of the pixel.
对于连通域标签的回收和重用方法,回收也即是确定出非生长标签,重用也即是利用非生长标签进行后续的连通域分析;主要基于待分析图像的某条分割线而言,如果待分析图像中的某部分连通域没有跨过该分割线,则该部分连通域中像素点对应的所有连通域标签均不会在该分割线以下出现,可以将这类连通域标签作为非生长标签,并进行回收和重用。以图9中虚线框作为分割线为例,在虚线框所在行之前已经不再生长的连通域中的标签将不会在虚线框以下区域出现,例如由连通域标签1和4组成的连通域、以及由连通域标签2和5组成的连通域不会再往下生长,则连通域标签1、2、4、5不会在虚线框以下区域中出现。而在虚线框行内的连通域标签组成的连通域继续生长的可能性很大,故在虚线框行内的连通域标签可能会在虚线框以下区域出现,例如连通域标签3和7在虚线框行内,由连通域标签7组成的连通域会继续往下生长,由连通域标签3组成的连通域继续向下生长的可能性很大,则连通域标签3和7均可能在虚线框以下区域中出现。综上所述,连通域标签1、2、4和5都可以回收,并可以在虚线框以下的部分进行重用而不产生影响。For the recovery and reuse method of connected domain labels, recovery means to determine non-growth labels, and reuse means to use non-growth labels for subsequent connected-domain analysis; mainly based on a certain segmentation line of the image to be analyzed, if If a certain part of the connected domain in the analysis image does not cross the dividing line, all connected domain labels corresponding to pixels in this part of the connected domain will not appear below the dividing line. Such connected domain labels can be regarded as non-growing labels , And recycle and reuse. Taking the dotted box in Figure 9 as the dividing line as an example, the labels in the connected domains that no longer grow before the line of the dotted box will not appear in the area below the dotted box, for example, the connected domain composed of connected domain labels 1 and 4 , And the connected domain composed of connected domain labels 2 and 5 will no longer grow downward, and the connected domain labels 1, 2, 4, and 5 will not appear in the area below the dashed box. The connected domains composed of the connected domain labels in the dashed frame are likely to continue to grow, so the connected domain labels in the dashed frame may appear in the area below the dashed frame, for example, the connected domain labels 3 and 7 are in the dashed frame. , The connected domain composed of the connected domain label 7 will continue to grow downward, and the connected domain composed of the connected domain label 3 is likely to continue to grow downward, so the connected domain labels 3 and 7 may both be in the area below the dotted box appear. In summary, connected domain tags 1, 2, 4, and 5 can all be recycled, and can be reused in the part below the dashed box without affecting them.
前文对连通域标签的回收和重用的主要思想进行了说明,下面依然以图9为例来具体说明连通域标签的回收和重用过程。假设将图9所示待分析图像连通域分析时支持的最大连通域标签设置为7,针对图9所示待分析图像前46个像素点的连通域分析方法可参照前文描述,此处不再赘述。在对像素点46连通域分析完之后,也即是赋予像素点点46一个新的连通域标签7之后,预设的7个连通域标签1至7均已被使用,无新的连通域标签可以用于后续的连通域分析。故而此时应进行连通域标签的回收,记录当前回收位置为像素点46。请一并参见 图10,图10为本发明实施例提供的一种行标签信息的示意图,图10中行标签信息与原图关系,为像素点46连通域分析完成之后,行标签信息与原待分析图像之间的关系,结合图10中的行标签信息可知,此时行标签信息中前6个数据从左至右分别是像素点41、42、43、44、45、46连通域分析之后的连通域标签0、0、0、0、0、7;而后6个数据分别是像素点46所在行的上一行中的像素点37、38、39、3a、3b、3c连通域分析之后的连通域标签;0、0、0、3、0、6。The foregoing has explained the main ideas of the recovery and reuse of connected domain labels. The following still takes Figure 9 as an example to illustrate the process of recovery and reuse of connected domain labels. Assuming that the maximum connected component label supported during the analysis of the connected component of the image to be analyzed shown in Figure 9 is set to 7, the connected component analysis method for the first 46 pixels of the image to be analyzed shown in Figure 9 can refer to the previous description, which will not be here Repeat. After analyzing the connected component of the pixel 46, that is, after assigning a new connected component label 7 to the pixel 46, the preset seven connected component labels 1 to 7 have been used, and no new connected component label can be used. Used for subsequent connected domain analysis. Therefore, at this time, the connected domain label should be recovered, and the current recovery position is recorded as the pixel 46. Please refer to FIG. 10 together. FIG. 10 is a schematic diagram of a row label information provided by an embodiment of the present invention. The relationship between the row label information and the original image in FIG. Analyzing the relationship between the images, combined with the row label information in Figure 10, it can be seen that the first 6 data in the row label information from left to right are pixels 41, 42, 43, 44, 45, 46 after the connected domain analysis Connected domain labels 0, 0, 0, 0, 0, 7; and the next 6 data are the pixels 37, 38, 39, 3a, 3b, 3c in the upper row of the row where the pixel 46 is after the connected domain analysis Connected domain label; 0, 0, 0, 3, 0, 6.
进一步地,对图10所示的行标签信息进行一次梳理,只要出现在行标签信息中的根节点标签,就有可能继续往下生长,而未出现在行标签信息中的根节点标签所指向的连通域中的全部连通域标签均可以进行回收。基于图10中的行标签信息可以找出有可能继续往下生长的根节点标签为3、7、6,随后在连通域统计信息中对根节点标签3、7、6进行生长标记。请一并参见图11,为本发明第二实施例提供的一种连通域统计信息的示意图,具体为连通域标签回收之前经过梳理后的图9所示待分析图像对应的连通域统计信息的示意图。如图11所示,第一标识位用于指示数据位所存放的统计数据的类型,第二标识位用于记录连通域标签的生长标识,当第二标识位为“0”时表示连通域标签为非生长标签,当第二标识位为“1”时表示连通域标签为生长标签。可见,连通域标签4指向根节点标签1(也即是01),连通域标签5指向根节点标签2(也即是10),连通域标签3、6、7为生长标签。其中,在连通域统计信息中对根节点标签3、7、6进行生长标记之后,对连通域统计信息进行梳理,将所有中间节点标签均改为指向根节点标签。需要说明的是,本例子中对图10所示的行标签信息进行梳理前后,记录的连通域统计信息不变,均为图11所示的连通域统计信息。其中,梳理过程举例说明如下:假设连通域统计信息中记录了10->9->8->7->6的一条链表,7->6表示连通域标签7指向连通域标签6,从链表可知从连通域标签10开始查找可以确定出连通域标签6为根节点标签,然后将连通域标签10、9、8均修改成指向根节点标签6的一级中间节点标签,也即是10->6,9->6,8->6,7->6。Further, the row label information shown in Figure 10 is sorted out once, as long as the root node label appears in the row label information, it is possible to continue to grow downward, and the root node label that does not appear in the row label information points to All connected domain labels in the connected domains can be recycled. Based on the row label information in Figure 10, it can be found that the root node labels that may continue to grow downward are 3, 7, and 6, and then the root node labels 3, 7, and 6 are grown in the connected domain statistics. Please also refer to FIG. 11, which is a schematic diagram of connected domain statistical information provided by the second embodiment of the present invention. Specifically, the connected domain statistical information corresponding to the image to be analyzed shown in FIG. 9 is sorted before the connected domain label is recovered. Schematic. As shown in Figure 11, the first identification bit is used to indicate the type of statistical data stored in the data bit, and the second identification bit is used to record the growth identification of the connected domain tag. When the second identification bit is "0", it indicates the connected domain The label is a non-growing label. When the second identification bit is "1", it indicates that the connected domain label is a growing label. It can be seen that the connected domain label 4 points to the root node label 1 (that is, 01), the connected domain label 5 points to the root node label 2 (that is, 10), and the connected domain labels 3, 6, and 7 are growth labels. Among them, after the root node labels 3, 7, and 6 are marked for growth in the connected domain statistical information, the connected domain statistical information is sorted, and all intermediate node labels are changed to point to the root node label. It should be noted that in this example, before and after the row label information shown in FIG. 10 is combed, the recorded connected domain statistical information remains unchanged, and they are all connected domain statistical information shown in FIG. 11. Among them, the combing process is illustrated as follows: suppose that a linked list of 10->9->8->7->6 is recorded in the connected domain statistics information, and 7->6 indicates that the connected domain label 7 points to the connected domain label 6, from the linked list It can be seen that starting from the connected component label 10, it can be determined that the connected component label 6 is the root node label, and then the connected component labels 10, 9, and 8 are all modified to the first-level intermediate node label pointing to the root node label 6, which is 10- >6,9->6,8->6,7->6.
进一步地,对图11所示的连通域统计信息进行一次遍历,确定出生长标记为“0”的根节点标签以及指向这些根节点标签的一级中间节点标签,上述两类连通域标签也即是非生长标签。通过遍历图11所示的连通域统计信息可以确 定出1、2、4、5四个非生长标签,此时可以将非生长标签1、2、4、5保存到预设存储空间中。进一步地,基于非生长标签1、2、4、5,从像素点47开始继续进行后续待分析像素点的连通域分析,对于需要赋予一个新的连通域标签的情况,只需将预设存储空间中保存的可重用非生长标签读出使用即可。请一并参见图12,为本发明第三实施例提供的一种连通域的示意图,具体为采用上述连通域标签回收和重用方式完成图9中所有像素点连通域分析后的结果。如图12所示,像素点46及其之前的像素点,也即是图中方格未加粗显示的部分,是利用预设的7个连通域标签1至7进行标记的部分,也即是连通域标签回收以及重用之前的部分。像素点47及其之后的像素点,也即是图中方格加粗显示的部分,是利用回收的非生长标签进行标记的部分,也即是连通域标签重用的部分。可以通过记录的回收位置像素点46来区别上述两个部分。其中,像素点49、4a、59、69对应的连通域标签为非生长标签1,像素点52、53、54、55、56、62、65对应的连通域标签为非生长标签2,像素点6b、6c对应的连通域标签为非生长标签4。可见,回收的4个非生长标签中的1、2和4三个连通域标签均进行了标签重用。Further, a traversal is performed on the connected component statistical information shown in FIG. 11, and the root node label whose growth mark is "0" and the first-level intermediate node labels pointing to these root node labels are determined. The above two types of connected component labels are also It is a non-growth label. By traversing the connected domain statistical information shown in Figure 11, four non-growth tags 1, 2, 4, and 5 can be determined. At this time, the non-growth tags 1, 2, 4, and 5 can be stored in the preset storage space. Further, based on the non-growth labels 1, 2, 4, and 5, the subsequent connected domain analysis of the pixel to be analyzed is continued starting from the pixel 47. For the case where a new connected domain label needs to be assigned, only the preset is stored The reusable non-growth tags stored in the space can be read and used. Please also refer to FIG. 12, which is a schematic diagram of a connected domain provided by the third embodiment of the present invention. Specifically, the connected domain label recovery and reuse method described above is used to complete the connected domain analysis result of all pixels in FIG. As shown in Figure 12, the pixel point 46 and the pixel point before it, that is, the part of the grid that is not shown in bold in the figure, is the part marked by the preset 7 connected domain labels 1 to 7, that is, It is the part before the recycling and reuse of connected domain labels. Pixel 47 and the following pixels, that is, the part shown in bold squares in the figure, are the parts marked with the recycled non-growth tags, that is, the parts reused by the connected domain tags. The above two parts can be distinguished by the recorded recovery position pixels 46. Among them, the connected component labels corresponding to pixels 49, 4a, 59, 69 are non-growth label 1, and the connected component labels corresponding to pixels 52, 53, 54, 55, 56, 62, and 65 are non-growth label 2. The connected domain label corresponding to 6b and 6c is the non-growth label 4. It can be seen that the three connected domain labels 1, 2, and 4 out of the 4 non-growth labels recovered are all label reused.
在一实施例中,在对待分析图像中的所有待分析像素点连通域分析完成之后,数据处理设备还可以根据记录的连通域统计信息以及标签图确定出待分析图像中不满足预设条件的连通域,并对不满足预设条件的连通域中的像素点进行过滤。在一实施例中,不满足预设条件是指:连通域中相连通的像素点的数量小于预设数值。In an embodiment, after the connected domain analysis of all the pixels to be analyzed in the image to be analyzed is completed, the data processing device may also determine, according to the recorded connected domain statistical information and the label map, that the image to be analyzed does not meet the preset conditions Connected domains, and filter pixels in the connected domains that do not meet the preset conditions. In one embodiment, not satisfying the preset condition means that the number of connected pixels in the connected domain is less than the preset value.
下面结合前文所述的例子进行举例说明,假设希望通过连通域分析过滤掉待分析图像中相连通的像素点的数量小于5的连通域。在前文进行连通域标签的回收过程中,通过遍历图11所示的连通域统计信息确定出1、2、4、5四个非生长标签之后,由于此时由连通域标签1和4组成的连通域中相连通的像素点的数量为5,则此连通域中的像素点应保留;此时由连通域标签2和5组成的连通域中相连通的像素点的数量为4,则此连通域中的像素点应过滤掉;此时可以将非生长标签1、4保存到第一预设存储空间中,将非生长标签2、5保存到第二预设存储空间中。请一并参见图13,为本发明第三实施例提供的一种连通域统计信息的示意图,具体为采用上述连通域标签回收和重用方式完成图9中所有 像素点连通域分析后记录的连通域统计信息。如图13所示,连通域统计信息中连通域标签1、2、4对应的数据均是为图12中加粗显示部分像素点记录的。可见连通域标签3指向根节点标签1,连通域标签5和7均指向根节点标签2,连通域标签1对应的数目数据为8、连通域标签2对应的数目数据为8、连通域标签4对应的数目数据为2。The following is an example to illustrate with the above-mentioned example. It is assumed that it is desired to filter out connected domains in the image to be analyzed that the number of connected pixels is less than 5 through connected domain analysis. In the previous process of recovering connected domain labels, after traversing the connected domain statistics shown in Figure 11, four non-growth labels 1, 2, 4, and 5 are determined, because at this time, the connected domain labels 1 and 4 are composed of The number of connected pixels in the connected domain is 5, then the pixels in this connected domain should be retained; at this time, the number of connected pixels in the connected domain composed of connected domain labels 2 and 5 is 4, then this The pixels in the connected domain should be filtered out; at this time, the non-growth tags 1, 4 can be stored in the first preset storage space, and the non-growth tags 2, 5 can be stored in the second preset storage space. Please refer to FIG. 13 together, which is a schematic diagram of connected domain statistical information provided by the third embodiment of the present invention. Specifically, the connection recorded after the connected domain analysis of all pixels in FIG. 9 is completed using the above-mentioned connected domain label recovery and reuse method Domain statistics. As shown in FIG. 13, the data corresponding to the connected domain labels 1, 2, and 4 in the connected domain statistical information are all recorded for the part of pixels shown in bold in FIG. 12. It can be seen that connected component label 3 points to root node label 1, connected component labels 5 and 7 both point to root node label 2, the number data corresponding to connected component label 1 is 8, the number data corresponding to connected component label 2 is 8, and the connected component label 4 The corresponding number data is 2.
由于方格未加粗部分和方格加粗部分中的连通域标签有重复的,故需要对图13所示的连通域统计信息进行一次遍历,将所有中间节点标签的统计数据用其根节点标签的统计数据替代,否则会影响结果判断。请一并参见图14,图14为本发明第四实施例提供的一种连通域统计信息的示意图,具体为图13所示连通域统计信息遍历之后的结果,此结果可以用于对方格加粗部分中的连通域进行分析。由于连通域标签4对应的数目数据小于5,故需要将方格加粗部分中连通域标签为4的像素点过滤掉;结合图12所示的连通域标记结果,或者记录的待分析图像对应的标签图,可以确定出方格加粗部分中连通域标签为4的像素点为6b和6c,故可以将图9所示待分析图像中的像素点6b和6c过滤掉。Since the connected component labels in the unbold part of the square and the bold part of the square are duplicated, it is necessary to traverse the connected component statistical information shown in Figure 13 once, and use the statistical data of all intermediate node labels as the root node The statistical data of the label is replaced, otherwise it will affect the result judgment. Please refer to FIG. 14 together. FIG. 14 is a schematic diagram of a connected domain statistical information provided by a fourth embodiment of the present invention. Specifically, it is the result of the connected domain statistical information traversal shown in FIG. The connected domains in the thick part are analyzed. Since the number data corresponding to the connected component label 4 is less than 5, it is necessary to filter out the pixels with the connected component label 4 in the bold part of the grid; combine the connected component labeling result shown in Figure 12, or the recorded image to be analyzed corresponding It can be determined that the pixels with the connected domain label of 4 in the thickened part of the grid are 6b and 6c, so the pixels 6b and 6c in the image to be analyzed shown in Figure 9 can be filtered out.
对于方格未加粗部分的连通域分析,由于图14所示的连通域统计信息中已经将重用的非生长标签对应的统计数据修改了,图14所示的连通域统计信息不能直接用于分析,需要将回收连通域标签时保存在第一预设存储单元和第二预设存储单元中的连通域标签1、4、2、5读出,并且根据读出地址的不同修改图14所示的连通域统计信息中相应的统计数据。请一并参见图15,为本发明第五实施例提供的一种连通域统计信息的示意图,具体为根据连通域标签1、4、2、5读出地址的不同对图14所示的连通域统计信息中相应统计数据进行修改后的结果。具体地,从第一预设存储单元中读出的连通域标签表示相应连通域中相连通的像素点的数量大于或者等于5,不能过滤,而从第二预设存储单元中读出的连通域标签表示相应连通域中相连通的像素点的数量小于5,可以过滤。如图15所示,直接将从第一预设存储单元中读出的连通域标签1、4所对应的连通域统计信息中的数目数据修改为5(也即101),而将从第二预设存储单元中读出的连通域标签2、5所对应的连通域统计信息中的数目数据修改为0,以便于进行后续判断。由于连通域标签2、5、6对应的数目数据小于5,故需要将方格未加粗部分中连通域标签为2、5、6的像素点过滤掉;结合图12所示的连 通域标记结果,或者记录的待分析图像对应的标签图,可以确定出方格未加粗部分中连通域标签为2、5、6的像素点为16、26、27、25、3c,故可以将图9所示待分析图像中的像素点16、26、27、25、3c过滤掉。采用上述方式,可以对待分析图像中相连通的像素点的数量小于预设数值的连通域中的像素点进行过滤。For the connected component analysis of the unbolded part of the grid, since the statistical data corresponding to the reused non-growth label has been modified in the connected component statistical information shown in Figure 14, the connected component statistical information shown in Figure 14 cannot be used directly Analyzed, it is necessary to read the connected domain tags 1, 4, 2, and 5 stored in the first preset storage unit and the second preset storage unit when the connected domain tags are recovered, and modify the data shown in Figure 14 according to the different read addresses. The corresponding statistical data in the connected domain statistical information shown. Please refer to FIG. 15 together, which is a schematic diagram of connected domain statistical information provided by the fifth embodiment of the present invention. Specifically, the connected domain label 1, 4, 2, and 5 read out different addresses for the connected domain shown in FIG. The modified result of the corresponding statistical data in the domain statistical information. Specifically, the connected domain label read from the first preset storage unit indicates that the number of connected pixels in the corresponding connected domain is greater than or equal to 5, which cannot be filtered, and the connected domain read from the second preset storage unit The domain label indicates that the number of connected pixels in the corresponding connected domain is less than 5 and can be filtered. As shown in Figure 15, the number data in the connected domain statistical information corresponding to the connected domain tags 1, 4 read from the first preset storage unit is directly modified to 5 (that is, 101), and the second The number data in the connected domain statistical information corresponding to the connected domain tags 2 and 5 read from the preset storage unit is modified to 0 to facilitate subsequent judgment. Since the number data corresponding to connected domain labels 2, 5, and 6 is less than 5, it is necessary to filter out pixels with connected domain labels 2, 5, and 6 in the unbold part of the grid; combined with the connected domain labels shown in Figure 12 As a result, or the label image corresponding to the recorded image to be analyzed, it can be determined that the pixels with the connected domain labels 2, 5, and 6 in the unbold part of the grid are 16, 26, 27, 25, 3c, so the image can be changed The pixels 16, 26, 27, 25, 3c in the image to be analyzed shown in 9 are filtered out. With the above method, the pixels in the connected domain whose number of connected pixels in the image to be analyzed are less than the preset value can be filtered.
需要说明的是,由于处理过程中可能存在回收一次连通域标签并不能完全分析完一张待分析图像的情况,此时可以继续执行上述连通域标签回收和重用过程,具体处理方式可参考前文描述,此处不再赘述。而在连通域分析过程中,例如在将不满足预设条件的连通域中的像素点进行过滤的过程中,则需要针对待分析图像按照从下到上,从右到左的顺序进行分析,与确定待分析像素点的连通域标签的过程相反;这样可以在一定程度上保证重用的连通域标签不对分析结果产生影响。如果同样希望按照从上到下、从左到右的顺序进行连通域分析,则需要对处理过程中多个阶段的连通域统计信息进行备份,基于备份的连通域统计信息可以实现按照从上到下、从左到右的顺序进行连通域分析。It should be noted that, due to the possibility of recovering connected domain labels once during the processing process, it is not possible to completely analyze an image to be analyzed. At this time, you can continue to perform the above connected domain label recovery and reuse process. For specific processing methods, please refer to the previous description. , I won’t repeat it here. In the connected domain analysis process, for example, in the process of filtering the pixels in the connected domain that do not meet the preset conditions, the image to be analyzed needs to be analyzed in the order from bottom to top, from right to left. Contrary to the process of determining the connected domain label of the pixel to be analyzed; this can ensure to a certain extent that the reused connected domain label does not affect the analysis result. If you also want to perform connected domain analysis in the order from top to bottom and from left to right, you need to back up the connected domain statistics at multiple stages in the processing process. The backed-up connected domain statistics can be realized from top to bottom. Analyze connected components in the order of bottom and left to right.
请参阅图16,为本发明实施例提供的一种数据处理设备的结构示意图。本发明实施例中所描述的数据处理设备包括:处理器1601、通信接口1602、存储器1603。其中,处理器1601、通信接口1602、存储器1603可通过总线或其他方式连接,本发明实施例以通过总线连接为例。Refer to FIG. 16, which is a schematic structural diagram of a data processing device provided by an embodiment of the present invention. The data processing device described in the embodiment of the present invention includes a processor 1601, a communication interface 1602, and a memory 1603. Among them, the processor 1601, the communication interface 1602, and the memory 1603 may be connected through a bus or other methods. The embodiment of the present invention takes the connection through a bus as an example.
处理器1601可以是中央处理器(central processing unit,CPU),网络处理器(network processor,NP),或者CPU和NP的组合。处理器1601也可以是多核CPU、或多核NP中用于实现通信标识绑定的核。The processor 1601 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and an NP. The processor 1601 may also be a multi-core CPU or a core used to implement communication identification binding in a multi-core NP.
所述处理器1601可以是硬件芯片。所述硬件芯片可以是专用集成电路(application-specific integrated circuit,ASIC),可编程逻辑器件(programmable logic device,PLD)或其组合。所述PLD可以是复杂可编程逻辑器件(complex programmable logic device,CPLD),现场可编程逻辑门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)或其任意组合。The processor 1601 may be a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a general array logic (generic array logic, GAL) or any combination thereof.
所述通信接口1602可用于收发信息或信令的交互,以及信号的接收和传递。所述存储器1603可主要包括存储程序区和存储数据区,其中,存储程序区 可存储操作系统、至少一个功能所需的存储程序(比如文字存储功能、位置存储功能等);存储数据区可存储根据装置的使用所创建的数据(比如图像数据、文字数据)等,并可以包括应用存储程序等。此外,存储器1603可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The communication interface 1602 can be used for the exchange of sending and receiving information or signaling, as well as the reception and transmission of signals. The memory 1603 may mainly include a storage program area and a storage data area. The storage program area can store an operating system and a storage program required by at least one function (such as a text storage function, a location storage function, etc.); the storage data area can store Data (such as image data, text data) created according to the use of the device, etc., and may include application storage programs, etc. In addition, the memory 1603 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
所述存储器1603还用于存储程序指令。所述处理器1601,用于执行所述存储器1603存储的程序指令,当所述程序指令被执行时,所述处理器1601用于:The memory 1603 is also used to store program instructions. The processor 1601 is configured to execute program instructions stored in the memory 1603, and when the program instructions are executed, the processor 1601 is configured to:
获取待分析图像,对所述待分析图像中当前的待分析像素点进行连通域分析,并根据分析结果在所述待分析图像的标签图中为所述待分析像素点记录目标连通域标签;根据所述目标连通域标签更新所述待分析图像的连通域统计信息;其中,在对所述连通域统计信息进行更新时,若所述目标连通域标签为根节点标签,则在所述连通域统计信息中为所述目标连通域标签记录第一类统计数据,所述第一类统计数据为数目数据,所述数目数据用于指示标记为所述目标连通域标签以及标记的连通域标签指向所述目标连通域标签的像素点的个数;若所述目标连通域标签为中间节点标签,则在所述连通域统计信息中为所述目标连通域标签记录第二类统计数据,所述第二类统计数据为指针数据,所述指针数据用于指示所述目标连通域标签所指向的根节点标签。Acquiring an image to be analyzed, performing a connected domain analysis on the current pixel to be analyzed in the image to be analyzed, and recording a target connected domain label for the pixel to be analyzed in the label map of the image to be analyzed according to the analysis result; Update the connected component statistical information of the image to be analyzed according to the target connected component label; wherein, when the connected component statistical information is updated, if the target connected component label is the root node label, then The domain statistical information records the first type of statistical data for the target connected domain label, where the first type of statistical data is number data, and the number data is used to indicate the target connected domain label and the marked connected domain label The number of pixels pointing to the target connected domain label; if the target connected domain label is an intermediate node label, record the second type of statistical data for the target connected domain label in the connected domain statistical information, so The second type of statistical data is pointer data, and the pointer data is used to indicate the root node label pointed to by the target connected domain label.
本发明实施例中处理器执行的方法均从处理器的角度来描述,可以理解的是,本发明实施例中处理器要执行上述方法需要其他硬件结构的配合。本发明实施例对具体的实现过程不作详细描述和限制。The methods executed by the processor in the embodiments of the present invention are all described from the perspective of the processor. It can be understood that the processor in the embodiments of the present invention requires the cooperation of other hardware structures to execute the foregoing methods. The embodiments of the present invention do not make detailed descriptions and restrictions on the specific implementation process.
在一实施例中,所述连通域统计信息包括第一标识位和数据位,其中,所述第一标识位用于表示所述数据位记录的统计数据的类型,所述数据位用于表示为所述目标连通域标签记录的统计数据;当所述第一标识位为第一标识时,所述数据位为所述目标连通域标签记录的是第一类统计数据,当所述第一标识位为第二标识时,所述数据位为所述目标连通域标签记录的是第二类统计数据。In an embodiment, the connected domain statistical information includes a first identification bit and a data bit, wherein the first identification bit is used to indicate the type of statistical data recorded by the data bit, and the data bit is used to indicate Is the statistical data recorded for the target connected domain label; when the first identification bit is the first identifier, the data bit is the first type of statistical data recorded for the target connected domain label, when the first When the identification bit is the second identification, the data bit is the second type of statistical data recorded by the target connected domain tag.
在一实施例中,所述处理器1601对所述待分析图像中当前的待分析像素点进行连通域分析时,具体用于:从所述待分析图像中确定出与当前的待分析像素点相邻的相邻像素点;根据所述相邻像素点对所述待分析像素点进行连通域 分析,确定出所述待分析像素点的目标连通域标签。In an embodiment, when the processor 1601 performs a connected domain analysis on the current pixel to be analyzed in the image to be analyzed, it is specifically configured to: determine from the image to be analyzed that the pixel to be analyzed is current Adjacent adjacent pixels; performing connected domain analysis on the pixel to be analyzed according to the adjacent pixel to determine the target connected domain label of the pixel to be analyzed.
在一实施例中,所述相邻像素点包括:与所述待分析像素点在同一列中上方向上相邻的第一像素点,和/或,与所述待分析像素点在同一行中左方向上相邻的第二像素点。In an embodiment, the adjacent pixel points include: a first pixel point that is adjacent in the upper direction in the same column as the pixel point to be analyzed, and/or is in the same row as the pixel point to be analyzed The second pixel point adjacent in the center-left direction.
在一实施例中,所述处理器1601根据所述相邻像素点对所述待分析像素点进行连通域分析,确定出所述待分析像素点的目标连通域标签时,具体用于:根据所述第一像素点对所述待分析像素点进行连通域分析;若确定出所述待分析像素点与所述第一像素点连通,则将所述第一像素点的连通域标签作为所述待分析像素点的目标连通域标签。In an embodiment, when the processor 1601 performs connected domain analysis on the pixel to be analyzed according to the adjacent pixels, and determines the target connected domain label of the pixel to be analyzed, it is specifically configured to: The first pixel performs connected domain analysis on the pixel to be analyzed; if it is determined that the pixel to be analyzed is connected to the first pixel, then the connected domain label of the first pixel is used as the The target connected domain label of the pixel to be analyzed.
在一实施例中,所述处理器1601根据所述相邻像素点对所述待分析像素点进行连通域分析,确定出所述待分析像素点的目标连通域标签时,具体用于:根据所述第二像素点对所述待分析像素点进行连通域分析;若确定出所述待分析像素点与所述第二像素点连通,则将所述第二像素点的连通域标签作为所述待分析像素点的目标连通域标签。In an embodiment, when the processor 1601 performs connected domain analysis on the pixel to be analyzed according to the adjacent pixels, and determines the target connected domain label of the pixel to be analyzed, it is specifically configured to: The second pixel performs connected domain analysis on the pixel to be analyzed; if it is determined that the pixel to be analyzed is connected to the second pixel, then the connected domain label of the second pixel is used as the The target connected domain label of the pixel to be analyzed.
在一实施例中,所述处理器1601根据所述相邻像素点对所述待分析像素点进行连通域分析,确定出所述待分析像素点的目标连通域标签时,具体用于:根据所述第一像素点以及所述第二像素点对所述待分析像素点进行连通域分析;若确定出所述待分析像素点与所述第一像素点以及所述第二像素点均连通,则将所述第一像素点的连通域标签以及所述第二像素点的连通域标签中标签值最小的连通域标签作为所述待分析像素点的目标连通域标签。In an embodiment, when the processor 1601 performs connected domain analysis on the pixel to be analyzed according to the adjacent pixels, and determines the target connected domain label of the pixel to be analyzed, it is specifically configured to: The first pixel and the second pixel perform a connected domain analysis on the pixel to be analyzed; if it is determined that the pixel to be analyzed is connected to the first pixel and the second pixel , The connected component label of the connected component of the first pixel and the connected component of the connected component label of the second pixel are used as the target connected component label of the pixel to be analyzed.
在一实施例中,所述处理器1601还用于:将所述第一像素点的连通域标签以及所述第二像素点的连通域标签中标签值最大的连通域标签确定为指向所述目标连通域标签的中间节点标签;对所述连通域统计信息中所述标签值最大的连通域标签进行更改。In an embodiment, the processor 1601 is further configured to: determine the connected component label with the largest label value among the connected component labels of the first pixel and the connected component labels of the second pixel as pointing to the The intermediate node label of the target connected domain label; the connected domain label with the largest label value in the connected domain statistical information is changed.
在一实施例中,所述处理器1601对所述连通域统计信息中所述标签值最大的连通域标签进行更改时,具体用于:将所述连通域统计信息中所述标签值最大的连通域标签对应的第一标识位调整为所述第二标识;在所述连通域统计信息中所述标签值最大的连通域标签对应的数据位,为所述标签值最大的连通域标签记录第二类统计数据,记录的第二类统计数据指示所述标签值最大的连通 域标签指向所述目标连通域标签。In an embodiment, when the processor 1601 changes the connected component label with the largest label value in the connected component statistical information, it is specifically configured to: change the connected component statistical information with the largest label value. The first identification bit corresponding to the connected domain label is adjusted to the second identification; the data bit corresponding to the connected domain label with the largest label value in the connected domain statistical information is the connected domain label record with the largest label value The second type of statistical data, the recorded second type of statistical data indicates that the connected component label with the largest label value points to the target connected component label.
在一实施例中,所述处理器1601还用于:若确定出所述待分析像素点与所述第一像素点以及所述第二像素点均不连通,则将预设的多个连通域标签中未被使用的一个连通域标签作为所述待分析像素点的目标连通域标签。In one embodiment, the processor 1601 is further configured to: if it is determined that the pixel to be analyzed is not connected with the first pixel and the second pixel, connect a plurality of preset An unused connected domain label in the domain labels is used as the target connected domain label of the pixel to be analyzed.
在一实施例中,与所述待分析像素点在同一列中上方向上相邻的第一像素点的连通域标签被记录在行标签信息中;所述行标签信息中还包括位于所述待分析像素点同一行中左方向上的像素点的连通域标签,以及位于所述第一像素点同一行中右方向上的像素点的连通域标签。In an embodiment, the connected domain label of the first pixel that is adjacent in the upper direction in the same column as the pixel to be analyzed is recorded in the row label information; the row label information further includes The connected domain label of the pixel in the left direction in the same row of the pixel to be analyzed, and the connected domain label of the pixel in the right direction in the same row of the first pixel.
在一实施例中,所述处理器1601还用于:在所述待分析像素点连通域分析完成之后,根据确定出的所述待分析像素点的目标连通域标签对所述行标签信息进行更新。In an embodiment, the processor 1601 is further configured to: after the connected domain analysis of the pixel to be analyzed is completed, perform the row label information on the line label information according to the determined target connected domain label of the pixel to be analyzed Update.
在一实施例中,所述处理器1601还用于:在预设的多个连通域标签使用完之后,根据当前记录的行标签信息从所述多个连通域标签中确定出生长标签和非生长标签;根据所述非生长标签对所述待分析图像中未完成连通域分析的像素点进行连通域分析。In an embodiment, the processor 1601 is further configured to: after a plurality of preset connected domain labels are used up, determine a growth label and a non-information from the plurality of connected domain labels according to the currently recorded row label information. Growing label; according to the non-growing label, the connected area analysis is performed on the pixels in the image to be analyzed that have not completed the connected area analysis.
在一实施例中,所述处理器1601根据当前记录的行标签信息从所述多个连通域标签中确定出生长标签和非生长标签时,具体用于:从所述多个连通域标签中确定出存在于当前记录的行标签信息中的第一标签,并将所述第一标签确定为生长标签;从所述多个连通域标签中确定出不存在于当前记录的行标签信息中的第二标签,并将所述第二标签确定为非生长标签。In an embodiment, when the processor 1601 determines a growing label and a non-growing label from the plurality of connected domain labels according to the row label information currently recorded, it is specifically configured to: Determine the first label that exists in the line label information of the current record, and determine the first label as a growth label; determine from the plurality of connected domain labels that are not present in the line label information of the current record A second label, and determining the second label as a non-growth label.
在一实施例中,所述处理器1601根据当前记录的行标签信息从所述多个连通域标签中确定出生长标签和非生长标签时,具体用于:从所述多个连通域标签中确定出存在于当前记录的行标签信息中的第一标签,并确定出不存在于当前记录的行标签信息中的第二标签;根据所述连通域统计信息,从所述多个连通域标签中确定出为所述第一标签的根节点标签或者中间节点标签的第三标签;将所述第二标签中除所述第三标签之外的标签确定为非生长标签,将所述第一标签以及所述第三标签确定为生长标签。In an embodiment, when the processor 1601 determines a growing label and a non-growing label from the plurality of connected domain labels according to the row label information currently recorded, it is specifically configured to: Determine the first label that exists in the line label information of the current record, and determine the second label that does not exist in the line label information of the current record; according to the connected domain statistical information, from the plurality of connected domain labels Is determined as the root node label of the first label or the third label of the intermediate node label; the labels other than the third label in the second label are determined as non-growth labels, and the first label The label and the third label are determined to be growth labels.
在一实施例中,所述连通域统计信息包括第二标识位,所述第二标识位用于记录连通域标签的生长标识,当所述第二标识位为第三标识时表示连通域标 签为非生长标签,当所述第二标识位为第四标识时表示连通域标签为生长标签。In an embodiment, the connected domain statistical information includes a second identification bit, the second identification bit is used to record the growth identification of the connected domain label, and when the second identification bit is the third identification, it indicates the connected domain label It is a non-growth tag, and when the second identification bit is a fourth tag, it indicates that the connected domain tag is a growth tag.
在一实施例中,所述处理器1601还用于:根据所述连通域统计信息以及所述标签图确定出所述待分析图像中不满足预设条件的连通域;对所述不满足预设条件的连通域中的像素点进行过滤。In an embodiment, the processor 1601 is further configured to: determine, according to the connected domain statistical information and the label map, a connected domain that does not meet a preset condition in the image to be analyzed; Set the pixels in the connected domain of the condition to filter.
在一实施例中,不满足预设条件是指:连通域中相连通的像素点的数量小于预设数值。In one embodiment, not satisfying the preset condition means that the number of connected pixels in the connected domain is less than the preset value.
在一实施例中,所述连通域统计信息保存在片内随机存取存储器RAM中,和/或,所述行标签信息保存在片内寄存器中,和/或,所述标签图保存在片外双倍速率同步动态随机存储器DDR中。In an embodiment, the connected domain statistical information is stored in an on-chip random access memory RAM, and/or the row label information is stored in an on-chip register, and/or, the label map is stored in a chip External double-rate synchronous dynamic random access memory DDR.
具体实现中,本发明实施例中所描述的处理器1601、通信接口1602、存储器1603可执行本发明实施例提供的一种连通域处理方法中所描述的实现方式,在此不再赘述。In specific implementation, the processor 1601, the communication interface 1602, and the memory 1603 described in the embodiment of the present invention can execute the implementation described in the method for processing a connected domain provided in the embodiment of the present invention, and details are not described herein again.
本发明实施例中,首先对待分析像素点进行连通域分析,并根据分析结果在标签图中为待分析像素点记录目标连通域标签;然后根据目标连通域标签更新连通域统计信息;其中,若目标连通域标签为根节点标签,则在连通域统计信息中记录第一类统计数据,若目标连通域标签为中间节点标签,则在连通域统计信息中记录第二类统计数据。采用上述方式,不仅可以有效降低DDR的读请求次数,还可以实现统计数据的复用,有效节省存储空间以及计算资源,扩大连通域处理的应用场景。In the embodiment of the present invention, the connected component analysis is performed on the pixel to be analyzed first, and the target connected component label is recorded in the label map for the pixel to be analyzed according to the analysis result; then the connected component statistical information is updated according to the target connected component label; where, if If the target connected domain label is the root node label, the first type of statistical data is recorded in the connected domain statistical information, and if the target connected domain label is an intermediate node label, the second type of statistical data is recorded in the connected domain statistical information. By adopting the above method, not only can the number of DDR read requests be effectively reduced, but also the multiplexing of statistical data can be realized, storage space and computing resources can be effectively saved, and the application scenarios of connected domain processing can be expanded.
本发明实施例还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,所述计算机程序被处理器执行时实现上述方法实施例所述的连通域处理方法。An embodiment of the present invention also provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the connected domain processing method described in the foregoing method embodiment is implemented.
本发明实施例还提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述方法实施例所述的连通域处理方法。The embodiment of the present invention also provides a computer program product containing instructions, which when run on a computer, causes the computer to execute the connected domain processing method described in the foregoing method embodiment.
需要说明的是,对于前述的各个方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某一些步骤可以采用其他顺序或者同时 进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明所必须的。It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described sequence of actions. Because according to the present invention, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the involved actions and modules are not necessarily required by the present invention.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(Random Access Memory,RAM)、磁盘或光盘等。A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium, and the storage medium can include: Flash disk, read-only memory (Read-Only Memory, ROM), random access device (Random Access Memory, RAM), magnetic disk or optical disk, etc.
以上对本发明实施例所提供的一种连通域处理方法及数据处理设备进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The above describes in detail a connected domain processing method and data processing equipment provided by the embodiments of the present invention. Specific examples are used in this article to explain the principles and implementation of the present invention. The description of the above embodiments is only for help Understand the method of the present invention and its core idea; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and the scope of application. It should be understood as a limitation of the present invention.

Claims (39)

  1. 一种连通域处理方法,其特征在于,所述方法包括:A connected domain processing method, characterized in that the method includes:
    获取待分析图像,对所述待分析图像中当前的待分析像素点进行连通域分析,并根据分析结果在所述待分析图像的标签图中为所述待分析像素点记录目标连通域标签;Acquiring an image to be analyzed, performing a connected domain analysis on the current pixel to be analyzed in the image to be analyzed, and recording a target connected domain label for the pixel to be analyzed in the label map of the image to be analyzed according to the analysis result;
    根据所述目标连通域标签更新所述待分析图像的连通域统计信息;Updating the connected domain statistical information of the image to be analyzed according to the target connected domain label;
    其中,在对所述连通域统计信息进行更新时,若所述目标连通域标签为根节点标签,则在所述连通域统计信息中为所述目标连通域标签记录第一类统计数据,所述第一类统计数据为数目数据,所述数目数据用于指示标记为所述目标连通域标签以及标记的连通域标签指向所述目标连通域标签的像素点的个数;若所述目标连通域标签为中间节点标签,则在所述连通域统计信息中为所述目标连通域标签记录第二类统计数据,所述第二类统计数据为指针数据,所述指针数据用于指示所述目标连通域标签所指向的根节点标签。Wherein, when the connected component statistical information is updated, if the target connected component label is a root node label, then the first type of statistical data is recorded for the target connected component label in the connected component statistical information, so The first type of statistical data is number data, and the number data is used to indicate the number of pixels marked as the target connected domain label and the marked connected domain label pointing to the target connected domain label; if the target is connected If the domain label is an intermediate node label, then the second type of statistical data is recorded for the target connected domain label in the connected domain statistical information, the second type of statistical data is pointer data, and the pointer data is used to indicate the The label of the root node pointed to by the target connected domain label.
  2. 根据权利要求1所述的方法,其特征在于,所述连通域统计信息包括第一标识位和数据位,其中,所述第一标识位用于表示所述数据位记录的统计数据的类型,所述数据位用于表示为所述目标连通域标签记录的统计数据;当所述第一标识位为第一标识时,所述数据位为所述目标连通域标签记录的是第一类统计数据,当所述第一标识位为第二标识时,所述数据位为所述目标连通域标签记录的是第二类统计数据。The method according to claim 1, wherein the connected domain statistical information includes a first identification bit and a data bit, wherein the first identification bit is used to indicate the type of statistical data recorded by the data bit, The data bit is used to represent the statistical data recorded for the target connected domain label; when the first identification bit is the first identifier, the data bit is the first type of statistics recorded for the target connected domain label Data. When the first identification bit is the second identification, the data bit records the second type of statistical data for the target connected domain tag.
  3. 根据权利要求2所述的方法,其特征在于,所述对所述待分析图像中当前的待分析像素点进行连通域分析,包括:The method according to claim 2, wherein the performing connected domain analysis on the current pixel to be analyzed in the image to be analyzed comprises:
    从所述待分析图像中确定出与当前的待分析像素点相邻的相邻像素点;Determining adjacent pixels adjacent to the current pixel to be analyzed from the image to be analyzed;
    根据所述相邻像素点对所述待分析像素点进行连通域分析,确定出所述待分析像素点的目标连通域标签。A connected domain analysis is performed on the pixel to be analyzed according to the adjacent pixels, and a target connected domain label of the pixel to be analyzed is determined.
  4. 根据权利要求3所述的方法,其特征在于,所述相邻像素点包括:与所述待分析像素点在同一列中上方向上相邻的第一像素点,和/或,与所述待分 析像素点在同一行中左方向上相邻的第二像素点。The method according to claim 3, wherein the adjacent pixel points comprise: the first pixel point adjacent to the upper direction in the same column as the pixel point to be analyzed, and/or, and the The pixel to be analyzed is the second pixel adjacent to the left in the same row.
  5. 根据权利要求4所述的方法,其特征在于,所述根据所述相邻像素点对所述待分析像素点进行连通域分析,确定出所述待分析像素点的目标连通域标签,包括:The method according to claim 4, wherein the performing connected domain analysis on the pixel to be analyzed according to the neighboring pixels to determine the target connected domain label of the pixel to be analyzed comprises:
    根据所述第一像素点对所述待分析像素点进行连通域分析;Performing connected domain analysis on the pixel to be analyzed according to the first pixel;
    若确定出所述待分析像素点与所述第一像素点连通,则将所述第一像素点的连通域标签作为所述待分析像素点的目标连通域标签。If it is determined that the pixel to be analyzed is connected to the first pixel, the connected region label of the first pixel is used as the target connected region label of the pixel to be analyzed.
  6. 根据权利要求4所述的方法,其特征在于,所述根据所述相邻像素点对所述待分析像素点进行连通域分析,确定出所述待分析像素点的目标连通域标签,包括:The method according to claim 4, wherein the performing connected domain analysis on the pixel to be analyzed according to the neighboring pixels to determine the target connected domain label of the pixel to be analyzed comprises:
    根据所述第二像素点对所述待分析像素点进行连通域分析;Performing connected domain analysis on the pixel to be analyzed according to the second pixel;
    若确定出所述待分析像素点与所述第二像素点连通,则将所述第二像素点的连通域标签作为所述待分析像素点的目标连通域标签。If it is determined that the pixel to be analyzed is connected to the second pixel, the connected region label of the second pixel is used as the target connected region label of the pixel to be analyzed.
  7. 根据权利要求4所述的方法,其特征在于,所述根据所述相邻像素点对所述待分析像素点进行连通域分析,确定出所述待分析像素点的目标连通域标签,包括:The method according to claim 4, wherein the performing connected domain analysis on the pixel to be analyzed according to the neighboring pixels to determine the target connected domain label of the pixel to be analyzed comprises:
    根据所述第一像素点以及所述第二像素点对所述待分析像素点进行连通域分析;Performing connected domain analysis on the pixel to be analyzed according to the first pixel and the second pixel;
    若确定出所述待分析像素点与所述第一像素点以及所述第二像素点均连通,则将所述第一像素点的连通域标签以及所述第二像素点的连通域标签中标签值最小的连通域标签作为所述待分析像素点的目标连通域标签。If it is determined that the pixel to be analyzed is connected to the first pixel and the second pixel, then the connected domain label of the first pixel and the connected domain label of the second pixel are The connected component label with the smallest label value is used as the target connected component label of the pixel to be analyzed.
  8. 根据权利要求7所述的方法,其特征在于,所述方法还包括:The method according to claim 7, wherein the method further comprises:
    将所述第一像素点的连通域标签以及所述第二像素点的连通域标签中标签值最大的连通域标签确定为指向所述目标连通域标签的中间节点标签;Determining the connected component label with the largest label value among the connected component label of the first pixel and the connected component label of the second pixel as an intermediate node label pointing to the target connected component label;
    对所述连通域统计信息中所述标签值最大的连通域标签进行更改。Change the connected domain label with the largest label value in the connected domain statistical information.
  9. 根据权利要求8所述的方法,其特征在于,所述对所述连通域统计信息中所述标签值最大的连通域标签进行更改,包括:The method according to claim 8, wherein the changing the connected domain label with the largest label value in the connected domain statistical information comprises:
    将所述连通域统计信息中所述标签值最大的连通域标签对应的第一标识位调整为所述第二标识;Adjusting the first identification bit corresponding to the connected domain label with the largest label value in the connected domain statistical information to the second identification;
    在所述连通域统计信息中所述标签值最大的连通域标签对应的数据位,为所述标签值最大的连通域标签记录第二类统计数据,记录的第二类统计数据指示所述标签值最大的连通域标签指向所述目标连通域标签。In the connected domain statistical information, the data bit corresponding to the connected domain label with the largest label value is recorded for the connected domain label with the largest label value, and the recorded second type statistical data indicates the label The connected component label with the largest value points to the target connected component label.
  10. 根据权利要求7至9中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 7 to 9, wherein the method further comprises:
    若确定出所述待分析像素点与所述第一像素点以及所述第二像素点均不连通,则将预设的多个连通域标签中未被使用的一个连通域标签作为所述待分析像素点的目标连通域标签。If it is determined that the pixel to be analyzed is not connected to the first pixel and the second pixel, then an unused connected domain label among a plurality of preset connected domain labels is used as the to-be-analyzed pixel. Analyze the target connected domain label of the pixel.
  11. 根据权利要求4至10中任一项所述的方法,其特征在于,与所述待分析像素点在同一列中上方向上相邻的第一像素点的连通域标签被记录在行标签信息中;所述行标签信息中还包括位于所述待分析像素点同一行中左方向上的像素点的连通域标签,以及位于所述第一像素点同一行中右方向上的像素点的连通域标签。The method according to any one of claims 4 to 10, wherein the connected domain label of the first pixel that is adjacent in the upper direction in the same column as the pixel to be analyzed is recorded in the row label information The line label information also includes the connected domain label of the pixel located in the left direction in the same row of the pixel to be analyzed, and the connected domain label of the pixel located in the right direction in the same row of the first pixel Domain label.
  12. 根据权利要求11所述的方法,其特征在于,所述方法还包括:The method of claim 11, wherein the method further comprises:
    在所述待分析像素点连通域分析完成之后,根据确定出的所述待分析像素点的目标连通域标签对所述行标签信息进行更新。After the connected domain analysis of the pixel to be analyzed is completed, the row label information is updated according to the determined target connected domain label of the pixel to be analyzed.
  13. 根据权利要求12所述的方法,其特征在于,所述方法还包括:The method of claim 12, wherein the method further comprises:
    在预设的多个连通域标签使用完之后,根据当前记录的行标签信息从所述多个连通域标签中确定出生长标签和非生长标签;After the multiple preset connected domain labels are used up, determine the growing label and the non-growing label from the multiple connected domain labels according to the row label information currently recorded;
    根据所述非生长标签对所述待分析图像中未完成连通域分析的像素点进 行连通域分析。Perform connected domain analysis on pixels in the image to be analyzed that have not completed connected domain analysis according to the non-growth tag.
  14. 根据权利要求13所述的方法,其特征在于,所述根据当前记录的行标签信息从所述多个连通域标签中确定出生长标签和非生长标签,包括:The method according to claim 13, wherein the determining a growing label and a non- growing label from the plurality of connected domain labels according to the row label information of the current record comprises:
    从所述多个连通域标签中确定出存在于当前记录的行标签信息中的第一标签,并将所述第一标签确定为生长标签;Determine the first label existing in the row label information of the current record from the plurality of connected domain labels, and determine the first label as a growth label;
    从所述多个连通域标签中确定出不存在于当前记录的行标签信息中的第二标签,并将所述第二标签确定为非生长标签。A second label that does not exist in the row label information of the current record is determined from the plurality of connected domain labels, and the second label is determined as a non-growing label.
  15. 根据权利要求13所述的方法,其特征在于,所述根据当前记录的行标签信息从所述多个连通域标签中确定出生长标签和非生长标签,包括:The method according to claim 13, wherein the determining a growing label and a non- growing label from the plurality of connected domain labels according to the row label information of the current record comprises:
    从所述多个连通域标签中确定出存在于当前记录的行标签信息中的第一标签,并确定出不存在于当前记录的行标签信息中的第二标签;Determine the first label existing in the row label information of the current record from the plurality of connected domain labels, and determine the second label that does not exist in the row label information of the current record;
    根据所述连通域统计信息,从所述多个连通域标签中确定出为所述第一标签的根节点标签或者中间节点标签的第三标签;Determining, from the plurality of connected domain labels, a third label that is the root node label of the first label or the intermediate node label according to the connected domain statistical information;
    将所述第二标签中除所述第三标签之外的标签确定为非生长标签,将所述第一标签以及所述第三标签确定为生长标签。The labels other than the third label among the second labels are determined as non-growth labels, and the first label and the third label are determined as growth labels.
  16. 根据权利要求13至15中任一项所述的方法,其特征在于,所述连通域统计信息包括第二标识位,所述第二标识位用于记录连通域标签的生长标识,当所述第二标识位为第三标识时表示连通域标签为非生长标签,当所述第二标识位为第四标识时表示连通域标签为生长标签。The method according to any one of claims 13 to 15, wherein the connected domain statistical information includes a second identification bit, and the second identification bit is used to record the growth identification of the connected domain label. When the second identification bit is the third identification, it indicates that the connected domain label is a non-growing label, and when the second identification bit is the fourth identification, it indicates that the connected domain label is a growing label.
  17. 根据权利要求1至16中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 16, wherein the method further comprises:
    根据所述连通域统计信息以及所述标签图确定出所述待分析图像中不满足预设条件的连通域;Determine, according to the connected domain statistical information and the label map, connected domains that do not meet a preset condition in the image to be analyzed;
    对所述不满足预设条件的连通域中的像素点进行过滤。Filtering the pixels in the connected domain that do not meet the preset condition.
  18. 根据权利要求17所述的方法,其特征在于,不满足预设条件是指:连通域中相连通的像素点的数量小于预设数值。The method according to claim 17, wherein the failure to satisfy the preset condition means that the number of connected pixels in the connected domain is less than the preset value.
  19. 根据权利要求11或12所述的方法,其特征在于,所述连通域统计信息保存在片内随机存取存储器RAM中,和/或,所述行标签信息保存在片内寄存器中,和/或,所述标签图保存在片外双倍速率同步动态随机存储器DDR中。The method according to claim 11 or 12, wherein the connected domain statistical information is stored in an on-chip random access memory (RAM), and/or the row label information is stored in an on-chip register, and/ Or, the label image is stored in an off-chip double-rate synchronous dynamic random access memory DDR.
  20. 一种数据处理设备,其特征在于,包括:存储器和处理器,A data processing device, characterized by comprising: a memory and a processor,
    所述存储器,用于存储程序指令;The memory is used to store program instructions;
    所述处理器,用于执行所述存储器存储的程序指令,当所述程序指令被执行时,所述处理器用于:The processor is configured to execute program instructions stored in the memory, and when the program instructions are executed, the processor is configured to:
    获取待分析图像,对所述待分析图像中当前的待分析像素点进行连通域分析,并根据分析结果在所述待分析图像的标签图中为所述待分析像素点记录目标连通域标签;Acquiring an image to be analyzed, performing a connected domain analysis on the current pixel to be analyzed in the image to be analyzed, and recording a target connected domain label for the pixel to be analyzed in the label map of the image to be analyzed according to the analysis result;
    根据所述目标连通域标签更新所述待分析图像的连通域统计信息;Updating the connected domain statistical information of the image to be analyzed according to the target connected domain label;
    其中,在对所述连通域统计信息进行更新时,若所述目标连通域标签为根节点标签,则在所述连通域统计信息中为所述目标连通域标签记录第一类统计数据,所述第一类统计数据为数目数据,所述数目数据用于指示标记为所述目标连通域标签以及标记的连通域标签指向所述目标连通域标签的像素点的个数;若所述目标连通域标签为中间节点标签,则在所述连通域统计信息中为所述目标连通域标签记录第二类统计数据,所述第二类统计数据为指针数据,所述指针数据用于指示所述目标连通域标签所指向的根节点标签。Wherein, when the connected component statistical information is updated, if the target connected component label is a root node label, then the first type of statistical data is recorded for the target connected component label in the connected component statistical information, so The first type of statistical data is number data, and the number data is used to indicate the number of pixels marked as the target connected domain label and the marked connected domain label pointing to the target connected domain label; if the target is connected If the domain label is an intermediate node label, then the second type of statistical data is recorded for the target connected domain label in the connected domain statistical information, the second type of statistical data is pointer data, and the pointer data is used to indicate the The label of the root node pointed to by the target connected domain label.
  21. 根据权利要求20所述的数据处理设备,其特征在于,所述连通域统计信息包括第一标识位和数据位,其中,所述第一标识位用于表示所述数据位记录的统计数据的类型,所述数据位用于表示为所述目标连通域标签记录的统计数据;当所述第一标识位为第一标识时,所述数据位为所述目标连通域标签记录的是第一类统计数据,当所述第一标识位为第二标识时,所述数据位为所述目标连通域标签记录的是第二类统计数据。The data processing device according to claim 20, wherein the connected domain statistical information includes a first identification bit and a data bit, wherein the first identification bit is used to indicate the statistical data recorded by the data bit Type, the data bit is used to indicate the statistical data recorded for the target connected domain label; when the first identification bit is the first identifier, the data bit is the first Type statistical data, when the first identification bit is the second identification, the data bit records the second type of statistical data for the target connected domain tag.
  22. 根据权利要求21所述的数据处理设备,其特征在于,所述处理器对所述待分析图像中当前的待分析像素点进行连通域分析时,具体用于:The data processing device according to claim 21, wherein when the processor performs connected domain analysis on the current pixel to be analyzed in the image to be analyzed, it is specifically configured to:
    从所述待分析图像中确定出与当前的待分析像素点相邻的相邻像素点;Determining adjacent pixels adjacent to the current pixel to be analyzed from the image to be analyzed;
    根据所述相邻像素点对所述待分析像素点进行连通域分析,确定出所述待分析像素点的目标连通域标签。A connected domain analysis is performed on the pixel to be analyzed according to the adjacent pixels, and a target connected domain label of the pixel to be analyzed is determined.
  23. 根据权利要求22所述的数据处理设备,其特征在于,所述相邻像素点包括:与所述待分析像素点在同一列中上方向上相邻的第一像素点,和/或,与所述待分析像素点在同一行中左方向上相邻的第二像素点。The data processing device according to claim 22, wherein the adjacent pixel points comprise: a first pixel point adjacent to the upper direction in the same column as the pixel to be analyzed, and/or, and The pixel to be analyzed is a second pixel adjacent to the left in the same row.
  24. 根据权利要求23所述的数据处理设备,其特征在于,所述处理器根据所述相邻像素点对所述待分析像素点进行连通域分析,确定出所述待分析像素点的目标连通域标签时,具体用于:The data processing device according to claim 23, wherein the processor performs a connected domain analysis on the pixel to be analyzed according to the adjacent pixels to determine the target connected domain of the pixel to be analyzed When labeling, specifically used for:
    根据所述第一像素点对所述待分析像素点进行连通域分析;Performing connected domain analysis on the pixel to be analyzed according to the first pixel;
    若确定出所述待分析像素点与所述第一像素点连通,则将所述第一像素点的连通域标签作为所述待分析像素点的目标连通域标签。If it is determined that the pixel to be analyzed is connected to the first pixel, the connected region label of the first pixel is used as the target connected region label of the pixel to be analyzed.
  25. 根据权利要求23所述的数据处理设备,其特征在于,所述处理器根据所述相邻像素点对所述待分析像素点进行连通域分析,确定出所述待分析像素点的目标连通域标签时,具体用于:The data processing device according to claim 23, wherein the processor performs a connected domain analysis on the pixel to be analyzed according to the adjacent pixels to determine the target connected domain of the pixel to be analyzed When labeling, specifically used for:
    根据所述第二像素点对所述待分析像素点进行连通域分析;Performing connected domain analysis on the pixel to be analyzed according to the second pixel;
    若确定出所述待分析像素点与所述第二像素点连通,则将所述第二像素点的连通域标签作为所述待分析像素点的目标连通域标签。If it is determined that the pixel to be analyzed is connected to the second pixel, the connected region label of the second pixel is used as the target connected region label of the pixel to be analyzed.
  26. 根据权利要求23所述的数据处理设备,其特征在于,所述处理器根据所述相邻像素点对所述待分析像素点进行连通域分析,确定出所述待分析像素点的目标连通域标签时,具体用于:The data processing device according to claim 23, wherein the processor performs a connected domain analysis on the pixel to be analyzed according to the adjacent pixels to determine the target connected domain of the pixel to be analyzed When labeling, specifically used for:
    根据所述第一像素点以及所述第二像素点对所述待分析像素点进行连通 域分析;Performing connected domain analysis on the pixel to be analyzed according to the first pixel and the second pixel;
    若确定出所述待分析像素点与所述第一像素点以及所述第二像素点均连通,则将所述第一像素点的连通域标签以及所述第二像素点的连通域标签中标签值最小的连通域标签作为所述待分析像素点的目标连通域标签。If it is determined that the pixel to be analyzed is connected to the first pixel and the second pixel, then the connected domain label of the first pixel and the connected domain label of the second pixel are The connected component label with the smallest label value is used as the target connected component label of the pixel to be analyzed.
  27. 根据权利要求26所述的数据处理设备,其特征在于,所述处理器还用于:The data processing device according to claim 26, wherein the processor is further configured to:
    将所述第一像素点的连通域标签以及所述第二像素点的连通域标签中标签值最大的连通域标签确定为指向所述目标连通域标签的中间节点标签;Determining the connected component label with the largest label value among the connected component label of the first pixel and the connected component label of the second pixel as an intermediate node label pointing to the target connected component label;
    对所述连通域统计信息中所述标签值最大的连通域标签进行更改。Change the connected domain label with the largest label value in the connected domain statistical information.
  28. 根据权利要求27所述的数据处理设备,其特征在于,所述处理器对所述连通域统计信息中所述标签值最大的连通域标签进行更改时,具体用于:The data processing device according to claim 27, wherein when the processor changes the connected domain label with the largest label value in the connected domain statistical information, it is specifically configured to:
    将所述连通域统计信息中所述标签值最大的连通域标签对应的第一标识位调整为所述第二标识;Adjusting the first identification bit corresponding to the connected domain label with the largest label value in the connected domain statistical information to the second identification;
    在所述连通域统计信息中所述标签值最大的连通域标签对应的数据位,为所述标签值最大的连通域标签记录第二类统计数据,记录的第二类统计数据指示所述标签值最大的连通域标签指向所述目标连通域标签。In the connected domain statistical information, the data bit corresponding to the connected domain label with the largest label value is recorded for the connected domain label with the largest label value, and the recorded second type statistical data indicates the label The connected component label with the largest value points to the target connected component label.
  29. 根据权利要求26至28中任一项所述的数据处理设备,其特征在于,所述处理器还用于:The data processing device according to any one of claims 26 to 28, wherein the processor is further configured to:
    若确定出所述待分析像素点与所述第一像素点以及所述第二像素点均不连通,则将预设的多个连通域标签中未被使用的一个连通域标签作为所述待分析像素点的目标连通域标签。If it is determined that the pixel to be analyzed is not connected to the first pixel and the second pixel, then an unused connected domain label among a plurality of preset connected domain labels is used as the to-be-analyzed pixel. Analyze the target connected domain label of the pixel.
  30. 根据权利要求23至29中任一项所述的数据处理设备,其特征在于,与所述待分析像素点在同一列中上方向上相邻的第一像素点的连通域标签被记录在行标签信息中;所述行标签信息中还包括位于所述待分析像素点同一行中左方向上的像素点的连通域标签,以及位于所述第一像素点同一行中右方向上 的像素点的连通域标签。The data processing device according to any one of claims 23 to 29, wherein the connected domain label of the first pixel that is adjacent in the upper direction in the same column as the pixel to be analyzed is recorded in the row In the label information; the row label information also includes a connected domain label of a pixel located in the left direction in the same row of the pixel to be analyzed, and a pixel located in the right direction in the same row of the first pixel The connected domain label.
  31. 根据权利要求30所述的数据处理设备,其特征在于,所述处理器还用于:The data processing device according to claim 30, wherein the processor is further configured to:
    在所述待分析像素点连通域分析完成之后,根据确定出的所述待分析像素点的目标连通域标签对所述行标签信息进行更新。After the connected domain analysis of the pixel to be analyzed is completed, the row label information is updated according to the determined target connected domain label of the pixel to be analyzed.
  32. 根据权利要求31所述的数据处理设备,其特征在于,所述处理器还用于:The data processing device according to claim 31, wherein the processor is further configured to:
    在预设的多个连通域标签使用完之后,根据当前记录的行标签信息从所述多个连通域标签中确定出生长标签和非生长标签;After the multiple preset connected domain labels are used up, determine the growing label and the non-growing label from the multiple connected domain labels according to the row label information currently recorded;
    根据所述非生长标签对所述待分析图像中未完成连通域分析的像素点进行连通域分析。The connected area analysis is performed on the pixels in the image to be analyzed that have not completed the connected area analysis according to the non-growth label.
  33. 根据权利要求32所述的数据处理设备,其特征在于,所述处理器根据当前记录的行标签信息从所述多个连通域标签中确定出生长标签和非生长标签时,具体用于:The data processing device according to claim 32, wherein when the processor determines a growing label and a non-growing label from the plurality of connected domain labels according to the row label information currently recorded, it is specifically configured to:
    从所述多个连通域标签中确定出存在于当前记录的行标签信息中的第一标签,并将所述第一标签确定为生长标签;Determine the first label existing in the row label information of the current record from the plurality of connected domain labels, and determine the first label as a growth label;
    从所述多个连通域标签中确定出不存在于当前记录的行标签信息中的第二标签,并将所述第二标签确定为非生长标签。A second label that does not exist in the row label information of the current record is determined from the plurality of connected domain labels, and the second label is determined as a non-growing label.
  34. 根据权利要求32所述的数据处理设备,其特征在于,所述处理器根据当前记录的行标签信息从所述多个连通域标签中确定出生长标签和非生长标签时,具体用于:The data processing device according to claim 32, wherein when the processor determines a growing label and a non-growing label from the plurality of connected domain labels according to the row label information currently recorded, it is specifically configured to:
    从所述多个连通域标签中确定出存在于当前记录的行标签信息中的第一标签,并确定出不存在于当前记录的行标签信息中的第二标签;Determine the first label existing in the row label information of the current record from the plurality of connected domain labels, and determine the second label that does not exist in the row label information of the current record;
    根据所述连通域统计信息,从所述多个连通域标签中确定出为所述第一标签的根节点标签或者中间节点标签的第三标签;Determining, from the plurality of connected domain labels, a third label that is the root node label of the first label or the intermediate node label according to the connected domain statistical information;
    将所述第二标签中除所述第三标签之外的标签确定为非生长标签,将所述第一标签以及所述第三标签确定为生长标签。The labels other than the third label among the second labels are determined as non-growth labels, and the first label and the third label are determined as growth labels.
  35. 根据权利要求32至34中任一项所述的数据处理设备,其特征在于,所述连通域统计信息包括第二标识位,所述第二标识位用于记录连通域标签的生长标识,当所述第二标识位为第三标识时表示连通域标签为非生长标签,当所述第二标识位为第四标识时表示连通域标签为生长标签。The data processing device according to any one of claims 32 to 34, wherein the connected domain statistical information includes a second identification bit, and the second identification bit is used to record the growth identifier of the connected domain label, when When the second identification bit is a third identification, it indicates that the connected domain label is a non-growth tag, and when the second identification bit is a fourth identification, it indicates that the connected domain label is a growing tag.
  36. 根据权利要求20至35中任一项所述的数据处理设备,其特征在于,所述处理器还用于:The data processing device according to any one of claims 20 to 35, wherein the processor is further configured to:
    根据所述连通域统计信息以及所述标签图确定出所述待分析图像中不满足预设条件的连通域;Determine, according to the connected domain statistical information and the label map, connected domains that do not meet a preset condition in the image to be analyzed;
    对所述不满足预设条件的连通域中的像素点进行过滤。Filtering the pixels in the connected domain that do not meet the preset condition.
  37. 根据权利要求36所述的数据处理设备,其特征在于,不满足预设条件是指:连通域中相连通的像素点的数量小于预设数值。The data processing device according to claim 36, wherein the failure to satisfy the preset condition means that the number of connected pixels in the connected domain is less than a preset value.
  38. 根据权利要求30或31所述的数据处理设备,其特征在于,所述连通域统计信息保存在片内随机存取存储器RAM中,和/或,所述行标签信息保存在片内寄存器中,和/或,所述标签图保存在片外双倍速率同步动态随机存储器DDR中。The data processing device according to claim 30 or 31, wherein the connected domain statistical information is stored in an on-chip random access memory (RAM), and/or the row label information is stored in an on-chip register, And/or, the label map is stored in an off-chip double-rate synchronous dynamic random access memory DDR.
  39. 一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,其特征在于:所述计算机程序被处理器执行时实现如权利要求1至19中任一项所述方法的步骤。A computer-readable storage medium in which a computer program is stored, characterized in that: when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 19 are implemented .
PCT/CN2019/080583 2019-03-29 2019-03-29 Connected domain processing method, data processing device and computer readable storage medium WO2020198997A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/080583 WO2020198997A1 (en) 2019-03-29 2019-03-29 Connected domain processing method, data processing device and computer readable storage medium
CN201980005003.5A CN111213178A (en) 2019-03-29 2019-03-29 Connected domain processing method, data processing device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/080583 WO2020198997A1 (en) 2019-03-29 2019-03-29 Connected domain processing method, data processing device and computer readable storage medium

Publications (1)

Publication Number Publication Date
WO2020198997A1 true WO2020198997A1 (en) 2020-10-08

Family

ID=70790113

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/080583 WO2020198997A1 (en) 2019-03-29 2019-03-29 Connected domain processing method, data processing device and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN111213178A (en)
WO (1) WO2020198997A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112927206A (en) * 2021-03-01 2021-06-08 安徽慧视金瞳科技有限公司 Special-shaped material sorting method suitable for linear array CCD
CN114550129A (en) * 2022-01-26 2022-05-27 江苏联合职业技术学院苏州工业园区分院 Machine learning model processing method and system based on data set
CN115661119A (en) * 2022-11-11 2023-01-31 北京鉴智科技有限公司 Retrieval method and device of connected domain and connected domain retriever
CN118154458A (en) * 2024-05-10 2024-06-07 宝鸡拓普达钛业有限公司 Filtering processing method of machine tool cutter image based on complex industrial environment

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112017218B (en) * 2020-09-09 2024-08-02 杭州海康威视数字技术股份有限公司 Image registration method and device, electronic equipment and storage medium
CN115049649B (en) * 2022-08-12 2022-11-11 山东振鹏建筑钢品科技有限公司 Reinforcing steel bar polishing and rust removing control method based on corrosion degree
CN116756071B (en) * 2023-08-21 2023-12-22 腾讯科技(深圳)有限公司 Data transmission method, apparatus, device, storage medium and computer program product
CN116993798B (en) * 2023-09-28 2024-03-19 荣耀终端有限公司 Image processing method and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030118236A1 (en) * 2001-12-26 2003-06-26 Nina Kung Grayscale image connected components segmentation
CN104503731A (en) * 2014-12-15 2015-04-08 柳州职业技术学院 Quick identification method for binary image connected domain marker

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103065314B (en) * 2012-12-28 2015-07-15 中国电子科技集团公司第五十四研究所 Image communicated domain rapid marking method based on linear description
CN103400125B (en) * 2013-07-08 2017-02-01 西安交通大学 Double-scanning double-labeling method for image connected domain
CN105740861A (en) * 2016-02-02 2016-07-06 大连楼兰科技股份有限公司 Method for quickly making statistics on labeled connected domains in image
CN107833238B (en) * 2017-11-14 2020-05-01 京东方科技集团股份有限公司 Maximum connected domain marking method, target tracking method and augmented reality/virtual reality device
WO2019127416A1 (en) * 2017-12-29 2019-07-04 深圳市大疆创新科技有限公司 Connected domain detecting method, circuit, device and computer-readable storage medium
CN108345888A (en) * 2018-02-11 2018-07-31 浙江华睿科技有限公司 A kind of connected domain extracting method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030118236A1 (en) * 2001-12-26 2003-06-26 Nina Kung Grayscale image connected components segmentation
CN104503731A (en) * 2014-12-15 2015-04-08 柳州职业技术学院 Quick identification method for binary image connected domain marker

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
LUO, ZHIZAO ET AL.: "Labeling Connected Components Algorithm Based on Array of Union-Find", JOURNAL OF HANGZHOU NORMAL UNIVERSITY (NATURAL SCIENCE EDITION), vol. 10, no. 1, 31 January 2011 (2011-01-31), ISSN: 1674-232X, DOI: 20191129095135Y *
ZHANG, CHUNMING ET AL.: "An Improvement of Common Two-Scanning Algorithm", AEROSPACE CONTROL AND APPLICATION, vol. 40, no. 5, 30 October 2014 (2014-10-30), ISSN: 1674-1579, DOI: 20191129100340Y *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112927206A (en) * 2021-03-01 2021-06-08 安徽慧视金瞳科技有限公司 Special-shaped material sorting method suitable for linear array CCD
CN112927206B (en) * 2021-03-01 2023-05-30 安徽慧视金瞳科技有限公司 Special-shape material sorting method suitable for linear array CCD
CN114550129A (en) * 2022-01-26 2022-05-27 江苏联合职业技术学院苏州工业园区分院 Machine learning model processing method and system based on data set
CN115661119A (en) * 2022-11-11 2023-01-31 北京鉴智科技有限公司 Retrieval method and device of connected domain and connected domain retriever
CN118154458A (en) * 2024-05-10 2024-06-07 宝鸡拓普达钛业有限公司 Filtering processing method of machine tool cutter image based on complex industrial environment

Also Published As

Publication number Publication date
CN111213178A (en) 2020-05-29

Similar Documents

Publication Publication Date Title
WO2020198997A1 (en) Connected domain processing method, data processing device and computer readable storage medium
WO2022077917A1 (en) Instance segmentation model sample screening method and apparatus, computer device and medium
US20200117943A1 (en) Method and apparatus for positioning text over image, electronic apparatus, and storage medium
US20210073569A1 (en) Pooling device and pooling method
WO2017181892A1 (en) Foreground segmentation method and device
JP2000295532A (en) Image processing unit, image processing method, recording medium and image processing system
CN114117128A (en) Method, system and equipment for video annotation
CN106201778B (en) Information processing method and storage equipment
CN111861883A (en) Multi-channel video splicing method based on synchronous integral SURF algorithm
CN106407940A (en) Port water area image extraction method and system
KR20180067909A (en) Apparatus and method for segmenting image
CN110622214A (en) Fast progressive method for spatio-temporal video segmentation based on hyper-voxels
CN103970901A (en) Geographic information graphic data integration method
US11270439B2 (en) Histogram-based method for auto segmentation of integrated circuit structures from SEM images
CN113989744A (en) Pedestrian target detection method and system based on oversized high-resolution image
CN114998595A (en) Weak supervision semantic segmentation method, semantic segmentation method and readable storage medium
Kristensen et al. Real-time extraction of maximally stable extremal regions on an FPGA
CN108876701B (en) Run-length-based single-scanning connected domain marking method and hardware structure thereof
US11256949B2 (en) Guided sparse feature matching via coarsely defined dense matches
CN114782688A (en) Natural image segmentation method and system based on tensor subspace clustering
US8666164B2 (en) System and method for modeling a region segmented image
CN101930593A (en) Single object image extracting system and method
EP0460968A2 (en) Local hierarchical processing focus shift within an image
CN111310824A (en) Multi-angle dense target detection inhibition optimization method and equipment
CN106408027A (en) Method and system for extracting image of logistics warehouse behind storage yard at port

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19922866

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19922866

Country of ref document: EP

Kind code of ref document: A1