Method and apparatus for blob image pixel boundary tracking based on run-length encoding
By proposing a run-length encoding-based pixel boundary tracking method for Blob images, the method calculates the pixel boundaries of Blob images using run-length encoding, thus solving the problem of high computational cost in Blob image pixel boundary analysis and achieving a significant improvement in computational efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING SMARTER EYE TECH CO LTD
- Filing Date
- 2025-09-25
- Publication Date
- 2026-07-21
AI Technical Summary
Existing methods for analyzing pixel boundaries in Blob images suffer from high computational cost and low computational efficiency.
A run-length encoding-based Blob image pixel boundary tracking method is adopted. By determining the current run corresponding to the current state of the target Blob image, the next run corresponding to the next state is predicted according to preset judgment conditions, and all position points contained in the boundary from the current run to the next run are extracted.
It significantly reduces computational load and improves the computational efficiency of traditional algorithms.
Smart Images

Figure CN120876523B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method and apparatus for tracking pixel boundaries in Blob images based on run-length encoding. Background Technology
[0002] Blob analysis is a common technique in computer vision and image processing, primarily used to identify and analyze connected pixel regions (i.e., "blobs") in images. These regions typically correspond to objects, defects, markers, or specific textures in a real-world scene. However, conventional methods for pixel boundary tracking using blob analysis, which analyze 2D blob images, involve significant computational overhead and are computationally inefficient. Summary of the Invention
[0003] This invention provides a method and apparatus for tracking pixel boundaries in Blob images based on run-length encoding, in order to solve the problems of large computational load and low computational efficiency in existing Blob image pixel boundary analysis.
[0004] This invention provides a method for tracking pixel boundaries in Blob images based on run-length encoding, the method comprising:
[0005] Determine the current run corresponding to the current state of the target Blob image;
[0006] Predict the next run corresponding to the next state based on preset judgment conditions to achieve state transition prediction;
[0007] Extract all position points contained in the boundary from the current run to the next run to perform the transfer operation.
[0008] In some embodiments, the preset judgment condition specifically includes:
[0009] In Travel Collection Search itinerary If point If is the left endpoint, then the following must be satisfied:
[0010] ;
[0011] If point If is the right endpoint, then the following must be satisfied:
[0012] ;
[0013] If a point that meets the above conditions is found, return. Otherwise, return .
[0014] In some embodiments, the preset judgment condition specifically includes:
[0015] In Travel Collection Search itinerary It satisfies the following conditions:
[0016] If multiple runs exist, select the leftmost run.
[0017] If a point that meets the above conditions is found, return. Otherwise, return .
[0018] In some embodiments, the preset judgment condition specifically includes:
[0019] In Travel Collection Search itinerary It satisfies the following conditions:
[0020] If there are multiple runs, select the rightmost run.
[0021] If a point that meets the above conditions is found, return. Otherwise, return .
[0022] In some embodiments, the transfer operation specifically includes:
[0023] In each operation, consider the first All points on the row, Except for the endpoints, In the line, number row or OK;
[0024] If point In the For rightward operations, start from point... Begin the transfer operation; for leftward operations, start from point... Initiate transfer operation;
[0025] If point Not in If it is a line, then start from the point. Initiate transfer operation;
[0026] like In the OK, ,Right now or , is the last point in the point set;
[0027] like Not in Line, point set includes .
[0028] In some embodiments, the obtained pixel boundary tracking states are summarized.
[0029] The present invention also provides a blob image pixel boundary tracking device based on run-length encoding, the device comprising:
[0030] The run-length encoding unit is used to determine the current run corresponding to the current state of the target Blob image;
[0031] The transition prediction unit is used to predict the next run corresponding to the next state based on preset judgment conditions, so as to realize state transition prediction.
[0032] The transfer operation unit is used to extract all position points contained in the boundary from the current run to the next run in order to perform the transfer operation.
[0033] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described above.
[0034] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described above.
[0035] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the method described above.
[0036] The present invention provides a method and apparatus for Blob image pixel boundary tracking based on run-length encoding. This method determines the current run corresponding to the current state of the target Blob image, predicts the next run corresponding to the next state based on preset judgment conditions, and thus achieves state transition prediction. It also extracts all position points contained in the boundary from the current run to the next run to achieve the transition operation. In this way, the run-length encoding-based Blob pixel boundary tracking method significantly reduces computational load and improves the computational efficiency of traditional algorithms by calculating the pixel boundaries of the Blob image using run-length encoding. Attached Figure Description
[0037] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0038] Figure 1This is a schematic diagram of the target pixel boundary and contour boundary;
[0039] Figure 2 This is a schematic diagram of Blob pixel boundary tracking based on run-length encoding;
[0040] Figure 3 These are schematic diagrams of four tracking states;
[0041] Figure 4 This is a flowchart of the Blob image pixel boundary tracking method based on run-length encoding provided by the present invention;
[0042] Figure 5 This is a structural block diagram of the Blob image pixel boundary tracking device based on run-length encoding provided by the present invention;
[0043] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0045] To facilitate understanding, the basic principle of Blob pixel boundary tracking based on run-length encoding will be introduced first.
[0046] Boundary tracking aims to represent the boundaries of a target (i.e., a Blob difference image). This paper proposes a run-length encoding-based Blob pixel boundary tracking method, which aims to reduce computational cost and improve the computational efficiency of traditional algorithms.
[0047] Boundaries can be represented in two ways: pixel boundaries and contour boundaries. Pixel boundaries are represented using pixels on the target as boundaries. Contour boundaries are represented using the contours of pixels on the target as boundaries. In blob analysis, the purpose of boundary representation is to calculate perimeter and other related features, which ultimately serve as the basis for classifier recognition. Running-length encoding is used to calculate the pixel boundaries of a blob image to determine its perimeter.
[0048] Figure 1 This is a schematic diagram of the pixel boundaries and contour boundaries of a heart-shaped target. Figure 1 (a) is the original shape of the target; Figure 1 (b) is the shape of the target image after sampling; Figure 1 (c) represents the pixel boundary of the target image; Figure 1(d) represents the target image contour boundary (thick black line). In this embodiment, the targets (i.e., blobs) are represented using run-length encoding, therefore the pixel boundary tracking provided by this invention is performed on run-length encoding.
[0049] Pixel boundary tracking based on run-length encoding, such as Figure 2 As shown, pixel boundaries are tracked in units of run-length, ultimately forming a closed pixel boundary. Here, the boundary is the set of target edge pixels, i.e. Figure 2 The black area shown is part of the target.
[0050] The above problem can be described using a finite state machine. The direction traversed from the current run to the next run is considered the state. In forward-guided boundary tracking, the possible states can be categorized into four types, such as... Figure 3 As shown.
[0051] like Figure 3 (a) shows the Down-Left state. The current run moves down and / or to the left, and the connected component is located below and / or to the right. Figure 3 (b) shows the Down-Right state. The current run moves down and / or to the right, and the connected component is located up and / or to the right. Figure 3 (c) shows the Up-Right state. The current run moves up and / or to the right, and the connected region is located above and / or to the left. For example... Figure 3 (d) shows the Up-Left state. The current run moves up and / or to the left, and the connected region is located down and / or to the left.
[0052] Based on the above portability, the key problem of pixel boundary tracking based on run-length encoding is how to determine the next run that the boundary will traverse, and which position points the boundary contains between these two runs, given a given run.
[0053] Therefore, the method provided by this invention predicts the next run (state transition prediction) through a series of conditional judgments, that is, which state the current state will transition to. It also indicates the position points (transition operations) included from the current run to the boundary of the next run.
[0054] In one specific embodiment, the Blob image pixel boundary tracking method based on run-length encoding provided by the present invention includes the following steps:
[0055] S410: Determine the current run corresponding to the current state of the target Blob image;
[0056] S420: Predict the next run corresponding to the next state based on preset judgment conditions to achieve state transition prediction;
[0057] S430: Extract all position points contained in the boundary from the current run to the next run to perform the transfer operation.
[0058] State transition prediction is achieved through a set of conditional tests (based on 8-connectivity). Before describing state transition prediction, the following related variables are defined.
[0059] A connected region, or blob; it is composed of The tour consists of several parts, namely .
[0060] Current itinerary.
[0061] The next run along the positive direction of the boundary, with counterclockwise positive for the outer boundary and clockwise positive for the inner boundary.
[0062] : The current point on the boundary.
[0063] : Boundary description along the positive direction of the boundary, where A boundary segment is a set of boundary points on the same run. A state transition is the movement from one boundary segment to the next.
[0064] : The Middle A subset of the travel itinerary.
[0065] : midpoint The left-hand subset of the journey.
[0066] : midpoint The right-hand subset of the journey.
[0067] : In the middle, the tour itinerary A subset of runs that are entirely on the left.
[0068] : In the middle, the tour itinerary A subset of runs that are completely on the right.
[0069] Tour Itinerary The left endpoint.
[0070] Tour Itinerary The right endpoint.
[0071] :point of Values, i.e., column values.
[0072] Tour Itinerary of Value, i.e., row value.
[0073] :point of Value, i.e., row value.
[0074] Accordingly, taking the 8-connectivity state prediction test condition as an example, the preset judgment condition mentioned in step S420 specifically includes:
[0075] : In the travel collection Search itinerary ,like If is the left endpoint, then the following must be satisfied:
[0076] ;like If is the right endpoint, then the following must be satisfied:
[0077] ;
[0078] If a point that meets the above conditions is found, return. Otherwise, return .
[0079] : In the travel collection Search itinerary It satisfies the following conditions:
[0080] If multiple runs exist, select the leftmost one.
[0081] If a point that meets the above conditions is found, return. Otherwise, return .
[0082] : In the travel collection Search itinerary It satisfies the following conditions:
[0083] If multiple runs exist, select the rightmost one.
[0084] If a point that meets the above conditions is found, return. Otherwise, return .
[0085] Furthermore, during boundary tracking, each run has three marked states: <left-used> 、 <right-used> 、 <unused>(default).
[0086] A transfer operation can be defined as:
[0087] : in the Okay, from point Start by moving to the right until the desired distance is reached. The endpoints (left or right) are used to add boundary points to the boundary point list during movement.
[0088] : in the Okay, from point Start by moving left until the desired distance is reached. The endpoints (left or right) are used to add boundary points to the boundary point list during movement.
[0089] After the transfer operation is complete, the travel... Marked as <left-used>or <right-used>They correspond to for , The situation.
[0090] Regarding the transfer operation, 4-connectivity, 6-connectivity, and 8-connectivity can be handled in slightly different ways, or they can be handled in the same way. This embodiment intends to use the same way, and the following points are noted:
[0091] In each operation, consider the first All points on the row, Except for the endpoints. Run In the A line, or the line above (below);
[0092] like In the For rightward operations, start from point... Begin; for leftward operations, start from point start;
[0093] like Not in A line, i.e., the line above (or below), starts from the point. start;
[0094] like In the OK, ,Right now or , is the last point in the point set;
[0095] like Not in Line, point set includes .
[0096] In some embodiments, all obtained pixel boundary tracking states are summarized. In summary, based on the state transition prediction and transition operations described above, there are a total of 16 pixel boundary tracking states for the 4-state finite state machine.
[0097] In the above specific embodiments, the run-length encoding-based Blob image pixel boundary tracking method provided by the present invention determines the current run corresponding to the current state of the target Blob image, predicts the next run corresponding to the next state based on preset judgment conditions, and thus realizes state transition prediction; it extracts all position points contained in the boundary from the current run to the next run to realize the transition operation. Thus, this run-length encoding-based Blob pixel boundary tracking method, by calculating the pixel boundaries of the Blob image using run-length encoding, can significantly reduce the computational load and improve the computational efficiency of traditional algorithms.
[0098] In addition to the methods described above, this invention also provides a Blob image pixel boundary tracking device based on run-length encoding, such as... Figure 5 As shown, the device includes:
[0099] The run-length encoding unit 510 is used to determine the current run corresponding to the current state of the target Blob image;
[0100] The transition prediction unit 520 is used to predict the next run corresponding to the next state according to preset judgment conditions, so as to realize state transition prediction.
[0101] The transfer operation unit 530 is used to extract all position points contained in the boundary from the current run to the next run in order to perform the transfer operation.
[0102] In some embodiments, the preset judgment condition specifically includes:
[0103] In Travel Collection Search itinerary If point If is the left endpoint, then the following must be satisfied:
[0104] ;
[0105] If point If is the right endpoint, then the following must be satisfied:
[0106] ;
[0107] If a point that meets the above conditions is found, return. Otherwise, return .
[0108] In some embodiments, the preset judgment condition specifically includes:
[0109] In Travel Collection Search itinerary It satisfies the following conditions:
[0110] If multiple runs exist, select the leftmost run.
[0111] If a point that meets the above conditions is found, return. Otherwise, return .
[0112] In some embodiments, the preset judgment condition specifically includes:
[0113] In Travel Collection Search itinerary It satisfies the following conditions:
[0114] If there are multiple runs, select the rightmost run.
[0115] If a point that meets the above conditions is found, return. Otherwise, return .
[0116] In some embodiments, the transfer operation specifically includes:
[0117] In each operation, consider the first All points on the row, Except for the endpoints, In the line, number row or OK;
[0118] If point In the For rightward operations, start from point... Begin the transfer operation; for leftward operations, start from point... Initiate transfer operation;
[0119] If point Not in If it is a line, then start from the point. Initiate transfer operation;
[0120] like In the OK, ,Right now or , is the last point in the point set;
[0121] like Not in Line, point set includes .
[0122] In some embodiments, the obtained pixel boundary tracking states are summarized.
[0123] In the above specific embodiments, the run-length encoding-based Blob image pixel boundary tracking device provided by the present invention determines the current run corresponding to the current state of the target Blob image, predicts the next run corresponding to the next state according to preset judgment conditions, and thus realizes state transition prediction; it extracts all position points contained in the boundary from the current run to the next run to realize the transition operation. Thus, this run-length encoding-based Blob pixel boundary tracking device, by calculating the pixel boundary of the Blob image using run-length encoding, can significantly reduce the computational load and improve the computational efficiency of traditional algorithms.
[0124] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6 As shown, the electronic device may include a processor 610, a communications interface 620, a memory 630, and a communication bus 640, wherein the processor 610, the communications interface 620, and the memory 630 communicate with each other via the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute the method described above.
[0125] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0126] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program, the computer program being stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer is able to perform the methods described above.
[0127] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the methods described above.
[0128] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0129] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0130] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. < / unused> < / right-used> < / left-used>
Claims
1. A method for tracking pixel boundaries in Blob images based on run-length encoding, characterized in that, The method includes: Determine the current run corresponding to the current state of the target Blob image; Predict the next run corresponding to the next state based on preset judgment conditions to achieve state transition prediction; Extract all point locations contained within the boundary from the current run to the next run to perform the transfer operation; The preset judgment conditions specifically include IN(γ, ), Fl( , η) and Fr( , η): IN(γ, ): In the travel itinerary Search itinerary If the current boundary point If is the left endpoint, then the following must be satisfied: ; If the current boundary point If is the right endpoint, then the following must be satisfied: ; If a point that meets the above conditions is found, return. Otherwise, return ; in, Indicates tour The left endpoint; Indicates tour The right endpoint; Point of Values, i.e., column values; Indicates a null value; Point of Values, i.e., column values; Point of Values, i.e., column values; runs set For all tours; Fl( , η): In the run set Search itinerary It satisfies the following conditions: If multiple runs exist, select the leftmost run. If a point that meets the above conditions is found, return. Otherwise, return ; in, Indicates the current tour The left endpoint; Indicates the current tour The right endpoint; Indicates a null value; Point of Values, i.e., column values; Point of Values, i.e., column values; runs set For all journeys; Fr( , η): In the run set Search itinerary It satisfies the following conditions: If there are multiple runs, select the rightmost run. If a point that meets the above conditions is found, return. Otherwise, return ; Indicates the current tour The left endpoint; Indicates the current tour The right endpoint; Tour The right endpoint; Indicates a null value; Point of Values, i.e., column values; Point of Values, i.e., column values; runs set For all tours; Among them, the IN(γ, ), the Fl ( , η) and the Fr( The returned data obtained by η is used to determine the next run corresponding to the next state; Specifically, the transfer operation includes: In each transition operation, the current line is the nth line, and the next run is... In the line, number row or Line, in the Row above, take and remove All points outside the endpoints; If the current point In the For a rightward movement operation, start from point... Begin the transfer operation; for a leftward move, start from point... Initiate transfer operation; If the current point Not in If it is a line, then start from the point. Initiate transfer operation; like In the OK, ,Right now or , is the last point in the point set, which includes a list of boundary points consisting of the position points from the current run to the boundary of the next run during the transfer operation; like Not in Line, point set includes ; in, Indicates tour The left endpoint; Indicates tour The right endpoint; Point of Values, i.e., column values; This represents the next run corresponding to the next state predicted based on preset judgment conditions; point This is the starting point of the transfer operation; if point In the And go In the Line, current line For point The line number, line( (for the tour) The y-value, i.e., the row value, at this time line( )= ;end( ) indicates tour The endpoints, including the left or right endpoints; Indicates column value The row value is point.
2. The method for tracking Blob image pixel boundaries based on run-length encoding according to claim 1, characterized in that, All obtained pixel boundary tracking states are summarized, including state transition predictions and transition operations from the starting state to the target state.
3. A Blob image pixel boundary tracking device based on run-length encoding, characterized in that, The device includes: The run-length encoding unit is used to determine the current run corresponding to the current state of the target Blob image; The transition prediction unit is used to predict the next run corresponding to the next state based on preset judgment conditions, so as to realize state transition prediction. The transfer operation unit is used to extract all position points contained in the boundary from the current run to the next run in order to implement the transfer operation; The preset judgment conditions specifically include IN(γ, ), Fl( , η) and Fr( , η): IN(γ, ): In the travel itinerary Search itinerary If the current boundary point If is the left endpoint, then the following must be satisfied: ; If the current boundary point If is the right endpoint, then the following must be satisfied: ; If a point that meets the above conditions is found, return. Otherwise, return ; in, Indicates tour The left endpoint; Indicates tour The right endpoint; Point of Values, i.e., column values; Indicates a null value; Point of Values, i.e., column values; Point of Values, i.e., column values; runs set For all tours; Fl( , η): In the run set Search itinerary It satisfies the following conditions: If multiple runs exist, select the leftmost run. If a point that meets the above conditions is found, return. Otherwise, return ; in, Indicates the current tour The left endpoint; Indicates the current tour The right endpoint; Indicates a null value; Point of Values, i.e., column values; Point of Values, i.e., column values; runs set For all journeys; Fr( , η): In the run set Search itinerary It satisfies the following conditions: If there are multiple runs, select the rightmost run. If a point that meets the above conditions is found, return. Otherwise, return ; Indicates the current tour The left endpoint; Indicates the current tour The right endpoint; Tour The right endpoint; Indicates a null value; Point of Values, i.e., column values; Point of Values, i.e., column values; runs set For all tours; Among them, the IN(γ, ), the Fl ( , η) and the Fr( The returned data obtained by η) is used to determine the next run corresponding to the next state; Specifically, the transfer operation includes: In each transition operation, the current line is the nth line, and the next run is... In the line, number row or Line, in the Row above, take and remove All points outside the endpoints; If the current point In the For a rightward movement operation, start from point... Begin the transfer operation; for a leftward move, start from point... Initiate transfer operation; If the current point Not in If it is a line, then start from the point. Initiate transfer operation; like In the OK, ,Right now or , is the last point of the point set, which is the set of boundary points from the current run to the next run boundary during the transition operation; like Not in Line, point set includes ; in, Indicates tour The left endpoint; Indicates tour The right endpoint; Point of Values, i.e., column values; This represents the next run corresponding to the next state predicted based on preset judgment conditions; point This is the starting point of the transfer operation; if point In the And go In the Line, current line For point The line number, line( (for the tour) The y-value, i.e., the row value, at this time line( )= ;end( ) indicates tour The endpoints, including the left or right endpoints; Indicates column value The row value is point.
4. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in claim 1 or 2.
5. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in claim 1 or 2.
6. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in claim 1 or 2.