Image inflation method and device, electronic equipment and storage medium

By using a run-length encoding-based image dilation method, the problem of time-consuming and inefficient Blob analysis is solved, improving the speed and efficiency of Blob analysis and achieving efficient merging and redundancy processing of image dilation.

CN120655514BActive Publication Date: 2026-01-20BEIJING SMARTER EYE TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511157654.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-19
Publication Date
2026-01-20
Estimated Expiration
2045-08-19

AI Technical Summary

Technical Problem

Existing technologies for performing Blob analysis calculations on raw Blob images are time-consuming and inefficient, and there is a lack of efficient image dilation schemes.

Method used

An image dilation method based on run-length encoding is adopted. By traversing the run lengths of the image and structuring elements, a basic run length is generated, and redundant run lengths are merged or deleted row by row to realize the image dilation operation.

Benefits of technology

It significantly improves the processing speed and efficiency of Blob analysis, reduces computational complexity, eliminates isolated noise points, merges adjacent small blobs, and repairs fractures in the target region.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120655514B_ABST
    Figure CN120655514B_ABST
Patent Text Reader

Abstract

The application discloses an image dilation method and device, electronic equipment and storage medium. The image dilation method comprises the following steps: traversing a current image obtained and all runs of a structure element to generate basic runs, wherein the basic runs are the result of performing a dilation operation on the runs of the current image and the runs of the structure element; traversing the basic runs row by row, if there are multiple basic runs in a current row, then judging any two basic runs in the multiple basic runs in turn; if the current two basic runs satisfy or, then performing a merging operation on the current two basic runs, if the current two basic runs satisfy and, then deleting the basic runs, wherein y represents a row identifier, represents a column start point identifier, and represents a column end point identifier; repeating the step until there are no two basic runs overlapping in the multiple basic runs and there is no basic run containing another basic run.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of image processing, in particular to an image inflation method and device, electronic equipment and storage medium. BACKGROUND

[0002] The purpose of Blob analysis is to detect and analyze 2-D shapes in an image to obtain information such as target position, shape, direction, and topological relationship between targets. Based on this information, the target can be identified. Blob analysis is actually a characteristic analysis of closed shapes. Before Blob analysis, the image must be segmented into targets and backgrounds.

[0003] Blob analysis calculation on the original Blob image is very time-consuming and inefficient. In order to improve the speed and efficiency of Blob analysis, introducing image inflation technology can significantly improve the processing speed and efficiency. Specifically, the image inflation operation can eliminate isolated noise points, reduce interference items in subsequent connected region analysis, and reduce the computational complexity of Blob labeling; by moderately inflating and merging adjacent small Blobs, the number of connected regions that need to be analyzed is reduced; the broken part of the target region is repaired to avoid misjudgment of the same object as multiple Blobs, and repeated calculation is reduced.

[0004] Therefore, in order to improve the speed and efficiency of Blob analysis, it is a technical problem to be solved at present to provide an efficient image inflation scheme. SUMMARY

[0005] The main purpose of the present application is to disclose an image inflation method, device, electronic equipment and storage medium, so as to at least solve the problems in the related art that Blob analysis calculation on the original Blob image is very time-consuming and inefficient, and there is a lack of an efficient image inflation scheme.

[0006] According to one aspect of the present application, an image inflation method is provided.

[0007] The image inflation method provided by the present application comprises: traversing a current image obtained and all runs of a structure element to generate a basic run, wherein the basic run is a result of performing an inflation operation on the runs of the current image and the runs of the structure element; traversing the basic run row by row, if there are multiple basic runs in the current row, then sequentially judging any two basic runs in the multiple basic runs; for the current two basic runs and if or , then performing a merging operation on the current two basic runs, if and if the basic run is deleted wherein y represents a row identifier, represents a column start point identifier, represents a column end point identifier, and the step is repeatedly performed until there is no case that two basic runs in the plurality of basic runs overlap each other and a case that one basic run contains another basic run exists.

[0008] Further, the current run of the current image The structure element is The structure element, and the structure element run is The expanded basic run is The current run of the current image The structure element is The structure element, and the structure element run is The expanded basic run is

[0009] Further, when the expansion operation is performed on the run of the current image and the run of the structure element, for the first row of the current input run- encoded image, the method for performing the row processing comprises: performing a new row operation in the output run-encoded image, a new row identical to the current input run-encoded image, a previous row of the new row, and a next row of the new row, wherein when the previous row and the next row are created, if the output image size range is exceeded, the new row operation is not performed, and when the next row is created, a boundary crossing processing is performed.

[0010] Further, when the expansion operation is performed on the run of the current image and the run of the structure element, for the second row of the current input run-encoded image and each row after the second row, the method for performing the row processing comprises one of the following:

[0011] When the current input run-encoded row and the previous input run-encoded row are adjacent, a next row of the current input run-encoded row is newly created in the output run-encoded image, and an add row operation is performed on the current row of the current input run-encoded row and a previous row of the current input run-encoded row, wherein when the next row is newly created, a boundary crossing processing is performed.

[0012] ​​​​​​​​​When the current input run-encoding line and the previous input run-encoding line are separated by one line, in the output run-encoding image, a current line of the current input run-encoding line is newly created, a next line of the current input run-encoding line is newly created, and a previous line of the current input run-encoding line is added, wherein when the next line is newly created, a boundary crossing process is performed.

[0013] When the current input run-encoding line and the previous input run-encoding line are separated by two lines or more, in the output run-encoding image, a line same as the current input run-encoding line is newly created, a previous line of the current input run-encoding line is newly created, and a next line of the current input run-encoding line is newly created, wherein when the next line is newly created, a boundary crossing process is performed.

[0014] Further, the newly created line operation includes inserting a current basic run at the end of the current line.

[0015] Further, the current basic run is the hotspot run is the added line operation includes one of the following:

[0016] When the following condition is satisfied if the hotspot run is the last run of the current line, the current basic run operation is ended after the current basic run is inserted after the hotspot run, and the current basic run operation is pointed to the hotspot run, otherwise, the hotspot run is pointed to the right adjacent run of the hotspot run, and the basic run operation process is repeated;

[0017] When the following condition is satisfied if the hotspot run is the first run of the current line, or the left adjacent run of the hotspot run is not connected with the current basic run, the current basic run operation is ended after the current basic run is inserted in front of the hotspot run, and the current basic run operation is pointed to the hotspot run, otherwise, the hotspot run is pointed to the left adjacent run of the hotspot run, and the current basic run operation is ended;

[0018] When the following condition is satisfied and the hotspot run is modified to if the hotspot run is the last run of the current line, the current basic run operation is ended, otherwise, the hotspot run is pointed to the right adjacent run of the hotspot run, and the basic run operation process is repeated;

[0019] When the following condition is satisfied and if the hotspot run is connected with the left adjacent run of the hotspot run, the hotspot run is deleted, otherwise, the hotspot run is modified to If the hotspot run is the last run of the current line, the current basic run operation is ended, and if the hotspot run is not the last run of the current line, the hotspot run is pointed to the right neighboring run of the hotspot run, and the basic run operation is repeated.

[0020] When the following conditions are satisfied and If the hotspot run is connected with the left neighboring run of the hotspot run, the left neighboring run is modified to , the hotspot run is deleted, otherwise, the hotspot run is modified to If the hotspot run is the last run of the current line, the current basic run operation is ended, and if the hotspot run is not the last run of the current line, the hotspot run is pointed to the right neighboring run of the hotspot run, and the basic run operation is repeated.

[0021] When the following conditions are satisfied and The current basic run operation is directly ended.

[0022] According to another aspect of the present application, there is provided an image dilation device.

[0023] The image dilation device according to the present application comprises: a generating module for generating basic runs by traversing a current image obtained and all runs of a structure element, wherein the basic runs are results of performing dilation operation on the runs of the current image and the runs of the structure element; a traversing module for traversing the basic runs line by line, and if there are multiple basic runs in a current line, any two basic runs in the multiple basic runs are sequentially judged; and a processing module for, for the current two basic runs and If the following conditions are satisfied or the current two basic runs are performed with merging operation, and if the following conditions are satisfied and the basic run is deleted, wherein y represents a line identifier, represents a column start point identifier, represents a column end point identifier, and this step is repeatedly performed until there are no two basic runs in the multiple basic runs that are overlapped, and there is no basic run that contains another basic run.

[0024] Further, the generating module comprises a line processing unit, wherein the line processing unit is configured to:

[0025] For the first row of the current input run-length encoded image, a new row operation is performed in the output run-length encoded image, a new row identical to the current input run-length encoded row, a previous row of the identical row, and a next row of the identical row are created, wherein, when the previous row and the next row are created, if the output image size is exceeded, the new row operation is not performed, and when the next row is created, a boundary crossing process is performed;

[0026] For the second row of the current input run-length encoded image and each row after the second row, a row processing method includes one of the following:

[0027] When the current input run-length encoded row and the previous input run-length encoded row are adjacent, in the output run-length encoded image, a next row of the current input run-length encoded row is created, and an add row operation is performed on the current row of the current input run-length encoded row and the previous row of the current input run-length encoded row, wherein, when the next row is created, a boundary crossing process is performed;

[0028] When the current input run-length encoded row and the previous input run-length encoded row are separated by one row, in the output run-length encoded image, the current row of the current input run-length encoded row, the next row of the current input run-length encoded row, and an add row operation are performed on the previous row of the current input run-length encoded row, wherein, when the next row is created, a boundary crossing process is performed;

[0029] When the current input run-length encoded row and the previous input run-length encoded row are separated by two rows or more, in the output run-length encoded image, a row identical to the current input run-length encoded row, the previous row of the current input run-length encoded row, and the next row of the current input run-length encoded row are created, wherein, when the next row is created, a boundary crossing process is performed.

[0030] According to still another aspect of the present application, an electronic device is also provided.

[0031] According to the electronic device of the present application, the electronic device comprises a processor and a memory, the memory is configured to store executable instructions of the processor, and the processor is configured to execute the image expansion method according to any one of the preceding aspects by executing the executable instructions.

[0032] According to still another aspect of the present application, a computer readable storage medium is provided.

[0033] According to the computer readable storage medium of the present application, the computer readable storage medium comprises a stored computer program, and the computer program controls the device in which the computer readable storage medium is located to execute the image expansion method according to any one of the preceding aspects when the computer program is running.

[0034] According to the present application, an image inflation method, device, electronic equipment and storage medium are provided. First, the original Blob image is run-length encoded (also referred to as RLE), and all subsequent processing steps are implemented for the run-length encoding of the image. By introducing the Blob image inflation scheme based on run-length encoding, the problem of time-consuming and low efficiency of Blob analysis and calculation on the original Blob image in the related art is solved, and the Blob analysis processing speed and efficiency are significantly improved. BRIEF DESCRIPTION OF DRAWINGS

[0035] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required to be used in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only exemplary, and other drawings can be obtained by the provided drawings without creative labor for those skilled in the art.

[0036] Figure 1 is a flowchart of the image inflation method according to an embodiment of the present application;

[0037] Figure 2 is a schematic diagram of run-length encoding according to an example of the present application;

[0038] Figure 3 is a structural block diagram of a Blob image run-length encoding data structure according to an example of the present application;

[0039] Figure 4 is a schematic diagram of Blob image run-length encoding data structure description according to an example of the present application;

[0040] Figure 5 is a structural block diagram of the image inflation device according to an embodiment of the present application;

[0041] Figure 6 is a structural block diagram of the image inflation device according to a preferred embodiment of the present application;

[0042] Figure 7 is a structural block diagram of the electronic equipment according to a preferred embodiment of the present application. DETAILED DESCRIPTION

[0043] The embodiments of the present application are described below by specific specific embodiments, and those skilled in the art can easily understand other advantages and effects of the present application from the content disclosed in the specification. Obviously, the described embodiments are part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0044] The specific implementation manners of the present application will be described in detail below with reference to the accompanying drawings.

[0045] According to an embodiment of the present application, an image inflation method is provided.

[0046] Figure 1 is a flowchart of the image inflation method according to an embodiment of the present application. As shown in Figure 1 , the image inflation method comprises:

[0047] Step S101: traversing the obtained current image and all runs of the structure element to generate basic runs, wherein the basic runs are the result of performing inflation operation on the runs of the current image and the runs of the structure element;

[0048] Step S102: traversing the basic runs by row, if there are multiple basic runs in the current row, then sequentially judging any two basic runs in the multiple basic runs;

[0049] Step S103: for the current two basic runs and if or is satisfied, performing a merge operation on the current two basic runs, if and are satisfied, deleting the basic run wherein y represents a row identifier, represents a column start point identifier, represents a column end point identifier, and this step is repeatedly executed until there are no two basic runs overlapping in the multiple basic runs and one basic run containing another basic run.

[0050] In the related art, Blob analysis calculation on the original Blob image is very time-consuming and inefficient. By introducing the Blob image inflation scheme based on run-length encoding shown in Figure 1 , the problem of Blob analysis calculation on the original Blob image being very time-consuming and inefficient in the related art is solved, and the Blob analysis processing speed and efficiency are significantly improved.

[0051] Run-length encoding (RLE) is an image encoding method in which a segment (row or column) with the same gray value is called a run. The present application adopts a row run-length encoding method, Figure 2 (a) in (b) shows a binary image, Figure 2The (b) in the above shows the run-length encoding corresponding to the binary image, which can be fully described by three variables: the row ROW, the column start point START COL, and the column end point END COL. For example, Figure 2 The first run in the first row of the (a) above corresponds to Figure 2 The first run in the first row of the (b) above corresponds to Figure 2 The second run in the first row of the (b) above corresponds to Figure 2 There are 7 runs in the above, corresponding to the serial numbers 1 to 7. In the implementation of the run-length encoding, each gray level can be encoded respectively for subsequent processing and operation.

[0052] The structural diagram and description of the run-length encoding data structure for the Blob image are shown in Figure 3 and Figure 4 The run-length encoding data is divided into four levels: image level, Blob level, row level, and run unit level, and is represented by a linked list. Among them, the image level structure is responsible for managing all Blob objects and their topological relationship, including: all Blob data classes, Blob quantity, and all Blob linked lists. The Blob level is one of the core levels, and a single Blob data class is composed of a Blob label, a single Blob all row linked list, and a currently accessed row. The row level structure is the core unit for processing single-row pixel connectivity, and a single-row data class is composed of a row label, a single-row all run unit linked list, and a currently accessed run unit. In the run unit level, the key fields of a single run unit data class include: start column, end column, permanent label, and reserved field.

[0053] The above preferred embodiments are further described below in combination with the image Z and the structural element .

[0054] The pixel numbers of the image and the structural element are and , respectively, and the run numbers are and , respectively.

[0055] The run-length encoding representations of the image and the structural element are , , respectively, and the dilation is defined as

[0056] ,

[0057] wherein, is about the origin, denotes is translated to .

[0058] is

[0059] ,

[0060] is

[0061] .

[0062] Thus, the dilation operation of image and structuring element is equivalent to the union of dilated structures between runs of image and runs of structuring element .

[0063] Consider which is equivalent to searching for the positions where runs and runs overlap, i.e. in the same line and with at least one pixel overlapping. If ; i.e.

[0064] wherein, Two runs overlap if

[0065] ;

[0066] or

[0067] .

[0068] i.e.

[0069] .

[0070] Thus, the dilation operation of image and structuring element can be described as

[0071] .

[0072] i.e. the dilation operation result is directly described in run-length coding, but there is redundancy in it, which must be processed by run-merging and run-deletion.

[0073] In this application, the result of the image run and structuring element run dilation operation is called basic run. The basic run is not a compact representation of the image run coding, i.e. there is redundancy between basic runs, so these redundancies must be eliminated.

[0074] In step S101, the current run of the current image is The structural element is The structural element, and the structural element run is respectively , , The expanded basic run is , , ;

[0075] In step S101, the current run of the current image is The structural element is The structural element, and the structural element run is respectively , , The expanded basic run is , , .

[0076] Specifically, in the multi-run expansion method based on run-length coding, the input is: the run-length coding data of the obtained image Z; the run-length coding data of the structural element S; the run-length coding data of the The structural element, and the structural element run is respectively , , The run-length coding data of the The structural element, and the structural element run is respectively , , .

[0077] The output is: The run-length coding data of the

[0078] All runs of the image are traversed by row first. Then the basic run is generated. If the run is expressed as: The expanded basic run is respectively as follows:

[0079] a. For the The structural element, the expanded basic run is , , ;

[0080] b. For the The structural element, the expanded basic run is , , .

[0081] In step S101, when performing the dilation operation on the run of the current image and the run of the structural element, for the first row of the current input run- encoded image, the method of performing the row processing comprises: performing a new row operation in the output run-encoded image, a new row identical to the current input run- encoded, a previous row of the new row, and a next row of the new row, wherein when the previous row and the next row are newly built, if the range of the output image size is exceeded, the new row operation is not performed, and when the next row is newly built, a boundary crossing processing is performed.

[0082] In step S101, when performing the dilation operation on the run of the current image and the run of the structural element, for the second row of the current input run- encoded image and each row after the second row, the method of performing the row processing comprises one of the following:

[0083] When the current input run-encoded row and the previous input run-encoded row are adjacent, in the output run-encoded image, a next row of the current input run- encoded row is newly built, and an add row operation is performed on the current row of the current input run-encoded row and a previous row of the current input run- encoded row, wherein when the next row is newly built, a boundary crossing processing is performed;

[0084] When the current input run-encoded row and the previous input run-encoded row are separated by one row, in the output run-encoded image, the current row of the current input run-encoded row, a next row of the current input run-encoded row, and an add row operation is performed on the previous row of the current input run- encoded row, wherein when the next row is newly built, a boundary crossing processing is performed;

[0085] When the current input run-encoded row and the previous input run-encoded row are separated by two rows or more, in the output run-encoded image, a row identical to the current input run-encoded row, a previous row of the current input run- encoded row, and a next row of the current input run-encoded row are newly built, wherein when the next row is newly built, a boundary crossing processing is performed.

[0086] Specifically, when performing the dilation operation on the run of the current image and the run of the structural element, the row processing strategy is as follows:

[0087] a. For the first row of the input run-encoded image (not necessarily the first row of the input image), three rows are newly built in the output run-encoded image, i.e. a row identical to the input run-encoded, a corresponding previous row, and a corresponding next row. When the previous row and the next row are newly built, if the range of the output image size is exceeded, the new row operation is not performed.

[0088] b. For the second row and subsequent rows of the input image, there are different processing strategies as follows:

[0089] b.1 When the current input run-encoding row and the previous input run-encoding row are adjacent: in the output run-encoding image, a corresponding lower 1 row is newly created, and an addition operation is performed on the current row and the upper 1 row.

[0090] b.2 When the current input run-encoding row and the previous input run-encoding row are spaced by 1 row: in the output run-encoding image, the current row is newly created, a corresponding lower 1 row is newly created, and an addition operation is performed on the upper 1 row.

[0091] b.3 When the current input run-encoding row and the previous input run-encoding row are spaced by 2 rows or more: in the output run-encoding image, a same 1 row as the input run-encoding is newly created, a corresponding upper 1 row is newly created, and a corresponding lower 1 row is newly created.

[0092] Wherein, when the lower 1 row is newly created, a boundary crossing processing is performed.

[0093] Wherein, the above newly created row operation includes: inserting a current basic run into the tail of the current row.

[0094] Wherein, the current basic run is , and the hotspot run is The above addition row operation includes one of the following:

[0095] When the following condition is met If the hotspot run is the last run of the current row, the current basic run is inserted after the hotspot run, the current basic run operation is ended, and the current basic run operation is pointed to the hotspot run, otherwise, the hotspot run is pointed to the right adjacent run of the hotspot run, and the basic run operation process is repeated.

[0096] When the following condition is met If the hotspot run is the first run of the current row, or the left adjacent run of the hotspot run is not connected with the current basic run, the current basic run is inserted in front of the hotspot run, the current basic run operation is ended, and the current basic run operation is pointed to the hotspot run, otherwise, the hotspot run is pointed to the left adjacent run of the hotspot run, and the current basic run operation is ended.

[0097] When the following conditions are met And The hotspot run is modified to If the hotspot run is the last run of the current row, the current basic run operation is ended, otherwise, the hotspot run is pointed to the right adjacent run of the hotspot run, and the basic run operation process is repeated.

[0098] When the following conditions are met And If the hotspot run is connected with the left adjacent run of the hotspot run, the hotspot run is deleted, otherwise, the hotspot run is modified to If the hotspot run is the last run of the current line, the current basic run operation is ended, and if the hotspot run is not the last run of the current line, the hotspot run is pointed to the right neighboring run of the hotspot run, and the basic run operation flow is repeated.

[0099] When the following conditions are satisfied and If the hotspot run is connected with the left neighboring run of the hotspot run, the left neighboring run is modified to , the hotspot run is deleted, otherwise, the hotspot run is modified to If the hotspot run is the last run of the current line, the current basic run operation is ended, and if the hotspot run is not the last run of the current line, the hotspot run is pointed to the right neighboring run of the hotspot run, and the basic run operation flow is repeated.

[0100] When the following conditions are satisfied and The current basic run operation is directly ended.

[0101] In the preferred implementation process, the output run encoding image is encoded, and in the current traversal process, the last run operated is called the hotspot run, which is initially the first run of the current line. The current basic run is defined as, and the hotspot run is defined as. According to the relationship between the current basic run and the hotspot run, it can be subdivided into the following operations, and processed according to the following flow:

[0102] a. Left not connected: that is, If the hotspot run is the last run of the current line, the current basic run is inserted after the hotspot run, the current basic run operation is ended, and it is pointed to the hotspot run; otherwise, the hotspot run is pointed to the right neighboring run, and the basic run operation flow is repeated.

[0103] b. Right not connected or left and right not connected: that is, If the hotspot run is the first run of the line, or the left neighboring run of the hotspot run is not connected with the current basic run, the current basic run is inserted in front of the hotspot run, the current basic run operation is ended, and it is pointed to the hotspot run; otherwise, the hotspot run is pointed to the left neighboring run, and the current basic run operation is ended.

[0104] c. Left connected: that is, and The hotspot run is modified to If the hotspot run is the last run of the current line, the current basic run operation is ended, and if the hotspot run is not the last run of the current line, the hotspot run is pointed to the right neighboring run of the hotspot run, and the basic run operation flow is repeated.

[0105] d. Contains: that is, and .

[0106] d.1 If the hotspot run is connected with its left-neighbor run, i.e. , then delete the hotspot run.

[0107] d.2 Modify the hotspot run to .

[0108] If the hotspot run is the last run of the current line, then end the current basic run operation; otherwise, point the hotspot run to its right-neighbor run, and repeat the basic run operation procedure.

[0109] e. Right-connection: i.e. and .

[0110] e.1 If the hotspot run is connected with its left-neighbor run, i.e. , then modify the left-neighbor run to , and delete the hotspot run.

[0111] e.2 Modify the hotspot run to .

[0112] If the hotspot run is the last run of the current line, then end the current basic run operation; otherwise, point the hotspot run to its right-neighbor run, and repeat the basic run operation procedure.

[0113] f. Containment: i.e. and , directly end the current basic run operation.

[0114] According to the embodiment of the present application, an image dilation device is further provided.

[0115] Figure 5 is a structural block diagram of the image dilation device according to the embodiment of the present application. As shown in Figure 5 , the image dilation device comprises: a generation module 50, configured to traverse a current image obtained and all runs of a structure element, and generate a basic run, wherein the basic run is a result of performing a dilation operation on the runs of the current image and the runs of the structure element; a traversal module 52, configured to traverse the basic run line by line, and if there are multiple basic runs in a current line, then judge any two basic runs in the multiple basic runs in sequence; and a processing module 54, configured to, for the current two basic runs and , perform a merging operation on the current two basic runs, and if or , perform a merging operation on the current two basic runs, and if and if the basic run is deleted, then the basic run is deleted wherein y represents a row identifier, represents a column start point identifier, represents a column end point identifier, and the step is repeatedly executed until there is no case that two basic runs in the plurality of basic runs overlap each other and a case that one basic run contains another basic run exists.

[0116] by introducing Figure 5 the Blob image inflation device based on run-length encoding shown in the figure, solves the problem that the Blob analysis calculation on the original Blob image is very time-consuming and low in efficiency in the related art, and significantly improves the Blob analysis processing speed and efficiency.

[0117] As shown in Figure 6 the generating module 50 can further include a row processing unit 500, wherein the row processing unit 500 is configured to:

[0118] a. for the first row of the current input run-length encoded image, perform a new row operation in the output run-length encoded image to newly create a row identical to the current input run-length encoded image, a previous row of the identical row, and a next row of the identical row, wherein when the previous row and the next row are created, if the output image size range is exceeded, the new row operation is not performed, and when the next row is created, a boundary crossing processing is performed;

[0119] b. for the second row of the current input run-length encoded image and each row after the second row, the row processing method includes one of the following:

[0120] b.1 when the current input run-length encoded row and the previous input run-length encoded row are adjacent, in the output run-length encoded image, a next row of the current input run-length encoded row is newly created, and an add row operation is performed on the current row of the current input run-length encoded row and the previous row of the current input run-length encoded row, wherein when the next row is newly created, a boundary crossing processing is performed;

[0121] b.2 when the current input run-length encoded row and the previous input run-length encoded row are separated by one row, in the output run-length encoded image, the current row of the current input run-length encoded row, the next row of the current input run-length encoded row, and an add row operation is performed on the previous row of the current input run-length encoded row, wherein when the next row is newly created, a boundary crossing processing is performed;

[0122] b.3 When the interval between the current input run-encoding line and the previous input run-encoding line is two or more lines, a line identical to the current input run-encoding line, a line above the current input run-encoding line, and a line below the current input run-encoding line are newly created in the output run-encoding image, and when the line below the current input run-encoding line is newly created, a wrap-around process is performed.

[0123] It should be noted that the image expansion device can be understood in correspondence with the related description and effects of the embodiments shown in Figures 1 to 4 and will not be described here again.

[0124] According to the embodiments of the present application, an electronic device is further provided.

[0125] Figure 7 is a structural block diagram of an electronic device according to a preferred embodiment of the present application. As shown in Figure 7 The electronic device according to the present application comprises a memory 70 and a processor 72, wherein the memory 70 is configured to store computer-executable instructions of the processor 72, and the processor 72 is configured to execute the image expansion method according to any one of the embodiments by executing the executable instructions.

[0126] The processor 72 can be a central processing unit (CPU). The processor 72 can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, or combinations thereof.

[0127] The memory 70 is a non-transitory computer-readable storage medium, which can be configured to store non-transitory software programs, non-transitory computer-executable instructions and modules, such as the program instructions / modules corresponding to the image expansion method according to the embodiments of the present application. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory.

[0128] The memory 70 can include a program storage area and a data storage area. The program storage area can store an operating system, application programs required by at least one function, etc. The data storage area can store data created by the processor, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-transitory memory, such as at least one disk memory device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory 70 can optionally include a memory that is remotely located with respect to the processor, and these remotely located memories can be connected to the processor through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0129] The one or more modules described above are stored in the memory 70 described above, and when executed by the processor 72, perform the image dilation method as described above. Figures 1 to 4 The image dilation method in the embodiment shown.

[0130] The specific details of the electronic device described above can be understood by referring to the corresponding relevant descriptions and effects of the embodiment shown in Figures 1 to 4 The specific details of the electronic device described above can be understood by referring to the corresponding relevant descriptions and effects of the embodiment shown in

[0131] According to the embodiments of the present application, a computer readable storage medium is also provided. The computer readable storage medium has a computer program stored thereon, and the computer program is executed by a processor to implement the image dilation method provided in any of the above.

[0132] The computer-readable storage medium can be a memory, for example, can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable Programmable ROM (EPROM), an Electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a Random Access Memory (RAM) used as an external cache. By way of example but not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous Dynamic RAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Sync Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM).

[0133] To sum up, by means of the above-mentioned embodiments provided by the present application, the Blob analysis calculation on the original Blob image is very time-consuming and inefficient, and by introducing the Blob image inflation scheme based on run-length coding, the problem of the Blob analysis calculation on the original Blob image being very time-consuming and inefficient in the related art is solved, and the Blob analysis processing speed and efficiency are significantly improved.

[0134] The above detailed description further describes the purpose, technical scheme and beneficial effects of the present application, and it should be understood that the above is only a specific embodiment of the present application and is not used to limit the protection scope of the present application, and any modification, equivalent replacement, improvement, etc. made on the basis of the technical scheme of the present application shall be included in the protection scope of the present application.

Claims

1. An image dilation method characterized by, include: The obtained current image and all runs of the structure element are traversed to generate a basic run, wherein the basic run is a result of performing a dilation operation on the runs of the current image and the runs of the structure element, in a multi-run dilation operation based on run-length coding, the input is: run-length coding data of the obtained current image Z and run-length coding data of the structure element S, and the output is: the run-length coding data of the basic run, wherein the dilation is defined as , , , is a mirror image of S about the origin, denotes that the origin of S is moved to p, denotes a run of the image Z, denotes a run of the structure element S, the number of pixels of the image Z and the structure element S are Z and S respectively, and the number of runs of the image Z and the structure element S are N and M respectively; The basic runs are traversed line by line. If there are multiple basic runs in the current line, any two basic runs in the multiple basic runs are judged in turn. For the two basic tours and If the conditions are met or If the current two basic runs are merged, then a merge operation will be performed. and Then delete the basic run. Where y represents the row identifier. Indicates the column start point identifier. Indicates the column termination point identifier. Indicates the basic tour and The row identifier, Indicates the basic tour The column start point identifier, Indicates the basic tour Column termination point identifier, Indicates the basic tour The column start point identifier, Indicates the basic tour The column termination point identifier is used to repeat this step until there are no cases where two basic runs overlap, or where one basic run contains another.

2. The method according to claim 1, characterized in that, The current run of the current image The structuring element is a 3×1 structuring element with run lengths of (-1,0,0), (0,0,0), and (1,0,0), respectively. The basic run length after expansion is... , , ,in, Indicates the current run The row identifier, Indicates the current run The column start point identifier, Indicates the current run Column termination point identifier; The current run of the current image , the structure element is a 3x3 structure element, the structure element run is (-1, -1, 1), (0, -1, 1), (1, -1, 1) respectively, and the basic run after expansion is , , .

3. The method of claim 1, wherein, When performing dilation operations on the run length of the current image and the run length of the structuring element, the method for performing row processing on the first row of the current input run-length encoded image includes: In the output run-length encoded image, a new row operation is performed, creating a new row that is the same as the current input run-length encoded row, the row above the same row, and the row below the same row. If the row above the current row and the row below the current row exceed the output image size range, the new row operation is not performed. When creating the row below the current row, out-of-bounds handling is performed.

4. The method of claim 1, wherein, When performing dilation operations on the run length of the current image and the run length of the structuring element, for the second row of the current input run-length encoded image and each row thereafter, the method for performing row processing includes one of the following: When the current input run-length encoding line is adjacent to the previous input run-length encoding line, a new line is created below the current input run-length encoding line in the output run-length encoding image. An add line operation is performed on the current line of the current input run-length encoding line and the previous line of the current input run-length encoding line. When creating the new line, out-of-bounds handling is performed. When the current input run-length encoding line is one line apart from the previous input run-length encoding line, in the output run-length encoding image, a new current line and a new next line of the current input run-length encoding line are created, and an add line operation is performed on the previous line of the current input run-length encoding line. When creating a new next line, out-of-bounds handling is performed. When the current input run-length encoding line is two or more lines away from the previous input run-length encoding line, a new line identical to the current input run-length encoding line, the line above the current input run-length encoding line, and the line below the current input run-length encoding line are created in the output run-length encoding image. When creating the new line, out-of-bounds processing is performed.

5. The method of claim 3, wherein, The new row operation includes inserting the current basic run at the end of the current row.

6. The method of claim 4, wherein, The current base run is , the hotspot run is , and the add row operation includes one of: when the condition is met if the hotspot run is the last run of the current line, the current basic run is inserted after the hotspot run, the current basic run operation is ended, and the current basic run operation is pointed to the hotspot run, otherwise, the hotspot run is pointed to the right adjacent run of the hotspot run, and the basic run operation flow is repeated; when the condition is met if the hotspot run is the first run of the current line, or the left-neighbor run of the hotspot run is not connected with the current base run, the current base run is inserted in front of the hotspot run, the current base run operation is ended, and the current base run operation is pointed to the hotspot run, otherwise, the hotspot run is pointed to the left-neighbor run of the hotspot run, and the current base run operation is ended; when the condition is met and the hotspot run is modified to if the hotspot run is the last run of the current line, the current basic run operation is ended, otherwise, the hotspot run is pointed to the right neighboring run of the hotspot run, and the basic run operation flow is repeated; when the condition is met and if the hotspot run is connected to the left-neighbor run of the hotspot run, the hotspot run is deleted, otherwise, the hotspot run is modified to if the hotspot run is the last run of the current line, the current basic run operation is ended, if the hotspot run is not the last run of the current line, the hotspot run is pointed to the right-neighbor run of the hotspot run, and the basic run operation procedure is repeated; when the condition and if the hotspot run is connected with the left-neighbor run of the hotspot run, the left-neighbor run is modified as the hotspot run is deleted, otherwise, the hotspot run is modified as if the hotspot run is the last run of the current line, the current basic run operation is ended; if the hotspot run is not the last run of the current line, the hotspot run is pointed to the right-neighbor run of the hotspot run, and the basic run operation procedure is repeated; When the condition and is met, the current basic run operation is ended directly.

7. An image dilation apparatus characterized by comprising: include: The generating module is configured to traverse the obtained current image and all runs of the structure element to generate a basic run, wherein the basic run is a result of performing a dilation operation on the run of the current image and the run of the structure element, in a multi-run dilation operation based on run coding, input is run coding data of the obtained current image Z and run coding data of the structure element S, and output is run coding data of , , , , , , , , wherein the dilation is defined as , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , The traversal module is used to traverse the basic run line by line. If there are multiple basic run lines in the current line, then any two basic processes in the multiple basic run lines are judged in turn. The processing module is used to process the current two basic runs. and If the conditions are met or If the current two basic runs are merged, then a merge operation will be performed. and Then delete the basic run. Where y represents the row identifier. Indicates the column start point identifier. Indicates the column termination point identifier. Indicates the basic tour and The row identifier, Indicates the basic tour The column start point identifier, Indicates the basic tour Column termination point identifier, Indicates the basic tour The column start point identifier, Indicates the basic tour The column termination point identifier is used to repeat this step until there are no cases where two basic runs overlap or one basic run contains another.

8. The apparatus of claim 7, wherein, The generation module includes a line processing unit, wherein the line processing unit is used for: For the first row of the current input run-length encoded image, perform a new row operation in the output run-length encoded image, creating a row that is the same as the current input run-length encoded image, the row above the same row, and the row below the same row. If the row above the current row and the row below the current row exceed the size range of the output image, the new row operation is not performed. When creating the row below the current row, out-of-bounds processing is performed. For the second row of the current input run-length encoded image and each row thereafter, the method for performing row processing includes one of the following: When the current input run-encoding row and the previous input run-encoding row are adjacent, in the output run-encoding image, a next row of the current input run-encoding row is newly created, a current row of the current input run-encoding row and a previous row of the current input run-encoding row are executed with an add row operation, wherein, when the next row is newly created, a wrap-around processing is executed; When the current input run-encoding row and the previous input run-encoding row are adjacent, in the output run-encoding image, a next row of the current input run-encoding row is newly created, a current row of the current input run-encoding row and a previous row of the current input run-encoding row are executed with an add row operation, wherein, when the next row is newly created, a wrap-around processing is executed; When the current input run-encoding row and the previous input run-encoding row are adjacent, in the output run-encoding image, a next row of the current input run-encoding row is newly created, a current row of the current input run-encoding row and a previous row of the current input run-encoding row are executed with an add row operation, wherein, when the next row is newly created, a wrap-around processing is executed; 9. An electronic device, comprising: Comprising: A processor and a memory, the memory is used to store executable instructions of the processor, wherein the processor is configured to execute the image inflation method of any one of claims 1 to 6 by executing the executable instructions.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium comprises a stored computer program, wherein the computer readable storage medium controls the device where the computer readable storage medium is located to execute the image inflation method of any one of claims 1 to 6 when the computer program is running.

Citation Information

Patent Citations

  • Fast expansion method based on run length coding

    CN119295321A