Stone building biological disease image recognition method based on computer vision
By preprocessing and fusing multimodal features of images of stone buildings using computer vision technology, the problem of classifying and identifying biological diseases in stone buildings has been solved, enabling rapid and accurate identification of biological disease types and improving the effectiveness of prevention and control efforts.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-28
- Publication Date
- 2026-04-03
AI Technical Summary
Existing technologies are insufficient for the comprehensive classification and identification of biological diseases in stone buildings, resulting in inadequate effectiveness of biological disease prevention and control.
Using a computer vision-based approach, the original color photographs of stone buildings are acquired, and image preprocessing, region segmentation, and multimodal feature fusion are performed to identify biological diseases, including a comprehensive judgment of optical features, texture features, and shape features.
It enables rapid and reliable identification of biological diseases on the surface of stone buildings, improving the accuracy and efficiency of biological disease prevention and control.
Smart Images

Figure CN121788929A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of stone culture and cultural heritage protection technology, specifically to a method for image recognition of biological diseases in stone buildings based on computer vision. Background Technology
[0002] Stone culture and cultural heritage refers to historical stone buildings that, over long periods of wind and rain, gradually age and develop various biological diseases due to natural erosion. These biological diseases accelerate the deterioration of buildings, resulting in the loss of cultural heritage. Therefore, better identifying the types and extent of these biological diseases is fundamental to effective prevention and restoration.
[0003] Existing technologies include several patented techniques capable of identifying building defects. For example, CN202510147649.4 discloses an intelligent identification method and device for historical building defects; CN202411973686.2 discloses an image recognition and location method for building facade defects; and CN202410062394.7 discloses a method and system for identifying building shear wall defects based on digital twins. However, these existing patented technologies rely on simple image comparison for identification and often focus on physical defects such as cracks and spalling. They struggle to comprehensively classify and identify biological defects, hindering the prevention and control of such defects. Summary of the Invention
[0004] In view of the shortcomings of the prior art, the technical problem to be solved by the present invention is: how to provide a computer vision-based image recognition method for biological diseases of stone buildings that can better realize the classification and special identification of biological diseases, so as to quickly and reliably identify the types of biological diseases on the surface of stone buildings, so as to facilitate accurate biological disease prevention and control.
[0005] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: A computer vision-based method for identifying biological defects in stone buildings, characterized by the following steps: A. Obtain a color photograph of the stone building to be identified and input it into a computer to obtain the original color image information of the stone building. Preprocess the image so that the objects displayed in the image retain only the brightness information (i.e., grayscale information). b. Based on the difference in brightness information, the image display object is segmented to obtain the outline range of various biological disease areas; c restores the internal regions of each segmented contour to their original color graphics, and then re-identifies the types of biological diseases in each contour based on differences in optical features, texture features, and shape features.
[0006] This multimodal feature fusion technology uses three-dimensional features—optical, textural, and shape characteristics—to comprehensively determine the type of biological disease, enabling it to quickly and reliably identify the types of biological diseases on stone building surfaces, thus facilitating accurate prevention and control of biological diseases.
[0007] Furthermore, in step a, the preprocessing of the graphic includes the following steps: a1 uses a morphological opening algorithm to remove image shadows; a2 uses a weighted average method to perform grayscale processing on the image, transforming the color image, which is a superposition of R (red), G (green), and B (blue) light, into an image containing only single-channel brightness information. The pixel value represents the brightness level from black (0) to white (255); this can better reduce the complexity of subsequent processing. a3 uses Gaussian filtering to reduce noise in images, eliminating minor noise interference; it can better eliminate image defects caused by poor lighting and high temperatures. Correcting the rotation angle in A4 images caused by shooting tilt; a5 uses histogram equalization to enhance the image and improve contrast. This image enhancement using histogram equalization stretches the parts with concentrated gray levels and compresses the parts with dispersed gray levels, thus improving contrast.
[0008] This image preprocessing, combining shadow removal, grayscale conversion, Gaussian noise reduction, angle correction, and contrast enhancement, effectively improves image quality and eliminates the effects of shooting conditions, lighting variations, and noise. This provides clear and accurate input data for subsequent biological disease region segmentation and classification. The core advantage of this series of operations lies in improving the robustness and accuracy of the recognition process, while optimizing computational efficiency, reducing algorithm complexity, and ensuring the practicality and stability of the biological disease detection system for stone buildings.
[0009] Furthermore, step a1 specifically includes the following steps: a11 performs LAB color space reconstruction on the image, transforming a color image composed of superimposed R (red), G (green), and B (blue) light into a LAB image containing only luminance (L) and chromaticity (A / B). Here, L represents image luminance (0 = pure black, 100 = pure white), A represents the green-red channel (green: negative value → red: positive value), and B represents the blue-yellow channel (blue: negative value → yellow: positive value). This ensures that lighting adjustments do not affect hue, and subsequent shadow removal only requires modification of the L channel. a12 performs a morphological opening operation (MORPH_OPEN) on the image, first eroding and then dilating to remove dark shadow areas and retain bright background areas, outputting an ideal brightness plane without shadows in the L channel, thus realizing the reconstruction of background shadow detection; A13 performs shadow compensation calculations. Based on the obtained ideal brightness plane background without shadows, it obtains the missing brightness value diff in the shadow area and performs additive compensation (the deeper the shadow, the larger the diff value). The missing brightness value is superimposed on the original L channel to make the brightness of the shadow area close to the background. a14 performs channel merging and color restoration (LAB → BGR), reversing the image back to the BGR color space to remove shadows. This ensures that the output image has natural and distortion-free colors.
[0010] Thus, by employing the above method to remove image shadows, the influence of shadows in the image can be effectively eliminated, ensuring uniform brightness and clear details while maintaining natural and realistic colors. This series of operations not only improves image quality and reduces interference from shadows, but also provides more accurate and reliable image data for subsequent biological disease detection.
[0011] Furthermore, step a4 specifically includes the following steps: a41 uses the object contour finding function (cv2.findContours) to find all outer contours in the image and selects the contour with the largest area (max(contours, key=cv2.contourArea)); calculates the minimum bounding rectangle of the contour with the largest area (cv2.minAreaRect, which can automatically adapt to the object orientation); extracts the rectangle angle (angle = rect[2]); (in the visual processing library OpenCV, the angle range is [-90, 0) degrees) If the angle is less than -45 degrees (meaning the rectangle is "lying flat"), then adjust the angle to 90+angle (so that it is within the range of [-45, 45] degrees, which meets the horizontal correction requirements). In this way, the angle is inferred from the shape of the largest object in the image through contour analysis, which is more reliable; a42 applies an edge detection algorithm (cv2.Canny) to the LAB image (i.e., grayscale image) obtained by a11 to extract edge points; it uses the probabilistic Hough transform function (cv2.HoughLinesP) to detect straight line segments (parameters such as minLineLength=100 (minimum line segment length) and maxLineGap=10 (maximum line segment gap) to balance accuracy and noise tolerance); it calculates the angle of each straight line segment (math.degrees(math.atan2)) and filters out lines in the range of [-45, 45] degrees (assuming horizontal or near-horizontal lines are predominant); then it calculates the median of these angles (np.median) to reduce the influence of outliers.
[0012] a43 employs a dual-check logic: if the straight line angle exists and the absolute difference between it and the original contour angle is less than 15 degrees, then the average of the two is taken as the final angle ((angle + median_line_angle) / 2); otherwise, the contour angle is retained, thus correcting the image tilt angle.
[0013] In this way, line detection utilizes the line features in the image to cross-validate angles, improving accuracy. Image correction employs a dual verification mechanism of contour analysis and Hough line detection, further enhancing the robustness of angle estimation.
[0014] Furthermore, step b specifically includes the following steps: b1 uses the Otsu algorithm (also known as the Otsu method) to perform adaptive threshold segmentation on the image obtained in step a. The segmented foreground part is regarded as the disease area and the background part is regarded as the building and other areas, thus realizing the separation of the disease area. This is because the inter-class variance is largest between the foreground and background images. Otsu's algorithm, based on grayscale histograms, can achieve adaptive thresholding segmentation, converting grayscale images into binary images and dividing them into background and foreground parts according to their grayscale characteristics. Since variance is a measure of the uniformity of grayscale distribution, the larger the inter-class variance between the background and foreground, the greater the difference between the two parts of the image. Misclassifying part of the foreground as background or part of the background as foreground will lead to a smaller inter-class difference. Therefore, this algorithm can directly achieve automatic separation of diseased areas based on the large grayscale value of the lesions.
[0015] b2 performs morphological opening operations on the diseased areas separated in step b1, first corroding and then expanding to separate the adhered diseased areas.
[0016] This opening operation can smooth the contours of objects, break up narrow necks, and eliminate fine protrusions. The image opening operation uses the function `morphologyEx()`, which is a set of existing functions extended from morphology, with the parameter `cv2.MORPH_OPEN` corresponding to the opening operation. Image opening is the process of sequentially eroding and dilating an image. Erosion removes noise but also compresses the image; subsequent dilution removes noise while preserving the original image. This method is particularly effective here for separating partially adhered diseased areas, yielding independent diseased regions.
[0017] b3 performs contour detection and quantification on the adhesion disease areas separated in step b2, obtains and displays the contours of each disease area; then calculates the geometric area of the closed contours based on Green's formula, traverses all detected contours, accumulates their area values, and calculates the proportion of the total disease area.
[0018] In implementation, the `findContours` function can be used to retrieve the contours; this is common knowledge in existing technology and will not be detailed here. This facilitates subsequent damage classification using the contour shape. Furthermore, after obtaining the contour of the damaged area, its area can be calculated, and thus the proportion of the damaged area to the total area of the stone building can be determined. This helps in better estimating the extent of building damage.
[0019] Furthermore, the identifiable biological diseases in step c include algae, lichens, molds, mosses, and plants. This encompasses the five types of biological diseases defined in the standard "Illustrated Glossary of Deterioration Patterns of Stone Cultural Relics".
[0020] Furthermore, during identification, the disease type is determined by performing optical feature HSV spatial analysis (obtaining saturation S and brightness V), optical feature color moment analysis (obtaining first-order color moment C-SD and second-order color moment C-SM), texture feature local binary standard deviation (LBP) analysis, texture feature gray-level co-occurrence matrix (GLCM) analysis, shape feature roundness (Cirs) analysis, and shape feature classification dimension (D) analysis on each contour region. In this way, the type of disease can be accurately identified based on the differences in various property characteristics among different types of diseases.
[0021] Thus, this method employs multimodal feature fusion technology, which comprehensively judges the type of biological disease by considering three-dimensional features such as optical properties, texture properties, and shape properties, thereby accurately classifying and identifying various diseases.
[0022] Furthermore, the identification process in step c specifically includes the following steps: c1 restores the internal regions of the biological disease outlines obtained in step b to the original color graphics; c2 sequentially performs the following disease classification and identification on each outline region of the biological disease. First, it performs the first round of judgment, detects and judges whether the saturation S of the outline region is equal to 0%. If the result is yes, the first round of judgment classifies it as algae, lichen, or mold. If the structure is no, the first round of judgment classifies it as algae, lichen, moss, or plant. Then, a second round of judgment is performed. The brightness of the outline area classified as algae, lichen, or mold in the first round is checked and judged to be greater than 0.2. If the result is yes, the second round of judgment further classifies it as mold. If the result is no, the second round of judgment still classifies it as algae, lichen, or mold. At the same time, the first-order color moment C-SD of the outline area classified as algae, lichen, moss, or plant in the first round is checked and judged to be greater than 30. If the result is yes, the second round of judgment classifies it as lichen or moss. If the result is no, the second round of judgment still classifies it as algae, lichen, moss, or plant. Then, a third round of judgment is performed. The second-order color moment C-SN of the outline region classified as algae, lichen, or mold in the second round is checked and determined. If the result is yes, the third round classifies it as lichen or mold; otherwise, it is classified as algae. Simultaneously, the local binary standard deviation LBP-SD of the outline region classified as lichen or moss in the second round is checked and determined. If the result is yes, the third round classifies it as moss; otherwise, it is classified as lichen. Finally, the gray-level co-occurrence matrix value GLCM-E of the outline region classified as algae, lichen, moss, or plant in the second round is checked and determined. If the result is no, the third round classifies it as algae or plant; otherwise, it is classified as algae, moss, or lichen. Then, a fourth round of judgment is performed. The circularity (Circ) of the outline region classified as lichen or mold in the third round is checked and judged to see if it is less than 0.5. If yes, it is classified as lichen; otherwise, it is classified as mold. Simultaneously, the fractal dimension (D) of the outline region classified as algae or plant in the third round is checked and judged to see if it is greater than 5. If yes, it is classified as algae; otherwise, it is classified as plant. Finally, the circularity (Circ) of the outline region classified as algae, moss, or lichen in the third round is checked and judged to see if it is greater than 0.5. If yes, it is classified as lichen; otherwise, it is classified as moss or algae. Then, a fifth round of judgment is performed, detecting and judging the fractal dimension D of the outline region classified as moss or algae in the fourth round. If the value is greater than 10, it is classified as moss; otherwise, it is classified as algae.
[0023] Thus, by employing the above identification method, which combines the differences in saturation (S), brightness (V) color moments, texture feature binary standard deviation, gray-level co-occurrence matrix value, shape feature roundness, and shape feature classification dimension of various diseased areas, and considering the comparison thresholds used in the identification process based on classification comparison principles and practical comparison experience, the method can reliably distinguish between different diseases. This approach allows for the rapid and accurate identification of the specific types of five biological diseases with minimal rounds of judgment, making the identification fast, accurate, and reliable.
[0024] In summary, this invention can quickly and reliably identify the types of biological diseases on the surface of stone buildings, so as to facilitate accurate prevention and control of biological diseases and improve the protection effect of stone buildings. Attached Figure Description
[0025] Figure 1 This is a schematic diagram of the steps involved in implementing the method of the present invention.
[0026] Figure 2 This is a schematic diagram illustrating the specific biological disease identification and judgment process during the implementation of the method of the present invention.
[0027] Figure 3 This is the original color photograph of the stone statue when the method of the present invention is specifically implemented.
[0028] Figure 4 for Figure 3 The image after shadow removal processing.
[0029] Figure 5 for Figure 4 The photo is an angle-corrected image.
[0030] Figure 6 for Figure 5 The photo after contrast enhancement processing.
[0031] Figure 7 for Figure 6 The image shows a segmented view of the diseased areas. In the image, green areas represent algae, yellow areas represent lichens, red areas represent mosses, purple areas represent molds, and blue areas represent plants. Detailed Implementation
[0032] The present invention will be further described in detail below with reference to specific embodiments.
[0033] Example: A computer vision-based method for identifying biological diseases in stone buildings, characterized by the following steps (see...). Figure 1 ): a. Obtain the original color photograph of the stone building to be identified (in the form of...) Figure 3(Taking the stone statue photo as an example) and inputting it into the computer to obtain the original color image information of the stone building, preprocessing the image so that only the brightness information of the objects displayed in the picture is retained; b. Based on differences in brightness information, the image display object is segmented to obtain the outline range of various biological disease areas (see...). Figure 7 ); c restores the internal regions of each segmented contour to their original color graphics, and then re-identifies the types of biological diseases in each contour based on differences in optical features, texture features, and shape features.
[0034] In implementation, in step a, the graphic ( Figure 3 (As shown) Preprocessing includes the following steps: a1 uses a morphological opening algorithm to remove image shadows (see...). Figure 4 ); a2 uses a weighted average method to perform grayscale processing on the image, transforming the color image, which is a superposition of R (red), G (green), and B (blue) light, into an image containing only single-channel brightness information. The pixel value represents the brightness level from black (0) to white (255); this can better reduce the complexity of subsequent processing. a3 uses Gaussian filtering to reduce noise in images, eliminating minor noise interference; it can better eliminate image defects caused by poor lighting and high temperatures. A4 corrected image shows rotation angle caused by shooting tilt (see...). Figure 5 ); a5 uses histogram equalization to enhance the image and improve contrast (see [link]). Figure 6 Image enhancement using histogram equalization can stretch areas with concentrated gray levels and compress areas with dispersed gray levels, thereby improving contrast.
[0035] This image preprocessing, combining shadow removal, grayscale conversion, Gaussian noise reduction, angle correction, and contrast enhancement, effectively improves image quality and eliminates the effects of shooting conditions, lighting variations, and noise. This provides clear and accurate input data for subsequent biological disease region segmentation and classification. The core advantage of this series of operations lies in improving the robustness and accuracy of the recognition process, while optimizing computational efficiency, reducing algorithm complexity, and ensuring the practicality and stability of the biological disease detection system for stone buildings.
[0036] In practice, step a1 specifically includes the following steps: a11 performs LAB color space reconstruction on the image, transforming a color image composed of superimposed R (red), G (green), and B (blue) light into a LAB image containing only luminance (L) and chromaticity (A / B). Here, L represents image luminance (0 = pure black, 100 = pure white), A represents the green-red channel (green: negative value → red: positive value), and B represents the blue-yellow channel (blue: negative value → yellow: positive value). This ensures that lighting adjustments do not affect hue, and subsequent shadow removal only requires modification of the L channel. a12 performs a morphological opening operation (MORPH_OPEN) on the image, first eroding and then dilating to remove dark shadow areas and retain bright background areas, outputting an ideal brightness plane without shadows in the L channel, thus realizing the reconstruction of background shadow detection; A13 performs shadow compensation calculations. Based on the obtained ideal brightness plane background without shadows, it obtains the missing brightness value diff in the shadow area and performs additive compensation (the deeper the shadow, the larger the diff value). The missing brightness value is superimposed on the original L channel to make the brightness of the shadow area close to the background. a14 performs channel merging and color restoration (LAB → BGR), reversing the image back to BGR space to remove image shadows (see...). Figure 4 This ensures that the output image has natural and distortion-free colors.
[0037] Thus, by employing the above method to remove image shadows, the influence of shadows in the image can be effectively eliminated, ensuring uniform brightness and clear details while maintaining natural and realistic colors. This series of operations not only improves image quality and reduces interference from shadows, but also provides more accurate and reliable image data for subsequent biological disease detection.
[0038] In practice, step a4 specifically includes the following steps: a41 uses the object contour finding function (cv2.findContours) to find all outer contours in the image and selects the contour with the largest area (max(contours, key=cv2.contourArea)); calculates the minimum bounding rectangle of the contour with the largest area (cv2.minAreaRect, which can automatically adapt to the object orientation); extracts the rectangle angle (angle = rect[2]); (in the visual processing library OpenCV, the angle range is [-90, 0) degrees) If the angle is less than -45 degrees (meaning the rectangle is "lying flat"), then adjust the angle to 90+angle (so that it is within the range of [-45, 45] degrees, which meets the horizontal correction requirements). In this way, the angle is inferred from the shape of the largest object in the image through contour analysis, which is more reliable; a42 applies an edge detection algorithm (cv2.Canny) to the LAB image (i.e., grayscale image) obtained by a11 to extract edge points; it uses the probabilistic Hough transform function (cv2.HoughLinesP) to detect straight line segments (parameters such as minLineLength=100 (minimum line segment length) and maxLineGap=10 (maximum line segment gap) to balance accuracy and noise tolerance); it calculates the angle of each straight line segment (math.degrees(math.atan2)) and filters out lines in the range of [-45, 45] degrees (assuming horizontal or near-horizontal lines are predominant); then it calculates the median of these angles (np.median) to reduce the influence of outliers.
[0039] a43 employs a dual-check logic: if the straight line angle exists and the absolute difference between it and the original contour angle is less than 15 degrees, then the average of the two is taken as the final angle ((angle + median_line_angle) / 2); otherwise, the contour angle is retained, thus correcting the image tilt angle.
[0040] In this way, line detection utilizes the line features in the image to cross-validate angles, improving accuracy. Image correction employs a dual verification mechanism of contour analysis and Hough line detection, further enhancing the robustness of angle estimation.
[0041] In practice, step b specifically includes the following steps: b1 uses the Otsu algorithm (also known as the Otsu method) to perform adaptive threshold segmentation on the image obtained in step a. The segmented foreground part is regarded as the disease area and the background part is regarded as the building and other areas, thus realizing the separation of the disease area. This is because the inter-class variance is largest between the foreground and background images. Otsu's algorithm, based on grayscale histograms, can achieve adaptive thresholding segmentation, converting grayscale images into binary images and dividing them into background and foreground parts according to their grayscale characteristics. Since variance is a measure of the uniformity of grayscale distribution, the larger the inter-class variance between the background and foreground, the greater the difference between the two parts of the image. Misclassifying part of the foreground as background or part of the background as foreground will lead to a smaller inter-class difference. Therefore, this algorithm can directly achieve automatic separation of diseased areas based on the large grayscale value of the lesions.
[0042] b2 performs morphological opening operations on the diseased areas separated in step b1, first corroding and then expanding to separate the adhered diseased areas.
[0043] This opening operation can smooth the contours of objects, break up narrow necks, and eliminate fine protrusions. The image opening operation uses the function `morphologyEx()`, which is a set of existing functions extended from morphology, with the parameter `cv2.MORPH_OPEN` corresponding to the opening operation. Image opening is the process of sequentially eroding and dilating an image. Erosion removes noise but also compresses the image; subsequent dilution removes noise while preserving the original image. This method is particularly effective here for separating partially adhered diseased areas, yielding independent diseased regions.
[0044] Step b3 performs contour detection and quantification on the adhered disease areas separated in step b2, obtaining and displaying the contours of each disease area; then, based on Green's formula, it calculates the geometric area of the closed contours, traverses all detected contours, accumulates their area values, and calculates the proportion of the total disease area. See implementation details. Figure 7 After separating the diseased area, different colored lines can be used to display its outline to show the disease situation more clearly and intuitively.
[0045] In implementation, the `findContours` function can be used to retrieve the contours; this is common knowledge in existing technology and will not be detailed here. This facilitates subsequent damage classification using the contour shape. Furthermore, after obtaining the contour of the damaged area, its area can be calculated, and thus the proportion of the damaged area to the total area of the stone building can be determined. This helps in better estimating the extent of building damage.
[0046] In practice, the identifiable biological diseases in step c include algae, lichens, molds, mosses, and plants. This encompasses the five types of biological diseases defined in the standard "Illustrated Glossary of Deterioration Patterns of Stone Cultural Relics".
[0047] During identification, the disease type is determined by performing optical feature HSV spatial analysis (obtaining saturation S and brightness V), optical feature color moment analysis (obtaining first-order color moment C-SD and second-order color moment C-SM), texture feature local binary standard deviation (LBP) analysis, texture feature gray-level co-occurrence matrix (GLCM) analysis, shape feature roundness (Cirs) analysis, and shape feature classification dimension (D) analysis on each contour region. This allows for accurate identification of the disease type based on the differences in various property characteristics among different diseases.
[0048] Specifically, the optical characteristic HSV spatial analysis is an existing technology. HSV spatial analysis comprises three components: Hue (H), Saturation (S), and Value (V). Hue (0-360°), Saturation (0-100%), and Value (0-100%) are used as the classification levels. During analysis, the RGB color space of the area to be analyzed is converted to HSV space. Referring to the standard "Illustrated Glossary of Deterioration Patterns of Stone Cultural Relics": algae are mainly green, red, and black; lichens have complex colors, including gray, yellow, orange, green, and black; moss is mainly green, turning brown during droughts; mold is white, gray, and black; and plants are predominantly green, exhibiting different colors in different seasons. Therefore, this can be used for differentiation.
[0049] Optical characteristic color moment analysis is an existing technology. This technology quantifies the color distribution characteristics of an image using color moments, capturing the central tendency, dispersion, and asymmetry of the color distribution by calculating the first three orders of the color moments in the image's color channels. Different defects are differentiated based on their color moment distribution characteristics. The first three orders of color moments reflect different characteristics of the image's colors: the first order reflects the central position of the color distribution, the second order reflects the dispersion of color values from the mean, and the third order reflects the asymmetry of the color distribution. The specific calculation formulas for the first, second, and third orders of color moments are existing technologies and will not be detailed here.
[0050] Among various diseases, algae are characterized by high mean and low standard deviation in the green channel; lichens exhibit the highest standard deviation due to the mixed symbiotic pigments, and their skewness is significantly affected by the light and dark of the substrate; mosses have a negative skewness due to their bright green and dense structure, which forms a key distinction from the positive skewness of plants; molds rely on high skewness; plants are dominated by the green mean, with a medium standard deviation (leaf vein texture), and positive skewness of the third moment is a common feature.
[0051] Although lichens exhibit significant variability in color space, their pixel-level color fluctuations are minimal due to the uniformity of their surface structure (velvety, crusty). The standard deviation is typically between 15-30 (RGB 0-255 range), with a long tail extending towards darker areas. Skewness values are mostly between -0.5 and -1.5, reflecting a significantly higher proportion of dark pixels than bright pixels. Therefore, the above optical characteristics can be used to classify the outlines of some lesions.
[0052] In the texture feature analysis, dual verification was used, employing Local Binary Standard Deviation (LBP) and Gray-Level Co-occurrence Matrix (GLCM).
[0053] Local Binary Pattern (LBP) captures local microstructures, while Gray-Level Co-occurrence Matrix (GLCM) describes global macroscopic patterns. While their individual calculation formulas are existing technologies, their combined application provides a more comprehensive description of the image's texture structure.
[0054] The standard deviation is used to quantify the dispersion of LBP (Local Binary Pattern) values. The larger the standard deviation, the more complex and uneven the texture. Algae have the most uniform texture (lowest standard deviation), followed by mosses. Lichens and molds exhibit higher standard deviations due to their complex structures, while plants have the widest range of standard deviations (significant differences from smooth leaves to rough bark).
[0055] For GLCM (Gray Co-occurrence Matrix), GLCM statistically analyzes the joint probability distribution p of gray values i and j of two pixels in an image that are d = (dx, dy) apart. Contrast, energy, and entropy (each calculated using existing techniques) are selected as texture feature evaluation criteria. Contrast reflects the intensity of local gray-level changes; a larger value indicates a coarser texture. Energy reflects texture uniformity; a large value indicates a uniform gray-level distribution. Entropy reflects texture randomness; a large value indicates a complex gray-level distribution.
[0056] Thus, algae exhibit a homogeneous texture with low contrast, high energy, and medium to low entropy due to their thin-layered structure; lichens display a complex surface with medium to high contrast, low energy, and high entropy due to the porous heterogeneity of their symbiotic structures; mosses form a random texture with medium contrast, energy, and high entropy due to their densely clustered stems and leaves; molds are characterized by extremely high contrast, extremely low energy, and the highest entropy due to their sharp branching of hyphae and disordered spore distribution; and higher plants exhibit significant fluctuations with organ differentiation. Based on different image recognition results, mold has the most fragmented and chaotic texture, while algae have the smoothest and most uniform texture, indicating that structural characteristics significantly influence texture features. Therefore, the above method can be used to identify disease types with different texture features through texture feature analysis.
[0057] In this method, a dual verification approach of circularity and fractal dimension is employed for shape feature analysis. Circularity primarily describes how close a shape is to a circle. This feature is effective for regular shapes, but its limitation lies in its insensitivity to complex boundaries; for example, a shape with many small protrusions may have the same circularity as a smooth shape. Fractal dimension, on the other hand, excels at quantifying the complexity and roughness of a shape, making it suitable for describing irregular shapes in nature. However, fractal dimension does not distinguish sufficiently between simple, regular shapes. Therefore, this method uses a combination of these two features to achieve complementarity. Circularity captures overall contour information, while fractal dimension describes boundary details, thus providing a more comprehensive description of shape features.
[0058] Specifically, circularity is a geometric measure commonly used to assess how close a shape is to an ideal circle. A circularity (Circ) value close to 1 indicates a very round shape, while a value less than 1 indicates an irregular shape. The specific calculation method is existing technology and will not be described in detail here.
[0059] Because algae, being single-celled organisms, and the leaves of higher plants exhibit a high degree of roundness, with outlines approaching regular geometric shapes; while lichens, mosses, and fungi, constrained by their clustered and spreading growth patterns, show significantly reduced roundness. Lichens, due to the coupling of the symbiotic edge to the base, mosses, due to their clustered structure, and fungi, due to the disordered extension of hyphae, all exhibit highly irregular outlines and extremely low roundness. Therefore, the calculation of roundness can be used to identify these types of diseases.
[0060] Fractal dimension is a measure of complex geometry, typically used to measure the complexity of self-similar objects or structures. A higher fractal dimension indicates greater complexity. The specific calculation method is based on existing technology and will not be detailed here. Mold hyphae networks exhibit extremely high fractal dimensions with significant self-similar branching structures; the symbiotic interface between mosses and lichens follows closely behind. Algae and higher plant leaves maintain lower fractal values because their function depends more on the overall structure than on microstructure, thus allowing for identification.
[0061] Thus, this method employs multimodal feature fusion technology, which comprehensively judges the type of biological disease by considering three-dimensional features such as optical properties, texture properties, and shape properties, thereby accurately classifying and identifying various diseases.
[0062] In practice, the identification process in step c specifically includes the following steps (see...). Figure 2 ): c1 restores the internal regions of the biological disease outlines obtained in step b to the original color graphics; c2 sequentially performs the following disease classification and identification on each outline region of the biological disease. First, it performs the first round of judgment, detects and judges whether the saturation S of the outline region is equal to 0%. If the result is yes, the first round of judgment classifies it as algae, lichen, or mold. If the structure is no, the first round of judgment classifies it as algae, lichen, moss, or plant. Then, a second round of judgment is performed. The brightness of the outline area classified as algae, lichen, or mold in the first round is checked and judged to be greater than 0.2. If the result is yes, the second round of judgment further classifies it as mold. If the result is no, the second round of judgment still classifies it as algae, lichen, or mold. At the same time, the first-order color moment C-SD of the outline area classified as algae, lichen, moss, or plant in the first round is checked and judged to be greater than 30. If the result is yes, the second round of judgment classifies it as lichen or moss. If the result is no, the second round of judgment still classifies it as algae, lichen, moss, or plant. Then, a third round of judgment is performed. The second-order color moment C-SN of the outline region classified as algae, lichen, or mold in the second round is checked and determined. If the result is yes, the third round classifies it as lichen or mold; otherwise, it is classified as algae. Simultaneously, the local binary standard deviation LBP-SD of the outline region classified as lichen or moss in the second round is checked and determined. If the result is yes, the third round classifies it as moss; otherwise, it is classified as lichen. Finally, the gray-level co-occurrence matrix value GLCM-E of the outline region classified as algae, lichen, moss, or plant in the second round is checked and determined. If the result is no, the third round classifies it as algae or plant; otherwise, it is classified as algae, moss, or lichen. Then, a fourth round of judgment is performed. The circularity (Circ) of the outline region classified as lichen or mold in the third round is checked and judged to see if it is less than 0.5. If yes, it is classified as lichen; otherwise, it is classified as mold. Simultaneously, the fractal dimension (D) of the outline region classified as algae or plant in the third round is checked and judged to see if it is greater than 5. If yes, it is classified as algae; otherwise, it is classified as plant. Finally, the circularity (Circ) of the outline region classified as algae, moss, or lichen in the third round is checked and judged to see if it is greater than 0.5. If yes, it is classified as lichen; otherwise, it is classified as moss or algae. Then, a fifth round of judgment is performed, detecting and judging the fractal dimension D of the outline region classified as moss or algae in the fourth round. If the value is greater than 10, it is classified as moss; otherwise, it is classified as algae.
[0063] Thus, by employing the above identification method, which combines the differences in saturation (S), brightness (V) color moments, texture feature binary standard deviation, gray-level co-occurrence matrix value, shape feature roundness, and shape feature classification dimension of various diseased areas, and considering the comparison thresholds used in the identification process based on classification comparison principles and practical comparison experience, the method can reliably distinguish between different diseases. This approach allows for the rapid and accurate identification of the specific types of five biological diseases with minimal rounds of judgment, making the identification fast, accurate, and reliable.
Claims
1. A computer vision-based image recognition method for biological diseases in stone buildings, characterized in that, Includes the following steps: a. Obtain the original color photo of the stone building to be identified and input it into the computer to obtain the original color image information of the stone building. Preprocess the image so that only the brightness information of the objects displayed in the image is retained. b. Based on the difference in brightness information, the image display object is segmented to obtain the outline range of various biological disease areas; c restores the internal regions of each segmented contour to their original color graphics, and then re-identifies the types of biological diseases in each contour based on differences in optical features, texture features, and shape features.
2. The image recognition method for biological diseases in stone buildings based on computer vision as described in claim 1, characterized in that, In step a, the preprocessing of the graphic includes the following steps: a1 uses a morphological opening algorithm to remove image shadows; a2 uses a weighted average method to process the image into grayscale, transforming the color image, which is a superposition of RGB three-color light, into an image containing only single-channel brightness information. The pixel value represents the brightness level from black to white. a3 uses Gaussian filtering to reduce noise in the image, eliminating minor noise interference. Correcting the rotation angle in A4 images caused by shooting tilt; a5 uses histogram equalization to enhance the image and improve contrast.
3. The image recognition method for biological diseases in stone buildings based on computer vision as described in claim 2, characterized in that, Step a1 specifically includes the following steps: a11 performs LAB color space reconstruction on the image, transforming the color image of RGB three-color light superimposed on each other into a LAB image containing only luminance L and chromaticity A / B; where L represents image luminance, 0=pure black, 100=pure white, A represents the green-red channel, green: negative value → red: positive value; B represents the blue-yellow channel, blue: negative value → yellow: positive value; a12 performs morphological opening operations on the image, first eroding and then dilating to remove dark shadow areas and retain bright background areas, outputting an ideal brightness plane without shadows in the L channel, thus realizing the reconstruction of background shadow detection; A13 performs shadow compensation calculations. Based on the obtained ideal brightness plane without shadows, it performs additive compensation on the missing brightness values (diff) in the shadow area and adds the missing brightness values to the original L channel to make the brightness of the shadow area close to the background. a14 performs channel merging and color restoration, inverts the image back to BGR space, and removes image shadows.
4. The image recognition method for biological diseases in stone buildings based on computer vision as described in claim 2, characterized in that, Step a4 specifically includes the following steps: a41 uses an object contour finding function to find all outer contours in the image and selects the contour with the largest area; it calculates the minimum bounding rectangle of the contour with the largest area; it extracts the rectangle angle; in the visual processing library OpenCV, the angle range is [-90, 0) degrees. If the angle is less than -45 degrees, it means that the rectangle is "lying flat". So the angle is adjusted to 90 + angle to make it within the range of [-45, 45] degrees, which meets the horizontal correction requirements. a42 applies an edge detection algorithm to the LAB image obtained by a11 to extract edge points; it uses the probabilistic Hough transform function to detect straight line segments; it calculates the angle of each straight line segment and filters out lines in the range of [-45, 45] degrees; then it calculates the median of these angles to reduce the influence of outliers. a43 employs a dual-check logic: if the straight-line angle exists and the absolute difference between it and the original contour angle is less than 15 degrees, then the average of the two is taken as the final angle; otherwise, the contour angle is retained, thus correcting the image tilt angle.
5. The image recognition method for biological diseases in stone buildings based on computer vision as described in claim 1, characterized in that, Step b specifically includes the following steps: b1 uses the Otsu algorithm to perform adaptive threshold segmentation on the image obtained in step a, treating the segmented foreground part as the diseased area and the background part as the building and other areas, thus achieving the separation of the diseased area; b2 performs morphological opening operations on the diseased areas separated in step b1, first corroding and then expanding to separate the adhered diseased areas.
6. The image recognition method for biological diseases in stone buildings based on computer vision as described in claim 5, characterized in that, Step b also includes step b3: b3 performs contour detection and quantification on the adhesion disease areas separated in step b2, obtains the contours of each disease area and displays them; Then, based on Green's formula, calculate the geometric area of the closed contour, traverse all detected contours, sum their area values, and calculate the proportion of the total disease area.
7. The image recognition method for biological diseases in stone buildings based on computer vision as described in claim 1, characterized in that, The types of biological diseases that can be identified in step c include algae, lichens, molds, mosses, and plants.
8. The image recognition method for biological diseases in stone buildings based on computer vision as described in claim 7, characterized in that, During identification, the types of diseases are identified by performing optical feature HSV spatial analysis, optical feature color moment analysis, texture feature local binary standard deviation analysis, texture feature gray-level co-occurrence matrix value analysis, shape feature roundness analysis, and shape feature classification dimension analysis on each contour region.
9. The image recognition method for biological diseases in stone buildings based on computer vision as described in claim 8, characterized in that, The identification process in step c specifically includes the following steps: c1 restores the internal regions of the biological disease outlines obtained in step b to the original color graphics; c2 sequentially performs the following disease classification and identification on each outline region of the biological disease. First, it performs the first round of judgment, detects and judges whether the saturation S of the outline region is equal to 0%. If the result is yes, the first round of judgment classifies it as algae, lichen, or mold. If the structure is no, the first round of judgment classifies it as algae, lichen, moss, or plant. Then, a second round of judgment is performed. The brightness of the outline area classified as algae, lichen, or mold in the first round is checked and judged to be greater than 0.
2. If the result is yes, the second round of judgment further classifies it as mold. If the result is no, the second round of judgment still classifies it as algae, lichen, or mold. At the same time, the first-order color moment C-SD of the outline area classified as algae, lichen, moss, or plant in the first round is checked and judged to be greater than 30. If the result is yes, the second round of judgment classifies it as lichen or moss. If the result is no, the second round of judgment still classifies it as algae, lichen, moss, or plant. Then, a third round of judgment is performed. The second-order color moment C-SN of the outline region classified as algae, lichen, or mold in the second round is checked and determined. If the result is yes, the third round classifies it as lichen or mold; otherwise, it is classified as algae. Simultaneously, the local binary standard deviation LBP-SD of the outline region classified as lichen or moss in the second round is checked and determined. If the result is yes, the third round classifies it as moss; otherwise, it is classified as lichen. Finally, the gray-level co-occurrence matrix value GLCM-E of the outline region classified as algae, lichen, moss, or plant in the second round is checked and determined. If the result is no, the third round classifies it as algae or plant; otherwise, it is classified as algae, moss, or lichen. Then, a fourth round of judgment is performed. The circularity (Circ) of the outline region classified as lichen or mold in the third round is checked and judged to see if it is less than 0.
5. If yes, it is classified as lichen; otherwise, it is classified as mold. Simultaneously, the fractal dimension (D) of the outline region classified as algae or plant in the third round is checked and judged to see if it is greater than 5. If yes, it is classified as algae; otherwise, it is classified as plant. Finally, the circularity (Circ) of the outline region classified as algae, moss, or lichen in the third round is checked and judged to see if it is greater than 0.
5. If yes, it is classified as lichen; otherwise, it is classified as moss or algae. Then, a fifth round of judgment is performed, detecting and judging the fractal dimension D of the outline region classified as moss or algae in the fourth round. If the value is greater than 10, it is classified as moss; otherwise, it is classified as algae.
Citation Information
Patent Citations
Building shear wall disease identification method and system based on digital twinning
CN117876347A
Intelligent identification method and device for historical building diseases
CN119625435B
Image recognition and positioning method for building facade diseases
CN119992374B
Spatial information identification method for existing building group
CN117541599A
Construction structure change image detection method based on edge detection and image fusion
CN120013940A