Rapid contour marking and searching method for multiple microorganism images

By using the target pixel coordinate matrix and search rules to determine the location of the communication domain in microbial image processing, the problem of low efficiency in microbial image contour marking and searching in the prior art is solved, and fast and accurate image processing is achieved.

CN119810068AActive Publication Date: 2025-04-11BEIHANG UNIV
View PDF 14 Cites 0 Cited by

Patent Information

Application Number
CN202411893755.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-04-11
Estimated Expiration
2044-12-20

AI Technical Summary

Technical Problem

The prior art has problems with inefficient contour marking and searching when processing high-resolution microbial images, especially when the images are huge and contain a large number of bacteria.

Method used

A method of rapid outline marking and searching for multiple microbial images is proposed. By obtaining the target binary image and the target pixel coordinate matrix, the starting pixel point is determined in the connected domain using the configured search rules, and the connected pixel point is searched in the specified direction, and the target pixel coordinate matrix is ​​updated to determine the position of the connected domain.

Benefits of technology

It realizes fast and accurate marking and storing of the connecting domain positions in the image, improves the efficiency and accuracy of image processing, and can complete the contour search of large-scale microbial images in a short time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119810068A_ABST
    Figure CN119810068A_ABST
Patent Text Reader

Abstract

The invention provides a rapid contour marking and searching method for multiple microbial images, and relates to the technical field of image processing, and the method comprises the steps: obtaining a target binary image and a target pixel coordinate matrix of the target binary image; for any connected domain, determining an initial pixel point of the connected domain in the pixel points in the connected domain according to a configured search rule; searching a connected domain along a first target neighborhood direction based on the starting pixel point, and acquiring a first connected pixel point of the starting pixel point in the first target neighborhood direction; respectively updating pixel coordinates of the starting pixel point and the first connected pixel point and values of element positions in the corresponding target pixel coordinate matrix into connected domain thresholds of connected domains; and determining the position of the connected domain from the updated target pixel coordinate matrix according to the threshold value of the connected domain. The position of the connected domain in the image can be efficiently determined.
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 technology, and in particular to a method for quickly marking and searching contours of multiple microorganism images. Background Art

[0002] Microscopic imaging technology enables accurate measurement of bacteria at the single-cell level, which is of great significance for in-depth understanding of microbial communities and accurate control of bacterial-based treatments or diagnostic methods. Live bacterial localization imaging can be achieved through genes, organic dyes or nanoprobes. Based on the imaging results, a segmentation algorithm is used to generate bacterial instance masks. By marking these masks, information such as the location, morphology and contour of individual bacteria can be obtained for subsequent in-depth analysis. The marking of each bacterium can be achieved by marking the connected domains in the mask binary image, and then extracting more detailed bacterial location, morphology and contour information based on the marked connected domains. However, a high-resolution microbial image is very large, usually hundreds of millions of pixels, and contains a large number of bacteria, usually more than hundreds of thousands. Therefore, it is necessary to effectively mark and store the connected domains of these bacteria before the rapid search and extraction of bacterial contours can be achieved.

[0003] The existing methods for determining the location of connected domains include the secondary scanning method and the region growing method. Among them, the secondary scanning method requires two passes through the image to implement, which takes more time and requires mutual mapping of the labels of the adhesion areas to select the smallest label. The amount of calculation is too large, and the actual image size is huge, while the area of ​​the connected domain only occupies a very small part of the actual image, so the processing efficiency will be relatively low. The region growing method needs to judge each target element one by one. When the area of ​​the connected domain is large, the efficiency of the algorithm is greatly reduced. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a method for quickly marking and searching contours of various microorganism images, so as to solve the above-mentioned problems existing in the prior art and to quickly and accurately obtain the locations of connected domains in the images.

[0005] In a first aspect, a method for rapid contour marking and searching for multiple microorganism images is provided, and the method may include:

[0006] Obtain a target binary image and a target pixel coordinate matrix of the target binary image; wherein the element position of each matrix element in the target pixel coordinate matrix corresponds one-to-one to the pixel coordinate of each pixel point in the target binary image; the target binary image includes at least one connected domain; each connected domain corresponds to a unique connected domain threshold;

[0007] For any connected domain, determine the starting pixel point of the connected domain among the pixel points in the connected domain according to the configured search rule; wherein the search rule includes a search direction and a first target neighborhood direction; and the first target neighborhood direction is determined based on the search direction;

[0008] Searching the connected domain along the first target neighborhood direction based on the starting pixel point to obtain a first connected pixel point of the starting pixel point in the first target neighborhood direction;

[0009] Respectively updating the values ​​of the element positions in the target pixel coordinate matrix corresponding to the pixel coordinates of the starting pixel point and the first connected pixel point to the connected domain threshold value of the connected domain;

[0010] Based on the starting pixel point in the connected domain, the first connected pixel points and the search rule, obtaining a second connected pixel point;

[0011] Taking the second connected pixel point as a new starting pixel point, returning to the execution step: searching the connected domain along the first target neighborhood direction based on the starting pixel point until all the pixels in the connected domain are traversed;

[0012] According to the connected domain threshold, the position of the connected domain is determined from the updated target pixel coordinate matrix.

[0013] In an optional implementation, each matrix element corresponds to an initial element value;

[0014] The search rule also includes: a search starting point.

[0015] In an optional implementation, determining the starting pixel point of the connected domain from the pixels in the connected domain according to the configured search rule includes:

[0016] Based on the search starting point and the search direction, the target binary image is searched, and the first pixel point located in the connected domain is used as the initial pixel point;

[0017] If the value of the element position in the target pixel coordinate matrix corresponding to the pixel coordinate of the initial pixel point is the same as the initial element value, the initial pixel point is used as the starting pixel point of the connected domain.

[0018] In an optional implementation, searching the connected domain along the first target neighborhood direction based on the starting pixel point to obtain a first connected pixel point of the starting pixel point in the first target neighborhood direction includes:

[0019] If the neighboring pixel points in the first target neighborhood direction of the starting pixel point are located in the connected domain, the neighboring pixel points are used as the first connected pixel points;

[0020] If the neighboring pixel points of the first connected pixel point in the first target neighborhood direction are located in the connected domain, the neighboring pixel points of the first connected pixel point in the first target neighborhood direction are used as the first connected pixel point;

[0021] Based on each first connected pixel point, a first connected pixel point of the starting pixel point in the first target neighborhood direction is obtained.

[0022] In an optional implementation, the search rule further includes: a second target neighborhood direction; the second target neighborhood direction is determined based on the search direction;

[0023] Acquiring a second connected pixel point based on the starting pixel point in the connected domain, the first connected pixel point and the search rule, comprising:

[0024] If the neighboring pixel points in the second target neighborhood direction of the starting pixel point are located in the connected domain, the neighboring pixel points are used as second connected pixel points;

[0025] If the neighboring pixel points of the first connected pixel point in the direction of the second target neighborhood are located in the connected domain, the neighboring pixel points of the first connected pixel point in the direction of the second target neighborhood are used as the second connected pixel points.

[0026] In an optional implementation, the method further includes: generating a connected domain search array based on the pixel coordinates of each second connected pixel point;

[0027] Taking the second connected pixel point as a new starting pixel point includes:

[0028] For any pixel coordinate in the connected domain search array, a pixel point corresponding to the pixel coordinate is used as a new starting pixel point.

[0029] In an optional implementation, determining the position of the connected domain from the updated target pixel coordinate matrix according to the connected domain threshold includes:

[0030] The matrix element whose element value in the updated target pixel coordinate matrix is ​​the same as the connected domain threshold is used as the target matrix element of the connected domain;

[0031] Based on the obtained element positions of each target matrix element, the position of the connected domain is determined.

[0032] In a second aspect, a device for quickly marking and searching contours of multiple microorganism images is provided, and the device may include:

[0033] An acquisition unit is used to acquire a target binary image and a target pixel coordinate matrix of the target binary image; wherein the element position of each matrix element in the target pixel coordinate matrix corresponds to the pixel coordinate of each pixel point in the target binary image one by one; the target binary image includes at least one connected domain; each connected domain corresponds to a unique connected domain threshold;

[0034] A search unit is configured to determine, for any connected domain, a starting pixel point of the connected domain from pixels within the connected domain according to a configured search rule; wherein the search rule includes a search direction and a first target neighborhood direction; the first target neighborhood direction is determined based on the search direction; based on the starting pixel point, the connected domain is searched along the first target neighborhood direction to obtain a first connected pixel point of the starting pixel point in the first target neighborhood direction;

[0035] An updating unit, used for updating the values ​​of the element positions in the target pixel coordinate matrix corresponding to the pixel coordinates of the starting pixel point and the first connected pixel point to the connected domain threshold value of the connected domain;

[0036] A returning unit is used to obtain a second connected pixel point based on the starting pixel point, the first connected pixel point and the search rule in the connected domain; take the second connected pixel point as a new starting pixel point, and return to the step of searching the connected domain along the first target neighborhood direction based on the starting pixel point until all the pixels in the connected domain are traversed;

[0037] The determination unit is used to determine the position of the connected domain from the updated target pixel coordinate matrix according to the connected domain threshold.

[0038] In a third aspect, an electronic device is provided, the electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0039] Memory, used to store computer programs;

[0040] The processor is used to implement any method step described in the first aspect when executing the program stored in the memory.

[0041] In a fourth aspect, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any method step described in the first aspect is implemented.

[0042] In the bacterial analysis of actual microbial images, for an image with a size of 25000*25000 pixels and containing 10,000 connected domains, it only takes 12 seconds to complete the storage and search.

[0043] The present application can efficiently, quickly and accurately complete the search for image connected domains (i.e., microbial image contours), and at the same time construct a matrix that is exactly the same as the pixel value distribution of the binary image based on the search results of the connected domains, complete the marking and storage of the positions of each connected domain of the image, so as to facilitate subsequent image processing tasks, thereby improving the efficiency and accuracy of any image processing and providing accurate connected domain information for different application scenarios.

[0044] The present application takes a complete outline in a plurality of microbial images as an image connected domain in the image. By constructing a matrix that is exactly the same as the image pixel value distribution, the position of each connected domain, i.e., each microbial outline, is obtained and marked, thereby facilitating subsequent searches for the positions of different microbial outlines and determining the states of different microbial outlines. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0046] Figure 1 A flowchart of a method for rapid contour marking and searching for multiple microorganism images provided in an embodiment of the present application;

[0047] Figure 2 A schematic diagram of a method for quickly marking and searching the contours of bacteria for multiple microorganism images provided in an embodiment of the present application;

[0048] Figure 3 A flowchart of a method for marking the outline of a microorganism image provided in an embodiment of the present application;

[0049] Figure 4 A schematic diagram of a storage structure provided in an embodiment of the present application;

[0050] Figure 5 A schematic diagram of a method for rapid contour marking and searching for multiple microorganism images provided in an embodiment of the present application;

[0051] Figure 6 A schematic diagram of the structure of a device for quickly marking and searching contours of multiple microorganism images provided in an embodiment of the present application;

[0052] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0054] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.

[0055] Figure 1 The present invention provides a flowchart of a method for rapid contour marking and searching for multiple microorganism images. Figure 1 As shown, the method may include:

[0056] Step S110, obtaining a target binary image and a target pixel coordinate matrix of the target binary image; for any connected domain, determining a starting pixel point of the connected domain from among the pixels within the connected domain according to a configured search rule.

[0057] In the embodiment of the present application, the target binary image is a binary image containing multiple or multiple microorganism contours.

[0058] In an embodiment of the present application, the element position of each matrix element in the target pixel coordinate matrix corresponds one-to-one to the pixel coordinate of each pixel point in the target binary image; the target binary image contains at least one connected domain; each connected domain corresponds to a unique connected domain threshold.

[0059] In an embodiment of the present application, each matrix element in the target pixel coordinate matrix corresponds to an initial element value, and each initial element value can be set to 0; when the element value of a matrix element is not 0, it means that the matrix element has been searched before (that is, its corresponding pixel point has been searched).

[0060] In an embodiment of the present application, the search rules include a search starting point, a search direction, a first target neighborhood direction, and a second target neighborhood direction; specifically, the search starting point, the first target neighborhood direction, and the second target neighborhood direction are all determined based on the search direction, the search starting point is the starting point of the search direction, and the first target neighborhood direction and the second target neighborhood direction are the two end points of the search direction, respectively.

[0061] For example, if the search direction is from left to right and from top to bottom, the search starting point is the pixel in the upper left corner of the image, the first target neighborhood direction is down, and the second target neighborhood direction is right; the first target neighborhood direction can also be right, and the second target neighborhood direction can be down; if the search direction is from right to left and from bottom to top, the search starting point is the pixel in the lower right corner of the image, the first target neighborhood direction is left, and the second target neighborhood direction is up; the first target neighborhood direction can also be up, and the second target neighborhood direction can be left.

[0062] In the embodiment of the present application, assuming that the values ​​of the binary image are 0 and 1, a pixel point with a value of 1 indicates that it is located within the connected domain, while a pixel point with a value of 0 indicates that it is located outside the connected domain.

[0063] In the embodiment of the present application, according to the configured search rule, determining the starting pixel point of the connected domain from the pixels in the connected domain includes:

[0064] Based on the search starting point and search direction, search the target binary image, and use the first pixel found in the connected domain as the initial pixel;

[0065] If the pixel coordinates of the initial pixel point and the corresponding element position value in the target pixel coordinate matrix are the same as the initial element value, the initial pixel point is used as the starting pixel point of the connected domain;

[0066] If the pixel coordinates of the initial pixel point and the value of the element position in the corresponding target pixel coordinate matrix are different from the initial element value, then the initial pixel point is used as the new search starting point, and the execution step is returned: based on the search starting point and the search direction, the target binary image is searched until an initial pixel point is obtained that is located in the connected domain and the value of the element position in the corresponding target pixel coordinate matrix is ​​the same as the initial element value.

[0067] In an embodiment of the present application, if the value of the element position in the target pixel coordinate matrix corresponding to the pixel coordinate of the initial pixel point is different from the initial element value, then the value of its element position should be the same as the threshold of the connected domain in which it is located, proving that the pixel point has been found before and is not searched for the first time, and therefore cannot be used as the starting pixel point.

[0068] In an embodiment of the present application, the initial pixel point is the first pixel point with a value of 1 in the connected domain searched. If the value of the element position corresponding to the pixel coordinate of the initial pixel point in the target pixel coordinate matrix is ​​0 (that is, the initial element value), then the initial pixel point is the starting pixel point of the connected domain in which it is located; if the corresponding value is not 0, the initial pixel point is used as the search starting point, and the search is continued in the search direction until the corresponding starting pixel point is found, or the edge of the image (that is, the end point) is reached.

[0069] For example, take the upper left corner as the search starting point, and the search direction is from left to right and from top to bottom. Assuming that the value of the pixel with pixel coordinates (2,2) in the image is 1, then (2,2) is the initial pixel, and continue to check whether the value of the matrix element at (2,2) in the target pixel matrix is ​​the initial value, that is, 0. If it is 0, (2,2) is the starting pixel; otherwise, start with (2,2) and continue to search from left to right and from top to bottom for the next pixel with a value of 1.

[0070] Step S120: searching the connected domain along the first target neighborhood direction based on the starting pixel point to obtain a first connected pixel point of the starting pixel point in the first target neighborhood direction.

[0071] In an embodiment of the present application, searching a connected domain along a first target neighborhood direction based on a starting pixel point to obtain a first connected pixel point of the starting pixel point in the first target neighborhood direction includes:

[0072] If the neighboring pixel points in the first target neighborhood direction of the starting pixel point are located in the connected domain, the neighboring pixel points are taken as the first connected pixel points, and the neighboring pixel points in the first target neighborhood direction of the first connected pixel point are continuously searched to see whether they are located in the connected domain. If they are located outside the connected domain, the first connected pixel point in the first target neighborhood direction of the starting pixel point is 1, that is, the neighboring pixel points of the starting pixel point in the first target neighborhood direction; if the neighboring pixel points of the first connected pixel point in the first target neighborhood direction are located in the connected domain, the neighboring pixel points of the first connected pixel point in the first target neighborhood direction are also taken as the first connected pixel points of the starting pixel point, and the search is performed in sequence until the neighboring pixel points of a certain first connected pixel point in the first target neighborhood direction are located outside the connected domain;

[0073] If the adjacent pixels of the starting pixel in the first target neighborhood direction are outside the connected domain, it means that there are no connected pixels of the starting pixel in the first target neighborhood direction.

[0074] For example, the pixel coordinates of the starting pixel are (2,2), and the first target neighborhood direction is directly below. The adjacent pixel point in the first target neighborhood direction of the starting pixel is (3,2). If the value of the pixel point at (3,2) in the binary image is 1 (that is, it is located in the connected domain), the pixel point at (3,2) is taken as the first connected pixel point; continue to query whether the pixel point directly below the first connected pixel point (3,2), that is, (4,2), has a value of 1 in the binary image. If it is 1, (4,2) is also the first connected pixel point and the query can be continued; if the value of (4,2) is 0, it means that it is outside the connected domain and there is no need to continue the query. The starting pixel point (2,2) has only one first connected pixel point in the first target neighborhood direction, that is, (3,2).

[0075] Step S130, respectively update the values ​​of the element positions in the target pixel coordinate matrix corresponding to the pixel coordinates of the starting pixel point and the first connected pixel point to the connected domain threshold of the connected domain; based on the starting pixel point, the first connected pixel point and the search rule in the connected domain, obtain the second connected pixel point.

[0076] In an embodiment of the present application, the value of the element in the matrix corresponding to the starting pixel point is the initial element value. Since the search direction is fixed, after the starting pixel point of a connected domain is determined, the pixel coordinates of the pixel points in the first target neighborhood direction of the starting pixel point can be determined, and the value of the element in the corresponding matrix should be consistent with the initial element value. Therefore, at this time, it is necessary to update the value of the element position in the matrix corresponding to the pixel coordinates of the starting pixel point and the first connected pixel point to the threshold of the connected domain, so that the element distribution of the matrix is ​​consistent with the pixel distribution in the image, so as to determine each connected domain in the image.

[0077] In an embodiment of the present application, based on the starting pixel point, the first connected pixel point and the search rule in the connected domain, obtaining the second connected pixel point includes:

[0078] If the adjacent pixel points in the direction of the second target neighborhood of the starting pixel point are located in the connected domain, the adjacent pixel points are taken as the second connected pixel points;

[0079] If the neighboring pixel points of the first connected pixel point in the direction of the second target neighborhood are located in the connected domain, the neighboring pixel points of the first connected pixel point in the direction of the second target neighborhood are taken as the second connected pixel points.

[0080] In an embodiment of the present application, the method further includes: generating a connected domain search array based on the pixel coordinates of each second connected pixel point.

[0081] In an embodiment of the present application, for the starting pixel point and the first connected pixel point, only the pixel points closely adjacent to the starting pixel point in the direction of the second target neighborhood are determined whether they are located in the connected domain, and the search will not be continued along the direction of the second target neighborhood, that is, it is not determined whether the adjacent pixel points of the second connected pixel point in the direction of the second target neighborhood are located in the connected domain.

[0082] In the embodiment of the present application, there is actually no order in which the first connected pixel point and the second connected pixel point are determined. After the starting pixel point is determined, it is possible to simultaneously determine whether the adjacent pixel points in the two target neighborhood directions of the pixel point are located in the connected domain. It is also possible to first determine whether the adjacent pixel points in one target neighborhood direction are located in the connected domain, and then determine whether the adjacent pixel points in the other target neighborhood direction are located in the connected domain.

[0083] In one embodiment of the present application, taking the order of existence of the two as an example, after determining the starting pixel point, it is determined whether the adjacent pixel point in the second target neighborhood direction is located in the connected domain. If the adjacent pixel point in the second target neighborhood direction is located in the connected domain, the adjacent pixel point is used as the second connected pixel point, and its pixel coordinates are stored in the connected domain search array; then it is determined whether the adjacent pixel point in the first target neighborhood direction is in the connected domain. If it is located in the connected domain, it is used as the first connected pixel point, and then it is determined whether the adjacent pixel point in the second target neighborhood direction of the first connected pixel point is located in the connected domain. If it is located, the adjacent pixel is used as the second connected pixel point, and its pixel coordinates are stored in the connected domain search array; if not, it is determined whether the adjacent pixel point in the first target neighborhood direction is located in the connected domain.

[0084] In an embodiment of the present application, the purpose of the operation performed after determining the starting pixel point is to search only one direction during the search process, and only store the coordinates for the other direction. When the direction being searched reaches the boundary, the stored coordinates are used as the new starting pixel point to complete the next round of search; thereby improving the search efficiency while avoiding repeated searches.

[0085] For example, the direction of the second target neighborhood is right, the pixel coordinates of the starting pixel are (2,2), and the first connected pixel includes (3,2). Then, it is determined whether the adjacent pixel points (2,3) and (3,3) of the starting pixel and the first connected pixel in the direction of the second target neighborhood are located in the connected domain. If (2,3) and (3,3) are both located in the connected domain, that is, the pixel values ​​are both 1, then (2,3) and (3,3) are both used as the second connected pixel points, and the pixel coordinates of (2,3) and (3,3) are stored in the connected domain search array. It is not necessary to determine whether the right pixel points of (2,3) and (3,3) are located in the connected domain.

[0086] Step S140, taking the second connected pixel point as the new starting pixel point, and returning to the execution step: searching the connected domain along the first target neighborhood direction based on the starting pixel point until all the pixels in the connected domain are traversed; determining the position of the connected domain from the updated target pixel coordinate matrix according to the connected domain threshold.

[0087] In an embodiment of the present application, after all first connected pixel points of the starting pixel point of the connected domain have been searched along the first target neighborhood direction, the pixel points corresponding to the pixel coordinates stored in the connected domain search array are used as new starting pixel points, and then the first connected pixel points in the corresponding first target neighborhood direction and the second connected pixel points in the second target neighborhood direction are re-searched, thereby searching all pixel points of the connected domain.

[0088] For example, the search direction is from top to bottom and from left to right. The direction of the first target neighborhood is directly below, and the direction of the second target neighborhood is directly to the right. The connected domain search array contains (2,3) and (3,3). First, for (2,3), determine whether the pixel point (2,4) to its right is located in the connected domain. If not, do not perform any operation, and prove that (2,3) should be the right boundary of the connected domain. If it is, continue to determine (2,5) until the pixel point outside the connected domain is traversed. Determine whether the pixel point (3,3) directly below (2,3) is in the connected domain. If it is, modify the value of the element at (3,3) in the matrix to the threshold of the connected domain. Then use (3,3) as the new starting pixel and repeat the above steps.

[0089] In an embodiment of the present application, the position of the connected domain is determined from the updated target pixel coordinate matrix according to the connected domain threshold, including: using the matrix element in the updated target pixel coordinate matrix whose element value is the same as the connected domain threshold as the target matrix element of the connected domain; and determining the position of the connected domain based on the obtained element position of each target matrix element.

[0090] In the embodiment of the present application, after traversing all the pixels in a connected domain, the corresponding connected domain search array may be deleted.

[0091] In the embodiment of the present application, during the search process, if the element value of the corresponding element in the target matrix is ​​not the initial value, it means that the element has been marked or searched, and the element will be directly skipped to continue the search.

[0092] In an embodiment of the present application, after traversing each connected domain in the image, a target matrix with the same pixel value distribution as the binary image can be obtained, and each region in the target matrix with an element value other than 0 is the connected domain of the binary image; and since the values ​​of the elements in the matrix corresponding to each pixel point in each connected domain are modified to the threshold of the connected domain, the value of each region in the target matrix is ​​the threshold of the connected domain at this time, and based on the target matrix, it can be intuitively seen how many connected domains there are in the binary image and the distribution of each connected domain.

[0093] In another embodiment of the present application, Figure 2 As shown in FIG. 1 , the contour fast marking and finding method for multiple microbial images includes:

[0094] Step 1: Obtain the bacterial segmentation mask binary image I1 of the microbial image, where 0 represents the background and 1 represents the connected area.

[0095] Step 2: Create a marking matrix M1 of the same size as the binary image to record the marked connected domains, with an initial value of 0. A starting point array A1 is used to record the starting point coordinates of each marked connected domain, that is, the number of rows of A1 corresponds to the number of connected domains. A1 has two columns, corresponding to the starting point position of each connected domain.

[0096] Step 3: Traverse the pixels from left to right and from top to bottom.

[0097] Step 4: If you encounter a pixel with a value of 0, follow step 3 and go to the next pixel. If you encounter a pixel with a value of 1, first query the value of the corresponding position in M1. If the value is 0, then the point is a new connected domain, recorded as the nth, and the value of the position in M1 is recorded as n, and the current position P is i,j Record it as the starting point, add it to A1, and execute step 5; if it is non-zero, execute step 3 and enter the next pixel.

[0098] Step 5: Use P i,j As the starting point, establish the connected domain search array A2, search to the right in I1 until a value of 0 is encountered and stop, and the corresponding position value of the non-zero area in M1 is recorded as n; specifically, when searching to the right in I1, if a non-zero value is encountered, it will not be added to the A2 array, only the value of the corresponding position of M1 will be modified to n, and the value of 0 will be stopped; when searching downward, if a non-zero value is encountered, the position being searched downward will be added to the A2 array, and no processing will be done for 0 value.

[0099] If we use 4 neighborhoods to determine the connected domain, we can determine P in I1. i,j The lower point P i+1,j , right point P i,j+1 If P i+1,j is 1, then P in M1 i+1,j The value is recorded as n, and P i+1,j Add to A2; if it is 0, no processing is done. i,j+1 is 1, then P in M1 i,j+1 The value is recorded as n, and P is further to the right. i,j+1 Repeat step 5; if it is 0, go to step 6.

[0100] If we use 8 neighborhoods to determine the connected domain, we can determine P in I1. i,j The lower point P i+1,j , its lower left point P i+1,j-1 , click P in the lower right corner i+1,j+1 , right point P i,j+1 If P i+1,j is 1, then P in M1 i+1,j The value is recorded as n, and P i+1,j Add to A2; if it is 0, no processing is done. i+1,j-1 is 1, then P in M1i+1,j-1 The value is recorded as n, and P i+1,j-1 Add to A2; if it is 0, no processing is done. i+1,j+1 is 1, then P in M1 i+1,j+1 The value is recorded as n, and p i+1,j+1 Add to A2; if it is 0, no processing is done. i,j+1 is 1, then P in M1 i,j+1 The value is recorded as n, and P is further to the right. i,j+1 Repeat step 5; if it is 0, go to step 6.

[0101] Step 6: Traverse A2. The point corresponding to the current traversal of A2 is recorded as Query I1 If the value is 0, no processing is done; if it is 1, query M1 If M1 If the value of is 0, Execute step 5 for the starting point; if M1 If the value of is not 0, no processing is done until A2 is traversed and the A2 array is deleted.

[0102] Step 7: After all elements in I1 are traversed in step 4, a matrix M1 with connected domain labels and an array A1 of starting points of each connected domain are obtained. M1 and A1 complete the labeling and storage of bacterial contour information.

[0103] Step 8: Traverse array A1, and the point corresponding to the current traversal of A1 is recorded as The contour of the connected domain can be extracted using the boundary tracing algorithm.

[0104] Step 9: Provide any point S in I1 i,j , find the corresponding bacterial outline. Find S in M1 i,j If the value is 0, the point is not a bacterial region and there is no bacterial contour; if it is n, the point is a bacterial region, and the nth element in A1 is found, which is the starting point of the region. The contour of the connected domain can be obtained directly using the boundary tracking algorithm. The bacterial contour search is completed.

[0105] In another embodiment of the present application, a method for rapid contour marking and searching for images of various microorganisms can be applied to image connected domain marking. It only takes one traversal of all pixels in the image to mark the connected domain and locate the connected domain; including: establishing a marking matrix and a starting point array. Traverse the original image and determine the connected domain of each pixel, add corresponding marks in the marking matrix, and only record the starting point of the connected domain in the starting point array. Use a connected domain search array to implement a connected domain search. Use a marking matrix to determine the connected domain's belonging and marked pixels. Use the marking matrix to record marked pixels that will be directly skipped during the search.

[0106] In another embodiment of the present application, Figure 3 As shown in the figure, the contour fast marking and searching method for various microorganism images can be applied to the storage and searching method of the connected domain of the image. By creating the marking matrix and the starting point array, the connected domain search of any point in the image can be completed quickly. The specific steps are:

[0107] A marking matrix M1 of the same size as the binary image is established to record the marked connected domains, with an initial value of 0. A starting point array A1 is used to record the starting point coordinates of each marked connected domain, that is, the number of rows of A1 corresponds to the number of connected domains. A1 has two columns, corresponding to the starting point position of each connected domain.

[0108] Provide any point S in I1 i,j , find the corresponding bacterial outline. Find S in M1 i,j If the value is 0, the point is not a bacterial region and there is no bacterial contour; if it is n, the point is a bacterial region, and the nth element in A1 is found, which is the starting point of the region. The contour of the connected domain can be obtained directly using the boundary tracking algorithm. The bacterial contour search is completed.

[0109] In another embodiment of the present application, a method for rapid contour marking and searching for multiple microorganism images can be applied to a strategy for adding a starting point to realize a connected domain search, and the specific steps are as follows:

[0110] P i,j As the starting point, establish the connected domain search array A2, search rightward in I1 until a value of 0 is encountered and stop. For non-zero areas, the corresponding position value in M1 is recorded as n. Traverse A2, and the point corresponding to the current traversal of A2 is recorded as Query I1 If the value is 0, no processing is done; if it is 1, query M1 If M1 If the value of is 0, Execute step 5 for the starting point; if M1 If the value of is not 0, no processing is done until A2 is traversed and the A2 array is deleted.

[0111] In one embodiment of the present application, taking four-neighborhood search as an example, the method for rapid contour marking and searching for multiple microorganism images includes:

[0112] like Figure 4 As shown, a marking matrix M1 of the same size as the binary image I1 is constructed, and the initial value of each matrix element in the marking matrix M1 is 0; a starting point array A1 is created; I1 is traversed from top to bottom and from left to right, that is, (1,1), (2,1), (3,1) ... (6,1), (2,1), (2,2) in order; since the search direction is from top to bottom and from left to right, and the 4-neighborhood contains four directions, the upper and left directions are subtracted from the 4-neighborhood, and only the right and lower directions are retained to obtain the neighborhood to be searched.

[0113] like Figure 5 As shown in the figure, when traversing to (2,2), the value of I1 is 1, the first connected domain is encountered, and the connected domain search array A2 is created; the value of M1 at this point is 0 and is not marked, and the value of M1 at this point is updated to 1. (2,2) is added to A1, and A1 now contains (2,2).

[0114] Based on the search direction, the neighborhood of (2,2) is searched. The neighborhood of (2,2) includes: (2,3) and (3,2); (2,3) is 1, (2,2) is not the lower boundary of the connected domain, the value of (2,3) of M1 is updated to 1, (2,3) is added to A2, and A2 now contains (2,3). (3,2) is 1, the value of (3,2) of M1 is updated to 1, (2,2) is not the right boundary; A2 now contains (2,3);

[0115] Continue searching downward and rightward with (3,2). (3,3) is 1, (3,2) is not the lower boundary of the connected domain, the value of (3,3) of M1 is updated to 1, (3,3) is added to A2, and A2 now contains (2,3), (3,3). (4,2) is 0, (3,2) is the right boundary.

[0116] Traverse A2 and perform a neighborhood search for the first point (2,3) in A2 until the 0 boundary is reached; (2,4) is 0, and (2,3) is the lower boundary of the connected domain. (3,3) is 1, and the value of (3,3) in M1 is 1, which is marked, and (2,3) is not the right boundary.

[0117] Based on (3,3), a domain search is performed. (3,4) is 1, and (3,3) is not the lower boundary of the connected domain. The value of (3,4) of M1 is updated to 1. (3,4) is added to A2. At this time, A2 contains (2,3), (3,3), and (3,4). (4,3) is 1, and (4,3) is not the right boundary of the connected domain. The value of (4,3) of M1 is updated to 1.

[0118] Based on (4,3), the domain search is performed. (4,4) is 0, (4,3) is the lower boundary of the connected domain, and (5,3) is 0, (4,3) is the right boundary of the connected domain.

[0119] Continue to traverse A2. The corresponding traversal point is (3,3). Perform a field search. M1's (3,4) has been marked as 1 and does not need to be modified. There is no need to add (3,4) to A2. A2 now contains (2,3), (3,3), and (3,4). (4,3) is 1. M1's (4,3) value has been marked as 1, indicating that the right search has been completed and there is no need to continue searching to the right.

[0120] Continue to traverse A2. The corresponding traversal point is (3,4). Perform a domain search. (3,5) is 0, and (3,4) is the lower boundary of the connected domain. (4,4) is 0, and (3,4) is the right boundary of the connected domain.

[0121] At this point, A2 is traversed, connected domain 1 is marked, and the connected domain search array A2 is deleted.

[0122] Continue to traverse I1 from top to bottom and from left to right. Since (2,3), (3,2), (3,3), (4,3), and (3,5) have been marked in M1, they are skipped until (6,4) encounters the second connected domain and creates the connected domain search array A2. Repeat the above steps.

[0123] Complete the update of the marking matrix M1 and the starting point array A1. The starting point array contains (2,2), (6,4), (1,6).

[0124] Randomly select a point (2,6) and find its connected domain.

[0125] The value corresponding to (2,6) in M1 is 3, which corresponds to (1,6) in A1. The outline of the connected domain is extracted using the boundary tracing algorithm to complete the search.

[0126] Corresponding to the above method, the embodiment of the present application also provides a device for quickly marking and searching the contours of various microorganism images, such as Figure 6 As shown, the contour rapid marking and searching device for multiple microorganism images includes:

[0127] The acquisition unit 610 acquires a target binary image and a target pixel coordinate matrix of the target binary image; wherein the element position of each matrix element in the target pixel coordinate matrix corresponds to the pixel coordinate of each pixel point in the target binary image one by one; the target binary image includes at least one connected domain; each connected domain corresponds to a unique connected domain threshold;

[0128] The search unit 620 is used to determine, for any connected domain, a starting pixel point of the connected domain among the pixels in the connected domain according to a configured search rule; wherein the search rule includes a search direction and a first target neighborhood direction; the first target neighborhood direction is determined based on the search direction; based on the starting pixel point, the connected domain is searched along the first target neighborhood direction to obtain a first connected pixel point of the starting pixel point in the first target neighborhood direction;

[0129] An updating unit 630 is used to update the values ​​of the element positions in the target pixel coordinate matrix corresponding to the pixel coordinates of the starting pixel point and the first connected pixel point to the connected domain threshold value of the connected domain;

[0130] The return unit 640 is used to obtain a second connected pixel point based on the starting pixel point, the first connected pixel point and the search rule in the connected domain; take the second connected pixel point as the new starting pixel point, and return to the execution step: search the connected domain along the first target neighborhood direction based on the starting pixel point until all the pixels in the connected domain are traversed;

[0131] The determination unit 650 is used to determine the position of the connected domain from the updated target pixel coordinate matrix according to the connected domain threshold.

[0132] The functions of the various functional units of the device for rapid contour marking and searching for images of multiple microorganisms provided in the above-mentioned embodiments of the present application can be realized through the above-mentioned method steps. Therefore, the specific working process and beneficial effects of each unit in the device for rapid contour marking and searching for images of multiple microorganisms provided in the embodiments of the present application will not be repeated here.

[0133] The present application also provides an electronic device, such as Figure 7 As shown, it includes a processor 710 , a communication interface 720 , a memory 730 and a communication bus 740 , wherein the processor 710 , the communication interface 720 , and the memory 730 communicate with each other via the communication bus 740 .

[0134] Memory 730, for storing computer programs;

[0135] The processor 710 is used to execute the program stored in the memory 730 to implement the following steps:

[0136] Obtain a target binary image and a target pixel coordinate matrix of the target binary image; wherein the element position of each matrix element in the target pixel coordinate matrix corresponds one-to-one to the pixel coordinate of each pixel point in the target binary image; the target binary image includes at least one connected domain; each connected domain corresponds to a unique connected domain threshold;

[0137] For any connected domain, according to the configured search rule, the starting pixel point of the connected domain is determined among the pixel points in the connected domain; wherein the search rule includes a search direction and a first target neighborhood direction; the first target neighborhood direction is determined based on the search direction; based on the starting pixel point, the connected domain is searched along the first target neighborhood direction to obtain the first connected pixel point of the starting pixel point in the first target neighborhood direction;

[0138] The pixel coordinates of the starting pixel point and the first connected pixel point and the values ​​of the element positions in the target pixel coordinate matrix corresponding to the pixel coordinates are respectively updated as the connected domain threshold value of the connected domain;

[0139] Based on the starting pixel point, the first connected pixel point and the search rule in the connected domain, a second connected pixel point is obtained; the second connected pixel point is used as a new starting pixel point, and the execution step is returned: based on the starting pixel point, the connected domain is searched along the first target neighborhood direction until all the pixels in the connected domain are traversed;

[0140] According to the connected domain threshold, the location of the connected domain is determined from the updated target pixel coordinate matrix.

[0141] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0142] The communication interface is used for communication between the above electronic device and other devices.

[0143] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0144] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0145] The implementation methods and beneficial effects of the components of the electronic device in the above embodiments to solve the problems can be seen in Figure 1 The various steps in the illustrated embodiment are implemented, therefore, the specific working process and beneficial effects of the electronic device provided by the embodiment of the present application are not repeated here.

[0146] In another embodiment provided in the present application, a computer-readable storage medium is also provided, which stores instructions. When the computer-readable storage medium is run on a computer, the computer executes any of the methods for rapid contour marking and searching for multiple microorganism images in the above embodiments.

[0147] In another embodiment provided in the present application, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute any of the methods for rapid contour marking and searching for images of multiple microorganisms in the above-mentioned embodiments.

[0148] Those skilled in the art will appreciate that the embodiments in the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt a complete hardware embodiment, a complete software embodiment, or a form of an embodiment combining software and hardware. Moreover, the present application may adopt a form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0149] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0150] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0151] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0152] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present application.

[0153] Obviously, those skilled in the art can make various changes and modifications to the embodiments in the present application without departing from the spirit and scope of the embodiments in the present application. Thus, if these modifications and variations of the embodiments in the present application fall within the scope of the claims and their equivalents in the embodiments of the present application, the embodiments of the present application are also intended to include these modifications and variations.

Claims

1. A method for rapid contour marking and searching of multiple microbial images, characterized in that: The method comprises: Obtain a target binary image and a target pixel coordinate matrix of the target binary image; wherein the element position of each matrix element in the target pixel coordinate matrix corresponds one-to-one to the pixel coordinate of each pixel point in the target binary image; the target binary image includes at least one connected domain; each connected domain corresponds to a unique connected domain threshold; For any connected domain, determine the starting pixel point of the connected domain among the pixel points in the connected domain according to the configured search rule; wherein the search rule includes a search direction and a first target neighborhood direction; and the first target neighborhood direction is determined based on the search direction; Searching the connected domain along the first target neighborhood direction based on the starting pixel point to obtain a first connected pixel point of the starting pixel point in the first target neighborhood direction; Respectively updating the values ​​of the element positions in the target pixel coordinate matrix corresponding to the pixel coordinates of the starting pixel point and the first connected pixel point to the connected domain threshold value of the connected domain; Based on the starting pixel point in the connected domain, the first connected pixel points and the search rule, obtaining a second connected pixel point; Taking the second connected pixel point as a new starting pixel point, returning to the execution step: searching the connected domain along the first target neighborhood direction based on the starting pixel point until all the pixels in the connected domain are traversed; According to the connected domain threshold, the position of the connected domain is determined from the updated target pixel coordinate matrix.

2. The method according to claim 1, characterized in that Each matrix element corresponds to an initial element value; The search rule also includes: a search starting point.

3. The method according to claim 2, characterized in that Determining a starting pixel point of the connected domain from pixels within the connected domain according to a configured search rule includes: Based on the search starting point and the search direction, the target binary image is searched, and the first pixel point found in the connected domain is used as the initial pixel point; If the value of the element position in the target pixel coordinate matrix corresponding to the pixel coordinate of the initial pixel point is the same as the initial element value, the initial pixel point is used as the starting pixel point of the connected domain.

4. The method according to claim 1, characterized in that Searching the connected domain along the first target neighborhood direction based on the starting pixel point to obtain a first connected pixel point of the starting pixel point in the first target neighborhood direction includes: If the neighboring pixel points in the first target neighborhood direction of the starting pixel point are located in the connected domain, the neighboring pixel points are used as the first connected pixel points; If the neighboring pixel points of the first connected pixel point in the first target neighborhood direction are located in the connected domain, the neighboring pixel points of the first connected pixel point in the first target neighborhood direction are used as the first connected pixel point; Based on each first connected pixel point, a first connected pixel point of the starting pixel point in the first target neighborhood direction is obtained.

5. The method according to claim 1, characterized in that The search rule further includes: a second target neighborhood direction; the second target neighborhood direction is determined based on the search direction; Acquiring a second connected pixel point based on the starting pixel point in the connected domain, the first connected pixel point and the search rule, comprising: If the neighboring pixel points in the second target neighborhood direction of the starting pixel point are located in the connected domain, the neighboring pixel points are used as second connected pixel points; If the neighboring pixel points of the first connected pixel point in the direction of the second target neighborhood are located in the connected domain, the neighboring pixel points of the first connected pixel point in the direction of the second target neighborhood are used as the second connected pixel points.

6. The method according to claim 5, characterized in that The method further comprises: Generate a connected domain search array based on the pixel coordinates of each second connected pixel point; Taking the second connected pixel point as a new starting pixel point includes: For any pixel coordinate in the connected domain search array, a pixel point corresponding to the pixel coordinate is used as a new starting pixel point.

7. The method according to claim 1, characterized in that Determining the position of the connected domain from the updated target pixel coordinate matrix according to the connected domain threshold includes: The matrix element whose element value in the updated target pixel coordinate matrix is ​​the same as the connected domain threshold is used as the target matrix element of the connected domain; Based on the obtained element positions of each target matrix element, the position of the connected domain is determined.

Citation Information

Patent Citations

  • Contour projection method of tumour 3D anatomy structure in radiotherapy plan system

    CN101000689A

  • Method for determining external periphery outline of mammary gland

    CN101419712A

  • Method realized by parallel pipeline for performing real-time marking and identification on connected domains of point targets

    CN101727654A

  • Method for extracting quick response matrix code region in image

    CN102831428A

  • Retina image processing method and device

    CN103198321A