A method for accurate extraction and identification of Escherichia coli outline

By designing an image processing algorithm for E. coli, including preprocessing, adaptive double-threshold binarization, and regional filling, the problem of insufficient extraction of E. coli morphological profiles is solved, and the accurate extraction and recognition of E. coli profiles is achieved, and the analysis accuracy of E. coli inhibition rate under the action of antibiotics is improved.

CN114648511BActive Publication Date: 2025-04-15HANGZHOU DIANZI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210313888.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-28
Publication Date
2025-04-15
Estimated Expiration
2042-03-28

AI Technical Summary

Technical Problem

In the prior art, E. coli morphological contour extraction is not accurate enough, few contour features lead to low recognition accuracy, and the professionalism of image processing technology leads to insufficient integration and adaptation when analyzing experimental data.

Method used

A set of image processing algorithms for E. coli was designed, including preprocessing, adaptive dual threshold binarization, region filling, morphological opening operations, adhesion segmentation, contour drawing, subpixel reconstruction and contour segmentation, through these steps, the contour features of E. coli were extracted and morphological analysis was performed.

Benefits of technology

The accurate extraction and identification of E. coli profile is achieved, the accuracy of analysis of E. coli inhibition rate under the action of antibiotics is improved, the burden of manual analysis is reduced, and the efficiency and accuracy of scientific researchers are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114648511B_ABST
    Figure CN114648511B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for accurately extracting and identifying the contour of Escherichia coli; the present invention relies on the image processing technology of computer vision, combines the geometric characteristics of Escherichia coli, and specifically designs a set of image processing algorithms, deeply combines the data obtained from the experiment, and improves the personalization and adaptability of the system in different scenarios. And using a statistical algorithm, the contour features of the Escherichia coli morphology are extracted from the complex Escherichia coli morphological image of the culture dish, thereby facilitating the user to collect statistical information, reducing the user's operating burden in a large number of image analyses, and speeding up the progress of the experiment. In addition, the present invention designs a contour sub-pixel reconstruction algorithm, which improves the resolution of the image without changing the hardware, making the contour of the system more detailed, so that the contour can be accurately extracted. At the same time, the present invention uses adaptive dual-threshold binarization to handle manual parameter adjustment in the binarization process, making the system more intelligent and efficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of biomedical image processing, and mainly relates to a method for accurately extracting and identifying the outline of Escherichia coli. Background Art

[0002] Cell morphology and subcellular spatial structure have a significant impact on the function of microbial cells, so the study of microbial morphology has very important theoretical significance and practical application value. For a long time, optical microscopy has been an important technology for characterizing and understanding the microbial world. It is widely used to measure the spatial structure inside living cells and communities, which usually results in a large number of images that are difficult to analyze manually. In the past, the inspection of microbial specimens was done manually, and there were a series of problems such as low detection efficiency and limited accuracy. When hundreds, thousands or even more images need to be analyzed, manual analysis becomes impossible. The automatic interpretation of cell images by computers can effectively avoid these problems, and thus has become a hot topic for scholars at home and abroad. With the rapid development of computer-based image analysis, both traditional image processing technology and convolutional neural networks can quantify a large number of properties of individual cells and communities. Since neural networks require a large amount of sample data and training time and have weak generalization ability. Therefore, most of the image analysis tools currently used in microbiology rely on traditional image analysis technology, which forms the basis of most current microbiology image analysis tools. However, in the field of traditional microbial image processing, there are problems such as inaccurate extraction of microbial morphological contours and low recognition accuracy due to fewer contour features. Morphological contour and feature extraction are crucial to experimental analysis, but they are also the most difficult and challenging steps. This is a very important link, and the quality of the processing results is directly related to the effect of subsequent recognition. Due to the diversity and complexity of cell images, there is currently no completely universal processing method that can analyze all cell images. Usually, it is necessary to fully combine and adapt with the knowledge in this field to solve the problem more effectively.

[0003] In biomedical research experiments, a large number of repeated experiments are usually required to ensure the accuracy of the results. In this process, a large number of cell morphology images will be generated. Manual analysis will inevitably lead to inefficiency and misjudgment. Therefore, having a set of image processing algorithms in this professional field is crucial for cell morphology image analysis.

[0004] In view of this, image processing technology is applied to the field of microorganisms, and a set of image processing algorithms are designed to solve the problems of morphological integrity, morphological resolution accuracy, and sufficient morphological features. The three constitute the necessary and sufficient conditions for the precise contour extraction and recognition algorithm of E. coli, and realize the precise and rapid analysis of the inhibition rate of E. coli under the action of antibiotics in experiments, which is conducive to improving the efficiency and accuracy of scientific researchers. Summary of the invention

[0005] The purpose of the present invention is to provide a method for accurately extracting and identifying the outline of Escherichia coli, so as to solve the technical problems in the prior art such as poor adhesion segmentation effect, insufficient resolution accuracy of bacterial morphological outline, insufficient classification and identification judgment conditions, insufficient extraction and identification accuracy, and inability to fully combine and adapt when analyzing experimental data due to the professionalism of image processing technology.

[0006] The precise extraction and identification method of the Escherichia coli outline has the following specific steps:

[0007] Step 1, collecting the identified Escherichia coli morphological image;

[0008] Step 2: preprocess the Escherichia coli morphological image obtained in step 1 to obtain a preprocessed image.

[0009] Step 3: Perform adaptive double threshold binarization on the preprocessed image obtained in step 2 to obtain a binary image.

[0010] Step 4: perform region filling on the binary image obtained in step 3 to obtain a filled image.

[0011] Step 5: Perform two morphological opening operations on the filled image in step 4 to obtain a colony opening operation image.

[0012] Step 6: Perform adhesion segmentation on the open operation image obtained in step 5 to obtain an adhesion segmentation image.

[0013] Step 7: Draw the outline of the adhesion segmentation image obtained in step 6 and count the numbers to obtain a contour image.

[0014] Step 8: Perform sub-pixel reconstruction on the contour image obtained in step 7 to obtain a contour sub-pixel reconstructed image.

[0015] Step 9: Perform contour segmentation on the contour sub-pixel reconstructed image obtained in step 8 to obtain a contour segmentation image.

[0016] Step 10: Extract the contour features of Escherichia coli.

[0017] Step 11: According to the outline features of Escherichia coli obtained in step 10, perform morphological analysis of Escherichia coli.

[0018] Preferably, antibiotics are added to the culture dish of the tested E. coli; steps 1 to 11 are repeated every preset time interval to obtain the inhibitory effect of the antibiotics on the E. coli at different time periods.

[0019] Preferably, the specific process of step 1 is:

[0020] 1-1. Add antibiotics to the E. coli culture dish.

[0021] 1-2. Use a transmission electron microscope to collect morphological images of Escherichia coli in the culture dish to obtain three-channel morphological images of Escherichia coli.

[0022] 1-3. Transfer the E. coli morphology image obtained in step 1-2 to a computer.

[0023] Preferably, the specific process of the pretreatment in step 2 is:

[0024] 2-1. The E. coli morphological image obtained in step 1 is grayed out using the component weighting method, wherein the three-channel morphological image is converted into a single-channel morphological grayscale image.

[0025] 2-2. Perform background correction on the morphological grayscale image obtained in step 2-1 to obtain a morphological background correction image. The specific process of background correction is as follows:

[0026] 2-2-1. Select a 3*3 convolution kernel template, which uses the center position as the coordinate origin.

[0027] 2-2-2. Use the 3*3 convolution kernel obtained in step 2-2-1 to convolve the grayscale image of E. coli morphology obtained in step 2-1 to obtain a lightly blurred image o(x,y).

[0028] 2-2-3. Select a 25*25 convolution kernel template and perform Gaussian filtering on the grayscale image of E. coli obtained in step 2-1 to obtain a strongly blurred image b(x,y). And calculate the average grayscale M of the strongly blurred image b(x,y).

[0029] 2-2-4. Perform background correction on the grayscale image of E. coli obtained in step 2-1 to obtain the morphological background correction image f(x, y) as follows:

[0030] f(x,y)=o(x,y)-b(x,y)+M

[0031] 2-3. Perform bilateral filtering on the morphological background correction image obtained in step 2-2 to obtain a bilateral filtered grayscale image of the E. coli morphology. The bilateral filtering method specifically superimposes a spatial domain kernel and a color domain kernel to obtain a dual kernel. The dual kernel is used to filter the identified image.

[0032] 2-4. Perform histogram equalization enhancement on the bilateral filtered grayscale image of the Escherichia coli morphology obtained in step 2-3 to obtain a grayscale enhanced image of the Escherichia coli morphology.

[0033] 2-5. Perform morphological gradient transformation on the grayscale enhanced image of E. coli obtained in step 2-4. The morphological gradient transformed image g of E. coli is obtained as follows:

[0034]

[0035] In formula (2), f represents the grayscale enhanced image of E. coli morphology, B represents the 3*3 cross kernel, represents the expansion operation, Represents the corrosion operation. The E. coli morphological gradient transformation image g is the preprocessed image obtained in step 2.

[0036] Preferably, the specific process of the adaptive dual-threshold binarization in step 3 is:

[0037] 3-1. Perform grayscale gradient calculation on the preprocessed image obtained in step 2. The gradient calculation includes calculating the gradient direction and amplitude. Combining the Sobel operator, the gradient change intensity in four directions is calculated, and then the gradient change intensity in two diagonal directions is calculated by linear interpolation.

[0038] 3-2. Compare the gradient change intensity of the current pixel with the gradient intensity of the adjacent pixels along the positive, negative and diagonal gradient directions. If a pixel point is the maximum value in the comparison, then keep the pixel as an edge point and set the pixel value to 255. If it is not the maximum, then suppress it and do not treat it as an edge point. Set the pixel value to 0.

[0039] 3-3. The non-real edge part of the gradient image is divided into pseudo-edge part and non-edge part by Otsu algorithm. The segmentation threshold when the maximum inter-class variance is obtained in the iterative segmentation operation is used as the optimal segmentation threshold to suppress isolated weak edges and complete edge detection. The expression of inter-class variance is as follows:

[0040]

[0041] Among them, w0 is the proportion of target points in the total image, u0 is its average grayscale; w1 is the proportion of background points in the image, u1 is its average grayscale; u is the total average grayscale of the image; g′ is the between-class variance.

[0042] 3-4. Take the threshold corresponding to the maximum inter-class variance value as the optimal segmentation threshold and define it as the low threshold; define 2.5 times the low threshold as the high threshold. Pixels with gradient strength lower than the low threshold are suppressed and not considered as edge points, and the pixel value is set to 0; pixels higher than the high threshold are defined as strong edges and retained as edge points, and the pixel value is set to 255; pixels between the high and low thresholds are defined as weak edges; if at least one of the neighborhood pixels of the weak edge is a strong edge pixel, the weak edge is retained as a strong edge, and the pixel value is set to 255; otherwise, the weak edge is not considered as an edge point, and the pixel value is set to 0.

[0043] Preferably, the specific process of performing area filling in step 4 is as follows:

[0044] 4-1. Assign all pixel values ​​outside the connected domain in the binary image obtained in step 3 to 0, and then perform bitwise inversion processing on the obtained image.

[0045] 4-2. Perform bitwise OR processing on the image obtained in step 4-1 and the binary image obtained in step 3 to obtain a filled image.

[0046] Preferably, the specific process of adhesion segmentation in step 6 is:

[0047] 6-1. Mark the adhesion segmentation image with eight-connected chain code. The specific process of chain code marking is as follows:

[0048]

[0049] In formula (4), j is the chain code number; k is the chain code step length; ζ j,k is the chain code value of the jth point in the chain code; (x j ,y j )、(x j-k ,y j-k ) represent the coordinates of the jth and jkth points in the chain code respectively.

[0050] 6-1-1. Start from the starting point and record it as the starting point coordinates, and search for the next boundary pixel point from the direction coded as 1 in an 8-connected manner; then, record the direction code.

[0051] 6-1-2. Repeat step 6-1-1 starting from the pixel found to obtain a set of chain codes. If the set of chain codes is closed, return to the starting point after encoding; otherwise, omit the starting point coordinates.

[0052] 6-1-3. Normalize the chain code obtained in step 6-1-2 to obtain a normalized chain code. Consider the chain code as an n-bit natural number, and circulate the chain code in one direction to minimize the n-bit natural number it constitutes, thus forming a chain code with a unique starting point.

[0053] 6-2. Determine the concave points on the boundary of the connected domain.

[0054] 6-2-1. Perform a cross multiplication operation on the image boundary chain code obtained in step 6-1 according to the vector cross multiplication operation formula, and store the vector cross multiplication operation result in the set S e Define a threshold T h If the result of the vector cross product operation is greater than the threshold T h , then the pixel points corresponding to the two vectors satisfy the concave point characteristic conditions.

[0055] The vector cross multiplication formula is as follows:

[0056] s=a×b=|a||b|sin(θ)

[0057] Among them, s is the result of vector cross multiplication; a represents the vector made with the starting coordinate of the chain code as the starting point and the step length k as the distance; b represents the vector made with the end point of vector a as the starting point and the step length k as the distance. θ is the angle between vector a and vector b.

[0058] 6-2-2. For the set S obtained in step 6-2-1 e The pixel points that meet the concave point characteristic conditions are marked to obtain multiple concave point pending sets; each concave point pending set includes a series of points located around the concave point; and then the point with the largest absolute value in each concave point pending set is taken as the concave point of the set to obtain all the concave points in the image.

[0059] 6-3. Match and segment the concave points on the connected domain boundary obtained in step 6-2. The specific process of concave point matching and segmentation is as follows:

[0060] 6-3-1. The concave points are classified into inner concave points and outer concave points. The inner concave points refer to the concave points found along the inner edge of the image; the outer concave points refer to the concave points found along the outer edge of the image.

[0061] 6-3-2. If the number of external concave points on the boundary of the connected domain is less than 1, no segmentation is performed.

[0062] 6-3-3. If the number of external concave points on the boundary of the connected domain is 2, the segmentation is performed by connecting the two external concave points with a straight line.

[0063] 6-3-4. If the number of external concave points on the boundary of the connected domain is greater than 2, pair the external concave points with each other; if two external concave points satisfy the minimum Euclidean distance and the dividing lines of the external concave points are in the same direction, the two external concave points are directly paired. Connect the external concave points of each group of pairs with straight lines to complete the segmentation.

[0064] Preferably, the specific steps of performing sub-pixel reconstruction of the contour in step 8 are:

[0065] 8-1. Grayscale the contour image obtained in step 7.

[0066] 8-2. After graying, the contour image is subjected to gradient detection. Gradient detection includes amplitude and direction. Eight 3*3 direction templates are set. Convolution operation is performed on the image using the eight direction templates to obtain eight gradient images. The direction of the template is the angle between the gradient direction and the X-axis.

[0067] The gradient image transformation formula used in gradient detection is as follows:

[0068] R(i,j)=∣f(i+1,j+1)+2f(i,j+1)+f(i-1,j+1)-f(i-1,j-1)-2f(i,j-1)-f(i+1,j- 1)∣+∣f(i-1,j-1)+2f(i-1,j)+f(i-1,j+1)-f(i+1,j+1)-2f(i+1,j)-f(i+1,j-1)∣

[0069] Where R(i,j) is the gradient amplitude at coordinate (i,j). f(i-1,j-1), f(i,j-1), f(i+1,j-1), f(i-1,j), f(i+1,j), f(i-1,j+1), f(i,j+1), and f(i+1,j+1) are the grayscale values ​​in the eight directions of upper left, upper, upper right, left, right, lower left, lower, and lower right of coordinate (i,j) respectively.

[0070] 8-3. According to the change rule of the gradient direction, the amplitude of the center point and the adjacent points in the direction are compared in the 3*3 neighborhood according to the direction of the gradient. The point with a larger amplitude is the edge point, and non-maximum suppression is performed. A single-pixel edge with a width of only one pixel is obtained.

[0071] 8-4. Perform polynomial interpolation on the single pixel edge obtained in step 8-3 to obtain a sub-pixel edge. The formula for polynomial interpolation is as follows:

[0072]

[0073] Among them, (X c , Y c ) represents sub-pixel coordinates; (m, n) represents pixel-level coordinates; W is the distance from the adjacent pixel to the edge point; θ is the angle between the gradient direction and the positive direction of the X axis; R0 is the modulus of the grayscale gradient of the edge point (m, n), R -1 , R1 are the gradient amplitudes of the two pixels adjacent to the edge point in the gradient direction.

[0074] 8-5. Store the edge sub-pixel coordinates obtained in step 8-4 and create a two-channel image. The first channel represents x and the second channel represents y. The x channel stores pixel values ​​and the y channel stores sub-pixel coordinates.

[0075] 8-6. Draw and connect the sub-pixel contours obtained in step 8-5.

[0076] Preferably, the specific process of performing contour segmentation in step 9 is as follows:

[0077] 9-1. Mark the sub-pixel reconstructed image of the contour obtained in step 8 with a chain code.

[0078] 9-2. Calculate the first-order difference chain code and normalize the first-order difference chain code of the chain code in step 9-1.

[0079] 9-3. Based on the characteristics that the inflection point is discontinuous at the tangent line and the curvature is continuous, the inflection point of the contour sub-pixel reconstructed image obtained in step 8 is extracted.

[0080] 9-4. Extract the tangent points of the contour image obtained in step 8.

[0081] 9-5. According to step 9-3 and step 9-4, all inflection points and tangent points are extracted, the inflection points are connected by line segments, the tangent points are fitted with an ellipse by the least square method, and the number of line segments and ellipse arcs is counted. The image with the contour segmented into straight line segments and ellipse arc segments is obtained.

[0082] 9-6. Draw the straight line segment and elliptical arc segment obtained in step 9-5.

[0083] In step 10, the specific process of extracting contour features is:

[0084] 10-1. The number of connected domains is taken as the number of E. coli.

[0085] 10-2. Take the total number of pixels in a single connected domain as the corresponding area of ​​a single E. coli.

[0086] 10-3. Take the total number of boundary pixels of a single connected domain as the corresponding perimeter of a single E. coli.

[0087] 10-4. Take the major-to-minor axis ratio of a single connected domain as the corresponding length-to-short ratio of a single E. coli.

[0088] 10-5. Take the ratio of the area of ​​a single connected domain to π times the maximum square of the distance from the center point to all contour pixels as the corresponding circularity of a single Escherichia coli.

[0089] 10-6. Count the number of contour lines and elliptical arcs of a single E. coli.

[0090] The specific process of performing E. coli morphological analysis in step 11 is as follows:

[0091] 11-1. If the area of ​​E. coli is greater than 100 or the perimeter is greater than 40, determine whether the length ratio of E. coli is greater than 3 and less than 10.

[0092] 11-2. If not, it is determined to be impurity. If so, it is determined whether the number of straight lines in the outline of E. coli is greater than 1 and the number of ellipses is greater than 2.

[0093] 11-3. If yes, it is judged as inhibited Escherichia coli; if no, it is judged as resistant Escherichia coli.

[0094] 11-4. If the area of ​​E. coli is less than 100 and the perimeter is less than 40, determine whether the circularity of E. coli is greater than 0.5.

[0095] 11-5. If yes, it is judged as inhibited Escherichia coli; if no, it is judged as impurity.

[0096] 11-6. The ratio of the number of inhibited Escherichia coli to the total number of Escherichia coli was taken as the inhibition rate of Escherichia coli.

[0097] Preferably, the specific process of step 9-2 is:

[0098] 9-2-1. Calculate the first-order differential chain code δ j,k as follows:

[0099]

[0100] Among them, j is the chain code number; k is the chain code step length; δ j,k is the first-order difference value of the j-th point in the chain code; (x j-k ,y j-k )、(x j ,y j )、(x j+k ,y j+k ) represent the coordinates of the jkth, jth, and j+kth points in the chain code respectively.

[0101] 9-2-2. Normalize the first-order differential chain code obtained in step 9-2-1, regard the first-order differential chain code as a natural number composed of numbers in each direction, and then cycle in one direction to minimize the natural number it constitutes.

[0102] The specific process of step 9-3 is as follows:

[0103] 9-3-1. Calculate the absolute value of the difference chain code deviation from the average value Use this absolute value Establish a Gaussian distribution and select a threshold. Use the points with the largest deviation from the mean as segmentation points. Absolute value The expression is as follows:

[0104]

[0105] Among them, j is the chain code number; k is the chain code step length; δ j,k is the first-order difference value of the jth point in the chain code; μ δ Represents the chain code mean.

[0106] 9-3-2. Set the threshold T; take the segmentation point that is greater than the threshold T and is the maximum value of the neighborhood as the inflection point. The expression of the threshold T is as follows:

[0107] T=z 1-2α σ

[0108] Wherein, z is the horizontal axis of the two-dimensional Gaussian distribution established in step 9-3-1, and 1-2α is the confidence interval of the two-dimensional Gaussian distribution established in step 9-3-1; z 1-2α is the horizontal coordinate value of the confidence interval of the two-dimensional Gaussian distribution established in step 9-3-1; σ is the standard deviation of the two-dimensional Gaussian distribution established in step 9-3-1.

[0109] The specific process of step 9-4 is as follows:

[0110] 9-4-1. Perform polygonal similarity approximation on the contour image obtained in step 8, and convert the contour into polyline segments to obtain smooth splitting points. Calculate the maximum error E between the contour and the approximate function ∞ (u1,u i+1 ). If the number of segments is reached or the maximum error of the split point is lower than the set threshold, the splitting is stopped. Maximum error E ∞ (u1,u i+1 ) is as follows:

[0111]

[0112] Among them, e i,j is the Euclidean distance between the jth point in interval i and its approximate function; (u1,u i+1 ) are the two endpoints of interval i.

[0113] 9-4-2. Perform piecewise approximate ellipse fitting on the splitting points obtained in step 9-4-1. Select the first splitting point as the starting point. Based on the premise that the three splitting points of adjacent contour segments cannot be on the same straight line, take the starting point and the two adjacent splitting points as a set to perform approximate ellipse fitting, and calculate the maximum error between the approximate ellipse and the contour segment corresponding to the splitting point set.

[0114] 9-4-3. If the maximum error is less than the maximum distance between the contour segment corresponding to the split point set and the similar approximation line segment of the polygon, the contour segment corresponding to the split point set is marked as a merge processing object, the split point set is saved and marked, and the next split point is used as the starting point. Execute the operation of step 9-4-2. Otherwise, the next split point is added to the split point set, the split point set is fitted with an approximate ellipse, and the maximum error between the approximate ellipse and the contour segment corresponding to the split point set is calculated.

[0115] 9-4-4. Repeat step 9-4-3 for multiple iterations until there are no more objects to be merged.

[0116] 9-4-5. The starting point and the end point of each marked split point set are regarded as the tangent points.

[0117] The present invention has the following beneficial effects:

[0118] 1. The present invention relies on computer vision image processing technology, combined with the geometric characteristics of E. coli (composed of straight line segments and circular arc segments), and specifically designs a set of image processing algorithms, which deeply combines the data obtained from the experiment to improve the personalization and adaptability of the system in different scenarios. And using statistical algorithms, the contour features of the E. coli morphology are extracted from the complex E. coli morphology images of the culture dish, which facilitates the user to collect statistical information, reduces the user's operating burden in a large number of image analyses, and speeds up the progress of the experiment.

[0119] 2. The present invention designs a method for segmenting the morphological contour of Escherichia coli, which segments its contour into two shapes, line segments and elliptical arcs. As a feature of the contour, the morphological contour features of Escherichia coli are increased, and the recognition rate is improved. Combined with the geometric characteristics of Escherichia coli before and after inhibition, that is, before inhibition, it is elliptical, and after inhibition, it presents a similar circular shape. By judging the number of elliptical arcs and line segments contained in Escherichia coli and the features such as area, perimeter, circularity, and aspect ratio, the suppressed Escherichia coli, drug-resistant Escherichia coli, and impurities can be accurately distinguished and judged. Usually, some irregular impurities are easy to meet the morphological area, perimeter, and aspect ratio features. At this time, after the increased contour is segmented into straight line segments and elliptical arcs, this type of misjudgment can be effectively avoided. It is applied to the identification of impurities before and after inhibition of Escherichia coli. Increasing its judgment conditions, reducing system misjudgments, improving the accuracy of recognition, and then improving the accuracy of the inhibition rate of Escherichia coli under the action of antibiotics.

[0120] 3. The present invention designs image algorithms for adhesion segmentation, contour sub-pixel, and contour segmentation to optimize the accuracy of contour extraction and the accuracy of system recognition from three perspectives: morphological integrity, resolution, and geometric characteristics. The integrity of the image ensures the geometric characteristics of the E. coli contour, paving the way for subsequent recognition; the resolution of the image ensures the accuracy of E. coli contour extraction. The accuracy of the contour geometric characteristics is improved; the geometric characteristics of E. coli increase the contour characteristics of E. coli, ensuring that the system's misjudgment is reduced in recognition judgment. The combination of the three greatly increases the accuracy and precision of the system.

[0121] 4. The present invention designs a segmentation algorithm for adhesion Escherichia coli, which ensures the integrity of Escherichia coli through precise segmentation, thereby improving the characteristics of morphological contours. In order to segment the adhesion area more accurately and quickly, the algorithm uses chain code marking, angle calculation, and concave point pairing segmentation to achieve segmentation accuracy; it uses multi-threading to achieve concurrency, which is improved in efficiency compared to loop execution, increases the running speed, and achieves the requirement of rapidity. At the same time, it reduces the hardware resource requirements.

[0122] 5. The present invention designs a sub-pixel contour reconstruction algorithm, which improves the resolution of the image without changing the hardware, making the contour of the system more detailed, so that the contour can be accurately extracted. At the same time, the present invention uses adaptive dual-threshold binarization to handle the manual parameter adjustment in the binarization process, making the system more intelligent and efficient. BRIEF DESCRIPTION OF THE DRAWINGS

[0123] Figure 1 It is a flowchart of the implementation steps of the present invention;

[0124] Figure 2 is a flow chart of Escherichia coli morphological analysis of the present invention;

[0125] Figure 3 A pre-processed image of the Escherichia coli morphological image obtained by the present invention;

[0126] Figure 4 A binary image of the Escherichia coli morphological image obtained by the present invention;

[0127] Figure 5 The region filling image of the Escherichia coli morphological image obtained by the present invention;

[0128] Figure 6 The open operation image of the Escherichia coli morphological image obtained by the present invention;

[0129] Figure 7 The adhesion segmentation image of the Escherichia coli morphological image obtained by the present invention;

[0130] Figure 8A pixel-level contour image of the Escherichia coli morphological image obtained by the present invention;

[0131] Fig. 9 A sub-pixel level contour image of the bacterial morphology image obtained by the present invention;

[0132] Fig.10 It is a sub-pixel level contour local enlarged comparison diagram of the Escherichia coli morphological image obtained by the present invention;

[0133] Fig.11 It is a sub-pixel level contour primitive segmented image of the Escherichia coli morphological image obtained by the present invention;

[0134] Fig.12 This is a sub-pixel level contour primitive segmented local enlargement comparison diagram of the Escherichia coli morphological image obtained by the present invention. DETAILED DESCRIPTION

[0135] The present invention will be further described below in conjunction with the accompanying drawings.

[0136] like Figure 1 As shown, a method for accurately extracting and identifying the outline of Escherichia coli is used to extract the outline and number of Escherichia coli in an image; based on the obtained changes in the morphological outline of Escherichia coli, the inhibitory effect under the action of antibiotics can be reflected, and an analysis experiment of the inhibition rate of Escherichia coli under the action of antibiotics is carried out.

[0137] like Figure 1 As shown, the specific steps of the extraction and recognition method are as follows:

[0138] Step 1: Obtain the morphological image of Escherichia coli under the action of antibiotics through transmission electron microscopy.

[0139] 1-4. Add low concentration (1 to 15 mg kg-1) of antibiotics to the E. coli culture dish and wait for about 30 minutes.

[0140] 1-5. Use a transmission electron microscope to collect morphological images of Escherichia coli in the culture dish to obtain three-channel morphological images of Escherichia coli.

[0141] 1-6. Transfer the E. coli morphological image obtained in step 1-2 to a computer.

[0142] Step 2: preprocess the E. coli morphological image obtained in step 1 to obtain a preprocessed image, such as Figure 3 The specific process of preprocessing is as follows:

[0143] 2-1. According to the following formula (1), the E. coli morphological image obtained in step 1 is grayed out, wherein the three-channel morphological image is converted into a single-channel morphological grayscale image.

[0144] Gray(i,j)=R(i,j) * 0.299+G(i,j) * 0.587+B(i,j) * 0.114 Formula (1)

[0145] In formula (1), Gray(i,j) is the gray value of the pixel in the i-th row and j-th column of the grayscale image after grayscale conversion, R(i,j), G(i,j), and B(i,j) are the red, green, and blue component values ​​of the pixel in the i-th row and j-th column of the original color image, and 0.299, 0.587, and 0.114 are the weights of the three components of each pixel, respectively.

[0146] 2-2. Perform background correction on the morphological grayscale image obtained in step 2-1 to obtain a morphological background correction image. The specific process of background correction is as follows:

[0147] 2-2-1. Select a 3*3 convolution kernel template with the center position as the coordinate origin. Substitute the coordinate positions of each point of the convolution kernel into the following two-dimensional Gaussian function formula (2) to obtain the 3*3 convolution kernel template coefficients.

[0148]

[0149] In formula (2), σ is the standard deviation, which determines the width of the Gaussian filter. (x, y) represents the coordinates, G(x, y) represents the grayscale value at the coordinates (x, y), and e represents the base of the natural logarithm function.

[0150] 2-2-2. Use the 3*3 convolution kernel template coefficient obtained in step 2-2-1 to convolve the grayscale image of E. coli obtained in step 2-1 (multiply the pixel values ​​where the template slides by the corresponding values ​​in the template, and finally add them up) to obtain a Gaussian filter image as a lightly blurred image. The grayscale of the obtained image is represented by o(x,y).

[0151] 2-2-3. Select a 25*25 convolution kernel template, perform Gaussian filtering according to steps 2-2-1 and 2-2-2, and obtain a Gaussian filtered image as a strongly blurred image. The grayscale of the obtained image is represented by b(x,y), and then its average grayscale is calculated and represented by M.

[0152] 2-2-4. According to the following formula (3), the grayscale image of Escherichia coli obtained in step 2-1 is background corrected to obtain a grayscale image of Escherichia coli with background correction.

[0153] f(x,y)=o(x,y)-b(x,y)+M Formula (3)

[0154] 2-3. Perform bilateral filtering on the grayscale image of E. coli background correction obtained in step 2-2 to highlight edge details, thereby obtaining a grayscale image of E. coli morphology with bilateral filtering.

[0155] 2-3-1. Nonlinear bilateral filtering combines the proximity and pixel value similarity of an image to filter out noise while retaining the edge information of the original image. The bilateral filtering method superimposes the spatial domain kernel and the color domain kernel to obtain a dual kernel. The dual kernel is used to filter the identified image.

[0156] 2-4. Perform histogram equalization enhancement on the bilateral filtered grayscale image of Escherichia coli morphology obtained in step 2-3, and change the grayscale of each pixel in the image by changing the histogram of the image to obtain a grayscale enhanced image of the Escherichia coli morphology.

[0157] 2-5. Perform morphological gradient transformation on the grayscale enhanced image of E. coli obtained in step 2-4 and the grayscale morphological gradient formula (4) below to obtain the E. coli morphological gradient transformed image.

[0158]

[0159] In formula (4), g represents the gradient image, f represents the grayscale image, and B represents the 3*3 cross kernel. Indicates expansion, Indicates corrosion.

[0160] Step 3: Perform adaptive double threshold binarization on the preprocessed image obtained in step 2 to obtain a binary image, such as Figure 4 As shown in the figure, the specific process of adaptive dual threshold binarization is:

[0161] 3-1. Perform grayscale gradient calculation on the preprocessed image obtained in step 2. The gradient calculation includes calculating the gradient direction and amplitude. Combining the Sobel operator, the gradient change intensity in four directions is calculated, and then the gradient change intensity in two diagonal directions is calculated by linear interpolation.

[0162] 3-2. Compare the gradient change intensity of the current pixel with the gradient intensity of the adjacent pixels along the positive, negative and diagonal gradient directions. If it is the maximum (i.e., the extreme value), the pixel is retained as an edge point and the pixel value is set to 255. If it is not the maximum, it is suppressed and not regarded as an edge point. The pixel value is set to 0.

[0163] 3-3. The non-real edge part of the gradient image is divided into a pseudo-edge part and a non-edge part by the Otsu method. The segmentation threshold when the iterative segmentation operation obtains the maximum inter-class variance is the optimal segmentation threshold. The isolated weak edges are suppressed to complete the edge detection. The maximum inter-class variance is calculated according to the following formula (5):

[0164]

[0165] In formula (5), w0 is the ratio of target points to the total image, u0 is its average grayscale; w1 is the ratio of background points to the image, u1 is its average grayscale; u is the total average grayscale of the image; g′ is the between-class variance.

[0166] 3-4. The threshold corresponding to the maximum inter-class variance value is the optimal segmentation threshold, which is defined as the low threshold, and 2.5 times the low threshold is defined as the high threshold. Pixels with gradient strength lower than the low threshold are suppressed and not considered as edge points, and the pixel value is set to 0; pixels higher than the high threshold are defined as strong edges and retained as edge points, and the pixel value is set to 255; pixels between the high and low thresholds are defined as weak edges. As long as there is a strong edge pixel in its neighborhood, the weak edge can be retained as a strong edge, that is, a true edge, and the pixel value is set to 255. Otherwise, it is not considered as an edge point, and the pixel value is set to 0.

[0167] Step 4: Perform region filling on the binary image obtained in step 3 to obtain a filled image, such as Figure 5 The specific process of area filling is as follows:

[0168] 4-1. Assign all pixel values ​​outside the connected domain in the binary image obtained in step 3 to 0, and then invert the pixel values ​​bit by bit.

[0169] 4-2. Perform a bitwise OR operation on the image obtained in step 4-1 and the binary image obtained in step 3 to obtain a filled image.

[0170] Step 5: Perform two morphological opening operations on the filled image in step 4 to obtain a colony opening operation image, such as Figure 6 shown.

[0171] 5-1. Perform two morphological erosions and two morphological dilations on the filled image in step 4.

[0172] Step 6: Perform adhesion segmentation on the open operation image obtained in step 5 to obtain an adhesion segmentation image, such as Figure 7 The specific process of adhesion segmentation is as follows:

[0173] 6-1. According to the following formula (6), eight-connected chain code marking is performed. The specific process of chain code marking is:

[0174]

[0175] In formula (6), j is the chain code number; k is the chain code step length; ζ j,k is the chain code value of the jth point in the chain code; (x j ,y j )、(x j-k ,y j-k) represent the coordinates of the jth and jkth points in the chain code respectively.

[0176] 6-1-1. Start from the starting point and record it as the starting point coordinates. Search for the next boundary pixel point from the direction coded as 1 (45 degrees) in an 8-connected manner. After finding it, record the direction code (0 to 7).

[0177] 6-1-2. Repeat step 6-1-1 starting from the pixel found to obtain a set of chain codes. If it is closed, return to the starting point after encoding, otherwise the starting point coordinates can be omitted.

[0178] 6-1-3. Normalize the chain code obtained in step 6-1-2 to obtain a normalized chain code. Consider the chain code as an n-bit natural number, and circulate the chain code in one direction to minimize the n-bit natural number it constitutes, thus forming a chain code with a unique starting point.

[0179] 6-2. According to the following vector cross product formula (7), determine the concave points on the boundary of the connected domain.

[0180] a×b=|a||b|sin(θ) Formula (7)

[0181] In formula (7), a represents the vector starting from the starting coordinate of the chain code and with a distance step length of k. The step length k depends on the specific situation. In this algorithm, k = 1 is selected. b represents the vector starting from the end point of vector a and with a synchronization length of k. Among them, θ is the angle between vector a and vector b, and the cross product direction satisfies the right-hand spiral criterion.

[0182] 6-2-1. Perform a cross multiplication operation on the image boundary chain code obtained in step 6-1 according to formula (7) and store the result in set S e Define a threshold T h If the result of the cross product of two vectors is greater than the threshold T h , then the two vectors are located around the concave point, otherwise they are located around the non-concave point, which is defined as the concave point characteristic condition.

[0183] 6-2-2. For the set S obtained in step 6-2-1 e Mark the results that meet the concave point characteristic conditions in the image to obtain a series of multiple sets of points located around the concave point, and then take the point with the largest absolute value in each set as the concave point of the set. Perform the same process on other point sets to obtain all the concave points in the image.

[0184] 6-3. Match and segment the concave points on the connected domain boundary obtained in step 6-2. The specific process of concave point matching and segmentation is as follows:

[0185] 6-3-1. The concave points are classified into inner concave points and outer concave points. The inner concave points are the concave points found along the inner edge of the image, and the outer concave points are the concave points found along the outer edge of the image.

[0186] 6-3-2. If the number of external concave points on the boundary of the connected domain is less than 1, no segmentation is performed.

[0187] 6-3-3. If the number of external concave points on the boundary of the connected domain is 2, two external concave points are connected and separated by a straight line four pixels wide.

[0188] 6-3-4. If the number of external concave points on the boundary of the connected domain is greater than 2, pair the external concave points with each other. If the Euclidean distance is the smallest and the dividing lines of the external concave points are in the same direction, pair them directly; if not, pair the next external concave point.

[0189] 6-3-5. Use four-pixel-wide straight lines to connect all paired concave points to achieve segmentation.

[0190] Step 7: Draw the outline of the adhesion segmentation image obtained in step 6 and count the numbers, and display it in random colors to obtain a contour image. Figure 8 shown.

[0191] Step 8: Perform sub-pixel reconstruction on the contour image obtained in step 7 to obtain a contour sub-pixel reconstructed image. Fig. 9 As shown, the local enlargement is as follows Fig.10 As shown. The specific steps of contour sub-pixel reconstruction are:

[0192] 8-1. Grayscale the contour image obtained in step 7, and the process is the same as step 2-1 in step 2.

[0193] 8-2. According to the following gradient image transformation formula (8), gradient detection is performed. Gradient detection includes amplitude and direction. Eight 3*3 directional templates are set. The eight directional templates are used to perform convolution operations on the detection image (the pixel values ​​where the template slides are multiplied by the corresponding values ​​in the template, and finally all are added up), and eight gradient images are obtained. The direction of the template is the angle with the X axis.

[0194]

[0195] In formula (8), R(i,j) is the gradient amplitude at the coordinate (i,j), which represents the gradient image. f(i-1,j-1), f(i,j-1), f(i+1,j-1), f(i-1,j), f(i+1,j), f(i-1,j+1), f(i,j+1), and f(i+1,j+1) are the grayscale values ​​in the eight directions of the coordinate (i,j) in the upper left, upper, upper right, left, right, lower left, lower, and lower right, respectively.

[0196] 8-3. Define the direction with the largest gradient amplitude as the gradient direction. Since the 8 gradient images are all in the direction with relatively large gradient amplitudes, the edge may be represented by multiple pixels, and the brightest point in the gradient amplitude image is the edge, that is, the point with the maximum gradient amplitude is the integer coordinate of the edge. According to the change law in the gradient direction, the amplitude of the center point and the adjacent points in the direction are compared according to the direction of the gradient in the 3*3 neighborhood. The point with a large amplitude is the edge point, and non-maximum suppression is performed. A single-pixel edge with a width of only one pixel is obtained.

[0197] 8-4. According to the following formula (9), polynomial interpolation is performed on the single-pixel edge obtained in step 8-3 to obtain a sub-pixel edge.

[0198]

[0199] In formula (9), (X c , Y c ) represents sub-pixel coordinates; (m, n) represents pixel-level coordinates; W is the distance from the adjacent pixel to the edge point (where the gradient direction is 0°, 90°, 180°, 270°, which is equal to 1, and other angles are equal to ), θ is the angle between the gradient direction and the positive direction of the X axis, R0 is the modulus of the grayscale gradient of the edge point (m,n), R -1 , R1 are the gradient amplitudes of the two pixels adjacent to the edge point in the gradient direction.

[0200] 8-5. Store the edge sub-pixel coordinates obtained in step 8-4 and create a two-channel image. The first channel represents x and the second channel represents y. The x channel stores pixel values ​​and the y channel stores sub-pixel coordinates. This method maintains the state associated with the image.

[0201] 8-6. Use random colors to draw connections for the sub-pixel outlines obtained in step 8-5.

[0202] Step 9: Perform contour segmentation on the contour sub-pixel reconstructed image obtained in step 8 to obtain a contour segmentation image. Fig.11 As shown, partial enlargement as Fig.12 As shown. The specific process of contour segmentation is:

[0203] 9-1. Chain code marking is performed on the sub-pixel reconstructed image of the contour obtained in step 8, and the process is the same as step 6-1 in step 6.

[0204] 9-2. Calculate the first-order difference chain code and normalize the first-order difference chain code in step 9-1. The specific process is as follows:

[0205] 9-2-1. Calculate the first-order differential chain code according to the following formula (10), which is obtained by changing the direction of two adjacent elements (counterclockwise), that is, the number of steps required to change from the previous number to the next number.

[0206]

[0207] In formula (10), j is the chain code number; k is the chain code step length; δ j,k is the first-order difference value of the j-th point in the chain code; (x j-k ,y j-k )、(x j ,y j )、(x j+k ,y j+k ) represent the coordinates of the jkth, jth, and j+kth points in the chain code respectively.

[0208] 9-2-2. Normalize the first-order differential chain code obtained in step 9-2-1, regard the first-order differential chain code as a natural number composed of numbers in each direction, and then cycle in one direction to minimize the natural number it constitutes.

[0209] 9-3. Based on the characteristics that the inflection point is discontinuous at the tangent line and the curvature is continuous, the inflection point of the contour image obtained in step 8 is extracted. The specific process of inflection point extraction is:

[0210] 9-3-1. According to formula (10) in step 9-2-1, the first-order differential chain code is obtained, which also represents the rate of change of the contour tangent. According to the following formula (11), the absolute value of the difference chain code minus the chain code mean represents the absolute value of the deviation from the mean. Use the absolute value to establish a Gaussian distribution and select a threshold within a certain confidence range. The part of the points with the largest deviation from the mean is used as the segmentation point.

[0211]

[0212] In formula (11), j is the chain code number; k is the chain code step length; is the absolute value of the difference chain code minus the chain code mean, representing the absolute value of the deviation from the mean value; δ j,k is the first-order difference value of the jth point in the chain code; μ δ Represents the chain code mean.

[0213] 9-3-2. According to the following formula (12), the threshold is obtained. If the segment point is greater than the threshold and is the maximum value of the neighborhood, it is considered an inflection point.

[0214] T=z 1-2α σ Formula (12)

[0215] In formula (12), T is the threshold value to be sought; z is the horizontal axis of the two-dimensional Gaussian distribution established in step 9-3-1, and 1-2α is the confidence interval of the two-dimensional Gaussian distribution established in step 9-3-1; z 1-2α is the horizontal coordinate value of the confidence interval of the two-dimensional Gaussian distribution established in step 9-3-1; σ is the standard deviation of the two-dimensional Gaussian distribution established in step 9-3-1.

[0216] 9-4. Based on the characteristics that the tangent points are continuous at the tangent line and the curvature is discontinuous, the tangent points are extracted from the contour image obtained in step 8. The specific process of tangent point extraction is as follows:

[0217] 9-4-1. Perform polygonal similarity approximation on the contour image obtained in step 8, and the contour becomes a polyline segment to obtain a smooth split point. According to the standard formula (13) for error detection of split points below, the maximum error between the contour and the approximate function is obtained. If the number of segments is reached or the maximum error of the split point is lower than the set threshold, the splitting is stopped.

[0218]

[0219] In formula (13), E ∞ (u1,u i+1 ) is the approximation error, where e i,j is the Euclidean distance between the jth point in interval i and its approximate function, and (u1,u i+1 ) are the two endpoints of the interval.

[0220] 9-4-2. Perform piecewise approximate ellipse fitting on the splitting points obtained in step 9-4-1. Select the first splitting point as the starting point. Based on the premise that the three splitting points of adjacent contour segments cannot be on the same straight line, take the starting point and the two adjacent splitting points as a set to perform approximate ellipse fitting. Calculate the maximum deviation value between the approximate ellipse and the contour segment corresponding to the splitting point set according to formula (13).

[0221] 9-4-3. If the maximum deviation value is smaller than the maximum distance between the contour segment corresponding to the split point set and the similar approximation line segment of the polygon, the contour segment corresponding to the split point set is marked as a merge processing object, the split point set is saved and marked, and the next split point is used as the starting point. Execute the operation of step 9-4-2.

[0222] 9-4-4. Otherwise, add the next split point to the split point set, perform an approximate ellipse fitting on the split point set, and calculate the maximum deviation value between the approximate ellipse and the corresponding contour segment of the split point set according to formula (13).

[0223] 9-4-5. Repeat steps 9-4-3 and 9-4-4 for multiple iterations until there are no more objects to be merged.

[0224] 9-4-6. Consider the starting point and end point of each split point set marked in step 9-4-5 as the tangent point.

[0225] 9-5. According to step 9-3 and step 9-4, all inflection points and tangent points are extracted, the inflection points are connected by line segments, the tangent points are fitted with an ellipse by the least square method, and the number of line segments and ellipse arcs is counted. The image with the contour segmented into straight line segments and ellipse arc segments is obtained.

[0226] 9-6. Draw the straight line segments and elliptical arc segments obtained in step 9-5 using random colors.

[0227] Step 10: Extract contour features, including statistics of number, area, perimeter, aspect ratio, circularity, contour line segments, and elliptical arcs. The specific process of extracting contour features is as follows:

[0228] 10-1. Number of E. coli: number of connected domains.

[0229] 10-2. Area of ​​a single E. coli: total number of pixels in the connected domain.

[0230] 10-3. Perimeter of a single E. coli: total number of boundary pixels.

[0231] 10-4. Length ratio of a single Escherichia coli: major axis to minor axis ratio.

[0232] 10-5. Circularity of a single Escherichia coli: the ratio of the area to π times the square of the maximum value of the distance from the center point to all contour pixels.

[0233] 10-6. Statistics of straight lines and elliptical arcs of the contour of a single E. coli: According to step 9-5 in step 9, the number of line segments and elliptical arcs of the contour of a single E. coli is obtained.

[0234] Step 11: Perform E. coli morphological analysis on the contour features of E. coli obtained in step 10, including analysis of the inhibition rate of antibiotics on E. coli, such as Figure 2 The specific process of E. coli morphological analysis is as follows:

[0235] 11-1. If the area of ​​E. coli is greater than 100 or the perimeter is greater than 40, determine whether the length ratio of E. coli is greater than 3 and less than 10.

[0236] 11-2. If not, it is determined to be impurity. If so, it is determined whether the number of straight lines in the outline of E. coli is greater than 1 and the number of ellipses is greater than 2.

[0237] 11-3. If yes, it is judged as inhibited Escherichia coli; if no, it is judged as resistant Escherichia coli.

[0238] 11-4. If the area of ​​E. coli is less than 100 and the perimeter is less than 40, determine whether the circularity of E. coli is greater than 0.5.

[0239] 11-5. If yes, it is judged as inhibited Escherichia coli; if no, it is judged as impurity.

[0240] 11-6. Loop through the entire profile and execute the process from step 11-1 to step 11-5. The number of Escherichia coli inhibited divided by the total number of Escherichia coli is defined as the inhibition rate of Escherichia coli, and the inhibition rate of Escherichia coli is obtained.

[0241] 11-7. Repeat steps 1 to 11 every 30 minutes to obtain the inhibitory effect of antibiotics on E. coli at different time periods. Then, the evolution of E. coli resistance can be deduced. Based on the information of each E. coli at different time periods, the growth rate and status of E. coli can be calculated, and the growth characteristics of the overall E. coli can be statistically analyzed.

Claims

1. A method for accurately extracting and identifying the outline of Escherichia coli, characterized in that: The following steps are involved: Step 1, collecting the identified Escherichia coli morphological image; Step 2: preprocess the E. coli morphological image obtained in step 1 to obtain a preprocessed image; the specific process of the preprocessing is as follows: 2-1. The E. coli morphological image obtained in step 1 is grayed using the component weight method, wherein the three-channel morphological image is converted into a single-channel morphological grayscale image; 2-2. Perform background correction on the morphological grayscale image obtained in step 2-1 to obtain a morphological background corrected image; 2-3. Performing bilateral filtering on the morphological background correction image obtained in step 2-2 to obtain a bilateral filtered grayscale image of the E. coli morphology; the bilateral filtering method specifically comprises superimposing a spatial domain kernel and a color domain kernel to obtain a dual kernel; and filtering the identified image using the dual kernel; 2-4. Performing histogram equalization enhancement on the bilateral filtered grayscale image of the Escherichia coli morphology obtained in step 2-3 to obtain a grayscale enhanced image of the Escherichia coli morphology; 2-5. Perform morphological gradient transformation on the grayscale enhanced image of Escherichia coli obtained in step 2-4; Obtain the E. coli morphological gradient transformation image g; Step 3, performing adaptive double threshold binarization on the preprocessed image obtained in step 2 to obtain a binary image; Step 4, performing region filling on the binary image obtained in step 3 to obtain a filled image; Step 5, perform two morphological opening operations on the filled image in step 4 to obtain a colony opening operation image; Step 6, performing adhesion segmentation on the open operation image obtained in step 5 to obtain an adhesion segmentation image; Step 7, contour drawing and counting are performed on the adhesion segmentation image obtained in step 6 to obtain a contour image; Step 8: Perform sub-pixel reconstruction on the contour image obtained in step 7 to obtain a contour sub-pixel reconstructed image. The specific steps of performing contour sub-pixel reconstruction are as follows: 8-1. Grayscale the contour image obtained in step 7; 8-2. Gradient detection is performed on the grayscale contour image. Gradient detection includes amplitude and direction. Eight 3*3 direction templates are set. Convolution operation is performed on the image using the eight direction templates to obtain eight gradient images. The direction of the template is the angle between the gradient direction and the X-axis. 8-3. According to the change rule of the gradient direction, the amplitude of the center point and the adjacent points in the direction are compared in the 3*3 neighborhood according to the direction of the gradient. The point with a larger amplitude is the edge point, and non-maximum suppression is performed to obtain a single-pixel edge with a width of only one pixel; 8-4. Perform polynomial interpolation on the single pixel edge obtained in step 8-3 to obtain a sub-pixel edge; 8-5. Store the edge sub-pixel coordinates obtained in step 8-4 and create a two-channel image, where the first channel represents x and the second channel represents y. The x channel stores pixel values ​​and the y channel stores sub-pixel coordinates. 8-6. Draw and connect the sub-pixel contours obtained in step 8-5; Step 9: Perform contour segmentation on the contour sub-pixel reconstructed image obtained in step 8 to obtain a contour segmentation image. The specific process of contour segmentation is as follows: 9-1. Mark the sub-pixel reconstructed image of the contour obtained in step 8 with a chain code; 9-2. Calculate the first-order difference chain code and normalize the first-order difference chain code for the chain code in step 9-1; 9-3. Based on the characteristics that the inflection point is discontinuous at the tangent line and the curvature is continuous, the inflection point is extracted from the sub-pixel reconstructed image of the contour obtained in step 8; 9-4. Extract the tangent points of the contour image obtained in step 8; 9-5. According to step 9-3 and step 9-4, all inflection points and tangent points are extracted, the inflection points are connected by line segments, the tangent points are fitted with an ellipse using the least squares method, and the number of line segments and elliptical arcs is counted; an image with the contour segmented into straight line segments and elliptical arc segments is obtained; 9-6. Draw the straight line segment and elliptical arc segment obtained in step 9-5; Step 10, extracting the contour features of Escherichia coli; the specific process of extracting the contour features is as follows: 10-1. The number of connected domains is taken as the number of E. coli; 10-2. Take the total number of pixels in a single connected domain as the corresponding single E. coli area; 10-3. Take the total number of boundary pixels of a single connected domain as the corresponding perimeter of a single E. coli; 10-4. Take the major-to-minor axis ratio of a single connected domain as the corresponding length-to-short ratio of a single E. coli; 10-5. Take the ratio of the area of ​​a single connected domain to π times the maximum square of the distance from the center point to all contour pixels as the corresponding circularity of a single Escherichia coli; 10-6. Count the number of contour lines and elliptical arcs of a single E. coli; Step 11: Perform morphological analysis of E. coli according to the contour features of E. coli obtained in step 10; the specific process of performing morphological analysis of E. coli is as follows: 11-1. If the area of ​​E. coli is greater than 100 or the perimeter is greater than 40, determine whether the length ratio of E. coli is greater than 3 and less than 10; 11-2. If not, it is determined to be impurity. If so, it is determined whether the number of straight lines in the outline of E. coli is greater than 1 and the number of ellipses is greater than 2; 11-3. If yes, it is determined as inhibited Escherichia coli; if no, it is determined as resistant Escherichia coli; 11-4. If the area of ​​the E. coli is less than 100 and the perimeter is less than 40, determine whether the circularity of the E. coli is greater than 0.5; 11-5. If yes, it is determined to be inhibited E. coli; if no, it is determined to be impurities; The ratio of the number of inhibited E. coli to the total number of E. coli was taken as the inhibition rate of E. coli.

2. The method for accurately extracting and identifying the outline of Escherichia coli according to claim 1, characterized in that: Antibiotics are added to the culture dish of the tested Escherichia coli; steps 1 to 11 are repeated every preset time interval to obtain the inhibitory effect of the antibiotics on the Escherichia coli at different time periods.

3. The method for accurately extracting and identifying the outline of Escherichia coli according to claim 1, characterized in that: The specific process of the background correction is as follows: 2-2-1. Select a 3*3 convolution kernel template, and the center position of the convolution kernel is used as the coordinate origin; 2-2-2. Use the 3*3 convolution kernel obtained in step 2-2-1 to convolve the grayscale image of E. coli obtained in step 2-1 to obtain a lightly blurred image o(x,y); 2-2-3. Select a 25*25 convolution kernel template, perform Gaussian filtering on the grayscale image of E. coli obtained in step 2-1, and obtain a strongly blurred image b(x, y); and calculate the average grayscale M of the strongly blurred image b(x, y); 2-2-4. Perform background correction on the grayscale image of E. coli obtained in step 2-1 to obtain the morphological background correction image f(x, y) as follows: f(x,y)=o(x,y)-b(x,y)+M; The E. coli morphological gradient transformation image g is as follows: Among them, f represents the grayscale enhanced image of E. coli morphology, B represents the 3*3 cross kernel, represents the expansion operation, ! represents the corrosion operation; the E. coli morphological gradient transformation image g is the preprocessed image obtained in step 2.

4. The method for accurately extracting and identifying the outline of Escherichia coli according to claim 1, characterized in that: The specific process of the adaptive dual-threshold binarization in step 3 is: 3-1. Perform grayscale gradient calculation on the preprocessed image obtained in step 2. The gradient calculation includes calculating the gradient direction and amplitude, combining the Sobel operator to calculate the gradient change intensity in four directions, and then calculating the gradient change intensity in two diagonal directions by linear interpolation; 3-2. Compare the gradient change intensity of the current pixel with the gradient intensity of the adjacent pixels along the positive, negative and diagonal gradient directions. If a pixel point is the maximum value in the comparison, then the pixel is retained as an edge point and the pixel value is set to 255; if it is not the maximum, then it is suppressed and not regarded as an edge point; the pixel value is set to 0; 3-3. The non-real edge part of the gradient image is divided into pseudo-edge part and non-edge part by Otsu algorithm. The segmentation threshold when the maximum inter-class variance is obtained in the iterative segmentation operation is used as the optimal segmentation threshold to suppress isolated weak edges and complete edge detection. The expression of inter-class variance is as follows: Among them, w0 is the proportion of target points in the total image, u0 is its average grayscale; w1 is the proportion of background points in the image, u1 is its average grayscale; u is the total average grayscale of the image; g′ is the inter-class variance; The threshold corresponding to the maximum inter-class variance value is taken as the optimal segmentation threshold and defined as the low threshold; 2.5 times the low threshold is defined as the high threshold; pixels with gradient intensity lower than the low threshold are suppressed and not regarded as edge points, and the pixel value is set to 0; pixels higher than the high threshold are defined as strong edges and retained as edge points, and the pixel value is set to 255; pixels between the high and low thresholds are defined as weak edges; if at least one of the neighborhood pixels of the weak edge is a strong edge pixel, the weak edge is retained as a strong edge, and the pixel value is set to 255; otherwise, the weak edge is not regarded as an edge point, and the pixel value is set to 0.

5. The method for accurately extracting and identifying the outline of Escherichia coli according to claim 1, characterized in that: The specific process of area filling in step 4 is as follows: 4-1. Assign all pixel values ​​outside the connected domain in the binary image obtained in step 3 to 0, and then perform bitwise inversion processing on the obtained image; The image obtained in step 4-1 and the binary image obtained in step 3 are subjected to bitwise OR processing to obtain a filled image.

6. The method for accurately extracting and identifying the outline of Escherichia coli according to claim 1, characterized in that: The specific process of adhesion segmentation described in step 6 is: 6-1. Mark the adhesion segmentation image with eight-connected chain code; the specific process of chain code marking is as follows: In formula (4), j is the chain code number; k is the chain code step length; ζ j,k is the chain code value of the jth point in the chain code; (x j ,y j )、(x j-k ,y j-k ) represent the coordinates of the jth and jkth points of the chain code respectively; 6-1-1. Start from the starting point and record it as the starting point coordinates, and search for the next boundary pixel point from the direction coded as 1 in an 8-connected manner; then, record the direction code; 6-1-2. Repeat step 6-1-1 starting from the found pixel to obtain a set of chain codes; If the chain code is closed, it returns to the starting point after the encoding is completed; otherwise, the starting point coordinates are omitted; 6-1-3. Normalize the chain code obtained in step 6-1-2 to obtain a normalized chain code; Treat the chain code as an n-bit natural number, and circulate the chain code in one direction to minimize the n-bit natural number it constitutes, thus forming a chain code with a unique starting point; 6-2. Determine the concave points on the boundary of the connected domain; 6-2-1. Perform a cross multiplication operation on the image boundary chain code obtained in step 6-1 according to the vector cross multiplication operation formula, and store the vector cross multiplication operation result in the set S e In; define a threshold T h ; If the result of the vector cross multiplication operation is greater than the threshold T h , then the pixel points corresponding to the two vectors meet the concave point characteristic condition; The vector cross multiplication formula is as follows: s=a×b=|a||b|sin(θ) Among them, s is the result of vector cross multiplication; a represents the vector made with the starting coordinate of the chain code as the starting point and the step length k as the distance; b represents the vector made with the end point of vector a as the starting point and the step length k as the distance; θ is the angle between vector a and vector b; 6-2-2. For the set S obtained in step 6-2-1 e The pixel points satisfying the concave point characteristic conditions are marked to obtain multiple concave point pending sets; each concave point pending set includes a series of points located around the concave point; and the point with the largest absolute value in each concave point pending set is taken as the concave point of the set to obtain all the concave points in the image; 6-3. Match and segment the concave points on the connected domain boundary obtained in step 6-2. The specific process of concave point matching and segmentation is as follows: 6-3-1. Classify the concave points into inner concave points and outer concave points. The inner concave points refer to the concave points found along the inner edge of the image; the outer concave points refer to the concave points found along the outer edge of the image; 6-3-2. If the number of external concave points on the boundary of the connected domain is less than 1, no segmentation is performed; 6-3-3. If the number of external concave points on the boundary of the connected domain is 2, segmentation is performed by connecting the two external concave points with a straight line; If the number of external concave points on the boundary of the connected domain is greater than 2, the external concave points are paired with each other; if two external concave points satisfy the minimum Euclidean distance and the dividing lines of the external concave points are in the same direction, the two external concave points are directly paired; the external concave points of each group are connected by straight lines to complete the segmentation.

7. The method for accurately extracting and identifying the outline of Escherichia coli according to claim 1, characterized in that: The gradient image transformation formula used in the gradient detection is as follows: R(i,j)=∣f(i+1,j+1)+2f(i,j+1)+f(i-1,j+1)- f(i-1,j-1)-2f(i,j-1)-f(i+1,j-1)∣+ ∣f(i-1,j-1)+2f(i-1,j)+f(i-1,j+1)- f(i+1,j+1)-2f(i+1,j)-f(i+1,j-1)∣ Where R(i,j) is the gradient amplitude at coordinate (i,j); f(i-1,j-1), f(i,j-1), f(i+1,j-1), f(i-1,j), f(i+1,j), f(i-1,j+1), f(i,j+1), and f(i+1,j+1) are the grayscale values ​​in the eight directions of upper left, upper, upper right, left, right, lower left, lower, and lower right of coordinate (i,j) respectively; The formula for polynomial interpolation is as follows: Among them, (X c , Y c ) represents sub-pixel coordinates; (m, n) represents pixel-level coordinates; W is the distance from the adjacent pixel to the edge point; θ is the angle between the gradient direction and the positive direction of the X axis; R0 is the modulus of the grayscale gradient of the edge point (m, n), R -1 , R1 are the gradient amplitudes of the two pixels adjacent to the edge point in the gradient direction.

8. The method for accurately extracting and identifying the outline of Escherichia coli according to claim 1, characterized in that: The specific process of step 9-2 is as follows: 9-2-1. Calculate the first-order differential chain code δ j,k as follows: Where j is the chain code number; k is the chain code step length; δ j,k is the first-order difference value of the j-th point in the chain code; (x j-k ,y j-k )、(x j ,y j )、(x j+k ,y j+k ) represent the coordinates of the jkth, jth, and j+kth points in the chain code respectively; Normalize the first-order differential chain code obtained in step 9-2-1, regard the first-order differential chain code as a natural number composed of numbers in each direction, and then cycle in one direction to minimize the natural number it constitutes.

9. The method for accurately extracting and identifying the outline of Escherichia coli according to claim 1, characterized in that: The specific process of step 9-3 is as follows: 9-3-1. Calculate the absolute value of the difference chain code deviation from the average value Use this absolute value Establish a Gaussian distribution and select a threshold; use the points with the largest deviation from the mean as segmentation points; the absolute value The expression is as follows: Where j is the chain code number; k is the chain code step length; δ j,k is the first-order difference value of the jth point in the chain code; μ δ represents the chain code mean; 9-3-2. Set the threshold T; take the segmentation point that is greater than the threshold T and is the maximum value of the neighborhood as the inflection point; the expression of the threshold T is as follows: T=z 1-2α σ Wherein, z is the horizontal axis of the two-dimensional Gaussian distribution established in step 9-3-1, and 1-2α is the confidence interval of the two-dimensional Gaussian distribution established in step 9-3-1; z 1-2α is the horizontal coordinate value of the confidence interval of the two-dimensional Gaussian distribution established in step 9-3-1; σ is the standard deviation of the two-dimensional Gaussian distribution established in step 9-3-1; The specific process of step 9-4 is as follows: 9-4-1. Perform polygonal similarity approximation on the contour image obtained in step 8, convert the contour into polyline segments, and obtain smooth splitting points; calculate the maximum error E between the contour and the approximate function ∞ (u1,u i+1 ); if the number of segments is reached or the maximum error of the split point is lower than the set threshold, the splitting is stopped; the maximum error E ∞ (u1,u i+1 ) is as follows: Among them, e i,j is the Euclidean distance between the jth point in interval i and its approximate function; (u1,u i+1 ) are the two endpoints of interval i; 9-4-2. Perform piecewise approximate ellipse fitting on the splitting points obtained in step 9-4-1. Select the first splitting point as the starting point. Based on the premise that the three splitting points of adjacent contour segments cannot be on the same straight line, take the starting point and the two adjacent splitting points as a set to perform approximate ellipse fitting, and calculate the maximum error between the approximate ellipse and the contour segment corresponding to the splitting point set. 9-4-3. If the maximum error is less than the maximum distance between the contour segment corresponding to the splitting point set and the similar approximation line segment of the polygon, the contour segment corresponding to the splitting point set is marked as a merge processing object, the splitting point set is saved and marked, and the next splitting point is used as the starting point; the operation of step 9-4-2 is executed; otherwise, the next splitting point is added to the splitting point set, the splitting point set is fitted with an approximate ellipse, and the maximum error between the approximate ellipse and the contour segment corresponding to the splitting point set is calculated; 9-4-4. Repeat step 9-4-3 for multiple iterations until there are no more objects to be merged; 9-4-5. The starting point and the end point of each marked split point set are regarded as the tangent points.

Citation Information

Patent Citations

  • Microscopic image detection and recognition method for rice blast fungus spore based on support vector machine

    CN108564124A

  • Target colony growth characteristic identification method

    CN111178173A