CN111213178A - 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
CN111213178A
CN111213178A CN201980005003.5A CN201980005003A CN111213178A CN 111213178 A CN111213178 A CN 111213178A CN 201980005003 A CN201980005003 A CN 201980005003A CN 111213178 A CN111213178 A CN 111213178A
Authority
CN
China
Prior art keywords
label
connected domain
pixel point
analyzed
labels
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201980005003.5A
Other languages
Chinese (zh)
Inventor
李泽祥
高明明
杨康
李涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SZ DJI Technology Co Ltd
Shenzhen DJ Innovation Industry Co Ltd
Original Assignee
SZ DJI Technology Co Ltd
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 SZ DJI Technology Co Ltd filed Critical SZ DJI Technology Co Ltd
Publication of CN111213178A publication Critical patent/CN111213178A/en
Pending legal-status Critical Current

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

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, the method comprising: acquiring an image to be analyzed, performing connected domain analysis on a current pixel point to be analyzed in the image to be analyzed, and recording a target connected domain label for the pixel point to be analyzed in a label graph 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 the root node label, recording first-class statistical data for the target connected domain label in the connected domain statistical information, wherein the first-class statistical data is number data; and if the target connected domain label is the 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 invention not only can effectively reduce the read request times of DDR, but also can realize the multiplexing of statistical data, effectively save storage space and computing resources and enlarge the application scene of connected domain processing.

Description

Connected domain processing method, data processing device and computer readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a connected domain processing method, a data processing device, and a computer-readable storage medium.
Background
Connected domain processing is an important component of image recognition technology, and for example, connected domain processing can be performed on an image to realize license plate recognition, text recognition, subtitle recognition, vehicle tracking, pedestrian intrusion detection and the like. The connected domain processing method widely used in the industry at present is a connected domain processing method based on 'seed diffusion'. However, when the connected domain processing method based on "seed diffusion" is adopted, once the line-crossing processing occurs, a read request of an off-chip Double Data Rate (DDR) synchronous dynamic random access memory needs to be initiated. Since frequent access to DDR will occupy a lot of bandwidth resources, in practical use, only the "seed diffusion" based approach is usually adopted to perform connected domain processing on the smaller-sized image (e.g. 640 × 360 pixels). For larger images, downsampling is required before performing connected domain processing in a "seed diffusion" based manner, for example, downsampling an image with a size of 1280 × 720 pixels to 640 × 360 pixels for processing. However, the down-sampling operation may reduce the precision of the image and may affect the accuracy of the processing result. Therefore, a connected domain processing mode based on 'seed diffusion' needs a large number of DDR read requests, and application scenarios are very limited.
Disclosure of Invention
The embodiment of the invention discloses a connected domain processing method, data processing equipment and a computer readable storage medium, which can effectively reduce the read request times of DDR, realize the multiplexing of statistical data, effectively save storage space and computing resources and expand the application scene of connected domain processing.
The first aspect of the embodiments of the present invention discloses a connected domain processing method, where the method includes:
acquiring an image to be analyzed, performing connected domain analysis on a current pixel point to be analyzed in the image to be analyzed, and recording a target connected domain label for the pixel point to be analyzed in a label graph of the image to be analyzed according to an analysis result;
updating the connected domain statistical information of the image to be analyzed according to the target connected domain label;
when updating the connected domain statistical information, if the target connected domain label is a root node label, recording first-class statistical data for the target connected domain label in the connected domain statistical information, wherein the first-class statistical data is number data, and the number data is used for indicating the number of pixels which are marked as the target connected domain label and the number of pixels of the marked connected domain label pointing to the target connected domain label; 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, and the pointer data is used for indicating a root node label pointed by the target connected domain label.
A second aspect of the embodiments of the present invention discloses a data processing apparatus, including: a memory and a processor, the memory for storing program instructions;
the processor to execute the memory-stored program instructions, the processor to, when executed:
acquiring an image to be analyzed, performing connected domain analysis on a current pixel point to be analyzed in the image to be analyzed, and recording a target connected domain label for the pixel point to be analyzed in a label graph of the image to be analyzed according to an analysis result;
updating the connected domain statistical information of the image to be analyzed according to the target connected domain label;
when updating the connected domain statistical information, if the target connected domain label is a root node label, recording first-class statistical data for the target connected domain label in the connected domain statistical information, wherein the first-class statistical data is number data, and the number data is used for indicating the number of pixels which are marked as the target connected domain label and the number of pixels of the marked connected domain label pointing to the target connected domain label; 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, and the pointer data is used for indicating a root node label pointed by the target connected domain label.
A third aspect of the present invention discloses a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the method according to the first aspect.
In the embodiment of the invention, firstly, connected domain analysis is carried out on the pixel points to be analyzed, and target connected domain labels are recorded for the pixel points to be analyzed in a label graph according to the analysis result; then updating the statistical information of the connected domain according to the target connected domain label; if the target connected domain label is a root node label, first-class statistical data is recorded in the connected domain statistical information, and if the target connected domain label is a middle node label, second-class statistical data is recorded in the connected domain statistical information. By adopting the mode, the read request times of the DDR can be effectively reduced, the multiplexing of statistical data can be realized, the storage space and the computing resource are effectively saved, and the application scene of the connected domain processing is enlarged.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
FIG. 1 is a schematic diagram of a connected domain disclosed in a first embodiment of the present invention;
FIG. 2 is a schematic illustration of a label graph as disclosed in embodiments of the invention;
FIG. 3 is a diagram of a multi-way tree according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of a connected domain processing method according to a first embodiment of the present invention;
FIG. 5 is a schematic structural diagram of statistics information of a connected domain according to the first embodiment of the present invention;
FIG. 6 is a diagram illustrating the results of the analysis of connected components of the pixels in the first row of FIG. 1;
FIG. 7 is a diagram illustrating the result of the second row of pixel points in FIG. 1 after the analysis of the connected component area is completed;
fig. 8 is a flowchart illustrating a connected domain processing method according to a second embodiment of the present invention;
FIG. 9 is a schematic diagram of a connected domain disclosed in a second embodiment of the present invention;
FIG. 10 is a diagram illustrating row tag information according to an embodiment of the present invention;
FIG. 11 is a diagram illustrating a structure of statistics information of a connected domain according to a second embodiment of the present invention;
FIG. 12 is a schematic diagram of a connected domain disclosed in a third embodiment of the present invention;
FIG. 13 is a diagram illustrating a structure of statistics information of a connected domain according to a third embodiment of the present invention;
FIG. 14 is a diagram illustrating a structure of statistics information of a connected domain according to a fourth embodiment of the present invention;
FIG. 15 is a diagram illustrating a structure of statistics information of a connected domain according to a fifth embodiment of the present invention;
fig. 16 is a schematic structural diagram of a data processing device according to an embodiment of the present invention.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
The connected component processing method in the embodiment of the present invention is implemented based on a connected component analysis method of "pixel labeling", and for better understanding of the present solution, a connected component analysis method based on "pixel labeling" is first described below. The connected domain analysis mode based on the pixel mark can directly operate the original image, mainly aims to reduce the read request times of DDR in the connected domain analysis process, takes four-connected analysis as an example, and can only judge whether a pixel point to be analyzed is connected with a pixel point adjacent to the upper direction position and/or the left direction position of the pixel point to be analyzed. The data required in the connected domain analysis process includes: 1. connected component statistics, which may be denoted as result, may be used to record the number of pixel points labeled as connected component labels. Usually, the maximum value of the connected domain label is taken empirically. 2. Pointer data with the depth consistent with the maximum value of the connected domain label can be marked as pointer _ list, and is used for forming the connected domains into a multi-branch tree. 3. The label graph of the image to be analyzed can be marked as intlabel _ list, the depth of the label graph is consistent with the size of the image to be analyzed, and the label graph is used for storing the connected domain label of each pixel point in the image to be analyzed.
The following exemplifies a connected component analysis method based on "pixel labeling", and specifically takes four-connected component analysis as an example. Please refer to fig. 1, which is a schematic diagram of a connected domain according to a first embodiment of the present invention. As shown in fig. 1, fig. 1 represents an image to be analyzed, and each grid in the graph represents a pixel point of the image to be analyzed. And setting marking information for each grid according to the position of the grid in the image to be analyzed, or according to the position of the pixel point represented by the grid in the image to be analyzed. The marking information is used for indicating the number of rows and columns of the pixel points represented by the lattices or the lattices in the image to be analyzed, namely coordinate information; the first bit mark in the marking information is used for indicating the number of the located rows, and the second bit mark in the marking information is used for indicating the number of the located columns. For example, the mark information 22 indicates that the position of the grid or the pixel point represented by the grid is the second row and the second column in the image to be analyzed; for another example, the mark information 1b indicates that the grid or the pixel point represented by the grid is located in the first row and the eleventh column in the image to be analyzed.
In the figure, the grids filled with shadows represent effective pixel points in the image to be analyzed, and the grids (or white grids) not filled with shadows represent ineffective pixel points in the image to be analyzed; the plurality of cells filled with the shadows constitute a plurality of connected domains of the image to be analyzed. In the process of analyzing the image to be analyzed based on the connected domain analysis mode of the 'pixel mark', the effective pixel points and the ineffective pixel points in the image to be analyzed are not communicated, and the connected domain labels of the ineffective pixel points in the image to be analyzed can be directly determined as ineffective connected domain labels (such as numerical values 0); and determining effective pixel points in the image to be analyzed as pixel points to be analyzed. Then judging whether the pixel point to be analyzed is communicated with the pixel point endowed with the connected domain label or not, if the pixel point to be analyzed is communicated with the pixel point endowed with the connected domain label, determining a target connected domain label of the pixel point to be analyzed from the connected domain labels of the pixel points communicated with the pixel point to be analyzed; and if the pixel point to be analyzed is not communicated with the pixel point which is endowed with the connected domain label, endowing the pixel point to be analyzed with a new connected domain label, and determining the connected domain label endowed to the pixel point to be analyzed as the target connected domain label of the pixel point to be analyzed.
Specifically, the connected component statistics result, the pointer data pointer _ list, and the label graph intlabel _ list are initialized to 0. Assuming that the value of the maximum supported connected component label is 10, it means that the value of the connected component label that can be used is 1 to 10. In the process of performing connected component analysis on the image to be analyzed shown in fig. 1, the images are analyzed from left to right and from top to bottom. As can be seen from fig. 1, the first effective pixel point in the image to be analyzed is a pixel point indicated by the shadow filling lattice with the mark information being 12, which is hereinafter referred to as the pixel point 12 for short, and so on in the following description. Because there is no pixel point at the position of the "up" direction of the position of the pixel point 12 in the image to be analyzed, the pixel point 11 at the position of the "left" direction of the position of the pixel point 12 is an invalid pixel point and is not communicated with the pixel point 12; at this time, a new connected domain label needs to be allocated to the pixel 12, and the connected domain label 1 may be determined as the target connected domain label of the pixel 12. Then, setting the connected domain statistical data result [1] corresponding to the connected domain label 1 to 1, and setting the pointer data point _ list [1] corresponding to the connected domain label 1 to 1, which indicates that the connected domain label 1 is a root node label. Further, please refer to fig. 2, which is a schematic diagram of a label graph according to an embodiment of the present invention, specifically, the label graph of the image to be analyzed shown in fig. 1. As shown in fig. 2, after determining that the target connected component label of the pixel 12 is 1, the connected component label 1 may be recorded for the pixel 12 in the label map of the image to be analyzed shown in fig. 2, that is, label _ list [1] [2] of the first row and the second column in the label map is marked as 1.
Further, when performing connected domain analysis on the pixel points 16 and 19, by analogy, it can be determined that the target connected domain labels of the pixel points 16 and 19 are 2 and 3, respectively. When the connected domain analysis is carried out on the pixel point 1a, the pixel point 1a is connected with the pixel point 19 adjacent to the left direction position of the pixel point 1a, and the target connected domain label of the pixel point 19 is 3; the target connected component label of pixel point 1a is also determined to be 3. And adjusting the connected domain statistical data result [3] corresponding to the connected domain label 3 to 2 (namely 19 and 1a pixel points). When performing connected domain analysis on the pixel point 21, it can be determined that the target connected domain label of the pixel point 21 is 4. When the connected domain analysis is performed on the pixel point 22, the pixel point 22 is communicated with the pixel point 12 adjacent to the upper direction position of the position where the pixel point 22 is located, and is communicated with the pixel point 21 adjacent to the left direction position of the position where the pixel point 22 is located; the target connected domain label of the pixel point 12 is 1, and the target connected domain label of the pixel point 21 is 4; it indicates that pixel point 12 and pixel point 21 belong to the same connected domain, and correspondingly, connected domain labels 1 and 4 also belong to the same connected domain. At this time, the target connected domain label of the pixel point 22 is determined to be 1 with a smaller label value, and two connected domains corresponding to the connected domain label 1 and the connected domain label 4 need to be merged. Pointer data point _ list [4] corresponding to the connected domain label 4 can be adjusted to 1, which indicates that the connected domain label 4 is an intermediate node label and points to the root node label 1; meanwhile, the connected domain statistical data result [1] corresponding to the connected domain label 1 is adjusted to 3 (namely, three pixel points 12, 21 and 22). Meanwhile, the connected domain statistical data result [4] corresponding to the connected domain label 4 can be adjusted to 1, or adjusted to the numerical value 3 recorded in result [1 ]. It should be noted that, in the above-mentioned connected component analysis process, reference may be made to the related description of the connected component analysis process performed on the pixel point 12, and details are not described here again.
By adopting the processing mode, the connected domain analysis of the image to be analyzed is completed, the label graph of the image to be analyzed shown in fig. 2 can be obtained, and the multi-branch tree shown in fig. 3 can be obtained according to the recorded pointer data point _ list. Based on the label graph, connected domain labels of all pixel points in the image to be analyzed can be determined, and based on the multi-branch tree, the relation among the connected domain labels used for marking the pixel points to be analyzed can be determined. As shown in fig. 3, it can be seen that the connected component labels 1, 6, and 8 are root node labels, the connected component labels 2, 3, 4, 5, 7, and 9 all point to the root node label 1, and the connected component label 10 points to the root node label 8. In addition, as can be seen from the recorded connected domain statistical data result or the tag map, the number of the pixels marked as the connected domain tag 1 and the number of the pixels marked as the connected domain tag pointing to the connected domain tag 1 are 36, the number of the pixels marked as the connected domain tag 8 and the number of the pixels marked as the connected domain tag pointing to the connected domain tag 8 are 5, and the number of the pixels marked as the connected domain tag 6 is 1. Based on the data obtained by the connected domain processing, the image to be analyzed can be continuously processed, for example, the pixels in the connected domain in which the number of the connected pixels in the image to be analyzed is smaller than a preset value are filtered.
It should be noted that, because two pixel points adjacent to the pixel point to be analyzed at the position in the "up" direction and the "left" direction can be obtained from the continuous encoded data stream of the DDR, the marking of the whole image by the above method only needs to initiate a DDR read request. Therefore, the problems that the number of DDR read requests is too many and a large amount of DDR bandwidth is occupied in a connected domain processing mode based on seed diffusion can be effectively reduced by a connected domain analysis mode based on pixel marking; therefore, the connected component analysis mode based on the pixel marking can also carry out the connected component processing on the image with larger size. However, when a connected domain analysis mode based on 'pixel marking' is adopted, a new label needs to be given to the current pixel point to be analyzed when the current pixel point to be analyzed is not connected with the pixel point which is already given the label; therefore, the number of connected component labels needed to be used in one image is large, that is, the maximum value of the connected component labels needed in one image is very large. For example, the number of connected domain labels required to be used when processing an image having a size of 1280 × 720 pixels is 33000 or more. Meanwhile, each connected domain label needs to be allocated with pointer data or connected domain statistical data; the pointer data and the connected domain statistical data are required to be read and written continuously during image scanning and stored in an on-chip memory; therefore, a large amount of storage space is occupied, and the application scene of a connected domain analysis mode based on pixel labeling is limited to a certain extent.
In order to solve the above problem, embodiments of the present invention provide a connected domain processing method, which not only can effectively reduce the read request times of the DDR, but also can implement multiplexing of statistical data, effectively save storage space and computational resources, and expand application scenarios of connected domain processing. The following are detailed below.
Fig. 4 is a flowchart illustrating a connected domain processing method according to a first embodiment of the present invention. The connected domain processing method described in the embodiment of the present invention may include:
s401, the data processing equipment acquires an image to be analyzed and performs connected domain analysis on a current pixel point to be analyzed in the image to be analyzed.
In the embodiment of the invention, the data processing equipment firstly acquires an image to be analyzed, the image to be analyzed comprises a plurality of pixel points, and the plurality of pixel points comprise effective pixel points and ineffective pixel points. The effective pixel points and the ineffective pixel points in the image to be analyzed are not communicated. In an embodiment, the image to be analyzed may be any one of a plurality of depth images acquired by the multi-view camera at a time by photographing the photographic subject. If the depth information between the pixel points of the image to be analyzed and the contrast depth image at the same position is within an error range, determining the pixel point at the position in the image to be analyzed as an effective pixel point; otherwise, determining the pixel point at the position in the image to be analyzed as an invalid pixel point; wherein, the contrast depth image is a depth image except for the image to be analyzed in the plurality of depth images. In another embodiment, the image to be analyzed may be any one of two depth images acquired by photographing the photographic subject once by the binocular camera. Firstly, carrying out depth information matching operation by taking an image to be analyzed as a reference image and a contrast depth image as a matching image to obtain a first matching result; the first matching result is used for indicating a first matching value between pixel points of the image to be analyzed and the contrast depth image at the same position. Then, the contrast depth image is used as a reference image, the image to be analyzed is used as a matching image, and depth information matching operation is carried out to obtain a second matching result; and the second matching result is used for indicating a second matching value between pixel points of the image to be analyzed and the contrast depth image at the same position. If the first matching value and the second matching value between the pixel points of the image to be analyzed and the contrast depth image at the same position are the same or within an error range, determining the pixel point at the position in the image to be analyzed as an effective pixel point; otherwise, determining the pixel point at the position in the image to be analyzed as an invalid pixel point. Wherein, the contrast depth image is the other one of the two depth images except the image to be analyzed.
In an embodiment, in the process of performing connected domain analysis on an image to be analyzed, the data processing device may first directly determine a connected domain label of an invalid pixel point in the image to be analyzed as an invalid connected domain label, for example, a value of 0; effective pixel points in the image to be analyzed are determined as pixel points to be analyzed, and then only connected domain analysis is carried out on the pixel points to be analyzed in the image to be analyzed, so that data processing amount is reduced, and software and hardware resources and processing time are saved. Further, the data processing equipment performs connected domain analysis on the current pixel point to be analyzed in the image to be analyzed to obtain an analysis result; the analysis result comprises a target connected domain label of the pixel point to be analyzed. The data processing equipment firstly determines adjacent pixel points adjacent to the pixel points to be analyzed from the image to be analyzed, then performs connected domain analysis on the pixel points to be analyzed according to the adjacent pixel points, and determines target connected domain labels of the pixel points to be analyzed.
In one embodiment, the neighboring pixel points adjacent to the pixel point to be analyzed include: and the first pixel point is adjacent to the pixel point to be analyzed in the same column in the upper direction, and/or the second pixel point is adjacent to the pixel point to be analyzed in the same row in the left direction. In an embodiment, the data processing device performs connected domain analysis on the pixel to be analyzed according to the first pixel and the second pixel, and determines whether the pixel to be analyzed is connected with the first pixel and the second pixel. And if the fact that the pixel point to be analyzed is communicated with the first pixel point is determined, the connected domain label of the first pixel point is used as a target connected domain label of the pixel point to be analyzed. And if the fact that the pixel point to be analyzed is communicated with the second pixel point is determined, the connected domain label of the second pixel point is used as the target connected domain label of the pixel point to be analyzed. And if the fact that the pixel point to be analyzed is communicated with the first pixel point and the second pixel point is determined, the connected domain label with the minimum label value in the connected domain labels of the first pixel point and the second pixel point is used as the target connected domain label of the pixel point to be analyzed. And if the fact that the pixel point to be analyzed is not communicated with the first pixel point and the second pixel point is determined, one unused connected domain label in the preset connected domain labels is used as a target connected domain label of the pixel point to be analyzed.
Wherein, the mode of judging whether to wait to analyze pixel communicates with first pixel and second pixel can be: firstly, obtaining values corresponding to a pixel point to be analyzed, a first pixel point and a second pixel point respectively, wherein the values can be depth values; then comparing the value corresponding to the pixel point to be analyzed with the value corresponding to the first pixel point to obtain a first comparison result; and comparing the value corresponding to the pixel point to be analyzed with the value corresponding to the second pixel point to obtain a second comparison result. If the first comparison result indicates that the difference value between the value corresponding to the pixel point to be analyzed and the value corresponding to the first pixel point is smaller than or equal to a preset threshold value, determining that the pixel point to be analyzed is communicated with the first pixel point; otherwise, the pixel point to be analyzed is determined not to be communicated with the first pixel point. Similarly, if the second comparison result indicates that the difference value between the value corresponding to the pixel point to be analyzed and the value corresponding to the second pixel point is less than or equal to the preset threshold value, determining that the pixel point to be analyzed is communicated with the second pixel point; otherwise, the pixel point to be analyzed is determined not to be communicated with the second pixel point.
In one embodiment, the data processing device performs connected domain analysis on the pixel point to be analyzed according to the first pixel point, and judges whether the pixel point to be analyzed is connected with the first pixel point; and if the fact that the pixel point to be analyzed is communicated with the first pixel point is determined, the connected domain label of the first pixel point is used as a target connected domain label of the pixel point to be analyzed. And if the pixel point to be analyzed is not communicated with the first pixel point, taking an unused connected domain label in the preset connected domain labels as a target connected domain label of the pixel point to be analyzed. In one embodiment, the data processing device performs connected domain analysis on the pixel point to be analyzed according to the second pixel point, and judges whether the pixel point to be analyzed is connected with the second pixel point; and if the fact that the pixel point to be analyzed is communicated with the second pixel point is determined, the connected domain label of the second pixel point is used as the target connected domain label of the pixel point to be analyzed. And if the pixel point to be analyzed is not communicated with the second pixel point, taking an unused connected domain label in the preset connected domain labels as a target connected domain label of the pixel point to be analyzed.
In another embodiment, the neighboring pixel points adjacent to the pixel point to be analyzed include: the analysis pixel point comprises one or more of a first pixel point which is adjacent to the pixel point to be analyzed in the same column in the upper direction, a second pixel point which is adjacent to the pixel point to be analyzed in the same row in the left direction, a third pixel point which is adjacent to the pixel point to be analyzed in the upper left direction, and a fourth pixel point which is adjacent to the pixel point to be analyzed in the upper right direction. The third pixel point is also the pixel point adjacent to the first pixel point in the same line in the left direction, and the fourth pixel point is also the pixel point adjacent to the first pixel point in the same line in the right direction. In an embodiment, the data processing device performs 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 connected with the first pixel, the second pixel, the third pixel and the fourth pixel. And if the fact that the pixel point to be analyzed is communicated with one of the first pixel point, the second pixel point, the third pixel point and the fourth pixel point is determined, the connected domain label of the pixel point communicated with the pixel point to be analyzed is used as the target connected domain label of the pixel point to be analyzed. And if the fact that the pixel point to be analyzed is communicated with at least two pixel points of the first pixel point, the second pixel point, the third pixel point and the fourth pixel point is determined, the connected domain label with the minimum label value in the connected domain labels of the at least two pixel points communicated with the pixel point to be analyzed is used as the target connected domain label of the pixel point to be analyzed. And if it is determined that the pixel point to be analyzed is not communicated with the first pixel point, the second pixel point, the third pixel point and the fourth pixel point, taking an unused connected domain label in a plurality of preset connected domain labels as a target connected domain label of the pixel point to be analyzed.
In an embodiment, the present disclosure further modifies a scanning process in a connected domain analysis mode based on a "pixel marker", and adds a Line Buffer (Line Buffer) operation, that is, records Line tag information, where the Line tag information is used to record a connected domain tag of a currently analyzed pixel point, and a depth of the Line tag information is the same as a number of pixel points in a Line of an image to be analyzed. Wherein the connected domain tag of the line tag information record comprises: the connected domain label of the first pixel point adjacent to the pixel point to be analyzed in the same column in the upper direction, the connected domain label of the pixel point located in the same row of the pixel point to be analyzed in the left direction, and the connected domain label of the pixel point located in the same row of the first pixel point in the right direction. In the process of analyzing the connected domain of the current pixel point to be analyzed in the image to be analyzed, if the connected domain label of the pixel point adjacent to the pixel point to be analyzed needs to be acquired, the connected domain label can be directly and quickly acquired from the line label information, and compared with a mode of searching a linked list, the searching speed can be effectively accelerated, and the efficiency of connected domain analysis is improved. Further, after the analysis of the connected domain of the pixel point to be analyzed is completed, the line tag information is updated according to the determined target connected domain tag of the pixel point to be analyzed. Specifically, the connected domain label of the recorded first pixel point can be adjusted to the target connected domain label of the pixel point to be analyzed in the row label information. Where the row tag information may be stored in an on-chip register.
S402, the data processing equipment records a target connected domain label for the pixel point to be analyzed in the label graph of the image to be analyzed according to the analysis result.
In the embodiment of the invention, the label graph of the image to be analyzed is used for recording the target connected domain label of each pixel point in the image to be analyzed. After the data processing equipment performs connected domain analysis on the current pixel point to be analyzed in the image to be analyzed to obtain an analysis result, a target connected domain label indicated by the analysis result is recorded for the pixel point to be analyzed in a label graph of the image to be analyzed. In an embodiment, the size of the label graph is consistent with the size of the image to be analyzed, and the position of the target connected domain label in the label graph is the same as the position of the pixel point to be analyzed in the image to be analyzed. The tag map is stored in the DDR of the data processing apparatus.
S203, the data processing equipment updates the connected domain statistical information of the image to be analyzed according to the target connected domain label; when updating the connected domain statistical information, if the target connected domain label is a root node label, recording first-class statistical data for the target connected domain label in the connected domain statistical information, wherein the first-class statistical data is number data, and the number data is used for indicating the number of pixels which are marked as the target connected domain label and the number of pixels of the marked connected domain label pointing to the target connected domain label; 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, and the pointer data is used for indicating a root node label pointed by the target connected domain label.
In the embodiment of the invention, the connected component statistical information comprises a first identification bit and a data bit, wherein the first identification bit is used for indicating the type of statistical data recorded by the data bit, and the data bit is used for indicating the statistical data recorded by a target connected component label; when the first identification bit is the first identification, the data bit is the first type of statistical data recorded by the target connected domain label, and when the first identification bit is the second identification, the data bit is the second type of statistical data recorded by the target connected domain label. In one embodiment, the first identifier may be an identifier "0" and the second identifier may be an identifier "1". The first identification bit may be the highest bit of the connected component statistics information or the lowest bit of the connected component statistics information, and the embodiment of the present invention is not limited thereto. The connected domain statistical information may be stored in a Random Access Memory (RAM), or a statistical data multiplexing Memory may be specially configured to store the connected domain statistical information.
The connected domain processing method in the embodiment of the invention multiplexes the number data and the pointer data on the basis of a connected domain analysis mode based on 'pixel marking', and only one 1-bit identification bit needs to be added to distinguish whether the statistical data recorded by the connected domain statistical information as a target connected domain label is the number data or the pointer data. Compared with a connected domain analysis mode based on 'pixel marking', the on-chip storage space required by the mode is greatly reduced, and approximately half of the storage space can be reduced. Please refer to fig. 5, which is a schematic structural diagram of connected domain statistical information according to a first embodiment of the present invention. As shown in fig. 5, each 1 square in the drawing represents 1bit, 11 squares in each row, that is, 11bits correspond to a connected component tag, for example, 11bits of data in the first row are connected component statistical information of the connected component tag 1. The 1 st square, or most significant bit, of each row represents a first identification of connected components statistics for indicating the type of statistics recorded by the data bits of the connected components statistics. The 2 nd to 11 th squares of each row represent data bits of connected component statistics for representing statistical data recorded for connected component labels. For example, if the first square in the first row records 0, that is, the first identification bit of the connected component statistical information of the connected component tag 1 is 0, it indicates that the number data is recorded for the connected component tag 1 in the 2 nd to 11 th squares in the first row, that is, the number data is recorded for the connected component tag 1 in the data bit of the connected component statistical information of the connected component tag 1; thereby also indirectly indicating that the connected domain label 1 is the root node label. The number data is 26(11010), which indicates that the number of the pixels marked as the connected component label 1 and the marked connected component label points to the connected component label 1 is 26. For example, if 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 tag 3 is 1, it indicates that the 2 nd to 11 th squares in the first row are pointer data recorded for the connected component tag 3, that is, the data bit of the connected component statistical information of the connected component tag 3 is pointer data recorded for the connected component tag 3; thereby also indicating that the connected domain label 3 is an intermediate node label. If the pointer data is 1(01), it indicates that the root node label pointed by the connected domain label 3 is the connected domain label 1.
In an embodiment, when the data processing device performs connected domain analysis on the pixel point to be analyzed according to the first pixel point and the second pixel point, if it is determined that the pixel point to be analyzed is not connected to the first pixel point and the second pixel point, the data processing device takes a target connected domain label as a root node label when an unused connected domain label in a plurality of preset connected domain labels is taken as the target connected domain label of the pixel point to be analyzed. If it is determined that the pixel point to be analyzed is communicated with both the first pixel point and the second pixel point, after the connected domain label with the minimum label value in the connected domain labels of the first pixel point and the second pixel point is used as the target connected domain label of the pixel point to be analyzed, the connected domain label with the maximum label value in the connected domain labels of the first pixel point and the second pixel point is determined as the intermediate node label pointing to the target connected domain label. Further, the data processing device changes the connected domain label with the maximum label value in the connected domain statistical information. Specifically, a first identification bit corresponding to the connected domain label with the maximum label value in the connected domain statistical information is adjusted to be a second identification, and second-type statistical data is recorded for the connected domain label with the maximum label value in the data bit corresponding to the connected domain label with the maximum label value in the connected domain statistical information, wherein the recorded second-type statistical data indicates that the connected domain label with the maximum label value points to the target connected domain label.
It should be noted that, for the case that the adjacent pixel points adjacent to the pixel point to be analyzed in step S401 include the first pixel point, the second pixel point, the third pixel point and the fourth pixel point, if it is determined that the pixel point to be analyzed is communicated with at least two pixel points of the first pixel point, the second pixel point, the third pixel point and the fourth pixel point, among the connected domain labels of the at least two pixel points to be communicated with the pixel point to be analyzed, the connected domain label with the smallest label value is used as the target connected domain label of the pixel point to be analyzed, and among the connected domain labels of the at least two pixel points to be communicated with the pixel point to be analyzed, the connected domain labels except the connected domain label with the smallest label value are all determined as the intermediate node labels pointing to the target connected domain label. Further, the data processing device changes the statistical data recorded for the connected domain labels except the connected domain label with the smallest label value in the connected domain statistical information, and the specific changing manner may refer to the foregoing description and is not described herein again.
For better understanding of the present solution, the connected domain processing method in the embodiment of the present invention is described below by taking fig. 1 as an example. Assuming that the supported maximum connected domain label is 16 and the maximum statistical number is 1024, the data required to be used in the scheme includes: 1. the connected domain statistical information supporting the maximum connected domain label can be recorded as record _ result _ list, and the data structure is shown in fig. 5; the connected component statistics may be used to record statistics for the connected component labels, including number data or pointer data. Because the supported maximum connected domain label is 16, the maximum statistical number is 1024, and 1bit of the first identification bit is added, the total storage space required by the connected domain statistical information is 16 × 11bits, and the connected domain statistical information can be stored in the on-chip RAM. 2. Line tag information, which can be recorded as root _ pointers; the depth of the line label information is the same as the number of pixel points in a line of the image to be analyzed, and the width is the number of bits supporting the maximum connected domain label; because the supported maximum connected domain label is 16, the width is 4 bits; if the number of pixel points in one row of the image to be analyzed shown in fig. 1 is 12, the total storage space required for the row tag information is 12 × 4bits, which can be stored in the on-chip register. 3. A label graph of the image to be analyzed can be recorded as label _ list; and the connected domain label is used for storing the connected domain label of each pixel point in the image to be analyzed. The depth of the label graph 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 memory space required for the tag map is 12 × 8 × 4bits, which can be stored in off-chip DDRs.
Specifically, taking four-way connectivity analysis as an example for explanation, firstly, all the label graphs label _ list are initialized to 0; initializing a first identification bit of connected domain statistical information record _ result _ list to 0, and initializing a data bit to 0; the row tag information root _ pointers are all initialized to 0. In the process of performing connected component analysis on an image to be analyzed, connected component analysis is performed on pixels to be analyzed in fig. 1, that is, pixels indicated by the shadow filling lattices, in the sequence from left to right and from top to bottom. As can be seen from fig. 1, the first pixel to be analyzed (or effective pixel) of the image to be analyzed is a pixel indicated by the shadow filling grid with the mark information of 12, which is hereinafter referred to as pixel 12 for short, and so on in the following description. Because there is no pixel point at the position of the "up" direction of the position of the pixel point 12 in the image to be analyzed, the pixel point 11 at the position of the "left" direction of the position of the pixel point 12 is an invalid pixel point and is not communicated with the pixel point 12; at this time, a new connected domain label needs to be allocated to the pixel point 12, and the connected domain label 1 may be determined as a target connected domain label of the pixel point 12, where the connected domain label 1 is a root node label.
Referring to fig. 6, fig. 6 is a schematic diagram of a result after the connected component analysis of the first row of pixel points in fig. 1 is completed, and specifically includes three parts, namely a label graph, row label information, and connected component statistical information. As shown in fig. 6, after determining that the target connected component label of the pixel 12 is 1, recording the target connected component label 1 for the pixel 12 at the position of the first row and the second column in the label map label _ list of the image to be analyzed. And recording a target connected domain label 1 for the pixel point 12 at a position indicated by the 2 nd square in the row label information root _ pointers, so that the pixel point 22 and the pixel point 13 can quickly find the connected domain label of the pixel point 12 according to the row label information. The first flag corresponding to the connected component label 1 is adjusted to 0 at the position indicated by the first cell of the connected component statistical information record _ result _ list, and the data bit indicated by the first cell is the connected component label 1 to record the number data 1, so the data in the first cell is represented as "0/1". It should be noted that the data structure of the connected component statistical information in fig. 6 is a simplified schematic diagram compared to the data structure shown in fig. 5, in the diagram, 16 squares in the connected component statistical information correspond to the connected component labels 1 to 16 in sequence from left to right, and data in each square indicates statistical data in which the connected component statistical information is recorded as a connected component label. The numerical value on the left side of the "/" in each data represents the value of the first identification bit, and the numerical value on the right side of the "/" represents the data recorded by the data bit.
Further, when performing connected domain analysis on the pixel points 16 and 19, by analogy, it can be determined that the target connected domain labels of the pixel points 16 and 19 are 2 and 3, respectively. When the connected domain analysis is carried out on the pixel point 1a, the pixel point 1a is communicated with the pixel point 19 adjacent to the left direction position of the pixel point 1a, and the target connected domain label of the pixel point 19 can be quickly found to be 3 according to the recorded row label information root _ pointers; the target connected component label of pixel point 1a is also determined to be 3. The information of the pixel point 1a and the information of the pixel point 19 in the label graph label and the row label information root _ pointers are kept consistent; then, the first identification bit corresponding to the connected component label 3 is adjusted to 0 at the position indicated by the third cell of the connected component statistical information record _ result _ list, and the data bit indicated by the third cell is the connected component label 3 to record the number data 2, so that the data in the third cell is represented as "0/2".
When performing connected component analysis on the pixel point 21, it can be determined that the target connected component label of the pixel point 22 is 4. When the connected domain analysis is performed on the pixel point 22, the pixel point 22 is communicated with the pixel point 12 adjacent to the upper direction position of the position where the pixel point 22 is located, and is communicated with the pixel point 21 adjacent to the left direction position of the position where the pixel point 22 is located, so that the pixel point 12 and the pixel point 21 belong to the same connected domain; in addition, according to the recorded line label information, the target connected domain label of the pixel point 12 is 1, and the target connected domain label of the pixel point 21 is 4, which indicates that the connected domain labels 1 and 4 also belong to the same connected domain. At this time, the target connected domain label of the pixel point 22 is determined to be 1 with a smaller label value, and two connected domains corresponding to the connected domain label 1 and the connected domain label 4 need to be merged.
Referring to fig. 7, fig. 7 is a schematic diagram of a result of the completed analysis of the connected component of the second row of pixels in fig. 1, which also includes three parts, namely a label graph, row label information and connected component statistical information. As shown in fig. 7, after determining that the target connected component label of the pixel 22 is 1, recording the target connected component label 1 for the pixel 22 at the position of the second row and the second column in the label map label _ list of the image to be analyzed. And recording the target connected domain label 1 of the pixel point 22 at the position indicated by the 2 nd square in the line label information root _ pointers. And adjusting a first identification bit corresponding to the connected component label 1 to be 0 at a position indicated by a first square of the connected component statistical information record _ result _ list, and recording the number data 3 for the connected component label 1 at a data bit indicated by the first square. Since the data recorded in the row tag information of fig. 7 is the data after the second row of pixels have been processed, the data in the first square is represented as "0/4", and the connected component label is 1 and further includes the pixel 23. The first identification bit corresponding to the connected component label 4 is adjusted to 1 at the position indicated by the fourth square of the connected component statistical information record _ result _ list, and the pointer data 1 is recorded for the connected component label 4 at the data bit indicated by the fourth square, which means that the connected component label 4 is the middle node label and points to the root node label 1, so that the data in the fourth square is represented as "1/1". The processing method is adopted until the analysis of the connected domain of the image to be analyzed is completed, and details are not repeated here.
It should be noted that, please refer to two squares filled with shadows in the line tag information in fig. 7, taking a square filled with the first shadow from left to right as an example, the square filled with shadows records a target connected domain tag of the pixel point 21, and after the connected domain analysis of the pixel point 21 is completed, it is determined that the target connected domain tag of the pixel point 21 is 4, and the connected domain tag 4 is a root node tag. However, in the process of analyzing the connected domain of the pixel point 22, the connected domain label 4, which is originally a root node label, is adjusted to be an intermediate node label pointing to the root node label 1. If the connected component label 4 is directly used as the root node when the connected component analysis is performed on the pixel point of the third row of the image to be analyzed, an error may be caused. Therefore, in an embodiment, in the process of performing connected domain analysis on to-be-analyzed pixel points of each row of an image to be analyzed, if connected domain labels of pixel points adjacent to the to-be-analyzed pixel points in the same column in the upper direction need to be directly obtained from row label information root _ pointers, root node label judgment can be performed on the connected domain labels of the pixel points adjacent to the to-be-analyzed pixel points in the same column in the upper direction, which are obtained from the row label information root _ pointers; if the connected domain label is judged to be the root node label, determining a target connected domain label of the pixel point to be analyzed based on the connected domain label; if the connected domain label is judged not to be the root node label, the root node label pointed by the connected domain label is found out from the connected domain statistical information record _ result _ list, and the target connected domain label of the pixel point to be analyzed is determined based on the root node label pointed by the connected domain label. Practice shows that the occurrence frequency of the condition that the connected domain label recorded in the row label information is the intermediate node label is not large, and the root node label pointed by the intermediate node label in the row label information can be found only by searching for one or two times, so that the processing speed of the connected domain is not influenced too much; in the connected domain analysis process, line tag information is recorded, and connected domain analysis is performed based on the line tag information, so that the connected domain processing speed can be effectively increased.
In the embodiment of the invention, firstly, connected domain analysis is carried out on the pixel points to be analyzed, and target connected domain labels are recorded for the pixel points to be analyzed in a label graph according to the analysis result; then updating the statistical information of the connected domain according to the target connected domain label; if the target connected domain label is a root node label, first-class statistical data is recorded in the connected domain statistical information, and if the target connected domain label is a middle node label, second-class statistical data is recorded in the connected domain statistical information. By adopting the mode, the read request times of the DDR can be effectively reduced, the multiplexing of statistical data can be realized, the storage space and the computing resource are effectively saved, and the application scene of the connected domain processing is enlarged.
Referring to fig. 8, in another embodiment, compared with the method shown in fig. 4, the method for processing a connected component further includes the following steps after step S403:
s404, after the preset multiple connected domain labels are used up, the data processing equipment determines a growing label and a non-growing label from the multiple connected domain labels according to currently recorded line label information.
In the embodiment of the present invention, after the preset plurality of connected domain labels are used up, that is, after the preset plurality of connected domain labels are all allocated to the pixel points to be analyzed in the image to be analyzed, the connected domain labels need to be recovered and reused. The growth label is a connected domain label which is likely to continue to extend downwards, has a large influence on the subsequent connected domain analysis, and should not support recovery and reuse; the non-growth label is a connected domain label which cannot continue to extend downwards, has little influence on the analysis of the subsequent connected domain, and can be recycled and reused. Specifically, the data processing device may determine a growing label and a non-growing label from a plurality of preset connected domain labels according to the currently recorded line label information. In one embodiment, the data processing device determines a first tag existing in the currently recorded row tag information from a plurality of preset connected domain tags, and determines the first tag as a growth tag; and determining a second label which does not exist in the currently recorded line label information from a plurality of preset connected domain labels, and determining the second label as a non-growing label.
In another embodiment, the data processing device determines a first tag existing in the currently recorded row tag information from a plurality of preset connected domain tags, and determines a second tag not existing in the currently recorded row tag information; then according to the recorded statistical information of the connected domain, determining a third label which is a root node label or a middle node label of the first label from a plurality of preset connected domain labels; and finally, determining the labels except the third label in the second label as non-growing labels, and determining the first label and the third label as growing labels. Compared with the method that the second label which does not exist in the currently recorded row label information is directly used as the non-growth label, the method in this embodiment is to use the label except the third label in the second label as the non-growth label, and the non-growth label determined by the method can ensure that the subsequent connected domain analysis is not affected to a certain extent.
In an embodiment, the connected component statistical information further includes a second identification bit, where the second identification bit is used to record a growth identifier of the connected component tag, and when the second identification bit is a third identifier, the connected component tag is represented as a non-growth tag, and when the second identification bit is a fourth identifier, the connected component tag is represented as a growth tag. Wherein the third identifier may be an identifier "0" and the fourth identifier may be an identifier "1". The second identification bit may be the highest bit of the connected component statistics information, or the lowest bit of the connected component statistics information; the second identification bit may be adjacent to the first identification bit, or may not be adjacent to the first identification bit. When the second identification bit is adjacent to the first identification bit, the second identification bit may be located at a left adjacent position of the first identification bit, or may be located at a right adjacent position of the first identification bit.
S405, the data processing equipment performs connected domain analysis on the pixel points which do not finish the connected domain analysis in the image to be analyzed according to the non-growth label.
In the embodiment of the invention, when the connected domain analysis is carried out on the pixel point to be analyzed, which does not finish the connected domain analysis, in the image to be analyzed, if the pixel point to be analyzed is determined to be connected with one of the adjacent pixel points, the connected domain label of the adjacent pixel point connected with the pixel point to be analyzed is used as the target connected domain label of the pixel point to be analyzed. And if the fact that the pixel point to be analyzed is communicated with at least two of the adjacent pixel points is determined, the connected domain label with the minimum label value in the connected domain labels of the at least two adjacent pixel points communicated with the pixel point to be analyzed is used as the target connected domain label of the pixel point to be analyzed. And if it is determined that the pixel point to be analyzed is not communicated with the adjacent pixel point, taking an unused connected domain label in the non-growth label as a target connected domain label of the pixel point to be analyzed. For a specific processing manner, reference may be made to the foregoing description, which is not repeated herein. By adopting the mode, the recovery and reuse of the connected domain label can be realized, and the processing of the image to be analyzed can still be finished under the condition that the supported maximum connected domain label is smaller; because the storage space occupied by the recycled labels is unchanged, the processing of the image to be analyzed can be completed by utilizing a smaller storage space, and the storage space is effectively saved.
In order to better understand the method for recovering and reusing the connected domain label in the present solution, the following example is described in detail. Please refer to fig. 9, which is a diagram illustrating a connected component according to a second embodiment of the present invention, wherein the result of the analysis is obtained according to the above-mentioned connected component analysis method. As shown in fig. 9, fig. 9 shows an image to be analyzed, and each grid in the graph shows a pixel point of the image to be analyzed. In the graph, the grids filled with shadows represent effective pixel points in the image to be analyzed, the grids not filled with shadows represent ineffective pixel points in the image to be analyzed, and the effective pixel points are not communicated with the ineffective pixel points; the plurality of cells filled with the shadows constitute a plurality of connected domains of the image to be analyzed. The mark information in the grid which is not filled with the shadow in the graph represents the coordinate information of the corresponding pixel point in the image to be analyzed, the mark information in the grid which is filled with the shadow in the graph represents the coordinate information of the corresponding pixel point in the image to be analyzed, and the connected domain label determined after the connected domain analysis. Specifically, the numerical value positioned on the left side of the "/" represents the coordinate information of the pixel point in the image to be analyzed, and the numerical value positioned on the right side of the "/" represents the connected domain label of the pixel point.
For the method for recycling and reusing the connected domain label, the recycling is to determine the non-growing label, and the reusing is to utilize the non-growing label to perform subsequent connected domain analysis; mainly based on a certain dividing line of an image to be analyzed, if a certain part of connected domain in the image to be analyzed does not cross the dividing line, all connected domain labels corresponding to pixel points in the part of connected domain do not appear below the dividing line, and the connected domain labels can be used as non-growth labels and recycled. Taking the dashed box in fig. 9 as an example of the dividing line, the labels in the connected domain that does not grow before the line where the dashed box is located will not appear in the area below the dashed 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 not grow further, and then the connected domain labels 1, 2, 4, 5 will not appear in the area below the dashed box. However, the connected domain formed by the connected domain labels in the dashed-line frame row has a high possibility of growing continuously, so that the connected domain labels in the dashed-line frame row may appear in the area below the dashed-line frame, for example, when the connected domain labels 3 and 7 are in the dashed-line frame row, the connected domain formed by the connected domain label 7 will grow continuously, and the connected domain formed by the connected domain label 3 will grow continuously, and both the connected domain labels 3 and 7 may appear in the area below the dashed-line frame. In summary, the connected component tags 1, 2, 4 and 5 can be recycled and reused in the portion below the dashed line frame without any impact.
The foregoing has described the main idea of recovering and reusing the connected domain label, and the following still takes fig. 9 as an example to specifically describe the recovering and reusing process of the connected domain label. If the maximum connected component label supported during the connected component analysis of the image to be analyzed shown in fig. 9 is set to 7, the method for analyzing the connected component of the first 46 pixels of the image to be analyzed shown in fig. 9 can refer to the foregoing description, and details are not repeated here. After the connected domain of the pixel point 46 is analyzed, that is, after a new connected domain label 7 is given to the pixel point 46, all the preset 7 connected domain labels 1 to 7 are used, and no new connected domain label can be used for subsequent connected domain analysis. Therefore, the connected domain label should be recovered at this time, and the current recovery position is recorded as the pixel point 46. Referring to fig. 10 together, fig. 10 is a schematic diagram of line tag information according to an embodiment of the present invention, a relationship between the line tag information and an original image in fig. 10 is a relationship between the line tag information and an original image to be analyzed after a connected domain analysis of a pixel point 46 is completed, and can be known by combining the line tag information in fig. 10, at this time, first 6 data in the line tag information are connected domain tags 0, and 7 after the connected domain analysis of the pixel points 41, 42, 43, 44, 45, and 46 from left to right, respectively; then 6 data are connected domain labels after connected domain analysis of pixel points 37, 38, 39, 3a, 3b and 3c in the previous row of the row where the pixel point 46 is located respectively; 0. 0, 3, 0, 6.
Further, the row label information shown in fig. 10 is once combed, so long as the root node label appearing in the row label information is present, it is possible to continue to grow downwards, and all connected domain labels in the connected domain pointed by the root node label not appearing in the row label information can be recovered. Root node labels 3, 7, 6 that are likely to continue to grow downward can be found based on the row label information in fig. 10, and then the root node labels 3, 7, 6 are growth-marked in the connected component statistics. Please refer to fig. 11, which is a schematic diagram of connected component statistical information according to a second embodiment of the present invention, and in particular, a schematic diagram of connected component statistical information corresponding to an image to be analyzed shown in fig. 9 after being carded before a connected component label is recovered. As shown in fig. 11, the first flag is used to indicate the type of the statistical data stored in the data bit, the second flag is used to record the growth flag of the connected domain label, when the second flag is "0", the connected domain label is represented as a non-growth label, and when the second flag is "1", the connected domain label is represented as a growth label. As can be seen, the connected component label 4 points to the root node label 1 (i.e., 01), the connected component label 5 points to the root node label 2 (i.e., 10), and the connected component labels 3, 6, 7 are growth labels. After the root node labels 3, 7 and 6 are subjected to growth marking in the statistical information of the connected domain, the statistical information of the connected domain is combed, and all the intermediate node labels are changed into the labels pointing to the root nodes. In this example, the connected component statistical information recorded before and after the line tag information shown in fig. 10 is sorted is the connected component statistical information shown in fig. 11. The carding process is illustrated, among others, as follows: assuming that a linked list of 10- >9- >8- >7- >6 is recorded in the connected component statistical information, and 7- >6 indicates that the connected component label 7 points to the connected component label 6, it can be determined from the linked list that the connected component label 10 starts to search, that the connected component label 6 is the root node label, and then the connected component labels 10, 9, and 8 are all modified into one-level intermediate node labels that point to the root node label 6, that is, 10- >6, 9- >6, 8- >6, 7- > 6.
Further, the statistical information of the connected domain shown in fig. 11 is traversed once to determine the root node labels with the growth mark "0" and the first-level intermediate node labels pointing to the root node labels, where the two types of connected domain labels are also non-growth labels. Through traversing the connected component statistical information shown in fig. 11, four non-growth labels 1, 2, 4, and 5 can be determined, and at this time, the non-growth labels 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 connected domain analysis of the subsequent pixels to be analyzed is continued from the pixel 47, and for the case that a new connected domain label needs to be given, the reusable non-growth label stored in the preset storage space is only needed to be read out for use. Please refer to fig. 12, which is a schematic diagram of a connected domain according to a third embodiment of the present invention, and specifically, a result of analyzing the connected domains of all the pixels in fig. 9 is obtained by using the above connected domain label recycling and reusing manner. As shown in fig. 12, the pixel point 46 and the previous pixel points, that is, the part of the grid not shown in bold, are marked by using the preset 7 connected domain labels 1 to 7, that is, the part before the connected domain labels are recovered and reused. The pixel point 47 and the pixel points after the pixel point, that is, the part of the graph in which the squares are displayed in a bold manner, are marked by using the recycled non-grown label, that is, the part of the connected domain label for reuse. The two parts can be distinguished by the recorded recycle location pixel points 46. The connected domain labels corresponding to the pixels 49, 4a, 59, and 69 are non-growth labels 1, the connected domain labels corresponding to the pixels 52, 53, 54, 55, 56, 62, and 65 are non-growth labels 2, and the connected domain labels corresponding to the pixels 6b and 6c are non-growth labels 4. It can be seen that three connected domain tags of 1, 2 and 4 out of the 4 recovered non-grown tags are all subjected to tag reuse.
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 further determine, according to the recorded connected domain statistical information and the label map, a connected domain that does not satisfy the preset condition in the image to be analyzed, and filter the pixels in the connected domain that does not satisfy the preset condition. In one embodiment, the condition that the preset condition is not satisfied is: the number of the connected pixel points in the connected domain is less than a preset value.
For example, in the following description with reference to the foregoing example, it is assumed that it is desirable to filter out connected domains with the number of connected pixels less than 5 in the image to be analyzed through connected domain analysis. In the foregoing recycling process of the connected domain labels, after four non-growth labels 1, 2, 4, and 5 are determined by traversing the connected domain statistical information shown in fig. 11, since the number of the connected pixels in the connected domain composed of the connected domain labels 1 and 4 is 5 at this time, the pixels in the connected domain should be retained; at this time, the number of the pixels communicated in the connected domain formed by the connected domain labels 2 and 5 is 4, and then the pixels in the connected domain are filtered; at this time, the non-grown tags 1 and 4 may be saved in the first preset storage space, and the non-grown tags 2 and 5 may be saved in the second preset storage space. Please refer to fig. 13, which is a schematic diagram of connected component statistical information according to a third embodiment of the present invention, and in particular, the connected component statistical information recorded after analyzing the connected components of all pixels in fig. 9 is completed by using the above connected component label recycling and reusing manner. As shown in fig. 13, the data corresponding to the connected component labels 1, 2, and 4 in the connected component statistical information are all recorded for the pixel points of the bold display portion in fig. 12. The visible connected domain label 3 points to the root node label 1, the connected domain labels 5 and 7 point to the root node label 2, the number data corresponding to the connected domain label 1 is 8, the number data corresponding to the connected domain label 2 is 8, and the number data corresponding to the connected domain label 4 is 2.
Since the connected domain labels in the grid non-thickened part and the grid thickened part are repeated, the connected domain statistical information shown in fig. 13 needs to be traversed once, the statistical data of all the intermediate node labels are replaced by the statistical data of the root node labels, and otherwise, the result judgment is influenced. Referring to fig. 14, fig. 14 is a schematic diagram of connected component statistics according to a fourth embodiment of the present invention, specifically, a result after traversing the connected component statistics shown in fig. 13, where the result can be used to analyze the connected component in the lattice-thickened portion. Because the number data corresponding to the connected domain label 4 is less than 5, the pixel points with the connected domain label of 4 in the grid thickened part need to be filtered; in combination with the connected component labeling result shown in fig. 12 or the recorded label map corresponding to the image to be analyzed, it can be determined that the pixel points 6b and 6c with the connected component label of 4 in the bold part of the square are 6b and 6c, so that the pixel points 6b and 6c in the image to be analyzed shown in fig. 9 can be filtered.
For the connected component analysis of the non-bold part of the square, since the statistical data corresponding to the non-growing label that has been reused in the connected component statistical information shown in fig. 14 is modified, the connected component statistical information shown in fig. 14 cannot be directly used for analysis, the connected component labels 1, 4, 2, and 5 stored in the first preset storage unit and the second preset storage unit when the connected component labels are recovered need to be read out, and the corresponding statistical data in the connected component statistical information shown in fig. 14 is modified according to the difference of the read addresses. Please refer to fig. 15, which is a schematic diagram of connected component statistics according to a fifth embodiment of the present invention, and specifically, is a result of modifying corresponding statistics in the connected component statistics shown in fig. 14 according to different read addresses of the connected component tags 1, 4, 2, and 5. Specifically, the connected component labels read out from the first preset storage unit indicate that the number of the connected pixel points in the corresponding connected component is greater than or equal to 5, and the filtering cannot be performed, and the connected component labels read out from the second preset storage unit indicate that the number of the connected pixel points in the corresponding connected component is less than 5, and the filtering can be performed. As shown in fig. 15, the number data in the connected component statistics information corresponding to the connected component tags 1 and 4 read from the first preset storage unit is directly modified to 5 (i.e., 101), and the number data in the connected component statistics information corresponding to the connected component tags 2 and 5 read from the second preset storage unit is modified to 0, so as to facilitate subsequent determination. Because the number data corresponding to the connected domain labels 2, 5 and 6 is less than 5, the pixel points with the connected domain labels 2, 5 and 6 in the part which is not thickened in the square are required to be filtered; in combination with the connected component labeling result shown in fig. 12 or the recorded label map corresponding to the image to be analyzed, it can be determined that the pixel points with the connected component labels 2, 5, and 6 in the non-bold part of the grid are 16, 26, 27, 25, and 3c, so that the pixel points 16, 26, 27, 25, and 3c in the image to be analyzed shown in fig. 9 can be filtered. By adopting the method, the pixels in the connected domain with the number of the connected pixels smaller than the preset numerical value in the image to be analyzed can be filtered.
It should be noted that, because there may be a situation that the recovery of the connected component label once cannot completely analyze one image to be analyzed in the processing process, the recovery and reuse process of the connected component label may be continuously performed at this time, and the specific processing manner may refer to the foregoing description, and is not described herein again. In the connected domain analysis process, for example, in the process of filtering the pixel points in the connected domain which do not meet the preset condition, the images to be analyzed need to be analyzed from bottom to top and from right to left, which is opposite to the process of determining the connected domain labels of the pixel points to be analyzed; therefore, the reused connected domain label can be ensured not to influence the analysis result to a certain extent. If it is also desired to perform the connected component analysis in the order from top to bottom and from left to right, the connected component statistical information of multiple stages in the processing process needs to be backed up, and the connected component analysis can be performed in the order from top to bottom and from left to right based on the backed-up connected component statistical information.
Fig. 16 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention. The data processing apparatus described in the embodiment of the present invention includes: a processor 1601, a communication interface 1602, a memory 1603. The processor 1601, the communication interface 1602, and the memory 1603 may be connected by a bus or in another manner, and the embodiment of the present invention is exemplified by being connected by a bus.
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 core in a multi-core CPU or a multi-core NP for implementing communication identity binding.
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 (GAL), or any combination thereof.
The communication interface 1602 is operable to communicate information or signaling interactions, as well as to receive and communicate signals. The memory 1603 may mainly include a program storage area and a data storage area, where the program storage area may store an operating system, and a storage program required by at least one function (e.g., a text storage function, a location storage function, etc.); the storage data area may store data (such as image data, text data) created according to the use of the device, etc., and may include an application storage program, etc. In addition, memory 1603 may include high speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The memory 1603 is also used for storing program instructions. The processor 1601 is configured to execute the 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 connected domain analysis on a current pixel point to be analyzed in the image to be analyzed, and recording a target connected domain label for the pixel point to be analyzed in a label graph of the image to be analyzed according to an analysis result; updating the connected domain statistical information of the image to be analyzed according to the target connected domain label; when updating the connected domain statistical information, if the target connected domain label is a root node label, recording first-class statistical data for the target connected domain label in the connected domain statistical information, wherein the first-class statistical data is number data, and the number data is used for indicating the number of pixels which are marked as the target connected domain label and the number of pixels of the marked connected domain label pointing to the target connected domain label; 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, and the pointer data is used for indicating a root node label pointed by the target connected domain label.
The method executed by the processor in the embodiment of the present invention is described from the perspective of the processor, and it is understood that the processor in the embodiment of the present invention needs to cooperate with other hardware structures to execute the method. The embodiments of the present invention are not described or limited in detail for the specific implementation process.
In an embodiment, the connected component statistics information includes a first identification bit and a data bit, wherein the first identification bit is used for indicating the type of the statistics data of the data bit record, and the data bit is used for indicating the statistics data of the target connected component tag record; when the first identification bit is a first identification, the data bit is the first type of statistical data recorded by the target connected domain label, and when the first identification bit is a second identification, the data bit is the second type of statistical data recorded by the target connected domain label.
In an embodiment, when the processor 1601 performs connected component analysis on a current pixel point to be analyzed in the image to be analyzed, it is specifically configured to: determining an adjacent pixel point adjacent to the current pixel point to be analyzed from the image to be analyzed; and performing connected domain analysis on the pixel point to be analyzed according to the adjacent pixel point, and determining a target connected domain label of the pixel point to be analyzed.
In one embodiment, the neighboring pixel point includes: and the first pixel point is adjacent to the pixel point to be analyzed in the same column in the upper direction, and/or the second pixel point is adjacent to the pixel point to be analyzed in the same row in the left direction.
In an embodiment, the processor 1601 is configured to perform connected component analysis on the pixel to be analyzed according to the neighboring pixel point, and when determining a target connected component label of the pixel to be analyzed, specifically: performing connected domain analysis on the pixel point to be analyzed according to the first pixel point; and if the fact that the pixel point to be analyzed is communicated with the first pixel point is determined, taking the connected domain label of the first pixel point as a target connected domain label of the pixel point to be analyzed.
In an embodiment, the processor 1601 is configured to perform connected component analysis on the pixel to be analyzed according to the neighboring pixel point, and when determining a target connected component label of the pixel to be analyzed, specifically: performing connected domain analysis on the pixel point to be analyzed according to the second pixel point; and if the fact that the pixel point to be analyzed is communicated with the second pixel point is determined, the connected domain label of the second pixel point is used as a target connected domain label of the pixel point to be analyzed.
In an embodiment, the processor 1601 is configured to perform connected component analysis on the pixel to be analyzed according to the neighboring pixel point, and when determining a target connected component label of the pixel to be analyzed, specifically: performing connected domain analysis on the pixel point to be analyzed according to the first pixel point and the second pixel point; and if the fact that the pixel point to be analyzed is communicated with the first pixel point and the second pixel point is determined, taking a connected domain label with the minimum label value in the connected domain labels of the first pixel point and the second pixel point as a target connected domain label of the pixel point to be analyzed.
In an embodiment, the processor 1601 is further configured to: determining a connected domain label with the maximum label value in the connected domain labels of the first pixel points and the second pixel points as an intermediate node label pointing to the target connected domain label; and changing the connected domain label with the maximum label value in the connected domain statistical information.
In an embodiment, when the processor 1601 changes the connected component tag with the largest tag value in the connected component statistical information, it is specifically configured to: adjusting a first identification bit corresponding to the connected domain label with the maximum label value in the connected domain statistical information to be the second identification; and recording second type statistical data for the connected domain label with the maximum label value in the data bit corresponding to the connected domain label with the maximum label value in the connected domain statistical information, wherein the recorded second type statistical data indicates that the connected domain label with the maximum label value points to the target connected domain label.
In an embodiment, the processor 1601 is further configured to: and if the fact that the pixel point to be analyzed is not communicated with the first pixel point and the second pixel point is determined, taking an unused connected domain label in a plurality of preset connected domain labels as a target connected domain label of the pixel point to be analyzed.
In one embodiment, the connected component labels of the first pixel points adjacent to the pixel point to be analyzed in the upper direction in the same column are recorded in the line label information; the line label information also comprises a connected domain label of a pixel point positioned in the left direction in the same line of the pixel point to be analyzed and a connected domain label of a pixel point positioned in the right direction in the same line of the first pixel point.
In an embodiment, the processor 1601 is further configured to: and after the analysis of the connected domain of the pixel point to be analyzed is completed, updating the row label information according to the determined target connected domain label of the pixel point to be analyzed.
In an embodiment, the processor 1601 is further configured to: after the preset multiple connected domain labels are used up, determining a growing label and a non-growing label from the multiple connected domain labels according to the currently recorded line label information; and performing connected domain analysis on the pixel points which do not finish the connected domain analysis in the image to be analyzed according to the non-growth label.
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 currently recorded row label information, it is specifically configured to: determining a first label in the currently recorded row label information from the plurality of connected domain labels, and determining the first label as a growth label; and determining a second label which does not exist in the currently recorded line label information from the plurality of connected domain labels, and determining the second label as a non-growing label.
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 currently recorded row label information, it is specifically configured to: determining a first label which exists in the currently recorded row label information from the plurality of connected domain labels, and determining a second label which does not exist in the currently recorded row label information; determining a third label which is a root node label or a middle node label of the first label from the plurality of connected domain labels according to the connected domain statistical information; and determining the labels except the third label in the second labels as non-growing labels, and determining the first labels and the third labels as growing labels.
In an embodiment, the connected component statistical information includes a second identification bit, where the second identification bit is used to record a growth identifier of a connected component label, and when the second identification bit is a third identifier, the connected component label is represented as a non-growth label, and when the second identification bit is a fourth identifier, the connected component label is represented as a growth label.
In an embodiment, the processor 1601 is further configured to: determining a connected domain which does not meet a preset condition in the image to be analyzed according to the connected domain statistical information and the label graph; and filtering the pixel points in the connected domain which do not meet the preset condition.
In one embodiment, the condition that the preset condition is not satisfied is: the number of the connected pixel points in the connected domain is less than a preset value.
In one embodiment, the connected component domain statistical information is stored in an on-chip random access memory RAM, and/or the row tag information is stored in an on-chip register, and/or the tag map is stored in an off-chip double rate synchronous dynamic random access memory DDR.
In a specific implementation, the processor 1601, the communication interface 1602, and the memory 1603 described in the embodiment of the present invention may execute an implementation manner described in the connected domain processing method provided in the embodiment of the present invention, and are not described herein again.
In the embodiment of the invention, firstly, connected domain analysis is carried out on the pixel points to be analyzed, and target connected domain labels are recorded for the pixel points to be analyzed in a label graph according to the analysis result; then updating the statistical information of the connected domain according to the target connected domain label; if the target connected domain label is a root node label, first-class statistical data is recorded in the connected domain statistical information, and if the target connected domain label is a middle node label, second-class statistical data is recorded in the connected domain statistical information. By adopting the mode, the read request times of the DDR can be effectively reduced, the multiplexing of statistical data can be realized, the storage space and the computing resource are effectively saved, and the application scene of the connected domain processing is enlarged.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the connected domain processing method according to the above method embodiment is implemented.
Embodiments of the present invention further provide a computer program product including instructions, which when run on a computer, cause the computer to execute the connected domain processing method described in the above method embodiments.
It should be noted that, for simplicity of description, the above-mentioned embodiments of the method are described as a series of acts or combinations, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The connected domain processing method and the data processing device provided by the embodiment of the present invention are described in detail above, and a specific example is applied in the present disclosure to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (39)

1. A connected domain processing method, the method comprising:
acquiring an image to be analyzed, performing connected domain analysis on a current pixel point to be analyzed in the image to be analyzed, and recording a target connected domain label for the pixel point to be analyzed in a label graph of the image to be analyzed according to an analysis result;
updating the connected domain statistical information of the image to be analyzed according to the target connected domain label;
when updating the connected domain statistical information, if the target connected domain label is a root node label, recording first-class statistical data for the target connected domain label in the connected domain statistical information, wherein the first-class statistical data is number data, and the number data is used for indicating the number of pixels which are marked as the target connected domain label and the number of pixels of the marked connected domain label pointing to the target connected domain label; 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, and the pointer data is used for indicating a root node label pointed by the target connected domain label.
2. The method of claim 1, wherein the connected component statistics comprise a first identification bit and a data bit, wherein the first identification bit is used for indicating a type of statistics of the data bit record, and the data bit is used for indicating statistics of the target connected component tag record; when the first identification bit is a first identification, the data bit is the first type of statistical data recorded by the target connected domain label, and when the first identification bit is a second identification, the data bit is the second type of statistical data recorded by the target connected domain label.
3. The method according to claim 2, wherein the performing connected component analysis on the current pixel point to be analyzed in the image to be analyzed comprises:
determining an adjacent pixel point adjacent to the current pixel point to be analyzed from the image to be analyzed;
and performing connected domain analysis on the pixel point to be analyzed according to the adjacent pixel point, and determining a target connected domain label of the pixel point to be analyzed.
4. The method of claim 3, wherein the neighboring pixel point comprises: and the first pixel point is adjacent to the pixel point to be analyzed in the same column in the upper direction, and/or the second pixel point is adjacent to the pixel point to be analyzed in the same row in the left direction.
5. The method according to claim 4, wherein the performing connected component analysis on the pixel point to be analyzed according to the neighboring pixel point to determine a target connected component label of the pixel point to be analyzed comprises:
performing connected domain analysis on the pixel point to be analyzed according to the first pixel point;
and if the fact that the pixel point to be analyzed is communicated with the first pixel point is determined, taking the connected domain label of the first pixel point as a target connected domain label of the pixel point to be analyzed.
6. The method according to claim 4, wherein the performing connected component analysis on the pixel point to be analyzed according to the neighboring pixel point to determine a target connected component label of the pixel point to be analyzed comprises:
performing connected domain analysis on the pixel point to be analyzed according to the second pixel point;
and if the fact that the pixel point to be analyzed is communicated with the second pixel point is determined, the connected domain label of the second pixel point is used as a target connected domain label of the pixel point to be analyzed.
7. The method according to claim 4, wherein the performing connected component analysis on the pixel point to be analyzed according to the neighboring pixel point to determine a target connected component label of the pixel point to be analyzed comprises:
performing connected domain analysis on the pixel point to be analyzed according to the first pixel point and the second pixel point;
and if the fact that the pixel point to be analyzed is communicated with the first pixel point and the second pixel point is determined, taking a connected domain label with the minimum label value in the connected domain labels of the first pixel point and the second pixel point as a target connected domain label of the pixel point to be analyzed.
8. The method of claim 7, further comprising:
determining a connected domain label with the maximum label value in the connected domain labels of the first pixel points and the second pixel points as an intermediate node label pointing to the target connected domain label;
and changing the connected domain label with the maximum label value in the connected domain statistical information.
9. The method of claim 8, wherein the modifying the connected component domain label with the largest label value in the connected component domain statistics comprises:
adjusting a first identification bit corresponding to the connected domain label with the maximum label value in the connected domain statistical information to be the second identification;
and recording second type statistical data for the connected domain label with the maximum label value in the data bit corresponding to the connected domain label with the maximum label value in the connected domain statistical information, wherein the recorded second type statistical data indicates that the connected domain label with the maximum label value points to the target connected domain label.
10. The method according to any one of claims 7 to 9, further comprising:
and if the fact that the pixel point to be analyzed is not communicated with the first pixel point and the second pixel point is determined, taking an unused connected domain label in a plurality of preset connected domain labels as a target connected domain label of the pixel point to be analyzed.
11. The method according to any one of claims 4 to 10, characterized in that a connected component label of a first pixel point adjacent to the pixel point to be analyzed in an upper direction in the same column is recorded in row label information; the line label information also comprises a connected domain label of a pixel point positioned in the left direction in the same line of the pixel point to be analyzed and a connected domain label of a pixel point positioned in the right direction in the same line of the first pixel point.
12. The method of claim 11, further comprising:
and after the analysis of the connected domain of the pixel point to be analyzed is completed, updating the row label information according to the determined target connected domain label of the pixel point to be analyzed.
13. The method of claim 12, further comprising:
after the preset multiple connected domain labels are used up, determining a growing label and a non-growing label from the multiple connected domain labels according to the currently recorded line label information;
and performing connected domain analysis on the pixel points which do not finish the connected domain analysis in the image to be analyzed according to the non-growth label.
14. The method of claim 13, wherein determining a growing label and a non-growing label from the plurality of connected domain labels based on currently recorded row label information comprises:
determining a first label in the currently recorded row label information from the plurality of connected domain labels, and determining the first label as a growth label;
and determining a second label which does not exist in the currently recorded line label information from the plurality of connected domain labels, and determining the second label as a non-growing label.
15. The method of claim 13, wherein determining a growing label and a non-growing label from the plurality of connected domain labels based on currently recorded row label information comprises:
determining a first label which exists in the currently recorded row label information from the plurality of connected domain labels, and determining a second label which does not exist in the currently recorded row label information;
determining a third label which is a root node label or a middle node label of the first label from the plurality of connected domain labels according to the connected domain statistical information;
and determining the labels except the third label in the second labels as non-growing labels, and determining the first labels and the third labels as growing labels.
16. The method according to any one of claims 13 to 15, wherein the connected component statistics information includes a second flag, the second flag is used to record a growth flag of a connected component label, and when the second flag is a third flag, the connected component label is represented as a non-growth label, and when the second flag is a fourth flag, the connected component label is represented as a growth label.
17. The method according to any one of claims 1 to 16, further comprising:
determining a connected domain which does not meet a preset condition in the image to be analyzed according to the connected domain statistical information and the label graph;
and filtering the pixel points in the connected domain which do not meet the preset condition.
18. The method according to claim 17, wherein the condition that the preset condition is not met is that: the number of the connected pixel points in the connected domain is less than a preset value.
19. The method according to claim 11 or 12, characterized in that the connected component statistics are stored in on-chip random access memory RAM, and/or the row tag information is stored in on-chip registers, and/or the tag map is stored in off-chip double rate synchronous dynamic random access memory DDR.
20. A data processing apparatus, characterized by comprising: a memory and a processor, wherein the processor is capable of,
the memory to store program instructions;
the processor to execute the memory-stored program instructions, the processor to, when executed:
acquiring an image to be analyzed, performing connected domain analysis on a current pixel point to be analyzed in the image to be analyzed, and recording a target connected domain label for the pixel point to be analyzed in a label graph of the image to be analyzed according to an analysis result;
updating the connected domain statistical information of the image to be analyzed according to the target connected domain label;
when updating the connected domain statistical information, if the target connected domain label is a root node label, recording first-class statistical data for the target connected domain label in the connected domain statistical information, wherein the first-class statistical data is number data, and the number data is used for indicating the number of pixels which are marked as the target connected domain label and the number of pixels of the marked connected domain label pointing to the target connected domain label; 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, and the pointer data is used for indicating a root node label pointed by the target connected domain label.
21. The data processing apparatus of claim 20, wherein the connected component statistics information comprises a first identification bit and a data bit, wherein the first identification bit is used for indicating a type of statistics data of the data bit record, and the data bit is used for indicating statistics data recorded as the target connected component tag; when the first identification bit is a first identification, the data bit is the first type of statistical data recorded by the target connected domain label, and when the first identification bit is a second identification, the data bit is the second type of statistical data recorded by the target connected domain label.
22. The data processing device according to claim 21, wherein when the processor performs connected component analysis on a current pixel point to be analyzed in the image to be analyzed, the processor is specifically configured to:
determining an adjacent pixel point adjacent to the current pixel point to be analyzed from the image to be analyzed;
and performing connected domain analysis on the pixel point to be analyzed according to the adjacent pixel point, and determining a target connected domain label of the pixel point to be analyzed.
23. The data processing device of claim 22, wherein the neighbor pixel point comprises: and the first pixel point is adjacent to the pixel point to be analyzed in the same column in the upper direction, and/or the second pixel point is adjacent to the pixel point to be analyzed in the same row in the left direction.
24. The data processing device according to claim 23, wherein the processor performs connected component analysis on the pixel to be analyzed according to the neighboring pixel point, and when determining a target connected component label of the pixel to be analyzed, is specifically configured to:
performing connected domain analysis on the pixel point to be analyzed according to the first pixel point;
and if the fact that the pixel point to be analyzed is communicated with the first pixel point is determined, taking the connected domain label of the first pixel point as a target connected domain label of the pixel point to be analyzed.
25. The data processing device according to claim 23, wherein the processor performs connected component analysis on the pixel to be analyzed according to the neighboring pixel point, and when determining a target connected component label of the pixel to be analyzed, is specifically configured to:
performing connected domain analysis on the pixel point to be analyzed according to the second pixel point;
and if the fact that the pixel point to be analyzed is communicated with the second pixel point is determined, the connected domain label of the second pixel point is used as a target connected domain label of the pixel point to be analyzed.
26. The data processing device according to claim 23, wherein the processor performs connected component analysis on the pixel to be analyzed according to the neighboring pixel point, and when determining a target connected component label of the pixel to be analyzed, is specifically configured to:
performing connected domain analysis on the pixel point to be analyzed according to the first pixel point and the second pixel point;
and if the fact that the pixel point to be analyzed is communicated with the first pixel point and the second pixel point is determined, taking a connected domain label with the minimum label value in the connected domain labels of the first pixel point and the second pixel point as a target connected domain label of the pixel point to be analyzed.
27. The data processing device of claim 26, wherein the processor is further configured to:
determining a connected domain label with the maximum label value in the connected domain labels of the first pixel points and the second pixel points as an intermediate node label pointing to the target connected domain label;
and changing the connected domain label with the maximum label value in the connected domain statistical information.
28. The data processing apparatus of claim 27, wherein when the processor changes the connected component tag with the largest tag value in the connected component statistics, the processor is specifically configured to:
adjusting a first identification bit corresponding to the connected domain label with the maximum label value in the connected domain statistical information to be the second identification;
and recording second type statistical data for the connected domain label with the maximum label value in the data bit corresponding to the connected domain label with the maximum label value in the connected domain statistical information, wherein the recorded second type statistical data indicates that the connected domain label with the maximum label value points to the target connected domain label.
29. The data processing device of any of claims 26 to 28, wherein the processor is further configured to:
and if the fact that the pixel point to be analyzed is not communicated with the first pixel point and the second pixel point is determined, taking an unused connected domain label in a plurality of preset connected domain labels as a target connected domain label of the pixel point to be analyzed.
30. The data processing apparatus according to any one of claims 23 to 29, wherein a connected component label of a first pixel point adjacent to the pixel point to be analyzed in an upper direction in the same column is recorded in row label information; the line label information also comprises a connected domain label of a pixel point positioned in the left direction in the same line of the pixel point to be analyzed and a connected domain label of a pixel point positioned in the right direction in the same line of the first pixel point.
31. The data processing device of claim 30, wherein the processor is further configured to:
and after the analysis of the connected domain of the pixel point to be analyzed is completed, updating the row label information according to the determined target connected domain label of the pixel point to be analyzed.
32. The data processing device of claim 31, wherein the processor is further configured to:
after the preset multiple connected domain labels are used up, determining a growing label and a non-growing label from the multiple connected domain labels according to the currently recorded line label information;
and performing connected domain analysis on the pixel points which do not finish the connected domain analysis in the image to be analyzed according to the non-growth label.
33. The data processing device of claim 32, wherein when determining a growing label and a non-growing label from the plurality of connected component labels according to currently recorded row label information, the processor is specifically configured to:
determining a first label in the currently recorded row label information from the plurality of connected domain labels, and determining the first label as a growth label;
and determining a second label which does not exist in the currently recorded line label information from the plurality of connected domain labels, and determining the second label as a non-growing label.
34. The data processing device of claim 32, wherein when determining a growing label and a non-growing label from the plurality of connected component labels according to currently recorded row label information, the processor is specifically configured to:
determining a first label which exists in the currently recorded row label information from the plurality of connected domain labels, and determining a second label which does not exist in the currently recorded row label information;
determining a third label which is a root node label or a middle node label of the first label from the plurality of connected domain labels according to the connected domain statistical information;
and determining the labels except the third label in the second labels as non-growing labels, and determining the first labels and the third labels as growing labels.
35. The data processing device according to any one of claims 32 to 34, wherein the connected component statistics information includes a second identification bit, the second identification bit is used for recording a growth identification of a connected component label, and when the second identification bit is a third identification, the connected component label is represented as a non-growth label, and when the second identification bit is a fourth identification, the connected component label is represented as a growth label.
36. The data processing device of any of claims 20 to 35, wherein the processor is further configured to:
determining a connected domain which does not meet a preset condition in the image to be analyzed according to the connected domain statistical information and the label graph;
and filtering the pixel points in the connected domain which do not meet the preset condition.
37. The data processing apparatus of claim 36, wherein the non-satisfaction of the preset condition is: the number of the connected pixel points in the connected domain is less than a preset value.
38. The data processing device according to claim 30 or 31, wherein the connected component statistics information is stored in an on-chip random access memory RAM, and/or wherein the row tag information is stored in an on-chip register, and/or wherein the tag map is stored in an off-chip double rate synchronous dynamic random access memory DDR.
39. A computer-readable storage medium having a computer program stored therein, characterized in that: the computer program when executed by a processor implementing the steps of the method according to any one of claims 1 to 19.
CN201980005003.5A 2019-03-29 2019-03-29 Connected domain processing method, data processing device and computer readable storage medium Pending CN111213178A (en)

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
CN111213178A true CN111213178A (en) 2020-05-29

Family

ID=70790113

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201980005003.5A Pending CN111213178A (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 (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115049649A (en) * 2022-08-12 2022-09-13 山东振鹏建筑钢品科技有限公司 Reinforcing steel bar polishing and rust removing control method based on corrosion degree
CN116756071A (en) * 2023-08-21 2023-09-15 腾讯科技(深圳)有限公司 Data transmission method, apparatus, device, storage medium and computer program product
CN116993798A (en) * 2023-09-28 2023-11-03 荣耀终端有限公司 Image processing method and electronic equipment

Families Citing this family (3)

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

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103065314A (en) * 2012-12-28 2013-04-24 中国电子科技集团公司第五十四研究所 Image communicated domain rapid marking method based on linear description
CN103400125A (en) * 2013-07-08 2013-11-20 西安交通大学 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
CN107833238A (en) * 2017-11-14 2018-03-23 京东方科技集团股份有限公司 Largest connected field mark method, method for tracking target, augmented reality/virtual reality device
CN108345888A (en) * 2018-02-11 2018-07-31 浙江华睿科技有限公司 A kind of connected domain extracting method and device
CN109074654A (en) * 2017-12-29 2018-12-21 深圳市大疆创新科技有限公司 It is connected to area detecting method, circuit, equipment, computer readable storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6898314B2 (en) * 2001-12-26 2005-05-24 Lockheed Martin Corporation Grayscale image connected components segmentation
CN104503731A (en) * 2014-12-15 2015-04-08 柳州职业技术学院 Quick identification method for binary image connected domain marker

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103065314A (en) * 2012-12-28 2013-04-24 中国电子科技集团公司第五十四研究所 Image communicated domain rapid marking method based on linear description
CN103400125A (en) * 2013-07-08 2013-11-20 西安交通大学 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
CN107833238A (en) * 2017-11-14 2018-03-23 京东方科技集团股份有限公司 Largest connected field mark method, method for tracking target, augmented reality/virtual reality device
CN109074654A (en) * 2017-12-29 2018-12-21 深圳市大疆创新科技有限公司 It is connected to area detecting method, circuit, equipment, computer readable storage medium
CN108345888A (en) * 2018-02-11 2018-07-31 浙江华睿科技有限公司 A kind of connected domain extracting method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
张春明等: "一种常用两次扫描算法的改进" *
罗志灶等: "基于数组型并查集的连通域标记算法" *

Cited By (6)

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

Also Published As

Publication number Publication date
WO2020198997A1 (en) 2020-10-08

Similar Documents

Publication Publication Date Title
CN111213178A (en) Connected domain processing method, data processing device and computer readable storage medium
AU2017232186A1 (en) Fast and robust image alignment for burst mode
US20100034469A1 (en) Method of fast searching and recognition of a digital image representative of at least one graphical pattern in a bank of digital images
US8965132B2 (en) Edge tracing with hysteresis thresholding
CN112950554B (en) Lung lobe segmentation optimization method and system based on lung segmentation
CN109034266A (en) A kind of target image detection method, apparatus and system
CN111881659B (en) Processing method and system of table picture, readable storage medium and computer equipment
US11270439B2 (en) Histogram-based method for auto segmentation of integrated circuit structures from SEM images
KR20220070482A (en) Image incremental clustering method, apparatus, electronic device, storage medium and program product
CN115937065A (en) Foreign matter detection method, device and equipment of display module and storage medium
CN108876701B (en) Run-length-based single-scanning connected domain marking method and hardware structure thereof
JP2014026370A (en) Image area segmentation device and image area segmentation program
CN111814795A (en) Character segmentation method, device and computer readable storage medium
CN114357958A (en) Table extraction method, device, equipment and storage medium
CN115908363B (en) Tumor cell statistics method, device, equipment and storage medium
CN113573137B (en) Video canvas boundary detection method, system, terminal equipment and storage medium
CN114820662A (en) Road side visual angle ground segmentation method, system and medium based on point cloud two-dimensional density
Nagendra et al. Patchrefinenet: Improving binary segmentation by incorporating signals from optimal patch-wise binarization
JP6922690B2 (en) Character area extraction program, character area extraction device and character area extraction method
CN108090483B (en) Method and device for detecting breast tumor candidate region
KR20110009761A (en) Real-time moving object detection for intelligent visual surveillance
CN117952992B (en) Intelligent segmentation method and device for CT image
CN115439488A (en) Sky region segmentation method based on bidirectional constraint
CN113435284B (en) Post-disaster road extraction method based on dynamic filtering and multi-direction attention fusion
CN112328629B (en) Entity object processing method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20200529

WD01 Invention patent application deemed withdrawn after publication