Serial image multi-connected domain segmentation method based on linked list structure
By introducing a linked list data structure into serial image processing, the problems of high computational cost and severe memory consumption are solved, and efficient multi-connected component segmentation of images is achieved. This method is suitable for high frame rate point target measurement and high dynamic weak target tracking on real-time hardware platforms.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING AEROSPACE INST FOR METROLOGY & MEASUREMENT TECH
- Filing Date
- 2025-11-10
- Publication Date
- 2026-06-05
AI Technical Summary
Existing technologies suffer from high computational cost and severe memory consumption in serial image multi-connected component segmentation. In particular, they cannot meet the requirements of sequential transmission of serial image streams in a row-first, column-later manner on hardware platforms, resulting in low algorithm efficiency.
A linked list data structure is adopted, including a linked list of connected component nodes and a linked list of row segment nodes. The upper neighbor connectivity features are determined through simple branch judgment. The image is traversed row by row and column by column to determine the connected component relationships and calculate the centroid.
It achieves efficient image processing on a real-time hardware platform, suitable for high frame rate point target measurement and high dynamic weak target tracking, while reducing memory overhead and computational complexity.
Smart Images

Figure CN122156223A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of real-time image processing, and in particular to a method for segmenting multiple connected components in a serial image based on a linked list structure, specifically applied to the extraction of multiple point-like or small-scale light spot targets in a serial image. Background Technology
[0002] Subpixel-level localization of distant small targets or point targets is generally achieved by calculating the gray-level centroid of the target region. Therefore, extracting the target from the background is a crucial prerequisite for target localization. If multiple targets appear in the image, in addition to segmenting the target pixels from the background using gray-level thresholding, it is also necessary to segment the target region using connected components.
[0003] Current multi-target connected component segmentation processes require determining the connected component to which each pixel belongs. This determination process necessitates traversing the connected component information of its surrounding pixels, resulting in a large number of non-sequential memory accesses. Therefore, the entire image needs to be stored in a cache to accommodate these numerous non-sequential accesses. However, such data access requirements cannot meet the demands of sequential image stream transmission (row-to-column).
[0004] On hardware platforms, images are typically transmitted on a bus in a serial streaming format, row by row. However, determining the connectivity of four-neighbor regions involves not only the left and top neighbors (which are visible in the same direction as the streaming output) but also the unknown right and bottom neighbors (the same applies to eight-neighbor regions). Therefore, typical connected component segmentation requires caching the entire image for reverse-order determination. Another approach uses the connectivity of adjacent rows and the entire image as statistical targets, updating the row connectivity information row by row. While suitable for serial data, this method requires frequent changes to the row target information, leading to complex array element insertion and deletion operations. Furthermore, the centroid is processed only after the entire image is processed, resulting in significant memory overhead for images with dense targets, severely impacting algorithm efficiency.
[0005] In summary, current methods for segmenting multiple connected components of serial images are relatively limited, and the process involves repeated addition, subtraction, and merging operations of array elements, resulting in high computational cost and significant memory consumption. Summary of the Invention
[0006] This disclosure provides a method for connected component segmentation of point targets or small targets on a serial image stream platform. This method introduces a linked list data structure, using both connected component node linked lists and row segment node linked lists to describe the connected component relationships of the target region. In the specific processing algorithm, in addition to using connected component statistics, row segment information variables are added to determine the connectivity features of the upper neighbor regions. The algorithm is mostly based on simple branch judgments and can be applied to large-scale logic processing devices with slight modifications. Therefore, it can be widely used in situations with high real-time requirements and where images are not cached, making it very suitable for applications such as high frame rate point target measurement and continuous tracking of high-dynamic, weak targets.
[0007] The serial image multi-connected component segmentation method based on linked list structure disclosed herein mainly includes the following steps: S1, define the basic data structure, including a fragment structure, a connected component linked list, and a row segment linked list, wherein the fragment is a set of consecutive row pixels that are greater than the background grayscale threshold in a row; the nodes in the connected component linked list are used to describe the connected component information of the target region in the image; the nodes in the row segment linked list are used to describe the position information of the fragment belonging to a certain connected component node; S2, for the serial image stream, traverses the image row by row and column by column according to its input order (row first, column last), determining the connected component to which each pixel belongs, with row traversal nested with column traversal; including: Before executing the column traversal subroutine, perform linked list operations when a newline is added, updating the current row segment linked list to the previous row segment linked list, and setting the current row segment linked list to empty, thus creating a primary backup for the new row traversal; after executing the column connectivity subroutine, process any segments that have not yet been closed, and simultaneously consider any connected components whose current row segment linked list is empty as complete, and output their centroids. During the execution of the column traversal subroutine, each pixel is checked to see if it exceeds the background threshold. Depending on the situation, fragment updates are enabled, maintained, or disabled; for disabled fragments, the linked list is updated. During the subroutine for updating the linked list, depending on the connected components, the closed segment is introduced into an existing connected component node, a new node is created, or nodes are merged.
[0008] Furthermore, step S1 specifically includes: (1) Fragment structure: used to describe the set of consecutive pixels in a row that are greater than the background grayscale threshold. It is used in the column-by-column traversal subroutine. Its state is divided into update state and closed state. It is in the update state when the fragment is not finished, and in the closed state otherwise. The data items of this structure include: Left boundary of the fragment: the column number of the leftmost pixel in the current fragment region; Right boundary of the fragment: the column number of the rightmost pixel in the current fragment region; Pixel count: The total number of pixels in the current segment; Gray sum: The sum of the gray levels of the current segment; X-weighted grayscale sum: The sum of the product of the X coordinate and the grayscale value of the current segment; Y-weighted grayscale sum: The sum of the product of the Y-coordinate and the grayscale value of the current segment; Image edge markers: Markers indicating whether the current segment is connected to any of the four edges of the image; Fragment attachment flag: A flag indicating whether the current fragment has been attached to a row segment node in the current row segment linked list of a connected component; Fragment attachment pointer: If the fragment attachment flag is true, then the connected component node to which the attached row segment node belongs is recorded; (2) Connected component nodes describe the connected component information of a target in the image. The data items of this linked list node include: Pixel count: The number of pixels in the current connected component nodes; Gray sum: The sum of the gray levels of the nodes in the current connected component; X-weighted grayscale sum: The sum of the product of the X coordinate and grayscale value of the current connected node; Y-weighted grayscale sum: The sum of the products of the Y-coordinate and grayscale value of the current connected component node; Image edge markers: Mark whether the current connected component node is connected to one of the four edges of the image; The root node of the previous row segment: the pointer to the root node of the linked list of the row segments connected to the current connected node in the previous row; The root node of the current row segment: a pointer to the root node of the linked list of row segments connected to the current row by the current connected node; Previous node pointer: used to form a doubly linked list of connected nodes; Post node pointer: used to form a doubly linked list of connected component nodes; (3) Row segment node, used to describe the position information of a segment belonging to a certain connected component node. The data items of this linked list node include: Segment start column: same as the left boundary of the segment; Section termination column: same as the right boundary of the segment; Previous node pointer: used to form a doubly linked list of connected nodes; Post node pointer: Used to form a doubly linked list of connected nodes.
[0009] Furthermore, in step S2, the subroutine for line-by-line traversal includes the following steps: Traverse each node in the connected domain linked list one by one, unregister the content attached to the previous row of the segment linked list for each node, and attach the root node of the current row of the segment linked list to the root node of the previous row of the segment linked list. Perform a column-by-column traversal subroutine, that is, traverse pixel by pixel; After the column-by-column traversal subroutine reaches the last column, it checks whether the fragment structure is still in the update state. If so, the fragment update ends and the fragment is sent to the update linked list subroutine. Traverse each node in the connected component linked list. If the current row segment linked list of a certain node is still empty, it indicates that the connected component has ended in this row. Then extract the centroid of the connected component and delete the node.
[0010] Furthermore, in step S2, the subroutine for column-by-column traversal includes the following steps: Determine if the pixel grayscale of the currently traversed column is less than the threshold. If so, then determine if the fragment structure is in an update state. If so, change the flag to the off state and send the fragment information to the update list subroutine. If the pixel grayscale is greater than or equal to the threshold in the previous judgment, then it is then determined whether the fragment structure is in an update state. If the segment is not in the update state in the previous judgment, it means that the pixel is the first pixel of the new segment. In this case, the original segment structure information is cleared and a new segment record is created. If the segment is already in an updated state in the previous judgment, it means that the pixel is in the segment's continuous pixel cluster, and the segment record is updated.
[0011] Furthermore, in step S2, the step of updating the linked list specifically includes: (1) Determine the left and right column numbers related to the current segment's 8-connected or 4-connected domain based on the left and right boundary information of the current segment; (2) Traverse each node in the connected component linked list; (3) For each connected component node, traverse the nodes in the previous row of the linked list that it is attached to; (4) Determine whether the starting and ending range of the node in the current segment is connected to the left and right column number ranges calculated in the previous order. If so, determine whether the current segment has been attached to a certain connected component node. (5) If a connected component node has been attached, the connected component nodes are merged, the current connected component node is deregistered, its accumulated grayscale, pixel and weighted value information is added to the attached connected component, the previous row segment linked list attached to it is appended to the end of the previous row segment linked list of the attached connected component node, and the current row segment linked list attached to it is connected to the row segment node generated by this segment and appended to the end of the current row segment linked list of the attached connected component node. (6) If the fragment has not yet been attached to a connected component node, update the information of the currently traversed connected component node, and insert this fragment as a new row segment node into the current row segment linked list of the current connected component node; at the same time, mark the fragment as attached to a connected component, and point the attachment pointer to the current connected component node. (7) After the branches in steps (4), (5), and (6) are completed, determine whether the traversal of the connected component nodes has reached the end of the linked list; if so, further determine whether the current segment is still not attached to any connected component nodes. (8) If it is true that no connected component node is attached, a new connected component node is created and attached to the connected component linked list, and the current segment is introduced as the first node of the current row segment linked list of the new connected component node.
[0012] The method disclosed herein utilizes a linked list to store connected components and row segment information. This data structure makes the insertion, merging, and deletion operations of connected components convenient and efficient, and the dynamic node recycling also enables the algorithm to be efficiently applied to images with dense targets.
[0013] Compared with existing technologies, the beneficial effects of this disclosure are: ① It flexibly uses a doubly linked list data structure to achieve the centroid localization of the entire image with a single sequential traversal; ② It uses row segment statistics to retain the feature judgment of the upper neighbor and uses a connected component linked list to perform real-time calculation of key quantities for centroid localization; ③ The method is simple and easy to implement, and is particularly suitable for the output of streaming image information on real-time hardware image platforms. With slight modifications, the method can be applied to logic devices such as FPGAs, making it very suitable for application scenarios such as high frame rate point target measurement and continuous tracking of high dynamic weak targets. Attached Figure Description
[0014] The above and other objects, features and advantages of this disclosure will become more apparent from the more detailed description of exemplary embodiments of this disclosure taken in conjunction with the accompanying drawings, in which the same reference numerals generally represent the same components.
[0015] Figure 1 This is a schematic diagram of the basic data structure according to this disclosure; Figure 2 Flowchart for the row and column traversal subroutine; Figure 3 Flowchart for updating the linked list subroutine; Figure 4 Example of connected component splitting. Detailed Implementation
[0016] Preferred embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While preferred embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be thorough and complete, and will fully convey the scope of the present disclosure to those skilled in the art.
[0017] This disclosure provides a serial image multi-connected component segmentation method based on a linked list structure, the main steps of which include: 1. Define the basic data structure, including a fragment structure, a connected component linked list, and a row segment linked list. The fragment is a set of consecutive pixels in a row that are greater than the background grayscale threshold. The nodes in the connected component linked list are used to describe the connected component information of the target region in the image. The nodes in the row segment linked list are used to describe the position information of the fragment belonging to a certain connected component node. 2. For a serial image stream, traverse the image row by row and column by column according to its input order (row first, column last), determine the connected components to which each pixel belongs, and nest row traversal with column traversal; this includes: Before performing column traversal, update the current row segment list to the previous row segment list, and set the current row segment list to empty to prepare for the new row traversal; After completing the column traversal, the connected components where the current row segment linked list is empty are considered complete, and the centroid is output. The column traversal process includes: determining whether each pixel is greater than the background threshold, and enabling, maintaining, or disabling fragment updates based on different situations; and updating the connected component list and row segment list simultaneously based on the disabled fragments. The linked list update process includes: depending on the connected components, introducing closed segments into existing connected component nodes, creating new nodes, or merging nodes.
[0018] In one exemplary implementation, the serial image multi-connected component segmentation method based on a linked list structure is as follows: 1. Define the basic data structure The basic data structure consists of fragment structures, connected component nodes, and row segment nodes, such as... Figure 1 As shown.
[0019] (1) The fragment structure describes a set of consecutive pixels in a row that are greater than the background grayscale threshold. This structure is used in the column-by-column traversal subroutine, and its state is divided into an update state and a closed state. It is in the update state when the fragment is not finished, and in the closed state otherwise. The data items of this structure are as follows: Left boundary of the fragment: the column number of the leftmost pixel in the current fragment region; Right boundary of the fragment: the column number of the rightmost pixel in the current fragment region; Pixel count: The total number of pixels in the current segment; Gray sum: The sum of the gray levels of the current segment; X-weighted grayscale sum: The sum of the product of the X coordinate and the grayscale value of the current segment; Y-weighted grayscale sum: The sum of the product of the Y-coordinate and the grayscale value of the current segment; Image edge markers: Markers indicating whether the current segment is connected to any of the four edges of the image; Fragment attachment flag: A flag indicating whether the current fragment has been attached to a row segment node in the current row segment linked list of a connected component; Fragment attachment pointer: If the fragment attachment flag is true, then the connected component node to which the attached row segment node belongs is recorded.
[0020] (2) Connected component nodes describe the connected component information of a target in the image. The data items of this linked list node are shown below: Pixel count: The number of pixels in the current connected component nodes; Gray sum: The sum of the gray levels of the nodes in the current connected component; X-weighted grayscale sum: The sum of the product of the X coordinate and grayscale value of the current connected node; Y-weighted grayscale sum: The sum of the products of the Y-coordinate and grayscale value of the current connected component node; Image edge markers: Mark whether the current connected component node is connected to one of the four edges of the image; The root node of the previous row segment: the pointer to the root node of the linked list of the row segments connected to the current connected node in the previous row; The root node of the current row segment: a pointer to the root node of the linked list of row segments connected to the current row by the current connected node; Previous node pointer: used to form a doubly linked list of connected nodes; Post node pointer: Used to form a doubly linked list of connected nodes.
[0021] (3) The row segment node describes the position information of a segment belonging to a certain connected component node. The data items of this linked list node are as follows: Segment start column: same as the left boundary of the segment; Section termination column: same as the right boundary of the segment; Previous node pointer: used to form a doubly linked list of connected nodes; Post node pointer: Used to form a doubly linked list of connected nodes.
[0022] 2. For a serial image stream, traverse the image row by row and column by column according to its input order (row first, column last), determine the connected component to which each pixel belongs, and nest the row traversal with the column traversal.
[0023] The algorithm flow is as follows Figure 2 As shown: (1) The serial image stream is output in row-first, column-second order, from the top left corner (coordinate (0,0)) to the bottom right corner (coordinate (M-1,N-1)). The image has a total of M rows and N columns. The outer loop of the algorithm is a subroutine that iterates through each row.
[0024] (2) In the subroutine that iterates line by line, the algorithm performs the following four steps in sequence: ○1 Traverse each node in the connected domain linked list one by one, unattach the content of the previous row of the segment linked list to each node, and attach the root node of the current row of the segment linked list to the root node of the previous row of the segment linked list.
[0025] ○2 Perform a column-by-column (i.e. pixel-by-pixel) traversal subroutine.
[0026] ○3 After the column-by-column traversal subroutine reaches the last column, it checks whether the fragment structure is still in the update state. If so, it ends the fragment update and sends the fragment to the update linked list subroutine.
[0027] ○4 Traverse each node of the connected component linked list. If the current row segment linked list of a certain node is still empty, it indicates that the connected component has ended in this row. Then extract the centroid of the connected component and delete the node.
[0028] (3) In the subroutine that iterates column by column (i.e. pixel by pixel), the algorithm performs the following four steps in sequence: ○1 Determine if the grayscale of the pixel in the currently traversed column is less than the threshold. If so, then determine if the fragment structure is in an update state. If so, change the flag to the off state and send the fragment information to the update list subroutine.
[0029] ○2 If the pixel grayscale is greater than or equal to the threshold in the previous judgment, then it is then judged whether the fragment structure is in the update state.
[0030] ○3 If the segment is not in the update state in the previous judgment, it means that the pixel is the first pixel of the new segment, and the original segment structure information needs to be cleared and a new segment record needs to be created.
[0031] ○4 If the segment is already in the update state in the previous judgment, it means that the pixel is in the segment's continuous pixel cluster and the segment record needs to be updated.
[0032] 3. Update the linked list subroutine flow, such as... Figure 3 As shown ○1 Determine the left and right column numbers associated with the current segment based on its left and right boundary information.
[0033] ○2 Traverse each node in the connected component linked list.
[0034] ○3 For each connected component node, iterate through the nodes in the linked list of the previous row that it is attached to.
[0035] ○4 Determine whether the starting and ending ranges of the current segment node are connected to the left and right column number ranges calculated in the previous order. If so, determine whether the current segment has been attached to a certain connected component node.
[0036] ○5 If a node is already attached to a connected component, the connected component nodes are merged. The current connected component node is deregistered, and its accumulated grayscale, pixel, and weighted value information are added to the attached connected component. The linked list of the previous row segment attached to it is appended to the end of the linked list of the previous row segment of the attached connected component node. The linked list of the current row segment attached to it, connected to the row segment node generated by this segment, is appended to the end of the linked list of the current row segment of the attached connected component node.
[0037] ○6 If the segment has not yet been attached to a connected component node, update the information of the currently traversed connected component node, and insert this segment as a new row segment node into the current row segment linked list of the current connected component node. At the same time, mark the segment as attached to a connected component and point the attachment pointer to the current connected component node.
[0038] ○7 After completing steps ○4, ○5, and ○6, determine whether the traversal of the connected component nodes has reached the end of the linked list. If so, further determine whether the current segment is still not attached to any connected component nodes.
[0039] ○8 If it is true that no connected component node is attached, then create a new connected component node and attach it to the connected component linked list, and introduce the current segment as the first node of the current row segment linked list of the new connected component node.
[0040] Application examples, such as Figure 4 As shown: (1) When traversing the first line, four segments appear in sequence. After traversing the line, four connected component nodes are generated, and the current line segment linked list of each connected component node is attached with one node.
[0041] (2) Before traversing the second row, the current row segment list of each connected component node is instead attached to the segment list of the previous row. After traversal, the current row segment list of node C1 is attached to one row segment node of this row, node C2 is attached to two current row segment nodes, and C3 and C4 are merged because they share a connected component relationship with one current row segment node.
[0042] (3) When traversing the third line, the current line segment still appears in the connected domain of C1, and the current line segment linked lists of C2 and C3 are empty. Then the centroid is output in turn, and the nodes of C2 and C3 are cancelled.
[0043] (4) When traversing the 4th line, no current row segment appears in the C1 connected domain node, so the centroid is output and the C1 node is deregistered.
[0044] (5) When traversing the 5th line, the connected component list is empty.
[0045] The above technical solutions are merely exemplary embodiments of the present invention. For those skilled in the art, based on the application methods and principles disclosed in the present invention, it is easy to make various types of improvements or modifications, and not limited to the methods described in the specific embodiments of the present invention. Therefore, the methods described above are merely preferred and not restrictive.
Claims
1. A serial image multi-connected component segmentation method based on a linked list structure, characterized in that, Includes the following steps: S1, define the basic data structure, including a fragment structure, a connected component linked list, and a row segment linked list, wherein the fragment is a set of consecutive row pixels that are greater than the background grayscale threshold in a row; the nodes in the connected component linked list are used to describe the connected component information of the target region in the image; the nodes in the row segment linked list are used to describe the position information of the fragment belonging to a certain connected component node; S2, for the serial image stream, traverses the image row by row and column by column according to its input order (row first, column last), determining the connected component to which each pixel belongs, with row traversal nested with column traversal; including: Before performing column traversal, update the current row segment list to the previous row segment list, and set the current row segment list to empty to prepare for the new row traversal; After completing the column traversal, the connected components where the current row segment linked list is empty are considered complete, and the centroid is output. The column traversal process includes: determining whether each pixel is greater than the background threshold, and enabling, maintaining, or disabling fragment updates based on different situations; and updating the connected component list and row segment list simultaneously based on the disabled fragments. The linked list update process includes: depending on the connected components, introducing closed segments into existing connected component nodes, creating new nodes, or merging nodes.
2. The method according to claim 1, characterized in that, Step S1 specifically includes: (1) Fragment structure: used to describe the set of consecutive pixels in a row that are greater than the background grayscale threshold. It is used in the column-by-column traversal subroutine. Its state is divided into update state and closed state. It is in the update state when the fragment is not finished, and in the closed state otherwise. The data items of this structure include: Left boundary of the fragment: the column number of the leftmost pixel in the current fragment region; Right boundary of the fragment: the column number of the rightmost pixel in the current fragment region; Pixel count: The total number of pixels in the current segment; Gray sum: The sum of the gray levels of the current segment; X-weighted grayscale sum: The sum of the product of the X coordinate and the grayscale value of the current segment; Y-weighted grayscale sum: The sum of the product of the Y-coordinate and the grayscale value of the current segment; Image edge markers: Markers indicating whether the current segment is connected to any of the four edges of the image; Fragment attachment flag: A flag indicating whether the current fragment has been attached to a row segment node in the current row segment linked list of a connected component; Fragment attachment pointer: If the fragment attachment flag is true, then the connected component node to which the attached row segment node belongs is recorded; (2) Connected component nodes describe the connected component information of a target in the image. The data items of this linked list node include: Pixel count: The number of pixels in the current connected component nodes; Gray sum: The sum of the gray levels of the nodes in the current connected component; X-weighted grayscale sum: The sum of the product of the X coordinate and grayscale value of the current connected node; Y-weighted grayscale sum: The sum of the products of the Y-coordinate and grayscale value of the current connected component node; Image edge markers: Mark whether the current connected component node is connected to one of the four edges of the image; The root node of the previous row segment: the pointer to the root node of the linked list of the row segments connected to the current connected node in the previous row; The root node of the current row segment: a pointer to the root node of the linked list of row segments connected to the current row by the current connected node; Previous node pointer: used to form a doubly linked list of connected nodes; Post node pointer: used to form a doubly linked list of connected component nodes; (3) Row segment node, used to describe the position information of a segment belonging to a certain connected component node. The data items of this linked list node include: Segment start column: same as the left boundary of the segment; Section termination column: same as the right boundary of the segment; Previous node pointer: used to form a doubly linked list of connected nodes; Post node pointer: Used to form a doubly linked list of connected nodes.
3. The method according to claim 2, characterized in that, In step S2, the subroutine for traversing line by line includes the following steps: Traverse each node in the connected domain linked list one by one, unregister the content attached to the previous row of the segment linked list for each node, and attach the root node of the current row of the segment linked list to the root node of the previous row of the segment linked list. Perform a column-by-column traversal subroutine, that is, traverse pixel by pixel; After the column-by-column traversal subroutine reaches the last column, it checks whether the fragment structure is still in the update state. If so, the fragment update ends and the fragment is sent to the update linked list subroutine. Traverse each node in the connected component linked list. If the current row segment linked list of a certain node is still empty, it indicates that the connected component has ended in this row. Then extract the centroid of the connected component and delete the node.
4. The method according to claim 3, characterized in that, In step S2, the subroutine for column-by-column traversal includes the following steps: Determine if the pixel grayscale of the currently traversed column is less than the threshold. If so, then determine if the fragment structure is in an update state. If so, change the flag to the off state and send the fragment information to the update list subroutine. If the pixel grayscale is greater than or equal to the threshold in the previous judgment, then it is then determined whether the fragment structure is in an update state. If the segment is not in the update state in the previous judgment, it means that the pixel is the first pixel of the new segment. In this case, the original segment structure information is cleared and a new segment record is created. If the segment is already in an updated state in the previous judgment, it means that the pixel is in the segment's continuous pixel cluster, and the segment record is updated.
5. The method according to claim 3 or 4, characterized in that, In step S2, the step of updating the linked list specifically includes: (1) Determine the left and right column numbers related to the current segment's 8-connected or 4-connected domain based on the left and right boundary information of the current segment; (2) Traverse each node in the connected component linked list; (3) For each connected component node, traverse the nodes in the linked list of the previous row attached to it one by one; (4) Determine whether the starting and ending range of the node in the current segment is connected to the left and right column number ranges calculated in the previous order. If so, determine whether the current segment has been attached to a certain connected component node. (5) If a connected component node has been attached, the connected component nodes are merged, the current connected component node is deregistered, its accumulated grayscale, pixel and weighted value information is added to the attached connected component, the previous row segment linked list attached to it is appended to the end of the previous row segment linked list of the attached connected component node, and the current row segment linked list attached to it is connected to the row segment node generated by this segment and appended to the end of the current row segment linked list of the attached connected component node. (6) If the fragment has not yet been attached to a connected component node, update the information of the currently traversed connected component node, and insert this fragment as a new row segment node into the current row segment linked list of the current connected component node; at the same time, mark the fragment as attached to a connected component, and point the attachment pointer to the current connected component node. (7) After the branches in steps (4), (5), and (6) are completed, determine whether the traversal of the connected component nodes has reached the end of the linked list; if so, further determine whether the current segment is still not attached to any connected component nodes. (8) If it is true that no connected component node is attached, a new connected component node is created and attached to the connected component linked list, and the current segment is introduced as the first node of the current row segment linked list of the new connected component node.