Image erosion method based on run-length encoding and image processing device

Through the image erosion method based on run-length encoding, the computational efficiency problem in high-resolution binary images and large structural element scenarios is solved, and efficient corrosion operations are achieved to meet industrial real-time requirements.

CN120410871BActive Publication Date: 2025-10-14SHENZHEN ZMOTION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510906350.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-02
Publication Date
2025-10-14
Estimated Expiration
2045-07-02

AI Technical Summary

Technical Problem

Existing morphological corrosion algorithms consume large computing resources and have low processing efficiency when processing high-resolution binary images or using large structuring elements, making it difficult to meet industrial real-time requirements.

Method used

An image erosion method based on run-length coding is adopted. By performing run-length coding on the binary image and the structure element, the row interval in the target area after erosion is determined, and the column interval is shrunk and the intersection is iteratively calculated within the interval to obtain the erosion result.

Benefits of technology

It effectively avoids the intensive calculation of traditional pixel-level convolution, improves the efficiency of corrosion calculation in high-resolution images or scenarios using large structural elements, and meets the strict real-time requirements of industrial applications for processing speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120410871B_ABST
    Figure CN120410871B_ABST
Patent Text Reader

Abstract

The application discloses a kind of image erosion method and image processing device based on run-length encoding, it is related to the technical field of image processing, wherein, image erosion method includes the following steps: based on the erosion method of run-length encoding, by converting binary image and specified structure element into target region and structure element region, by directly verifying whether all run-length segments of structure element are completely contained by target region corresponding run, further decide the reservation of anchor point run, complete the efficient erosion of target region.The application based on run-length encoding effectively avoids the intensive calculation of traditional pixel-level convolution, improves the erosion calculation efficiency in the scene of high-resolution image or using large structure element, so as to meet the strict real-time requirement of processing speed for industrial application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of image processing, and in particular to an image corrosion method and an image processing device based on run length encoding. Background Art

[0002] Morphological erosion is a common preprocessing algorithm in connected domain analysis and is widely used. It can be used to remove small particles of noise to make objects clearer, remove burrs or irregular protrusions on object edges to make them smoother, remove unnecessary details to refine shapes for a simpler look, and separate small connections between objects to facilitate subsequent connected domain analysis. In traditional binary images, erosion of objects is typically performed by convolution of the binary image using a structuring element.

[0003] In a binary image, adjacent pixels with a value of 255 form a connected domain. Connected domains are labeled using binary images, marking multiple connected objects. Typically, when performing an erosion operation on a connected object, the connected object is converted into a binary image. Then, a structuring element is used to perform row-by-row and column-by-column convolution on the binary image. However, convolution operations are computationally complex, especially for high-resolution images or when using large structuring elements. This can be inefficient and difficult to meet the high efficiency requirements of industry. Summary of the Invention

[0004] The main purpose of this application is to provide an image corrosion method and image processing device based on run-length encoding, aiming to solve the technical problems of existing morphological corrosion algorithms in processing high-resolution binary images or using large structural elements, such as high consumption of computing resources, low processing efficiency, and difficulty in meeting industrial real-time requirements.

[0005] To achieve the above objectives, the present application proposes an image erosion method based on run length encoding, comprising the following steps:

[0006] Acquire a binary image and a preset structure element, and perform run-length encoding on the binary image and the structure element to obtain a target region and a structure element region;

[0007] Find the starting and ending rows of the trip in the target area and the structural element area respectively to determine the row interval where the trip in the target area after corrosion is located;

[0008] In the row interval where the trip in the target area after corrosion is located, when it is detected that there is a trip on the target row, the column interval of each trip in the structural element area on the row corresponding to the target area is contracted to obtain multiple column interval contraction sets;

[0009] In the absence of a case where the set of column interval contraction sets is empty, the intersection of the column intervals in all column interval contraction sets is iterated to obtain all eroded result column intervals on the target row, and a row range is formed by the row number of the target row and the result column interval corresponding to the target row to obtain the erosion result on each row.

[0010] In an embodiment, the specific steps of obtaining a binary image and a preset structure element, respectively performing run-length encoding on the binary image and the structure element to obtain a target region and a structure element region include:

[0011] Obtaining a binary image, performing run-length encoding on the binary image, and defining the binary image as a target region;

[0012] Inputting a preset structure element, performing run-length encoding on the structure element to obtain a run-length set of the structure element, defining the run-length set of the structure element as a preliminary structure element region, and calculating anchor points of the preliminary structure element region, wherein the anchor points are used as mirror points to mirror and transpose all runs in the preliminary structure element region to obtain a structure element region.

[0013] In an embodiment, the specific steps of respectively searching for start and end rows of runs in the target region and the structure element region to determine a row interval in which the runs in the target region after erosion are located include:

[0014] Based on the completion of the transposition of the structure element region, searching for start and end rows of runs in the structure element region, including the minimum row and the maximum row of the structure element region;

[0015] Searching for start and end rows of runs in the target region, including the minimum row and the maximum row of the target region;

[0016] According to the minimum row and the maximum row of the target region and the minimum row and the maximum row of the structure element region, determining the minimum row, the maximum row, and the row interval in which the runs in the target region after erosion are located.

[0017] In an embodiment, the row interval in which the runs in the target region after erosion are located is defined as a calculation interval, and a row corresponding to the row in which the anchor point of the structure element region is located in the calculation interval is a target row of the calculation interval.

[0018] In an embodiment, the specific steps of, in the row interval in which the runs in the target region after erosion are located, when it is checked that there is a run on the target row, performing column interval contraction on the runs of each run in the structure element region on the corresponding row in the target region to obtain a plurality of column interval contraction sets include:

[0019] Detecting whether there is a run on the target row in the calculation interval;

[0020] When it is detected that a trip exists in the target row, column interval contraction is performed on the trip on the row corresponding to each trip in the structural element region in the target region to obtain multiple column interval contraction sets;

[0021] When it is detected that the target row has no travel, it is detected whether the next target row in the calculation interval has a travel.

[0022] In one embodiment, the specific steps of detecting whether a target line in the calculation interval has a travel distance include:

[0023] Check whether there is at least one trip in the target row in the calculation interval;

[0024] When it is detected that the target row has at least one trip, traverse each trip in the structure element area and obtain the structure element target row where it is located, and detect whether there is a trip in the row corresponding to the structure element target row in the target area;

[0025] When it is detected that all rows corresponding to the target row of the structural element in the target area have travel paths, it is determined that a travel path exists on the target row;

[0026] When it is detected that the target row has no trip or any row corresponding to the target row in the target area has no trip, it is detected whether the next target row in the calculation interval has at least one trip.

[0027] In one embodiment, when a run exists in the target row, the specific steps of performing column interval contraction on the run on the row corresponding to each run in the structure element region in the target region to obtain multiple column interval contraction sets include:

[0028] When it is detected that there is a trip in the target row, traverse each trip in the structure element area and obtain the structure element target row where it is located, and read all trips in the target area that correspond to the structure element target row;

[0029] Column interval contraction is performed on all runs in the target area that correspond to the target row of the structural element to obtain multiple column interval contraction sets.

[0030] In one embodiment, when no set is empty in the multiple column interval contraction sets, iteratively finding the intersection of the column intervals in all the column interval contraction sets to obtain all eroded result column intervals on the target row, and forming a run consisting of the row number of the target row and the result column interval corresponding to the target row to obtain the erosion result on each row. Specifically, the steps include:

[0031] Determine whether any of the multiple column interval contraction sets are empty;

[0032] When there is no empty set in multiple column interval contraction sets, the column intervals in all column interval contraction sets are iteratively intersected to obtain all eroded result column intervals on the target row, and a trip is formed by the row number of the target row and the result column interval corresponding to the target row to obtain the erosion result on the target row, and check whether there is a trip for the next target row in the calculation interval;

[0033] When there is an empty set in the plurality of column interval contraction sets, it is detected whether there is a trip in the next target row in the calculation interval.

[0034] In one embodiment, the following steps are further included:

[0035] Get the erosion results of all target rows in the calculation interval and generate a binary image after erosion.

[0036] In addition, to achieve the above-mentioned purpose, the present application also proposes an image processing device, comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the computer program is configured to implement the steps of the above-mentioned image corrosion method based on run-length encoding.

[0037] One or more technical solutions proposed in this application have at least the following technical effects:

[0038] This application's run-length encoding-based erosion method efficiently erodes the target region by converting a binary image and a specified structuring element into a target region and a structuring element region. By directly verifying whether all structuring element run segments are fully contained by the corresponding run of the target region, the method determines the anchor point run to be retained. This method, based on run-length encoding, effectively circumvents the computationally intensive nature of traditional pixel-level convolution, improving the efficiency of erosion calculations for high-resolution images or scenarios using large structuring elements, thereby meeting the stringent real-time processing speed requirements of industrial applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0041] Figure 1 A flowchart of the first embodiment of the image erosion method based on run length encoding is provided in this application;

[0042] Figure 2A flow chart of the second embodiment of the image erosion method based on run length encoding provided in this application;

[0043] Figure 3 A schematic diagram of run length encoding of a binary image according to an embodiment of the image erosion method based on run length encoding of the present application;

[0044] Figure 4 A schematic diagram of a region converted from a structural element of an embodiment of an image erosion method based on run length encoding of the present application;

[0045] The purpose, features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0046] It should be understood that the specific embodiments described herein are merely used to explain the technical solutions of the present application and are not intended to limit the present application.

[0047] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0048] The main solutions of the embodiments of this application are:

[0049] This application proposes an image erosion method based on run length encoding, such as Figure 1 As shown, the following steps are included:

[0050] S100: Acquire a binary image and a preset structure element, and perform run-length encoding on the binary image and the structure element to obtain a target region and a structure element region;

[0051] S200: searching for the start and end rows of the travel in the target area and the structural element area respectively, so as to determine the row interval where the travel in the target area after corrosion is located;

[0052] S300: within the row interval where the trip in the eroded target region is located, when it is detected that a trip exists on the target row, performing column interval contraction on the trip on the row corresponding to each trip in the structural element region in the target region to obtain multiple column interval contraction sets;

[0053] S400: When there is no empty set in the multiple column interval contraction sets, the column intervals in all column interval contraction sets are iteratively calculated to obtain the intersection of all eroded result column intervals on the target row, and the row number of the target row and the result column interval corresponding to the target row form a trip to obtain the erosion result on each row.

[0054] Image processing is a multi-stage process that begins with acquiring the original image, undergoes preprocessing to improve image quality or structure, then performs segmentation to isolate objects, extracts their features, and finally achieves recognition or understanding of the image content. Morphological operations are extremely important tools in the preprocessing stage. They are specifically used to analyze and manipulate the shape and structure of objects in an image, providing a clean and well-structured representation of the object for subsequent connected domain analysis, feature extraction, and recognition. They address the morphology of the object itself and serve as the foundation for subsequent advanced analysis.

[0055] More specifically, morphological erosion is a fundamental and widely used preprocessing algorithm in connected domain analysis. Its core value lies in its ability to effectively improve the morphological characteristics of the target, laying a good foundation for subsequent connected domain identification and labeling. Specifically, the erosion operation can remove tiny, isolated pixels in the image that are considered noise, making the main outline of the target clearer; it can smooth out burrs or irregular tiny bumps on the edge of the target, thereby making the target boundary smoother; at the same time, it can also eliminate unnecessary details inside or on the boundary of the target, achieving shape simplification and refinement; more importantly, when multiple target objects should be separated due to tiny pixel adhesion, erosion can cut these thin connecting bridges and successfully separate the targets. These effects improve the accuracy and robustness of subsequent connected domain analysis.

[0056] In traditional binary image processing, erosion is typically performed by convolving the image with a predefined structure element. This process involves sliding the structure element across the image row by row and column by column. At each location, the structure element checks whether all pixels within its coverage area are target pixels. This determines whether the corresponding location in the output image should retain the target or be eroded to background. However, this point-by-point convolution-based implementation has significant efficiency limitations, especially when working with high-resolution images, or when operating with large structure elements, as is common in industrial applications. This problem stems primarily from the computational complexity of the convolution operation. Each movement of the structure element requires a complete check and logical operation (AND operation) on all pixels within its coverage area. For large structure elements or high-resolution images, this pixel-by-pixel traversal and repeated computations can significantly increase, resulting in a significant decrease in processing speed. This efficiency bottleneck makes traditional convolution-erosion methods inadequate for the high throughput and real-time processing required by industrial scenarios, making them difficult to meet the stringent speed requirements of practical applications.

[0057] To overcome this efficiency dilemma, this application proposes an image erosion method based on run-length encoding. The solution is to efficiently represent the target connected domain using run-length encoding (RLE), and to design a specialized erosion algorithm based on this. The core idea of ​​run-length encoding is to represent continuous horizontal segments of pixels with the same pixel value in an image (i.e., "runs") by their starting position and length, rather than storing or processing each individual pixel. This representation method is particularly efficient in binary images because it naturally compresses information about continuous regions with the same pixel value.

[0058] The erosion method based on run-length encoding utilizes this efficient structured representation. Its key advantage is that the algorithm can directly operate on the run-length data representing continuous target pixel segments, avoiding independent, repetitive checks and convolution calculations for each pixel in the image. Through the algorithm logic, it is possible to efficiently determine whether the structural element will "hit" the target at the current position at the run-length data level and simulate the effect of erosion, thereby greatly reducing unnecessary calculations. This method is particularly suitable for processing high-resolution images containing large connected targets or requiring large structural elements. It can significantly improve the efficiency of erosion operations and provide a better solution to the challenges of real-time processing in industrial applications.

[0059] This application includes the following steps:

[0060] In step S100, a binary image and a preset structuring element are obtained. Runlength encoding is performed on these binary image and structuring element, respectively, to obtain the target region and the structuring element region. This step first defines the input objects: the original binary image to be processed, in which pixels contain only two distinct values: the target and the background; and the preset structuring element, a core template that defines the shape and size of the morphological operation neighborhood and is itself a numerical matrix. To improve the efficiency of subsequent morphological operations, especially for images that may contain large, continuous areas of the same value, this step applies runlength encoding, an optimized representation technique, to both input objects.

[0061] Specifically, the system independently performs run-length encoding on the input binary image, converting its original pixel matrix into a more concise run-length encoding set. This set effectively captures and describes the position and length information of all horizontally continuous target pixel segments and background pixel segments in the image, thereby forming a run-length encoding region representation of the target image. Simultaneously, the system independently performs the same run-length encoding operation on a preset structuring element. Although smaller in size, the structuring element itself also contains a specific pixel value pattern, typically a combination of foreground target and background. By encoding it, the structuring element is also converted into an equivalent run-length encoding set, which clearly depicts the distribution characteristics of the continuous foreground or background regions within it, forming a run-length encoding region representation of the structuring element. At this point, step S100 completes the efficient conversion of the original pixel space representation of the image and the structuring element into run-length encoding region forms based on continuous segment descriptions, laying the necessary foundation for subsequent efficient morphological operations directly on these compressed and structured encoding regions.

[0062] In step S200, the start and end rows of the run in the target region and the structuring element region are searched respectively to determine the row interval in which the run in the target region after corrosion is located. This step is based on a key insight: in the resulting image of the corrosion operation, the row position of any valid run must be strictly constrained by the spatial distribution of both the original target image and the structuring element. The specific implementation process is as follows: the system first independently analyzes the two run encoding regions generated by step S100: the target region and the structuring element region. For the target region, the system traverses all the run segments recorded therein, identifies the topmost and bottommost row numbers where these run segments appear, and thus determines the actual vertical distribution boundary of the target image content.

[0063] Similarly, the system also performs similar operations on the structural element area to find the minimum and maximum row numbers occupied by all the stroke segments of the structural element itself, which defines the spatial span of the structural element template in the vertical direction. Next, it is necessary to determine all the row positions where its anchor point can be placed and produce valid erosion results when the structural element slides over the target image. This is calculated by considering the height of the structural element, that is, its own row span, and the upper and lower extension range of the structural element relative to its center point, for example, how many rows are above the center point and how many rows are below, and combined with the valid row range of the target image.

[0064] Ultimately, this step calculates all possible row intervals in the eroded image that contain valid travel paths. Determining this row interval is crucial because it narrows the target row range for detailed processing in subsequent steps S300 and S400, avoiding unnecessary computation on rows where no results are likely to be found, thus laying the foundation for the efficiency of the entire optimization algorithm. Essentially, step S200 performs preliminary spatial pruning and range focusing in the vertical dimension of the erosion operation.

[0065] In step S300, within the row interval containing the run lengths in the eroded target region, if a run length is detected on the target row, column interval contraction is performed on the run lengths of each run length in the structuring element region on the corresponding row in the target region, thereby obtaining multiple column interval contraction sets. This step focuses on each specific target row within the row interval determined in step S200 as a possible erosion result. Its execution logic is as follows: First, for the target row currently being processed, the system queries the run length coding area of ​​the target image to check whether any valid run lengths representing foreground objects exist on that row. If the row is completely background in the target image, meaning no target run lengths exist, then it is clearly impossible for that row to produce any foreground pixels that would result in erosion, and the system skips further processing of that row. However, if one or more target run length segments do exist on the target row, this indicates that the row has the potential to produce erosion results and must enter the core processing phase. At this point, the system traverses each individual run length segment in the structuring element run length coding area, which represents consecutive pixel units in the structuring element template. For each such run segment in the structure element region, the system needs to evaluate the spatial constraints it imposes on the current target row of the target image.

[0066] It can be understood that the system "projects" or "maps" the structure element run segment onto the current target row of the target image based on the row position of the structure element run segment itself. This projection process is essentially the calculation of a displacement: the row offset of the structure element run segment relative to its center point determines the exact column coordinate range of the foreground pixels that must exist on the corresponding row in the target image, that is, the current target row plus or minus the row offset. Next, the system will query the run encoding area of ​​the target image to obtain all the run segments and their column interval information that actually exist in the target image on the corresponding row required by the structure element run segment. Then, the system will perform overlap judgment and interval intersection operations on the column interval required by the structure element run segment on the current target row and the column intervals of all the run segments that actually exist on the corresponding row of the target image.

[0067] The result of this intersection operation is a new column interval set, which may be empty, representing the region fragments that actually exist on the corresponding row of the target image and can satisfy the column-direction spatial constraints imposed by the current specific structural element run segment. Since the structural element region usually contains multiple run segments, after performing the above-mentioned projection mapping, querying the run of the corresponding row, and interval intersection operations on each run segment in the structural element region, step S300 will eventually generate a "column interval contraction set" for the current target row. Each element in this column interval contraction set corresponds to a structural element run segment, and contains the column interval fragments that meet the conditions found on the corresponding row of the target image after being "contracted" by the structural element run segment constraint. These column interval contraction sets provide the basis for the next step S400, which is used to comprehensively judge whether the entire structural element can be completely "fitted" to the specific column position of the current target row.

[0068] In step S400, if no column interval contraction sets are empty, the column intervals in all column interval contraction sets are iteratively intersected to obtain all resulting column intervals for the target row after erosion. A run is constructed from the target row number and the corresponding resulting column interval to obtain the erosion result for each row. The execution logic of this step is based on a strict check of the state of the column interval contraction sets. First, the system verifies that all column interval contraction sets generated for the current target row in step S300 are non-empty sets. Each column interval contraction set represents a column interval segment of the target image that satisfies the spatial constraints of a specific run segment in the structuring element. If any column interval contraction set is found to be empty, it means that at least one structuring element run segment requirement cannot be met for the current row. The entire structuring element cannot achieve complete "coverage" at any column position in the row. Therefore, in this case, the system will directly determine that there is no valid erosion result for the current target row, without further calculation.

[0069] Only when all column interval contraction sets are non-empty, that is, when the constraints corresponding to each structuring element segment have found at least one column interval that satisfies the conditions on the target image, does step S400 enter the substantive result calculation stage. At this point, the system needs to find one or more specific column coordinate positions that must simultaneously satisfy the joint spatial constraints imposed by all segments in the structuring element. This is equivalent to requiring that there must be a column position point on the current row of the target image such that when the structuring element center is placed at this point, each component pixel of the structuring element template can find a foreground pixel matching it at the corresponding precise position in the target image.

[0070] In order to find such a position point, step S400 adopts an iterative intersection method. The system will traverse all non-empty column interval contraction sets and perform a global intersection operation on all column interval segments in these column interval contraction sets. This operation needs to efficiently find the common overlapping parts in all interval segments. These final intersection interval segments represent the precise column coordinate range where the requirements of all structural element segments are met at the same time on the current target row. In other words, each column position point in these interval segments is a position where the center of the structural element can be placed, and when the structural element is placed at this position, its entire shape can completely "fall into" the foreground area of ​​the target image.

[0071] Finally, step S400 outputs the column intervals resulting from these intersection operations, along with the target row's row number, as the valid result of the erosion operation on the current target row. These intervals are recorded in run-length encoding format, representing the continuous segment of pixels on that row that belong to the eroded foreground. By sequentially processing each row within the row interval determined in step S200 and executing steps S300 and S400, the complete, eroded target image region can be constructed row by row, also represented in an efficient run-length encoding format.

[0072] This application's run-length encoding-based erosion method efficiently erodes the target region by converting a binary image and a specified structuring element into a target region and a structuring element region. By directly verifying whether all structuring element run segments are fully contained by the corresponding run of the target region, the method determines the anchor point run to be retained. This method, based on run-length encoding, effectively circumvents the computationally intensive nature of traditional pixel-level convolution, improving the efficiency of erosion calculations for high-resolution images or scenarios using large structuring elements, thereby meeting the stringent real-time processing speed requirements of industrial applications.

[0073] In one embodiment, the specific steps of acquiring a binary image and a preset structure element, and performing run-length encoding on the binary image and the structure element to obtain a target region and a structure element region include:

[0074] S110: Acquire a binary image, perform run-length encoding on the binary image, and define the target area;

[0075] S120: Input a preset structure element, perform run encoding on the structure element, obtain a set of runs of the structure element, and define it as a preliminary structure element region. Calculate an anchor point of the preliminary structure element region, and perform mirror transposition on all runs in the preliminary structure element region with the anchor point as a mirror point to obtain the structure element region.

[0076] In step S110, an image is first captured and binarized to produce a binary image. If the grayscale value of a pixel is above a threshold, the pixel is classified as foreground and has a value of 255. Conversely, if the grayscale value of a pixel is below the threshold, the pixel is classified as background and has a value of 0. Adjacent consecutive pixels with a value of 255 in the binary image are represented using run-length encoding to obtain a run-length encoding set, which is defined as a region.

[0077] A trip is defined as The region is defined as ,in row is the row coordinate of the continuous pixels with a value of 255 in a row of the binary image, cb is the starting column coordinate of the adjacent consecutive pixels with a value of 255, ce The ending column coordinates of the adjacent continuous pixels with a value of 255. Therefore, the continuous pixels with a value of 255 in a row of the binary image can be encoded into a run. Run encoding is performed on the binary image row by row and column by column, and finally a run set is formed, i.e., region .like Figure 3 The binary image shown in the figure has a pixel value of 0 for the white square and a pixel value of 255 for the gray square. The run length encoding sequence is performed row by row and column by column to obtain 5 run length sets: runLength1={row = 0,cb = 1,ce = 3}, runLength2={row = 1,cb = 0,ce = 4} , runLength3={row = 2,cb = 1,ce = 1}, runLength4={row = 2,cb = 3,ce = 3}, runLength5={row = 4,cb = 0,ce = 3}.

[0078] In step S120, the designated structural element is processed into a region form, and the structural element is run-length encoded to obtain the structural element region , calculate the center of gravity of the region as the structural element anchor anchor = (anchorx, anchory), the center of gravity of the region is defined as the center of gravity of all points in the region, and the region is transposed or mirrored according to the anchor point to obtain the final structural element regional representation The transpose of the region is the mirror image of each stroke in the region relative to the anchor point. ,Right now .

[0079] like Figure 4As shown in the figure, it describes the process of converting a 3x3 rectangular structural element into a region. First, the structural element is converted into a set of runs, namely the region runLength1={row = 0,cb = 0,ce = 2}, runLength2={row = 1,cb =0,ce = 2}, runLength3={row = 2,cb = 0,ce = 2}, then the center of gravity of the region, namely the anchor point anchor=(1, 1), is calculated, and finally all runs in the region are mirrored with the anchor point as the mirror point to complete the transposition of the region, and the results are runLength1={row = 1,cb = -1,ce = 1}, runLength2={row = 0,cb = -1,ce = 1}, runLength3={row = -1,cb = -1,ce = 1}.

[0080] In one embodiment, the specific steps of searching for the start and end rows of the run in the target area and the structural element area respectively to determine the row interval where the run in the target area after corrosion is located include:

[0081] Complete the transposition based on the structural element region, and find the starting and ending rows of the trip in the structural element region, including the minimum row and the maximum row of the structural element region;

[0082] Find the starting and ending rows of the trip in the target area, including the minimum and maximum rows in the target area;

[0083] According to the minimum row and maximum row of the target area and the minimum row and maximum row of the structural element area, the minimum row, maximum row and row interval of the travel in the target area after corrosion are determined.

[0084] Specifically, the system first independently analyzes the two run-length encoding regions generated in step S100: the target region and the structure element region. For the target region, the system traverses all run segments recorded therein, identifying the topmost and bottommost row numbers where these run segments appear, thereby determining the actual vertical distribution boundaries of the target image content. The minimum row (minRowRe) and maximum row (maxRowRe) of the run length in the target region are found. Similarly, the system performs a similar operation on the structure element region, determining the minimum row (minRowSt) and maximum row (maxRowSt) occupied by all run segments of the structure element itself.

[0085] Next, we need to determine all the possible row positions where the anchor points of the structuring element can be placed and produce valid erosion results when the structuring element slides over the target image. This is calculated by considering the height of the structuring element, that is, its own row span, and the range of the structuring element above and below its center point, for example, how many rows are above the center point and how many rows are below, combined with the valid row range of the target image. The formula is as follows: ; That is, after the erosion, the rows containing the trips in the target area must be within the interval [minRow, maxRow]. This is equivalent to calculating the possible trips on each row in the interval [minRow, maxRow]. The steps in this embodiment narrow the range of target rows that require detailed processing, avoiding unnecessary calculations on rows where no results are likely to appear, thereby laying the foundation for the efficiency of the entire optimization algorithm.

[0086] In one embodiment, the row interval where the travel path in the target area after corrosion is located is defined as the calculation interval. Within the calculation interval, the row corresponding to the row where the anchor point of the structure element area is located is the target row of the calculation interval.

[0087] Specifically, the above embodiment defines the row of the target area after erosion as falling within the interval [minRow, maxRow] as the calculation interval. This interval represents all possible locations where the erosion result can actually appear in the vertical direction. After determining this calculation interval, the system processes each row within it. At this point, the concept of a "target row" becomes crucial. A "target row" specifically refers to the row currently being processed within the calculation interval. The key connection here lies in the "anchor point" of the structuring element, which typically represents its center point. During the erosion operation, when the structuring element's anchor point is placed on a specific row of the target image, that row is defined as the "target row" for that placement operation. In other words, when the system considers aligning the structuring element's anchor point to a row within the calculation interval (i.e., the target row), it is essentially evaluating whether the entire structuring element template can fully "fit" within the foreground area of ​​the current target image if the structuring element's center falls on that row. Therefore, as the calculation interval is traversed, each row corresponding to the structuring element's anchor point becomes a target row. For each such target row, the system performs subsequent key steps such as stroke mapping, constrained shrinkage, and result synthesis to finally determine which column positions on the row can produce valid erosion result foreground pixels.

[0088] In one embodiment, within the row interval where the run in the target area after corrosion is located, when it is detected that a run exists on the target row, the specific steps of performing column interval contraction on the run on the row corresponding to each run in the target area in the structuring element area to obtain multiple column interval contraction sets include:

[0089] S310: Detect whether there is a trip in the target line in the calculation interval;

[0090] S320: When it is detected that a trip exists in the target row, column interval contraction is performed on the trip in the row corresponding to each trip in the structural element region in the target region to obtain multiple column interval contraction sets;

[0091] S330: When it is detected that the target row has no travel, it is detected whether the next target row in the calculation interval has a travel.

[0092] In step S310, its function is to perform a quick screening. It checks whether the target row in the target area currently being processed contains any valid travel data. If there is no travel on the target row, it means that the row is entirely composed of background pixels and is a blank row. In the morphological corrosion operation, if the structural element area is projected onto such a blank row, its corrosion result must also be blank. Therefore, the working principle of this step is to provide a key decision basis for subsequent steps by detecting the "blank" state of the target row: if it is empty, the tedious calculation of the row is skipped directly. Specifically, calculate the travel on the rowth row in the interval [minRow, maxRow], first perform an existence check on the row to improve the corrosion efficiency, that is, detect whether there is a travel after corrosion on the rowth row. If so, further calculate the travel that may exist on the rowth row; if not, go to the next row row+1. Traverse each travel in the structural element area st to obtain the row stRow where it is located. i , detect the target row row+stRow i Is there a trip in the target region Region. If the target row row + stRow generated for all stRowi of the structure element st i If there are trips in the corresponding rows in the target region Region, we can further calculate the possible trips in row row; if not, we go to the next row row+1.

[0093] In step S320, confirming the presence of a foreground stroke in the target row indicates that the row may produce an output result after erosion. This process accurately constrains the stroke intervals on the target row that may be covered by the structuring element, based on the geometric properties of the structuring element. The process works as follows: Each stroke within the structuring element region is traversed. For each stroke within the structuring element region, all corresponding strokes on rows in the target region that are related to the target row are found. Then, based on the column interval range of the structuring element's current stroke, the column intervals of the strokes on the corresponding rows in the target region are "contracted." This "contraction" essentially calculates the column-wise intersection constraint between the pixel area covered by the structuring element at its current projection position and the strokes in the corresponding region of the target image. A structuring element stroke typically generates a set of contracted column intervals, representing the effective contribution of that portion of the structuring element to the final eroded result in the column interval on the target row. After traversing all structuring element strokes, multiple such contracted column interval sets are obtained.

[0094] For example, to find the i-th trip in the structure element st Generated structure element target row row + stRow i The set of all k trips on the corresponding row in the target region Region Use the structure element stRunLength i The set of column interval pairs The column intervals of all trips in the column interval are shrunk one by one to obtain the set of valid column intervals after all shrinkage ,in , ,and .

[0095] In step S330, if the current target row is determined to be blank, all erosion calculations for that row are effectively skipped. If the result of S310 indicates that the target row has no travel, this step takes effect immediately, instructing the process to move directly to the next row to be processed within the calculation interval and re-triggering S310 to detect that new row. This avoids performing any column interval shrinkage calculations on known invalid rows, significantly improving algorithm efficiency, especially when the image contains large blank areas.

[0096] In one embodiment, the specific steps of detecting whether a target line in the calculation interval has a travel distance include:

[0097] Check if there is at least one trip in the target row of the calculation interval;

[0098] When it is detected that the target row has at least one trip, traverse each trip in the structure element area and obtain the structure element target row where it is located, and detect whether there is a trip in the row corresponding to the structure element target row in the target area;

[0099] When it is detected that all rows corresponding to the target row of the structural element in the target area have travel paths, it is determined that a travel path exists on the target row;

[0100] When it is detected that the target row has no trip or any row corresponding to the target row in the target area has no trip, it is detected whether the next target row in the calculation interval has at least one trip.

[0101] This can be understood as determining whether the target row (row) currently being processed contains at least one foreground stroke. If the target row itself contains no strokes, according to the principles of morphological erosion, the structuring element cannot be completely contained within the region where the row resides, and the row will inevitably have no valid output. At this point, a process jump is immediately triggered to avoid invalid computation. If the target row itself is valid, this step performs a deep verification of the erosion feasibility. For each independent stroke within the structuring element region, the row position of the structuring element target row is obtained. The structuring element target row is mapped to the corresponding row in the target region, and at least one stroke is checked for each mapped row. This step ensures that each row of the input image vertically covered by the structuring element is supported by foreground pixels. The target row is considered to pass the erosion feasibility verification if and only if all structuring element mapping rows have strokes. This does not mean that the target row itself has strokes, but rather that the vertical condition that the structuring element completely covers the foreground has been met, allowing the column-wise shrinkage calculation to proceed.

[0102] If the first-level detection finds no travel in the target row, or any mapped row in the second-level detection has no travel, the current target row is deemed to have no corruption results. This immediately terminates subsequent processing of that row, jumps to the next target row in the calculation interval, and re-triggers the first-level detection. This design significantly reduces the amount of ineffective computation through a two-level fast fail mechanism.

[0103] In one embodiment, when a run exists in the target row, the specific steps of performing column interval contraction on the run on the row corresponding to each run in the structure element region in the target region to obtain multiple column interval contraction sets include:

[0104] When it is detected that there is a trip in the target row, traverse each trip in the structure element area and obtain the structure element target row where it is located, and read all trips in the target area that correspond to the structure element target row;

[0105] Column interval contraction is performed on all runs in the target area that correspond to the target row of the structural element to obtain multiple column interval contraction sets.

[0106] Specifically, when a trip is detected in the target row, the system processes each independent trip in the structural element area one by one. For each structural element target row, the algorithm maps it to the corresponding row coordinate position in the target area. Find the i-th trip in the structural element st Generated structure element target row row + stRow i The set of all k trips on the corresponding row in the target region Region Then, read the column interval data of all runs on the mapping row completely, using the structure element run stRunLength i The set of column interval pairs The column intervals of all trips in the column interval are shrunk one by one to obtain the set of valid column intervals after all shrinkage ,in , ,and Through this process, each structuring element run is associated with the set of all runs on the corresponding row in the target image.

[0107] In one embodiment, when no set is empty in the multiple column interval contraction sets, iteratively finding the intersection of the column intervals in all the column interval contraction sets to obtain all eroded result column intervals on the target row, and forming a run consisting of the row number of the target row and the result column interval corresponding to the target row to obtain the erosion result on each row. Specifically, the steps include:

[0108] S410: Determine whether any of the multiple column interval contraction sets is empty;

[0109] S420: When none of the multiple column interval contraction sets is empty, iteratively calculate the intersection of the column intervals in all column interval contraction sets to obtain all eroded result column intervals on the target row, thereby obtaining the erosion result of the target row, and detecting whether there is a trip for the next target row in the calculation interval;

[0110] S430: When there is an empty set among the plurality of column interval contraction sets, detecting whether there is a trip in the next target row in the calculation interval.

[0111] In step S410, the column interval contraction step is performed on each trip in the structural element st to obtain the column interval set after the column intervals of all trips on the corresponding row of each trip in st in region are contracted. . judge Is there a collection in If it is empty, go to the next row row+1, otherwise continue to the next step.

[0112] In step S420, All collections in Iterate the column intervals in the intersection, if there is such a result intersection, keep it, otherwise go to the next row row+1. Specifically, take out and The column interval set and the intersection of their column intervals are calculated. The column interval set of the intersection result describes its coverage, which belongs to The column interval also belongs to Column interval. If such a column interval set exists, it will be used as the result column interval set, and then the result column interval set will be combined with Continue to find the intersection, and iterate until After the intersection is calculated, if the resulting column interval set is not empty, the row number of the target row and the column intervals therein are combined to form a trip set. The retained result is the result of the erosion of the structural element st and the region Region on row, and then the next step is row+1; if it is empty, the next step is row+1.

[0113] The intersection of two columns of intervals is calculated as follows , ,like Then the two columns of intervals have an intersection, and the intersection is , otherwise the two columns have no intersection.

[0114] In step S430, when S410 detects that the contraction set of any column interval is empty, all subsequent operations of the current row are immediately terminated, and the control flow jumps directly to the next adjacent row row+1 in the calculation interval, repeating the above steps S300 to S400 until the maxRow row, thereby completing the erosion of the region Region by the structural element st.

[0115] In one embodiment, the following steps are further included:

[0116] The erosion results for all target rows in the calculation interval are obtained to generate a binary image after erosion. The system collects the erosion output results for all target rows in the calculation interval. These results are organized in a run-length encoding format, with each valid run containing precise row coordinates, starting column coordinates, and ending column coordinates. By traversing the entire set of rows in the calculation interval, all discrete erosion runs are integrated into a unified run-length dataset in row-number order. This dataset fully describes the geometric distribution characteristics of all continuous foreground regions in the eroded image. Based on the obtained erosion run-length dataset, the system performs image reconstruction, initializing a blank binary matrix of the same size as the original image, with all pixels set to background values ​​by default. It then traverses each erosion run record and, based on its row and column coordinate ranges, sets the corresponding continuous pixel segments in the image matrix to foreground values. This process is implemented through efficient block filling, avoiding the overhead of pixel-by-pixel processing. The resulting binary image intuitively reflects the topological effects of morphological erosion. Each foreground pixel region in the image precisely corresponds to a location in the original target region that is fully covered by the structuring element. The background region clearly displays the portions removed by erosion, resulting in a spatial filtering result that conforms to morphological principles. This output image retains the spatial resolution and geometric characteristics of the original image and can be directly used for subsequent image analysis tasks.

[0117] Combining all the above embodiments, Figure 2 As shown, the specific steps of an image erosion method based on run length encoding include:

[0118] First, an image is captured and binarized to create a binary image. If the grayscale value of a pixel is above the threshold, it is classified as foreground and has a value of 255. Conversely, if the grayscale value is below the threshold, it is classified as background and has a value of 0. Adjacent consecutive pixels with a value of 255 in the binary image are represented using run-length encoding to create a run-length encoding set, which is defined as a region.

[0119] A trip is defined as The region is defined as ,in row is the row coordinate of the continuous pixels with a value of 255 in a row of the binary image, cb is the starting column coordinate of the adjacent consecutive pixels with a value of 255, ce The ending column coordinates of the adjacent continuous pixels with a value of 255. Therefore, the continuous pixels with a value of 255 in a row of the binary image can be encoded into a run. Run encoding is performed on the binary image row by row and column by column, and finally a run set is formed, i.e., region .like Figure 3 The binary image shown in the figure has a pixel value of 0 for the white square and a pixel value of 255 for the gray square. The run length encoding sequence is performed row by row and column by column to obtain 5 run length sets: runLength1={row = 0,cb = 1,ce = 3}, runLength2={row = 1,cb = 0,ce = 4} , runLength3={row = 2,cb = 1,ce = 1}, runLength4={row = 2,cb = 3,ce = 3}, runLength5={row = 4,cb = 0,ce = 3}.

[0120] Process the specified structural element into a region form, and perform run-length encoding on the structural element to obtain the structural element region. , calculate the center of gravity of the region as the structural element anchor anchor = (anchorx, anchory), the center of gravity of the region is defined as the center of gravity of all points in the region, and the region is transposed or mirrored according to the anchor point to obtain the final structural element regional representation The transpose of the region is the mirror image of each stroke in the region relative to the anchor point. ,Right now .

[0121] like Figure 4As shown in the figure, it describes the process of converting a 3x3 rectangular structural element into a region. First, the structural element is converted into a set of runs, namely the region runLength1={row = 0,cb = 0,ce = 2}, runLength2={row = 1,cb =0,ce = 2}, runLength3={row = 2,cb = 0,ce = 2}, then the center of gravity of the region, namely the anchor point anchor=(1, 1), is calculated, and finally all runs in the region are mirrored with the anchor point as the mirror point to complete the transposition of the region, and the results are runLength1={row = 1,cb = -1,ce = 1}, runLength2={row = 0,cb = -1,ce = 1}, runLength3={row = -1,cb = -1,ce = 1}.

[0122] The minimum row minRowRe and maximum row maxRowRe of the travel segment in the target area are found. Similarly, the system also performs similar operations on the structure element area to find the minimum row minRowSt and maximum row maxRowSt occupied by all travel segments of the structure element itself.

[0123] Next, we need to determine all the possible row positions where the anchor points of the structuring element can be placed and produce valid erosion results when the structuring element slides over the target image. This is calculated by considering the height of the structuring element, that is, its own row span, and the range of the structuring element above and below its center point, for example, how many rows are above the center point and how many rows are below, combined with the valid row range of the target image. The formula is as follows: ; That is, after the erosion, the row where the travel of the target area is located must be in the interval [minRow, maxRow]. This is equivalent to calculating the possible travel on each row in the interval [minRow, maxRow].

[0124] First, perform an existence check on row to improve the erosion efficiency, that is, check whether there is an eroded trip on row. If so, further calculate the trip that may exist on row; if not, go to the next row row+1. Traverse each trip in the structural element area st to obtain its row stRow i , detect the target row row+stRow i Is there a trip in the target region Region. If for all stRow i The generated target row row + stRow iIf there are trips in the corresponding rows in the target region Region, we can further calculate the possible trips in row row; if not, we go to the next row row+1.

[0125] Find the i-th trip in the structural element st Generated structure element target row row + stRow i The set of all k trips on the corresponding row in the target region Region Then, read the column interval data of all runs on the mapping row completely, using the structure element run stRunLength i The set of column interval pairs The column intervals of all trips in the column interval are shrunk one by one to obtain the set of valid column intervals after all shrinkage ,in , ,and Through this process, each structuring element run is associated with the set of all runs on the corresponding row in the target image.

[0126] Perform the column interval contraction step on each trip in the structural element st to obtain the column interval set after the column intervals of all trips on the corresponding row of each trip in st in region are contracted. . judge Is there a collection in If it is empty, go to the next row row+1, otherwise continue to the next step.

[0127] right All collections in Iterate the column intervals in the intersection, if there is such a result intersection, keep it, otherwise go to the next row row+1. Specifically, take out and The column interval set and the intersection of their column intervals are calculated. The column interval set of the intersection result describes its coverage, which belongs to The column interval also belongs to Column interval. If such a column interval set exists, it will be used as the result column interval set, and then the result column interval set will be combined with Continue to find the intersection, and iterate until After the intersection is calculated, if the resulting column interval set is not empty, the row number of the target row and the column intervals therein are combined to form a trip set, which is the result of the erosion of the structural element st and the region Region on row, and then continue to row+1; if it is empty, it also continues to row+1.

[0128] The intersection of two columns of intervals is calculated as follows , ,like Then the two columns of intervals have an intersection, and the intersection is , otherwise the two columns have no intersection.

[0129] Repeat the above steps until maxRow rows are reached, thus completing the erosion of the region Region by the structural element st.

[0130] In addition, to achieve the above-mentioned purpose, the present application also proposes an image processing device, comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the computer program is configured to implement the steps of the above-mentioned image erosion method based on run-length coding. The image processing device provided by the present application adopts the image erosion method based on run-length coding in the above-mentioned embodiment, which can solve the technical problems of the existing morphological erosion algorithm in processing high-resolution binary images or using large structural elements, such as high consumption of computing resources, low processing efficiency, and difficulty in meeting industrial real-time requirements. Compared with the prior art, the beneficial effects of the image processing device provided by the present application are the same as the beneficial effects of the image erosion method based on run-length coding provided by the above-mentioned embodiment, and the other technical features in the image processing device are the same as the features disclosed in the method of the previous embodiment, which will not be described in detail here.

[0131] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0132] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

[0133] The above description is only part of the embodiments of the present application and does not limit the patent scope of the present application. All equivalent structural transformations made by using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.

Claims

1. An image erosion method based on run length encoding, characterized in that: The following steps are involved: Acquire a binary image and a preset structure element, and perform run-length encoding on the binary image and the structure element to obtain a target region and a structure element region; Find the starting and ending rows of the trip in the target area and the structural element area respectively to determine the row interval where the trip in the target area after corrosion is located; In the row interval where the trip in the target area after corrosion is located, when it is detected that there is a trip on the target row, the column interval of each trip in the structural element area on the row corresponding to the target area is contracted to obtain multiple column interval contraction sets; When there is no empty set in multiple column interval contraction sets, the column intervals in all column interval contraction sets are iteratively calculated to obtain all the eroded result column intervals on the target row, and the row number of the target row and the result column interval corresponding to the target row form a trip to obtain the erosion result on each row.

2. The image erosion method based on run length encoding according to claim 1, wherein: The specific steps of acquiring a binary image and a preset structure element, and performing run-length encoding on the binary image and the structure element to obtain a target region and a structure element region include: Acquire a binary image, perform run-length encoding on the binary image, and define the target area; A preset structural element is input, and the structural element is run-length encoded to obtain a set of structural element runs, which is defined as a preliminary structural element region. The anchor point of the preliminary structural element region is calculated, and all runs in the preliminary structural element region are mirror-transposed with the anchor point as the mirror point to obtain the structural element region.

3. The image erosion method based on run length encoding according to claim 2, wherein: The specific steps of searching the start and end rows of the travel in the target area and the structural element area respectively to determine the row interval where the travel in the target area after corrosion is located include: Complete the transposition based on the structural element region, and find the starting and ending rows of the trip in the structural element region, including the minimum row and the maximum row of the structural element region; Find the starting and ending rows of the trip in the target area, including the minimum and maximum rows in the target area; According to the minimum row and maximum row of the target area and the minimum row and maximum row of the structural element area, the minimum row, maximum row and row interval of the travel in the target area after corrosion are determined.

4. The image erosion method based on run length encoding according to claim 3, wherein: The row interval where the travel distance in the target area after corrosion is located is defined as the calculation interval. Within the calculation interval, the row corresponding to the row where the anchor point of the structural element area is located is the target row of the calculation interval.

5. The image erosion method based on run length encoding according to claim 4, wherein: The specific steps of performing column interval contraction on the runs on the row corresponding to each run in the target area in the eroded target area within the row interval where the runs are located to obtain multiple column interval contraction sets include: Check whether the target line in the calculation interval exists; When it is detected that a trip exists in the target row, column interval contraction is performed on the trip on the row corresponding to each trip in the structural element region in the target region to obtain multiple column interval contraction sets; When it is detected that the target row has no travel, it is detected whether the next target row in the calculation interval has a travel.

6. The image erosion method based on run length encoding according to claim 5, characterized in that: The specific steps of detecting whether the target line in the calculation interval has a travel range include: Check whether there is at least one trip in the target row in the calculation interval; When it is detected that the target row has at least one trip, traverse each trip in the structure element area and obtain the structure element target row where it is located, and detect whether there is a trip in the row corresponding to the structure element target row in the target area; When it is detected that all rows corresponding to the target row of the structural element in the target area have a travel path, it is determined that a travel path exists on the target row; When it is detected that the target row has no trip or any row corresponding to the target row in the target area has no trip, it is detected whether the next target row in the calculation interval has at least one trip.

7. The image erosion method based on run length encoding according to claim 5, wherein: The specific steps of performing column interval contraction on the row corresponding to each trip in the target area in the structural element area when a trip in the target row is detected to obtain multiple column interval contraction sets include: When it is detected that there is a trip in the target row, traverse each trip in the structure element area and obtain the structure element target row where it is located, and read all trips in the target area that correspond to the structure element target row; Column interval contraction is performed on all runs in the target area that correspond to the target row of the structural element to obtain a plurality of column interval contraction sets.

8. The image erosion method based on run length encoding according to claim 4, wherein: When no set is empty in the plurality of column interval contraction sets, iteratively finding the intersection of the column intervals in all column interval contraction sets to obtain all eroded result column intervals on the target row, and forming a trip by the row number of the target row and the result column interval corresponding to the target row to obtain the erosion result on each row. The specific steps include: Determine whether any of the multiple column interval contraction sets are empty; When there is no empty set in multiple column interval contraction sets, the column intervals in all column interval contraction sets are iteratively intersected to obtain all eroded result column intervals on the target row. The row number of the target row and the result column interval corresponding to the target row form a trip to obtain the erosion result on the target row, and check whether there is a trip for the next target row in the calculation interval. When there is an empty set in the plurality of column interval contraction sets, it is detected whether there is a trip in the next target row in the calculation interval.

9. The image erosion method based on run length encoding according to claim 8, wherein: The following steps are also included: Get the erosion results of all target rows in the calculation interval and generate a binary image after erosion.

10. An image processing device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the image erosion method based on run length encoding according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Rapid area erosion algorithm and device based on random structural element of run-length encoding

    CN106600655A

  • Rapid region expansion algorithm and device of any structure element based on stroke coding

    CN106709892A