A motorcycle cover plate surface defect detection method based on image detection

By identifying weak textured areas on the surface of motorcycle covers and adaptively adjusting the contrast threshold, combined with the CLAHE algorithm for local image enhancement, the accuracy problem of defect detection on the surface of motorcycle covers is solved, and the detection effect of minute defects is improved.

CN122199419APending Publication Date: 2026-06-12CHANGSHU JIADE AUTO PARTS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610245653.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-02
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

Existing methods for detecting surface defects on motorcycle covers are inaccurate in detecting minute scratches, shallow pits, or low-contrast cracks. Histogram equalization algorithms may result in the loss of detail information or false contours, affecting detection accuracy.

Method used

By acquiring the texture features of the motorcycle cover surface image, weak texture regions are identified, suspected peak points and contrast coefficients are obtained, contrast limit thresholds are adaptively adjusted, local image enhancement is performed using the CLAHE algorithm, and partitioning is performed based on sparsity and comprehensive nearest neighbor distance to improve detection accuracy.

Benefits of technology

It improves the accuracy of surface defect detection for motorcycle cover plates, avoids the impact of histogram equalization on significant texture areas, enhances the detection effect of minor defects, and reduces the generation of artifacts and noise.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122199419A_ABST
    Figure CN122199419A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image detection, in particular to a motorcycle cover plate surface defect detection method based on image detection; a weak texture region block is acquired according to the texture features of a surface image; a suspected peak point is acquired according to the gray distribution features of the weak texture region block; an adaptive contrast limitation threshold is obtained according to the number features of the suspected peak point, the gray interval features of the suspected peak point and the gray level range features of a gray histogram; a comprehensive nearest neighbor distance and a sparsity degree are obtained according to the pixel point distribution features and the gray level number features of the same gray level in the weak texture region block; and a subregion is obtained according to the sparsity degree and the comprehensive nearest neighbor distance. According to the gray distribution of the subregion and the weak texture region block, the adaptive contrast limitation threshold and the local contrast limitation threshold, image enhancement is carried out; surface defect detection is carried out on the image to be detected, and the accuracy of defect detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image detection technology, and more specifically to a method for detecting surface defects on motorcycle cover plates based on image detection. Background Technology

[0002] As a key component integrating appearance protection and functionality, the surface quality of motorcycle covers directly affects product safety and aesthetics. Surface defects such as scratches, dents, bubbles, and runs not only damage the product's appearance but may also lead to safety hazards such as reduced structural strength and seal failure. Due to the complex structure and varied curvature of motorcycle covers, defect detection is challenging. Image-based inspection methods can be used for large-scale inspection.

[0003] Defect detection typically uses existing edge detection algorithms, but the cover plate surface may contain minute scratches, shallow pits, or low-contrast cracks, which are easily missed by direct detection. Therefore, image enhancement is necessary. Existing histogram equalization algorithms can expand the dynamic range and improve image contrast by merging gray levels, but this may lead to the loss of some detail information. For images with peaks in the histogram, such as the complex texture of the cover plate surface, histogram equalization may lead to excessive contrast enhancement, producing false contours or noise, affecting the accuracy of cover plate surface defect detection. Summary of the Invention

[0004] To address the aforementioned technical problems, the present invention aims to provide a method for detecting surface defects on motorcycle cover plates based on image detection. The specific technical solution adopted is as follows: Obtain a surface image of the motorcycle cover; Weak texture region blocks are obtained based on the texture features of the surface image; suspected peak points are obtained based on the gray-level distribution features of the gray-level histogram of the weak texture region blocks; a contrast coefficient is obtained based on the number of suspected peak points, the gray-level interval features of the suspected peak points, and the gray-level range features of the gray-level histogram; and an adaptive contrast limiting threshold is obtained based on the contrast coefficient of the weak texture region blocks. The comprehensive nearest neighbor distance and sparsity are obtained based on the distribution characteristics and number of pixels with the same gray level in the weak texture region block; the partition length is obtained based on the sparsity and the comprehensive nearest neighbor distance; the weak texture region block is divided according to the partition length to obtain different sub-regions; the local contrast limit threshold of the sub-region is obtained based on the difference characteristics of the gray level distribution between the sub-region and the weak texture region block and the adaptive contrast limit threshold. Based on the local contrast limiting threshold, image enhancement is performed on all sub-regions using the CLAHE algorithm. The enhanced regions and non-weak texture regions are then stitched together to obtain the image to be detected. Surface defect detection is then performed on the image to be detected.

[0005] Further, the step of obtaining weak texture region blocks based on the texture features of the surface image includes: The LBP values ​​of pixels in the surface image are obtained, the variance of the LBP values ​​of pixels in each preset window region of the surface image is calculated and normalized to obtain significant texture feature values; the regions in the surface image whose significant texture feature values ​​are lower than the preset texture threshold are divided into regions using the SLIC superpixel algorithm to obtain different weak texture region blocks.

[0006] Further, the step of obtaining suspected peak points based on the gray-level distribution characteristics of the gray-level histogram of the weakly textured region block includes: The curve corresponding to the gray-level histogram is obtained by kernel density estimation; the suspected peak points are obtained based on the variation characteristics of the first derivative of the curve.

[0007] Furthermore, the step of obtaining the contrast coefficient based on the quantity characteristics of the suspected peak points, the gray-level interval characteristics of the suspected peak points, and the gray-level range characteristics of the gray-level histogram includes: In the formula, R represents the contrast coefficient of the weak texture area block. Let N represent the number of gray levels in the weak texture region block, n represent the number of suspected peak points, and D represent the average number of gray level intervals between adjacent suspected peak points. This represents the maximum gray level of a weakly textured region. This represents the minimum gray level of a weakly textured region.

[0008] Further, the step of obtaining the adaptive contrast limiting threshold of the weak texture region block based on the contrast coefficient includes: In the formula, K represents the adaptive contrast limit threshold of the weak texture area block, a represents the preset minimum contrast limit threshold, b represents the preset maximum contrast limit threshold, and R represents the contrast coefficient.

[0009] Further, the step of obtaining the comprehensive nearest neighbor distance and sparsity based on the distribution characteristics and gray-level quantity characteristics of pixels with the same gray level in the weak texture region block includes: In the formula, E represents the sparsity of the weak texture region block. This indicates normalization, where G represents the number of gray levels in the weakly textured region block, and M represents the number of pixels in the weakly textured region block. This represents the minimum Euclidean distance between the m-th pixel and other pixels of the same gray level. This represents the combined nearest neighbor distance.

[0010] Further, the step of obtaining the partition length based on the sparsity and the comprehensive nearest neighbor distance includes: In the formula, S represents the partition length, T represents the comprehensive nearest neighbor distance, and E represents the sparsity.

[0011] Further, the step of dividing the weak texture region block according to the partition length to obtain different sub-regions includes: A partitioning window is constructed based on the partition length as the window side length. The weak texture region block is then divided according to the size of the partitioning window to obtain different sub-regions.

[0012] Further, the step of obtaining the local contrast limit threshold of the sub-region based on the difference characteristics of the grayscale distribution of the sub-region and the corresponding weak texture region block, and the adaptive contrast limit threshold, includes: Calculate the ratio of the number of pixels with the most gray level in the sub-region to the total number of pixels in the sub-region to obtain a first value; calculate the ratio of the number of pixels with the most gray level in the weak texture region block to the total number of pixels in the weak texture region block to obtain a second value; calculate the ratio of the first value to the second value to obtain a first ratio; calculate the product of the first ratio and the adaptive contrast limiting threshold to obtain the local contrast limiting threshold of the sub-region.

[0013] The present invention has the following beneficial effects: In this invention, acquiring weak-texture region blocks avoids the influence of significant texture regions during histogram equalization, initially improving the accuracy of enhancing subtle defect areas. Acquiring suspected peak points reflects the distribution characteristics of pixel counts at different gray levels within the weak-texture region blocks, and acquiring contrast coefficients reflects the contrast characteristics of these blocks, allowing for adaptive adjustment of the contrast limit threshold. Acquiring adaptive contrast limit thresholds sets a more suitable contrast limit threshold based on the contrast characteristics of each weak-texture region block, thereby improving the accuracy of histogram equalization. Acquiring a combination of nearest neighbor and sparsity characterizes the distribution characteristics of potential defect areas, enabling more accurate partitioning of weak-texture region blocks. Acquiring partition lengths and sub-regions allows for further histogram equalization of different sub-regions to varying degrees, improving the accuracy of micro-defect detection; acquiring local contrast limit thresholds makes histogram equalization more consistent with the texture characteristics of the sub-region, improving image enhancement. Finally, surface defect detection based on the image to be detected improves the accuracy of detecting surface defects on motorcycle covers. Attached Figure Description

[0014] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0015] Figure 1 This is a flowchart of a method for detecting surface defects on a motorcycle cover plate based on image detection, provided as an embodiment of the present invention. Detailed Implementation

[0016] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of an image detection-based method for detecting surface defects on motorcycle covers according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.

[0017] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0018] The following description, in conjunction with the accompanying drawings, details a specific scheme for a method for detecting surface defects on a motorcycle cover plate based on image detection, provided by the present invention.

[0019] Please see Figure 1 The diagram illustrates a flowchart of an image-based method for detecting surface defects on a motorcycle cover plate, according to an embodiment of the present invention. The method includes the following steps: Step S1: Obtain a surface image of the motorcycle cover.

[0020] In this embodiment of the invention, the implementation scenario is to perform defect detection on the surface of a motorcycle cover, thereby improving the accuracy of defect detection. First, a photograph of the area of ​​the motorcycle cover to be inspected is taken, and the photograph is then converted to grayscale to obtain a surface image of the motorcycle cover.

[0021] Step S2: Obtain weak texture region blocks based on the texture features of the surface image; obtain suspected peak points based on the gray-level distribution features of the gray-level histogram of the weak texture region blocks; obtain contrast coefficients based on the number of suspected peak points, the gray-level interval features of the suspected peak points, and the gray-level range features of the gray-level histogram; and obtain an adaptive contrast limiting threshold for the weak texture region blocks based on the contrast coefficients.

[0022] Because motorcycle covers themselves have complex design textures, such as regular raised or recessed textures or gradient images, the purpose of this invention is primarily to enhance the detection of minute defects that may exist on the cover surface, such as holes and minute scratches or cracks with a width of less than 0.5 mm. Since minute defects are smaller and shallower, their grayscale variation is less pronounced than the obvious edges of the design texture. Therefore, based on the difference in physical characteristics between defects and textures, it can be known that the contrast of most minute defect edges is less than the contrast of the motorcycle cover's own texture edges; thus, weak texture regions can be obtained based on the texture characteristics of the surface image.

[0023] Preferably, in this embodiment of the invention, the step of obtaining weak texture region blocks includes: obtaining the LBP values ​​of pixels in the surface image. LBP local binary mode can describe local texture information by analyzing the grayscale difference features between pixels and their neighbors. The variance of the LBP values ​​of pixels within each preset window region in the surface image is calculated and normalized to obtain significant texture feature values. In this embodiment of the invention, the preset window region refers to a range with a side length of 3, which is filled in the surface image without overlap. Each preset window region corresponds to a significant texture feature value, which can be determined by the implementer according to the implementation scenario. A larger significant texture feature value means that the texture features of the preset window region are more complex and obvious, and it is more likely to be a significant texture region of the cover plate itself. Regions in the surface image with significant texture feature values ​​lower than a preset texture threshold are divided into different weak texture region blocks using the SLIC superpixel algorithm. The more obvious the texture features of a preset window region, the closer its significant texture feature value is to 1; conversely, the weaker the texture features of a preset window region, the closer its significant texture feature value is to 0. In this embodiment of the invention, the preset texture threshold is 0.7, which can be determined by the implementer according to the implementation scenario. Because the contrast of pixels in the design texture area of ​​the cover plate is relatively obvious, if the calculation of the local contrast limit threshold does not exclude such areas, it will easily affect the accuracy of the selection of the contrast limit threshold and the accuracy of the enhancement of minor defects. Meanwhile, minor defects that are not easily detected are retained because their texture features are weak. Minor defects may exist in the weak texture area blocks obtained through texture feature screening. Therefore, adaptive enhancement is subsequently performed on the weak texture area blocks. It should be noted that the SLIC superpixel algorithm is an existing technology that re-segments the entire region of the surface image below the preset texture threshold. It can construct weak texture area blocks from adjacent pixels with similar texture, brightness, and color features, further improving the accuracy of subsequent histogram equalization.

[0024] Furthermore, to improve the accuracy of image enhancement, each weak texture region is analyzed separately. When the gray values ​​in certain areas of the image are too concentrated or the local contrast is too high, direct global histogram equalization can easily lead to noise amplification, artifacts, or loss of detail, which is not conducive to improving the detection accuracy of small defects. Therefore, CLAHE-limited contrast adaptive histogram equalization can be used for image enhancement to avoid excessive contrast stretching at a certain gray level due to too many pixels. When the contrast limit threshold is large, the algorithm stretches the local histogram more significantly due to the relatively loose cropping constraint, resulting in a significant improvement in the overall image contrast. However, excessive stretching may lead to loss of local details or artifacts such as halos and stripes, and noise pixels may become more noticeable due to stretching. When the contrast limit threshold is small, the cropping constraint is stricter, the algorithm stretches the local histogram less, and the overall image contrast improvement is limited. This can prevent excessive stretching of local gray values, reduce loss of detail or artifacts, and reduce sensitivity to noise, making noise less likely to be amplified. Therefore, to improve the accuracy of the contrast limit threshold selection, it can be selected based on the contrast characteristics of the weak texture region. Image contrast levels exhibit different characteristics in grayscale histograms. For example, in images with low contrast, grayscale values ​​are typically concentrated within a narrow range of grayscale levels, resulting in a narrow peak or multiple closely spaced peaks in the grayscale histogram, with the grayscale level range being relatively narrow, possibly only occupying a small portion of the total grayscale level. Conversely, images with high contrast exhibit significant color differences, resulting in a wider distribution of grayscale values, and the grayscale histogram may show bimodal or multimodal peaks with significant distances between them. Therefore, contrast characteristics can be analyzed based on the grayscale histograms corresponding to weakly textured regions, and a contrast limit threshold can be obtained based on these characteristics. Thus, suspected peak points are identified based on the grayscale distribution characteristics of the grayscale histograms of weakly textured regions.

[0025] Preferably, in this embodiment of the invention, the step of obtaining suspected peak points includes: obtaining the curve corresponding to the grayscale histogram using kernel density estimation; and obtaining suspected peak points based on the variation characteristics of the first derivative of the curve. It should be noted that kernel density estimation is existing technology, and the specific steps will not be elaborated further. When the first derivative of a point is zero and the left side is greater than zero and the right side is less than zero, it means that the point in the curve is a local maximum. The average difference between adjacent points in the curve is calculated. If the difference between the first and second points of the curve is greater than the average difference, the first point is taken as a suspected peak point; if the difference between the last point and the second-to-last point of the curve is greater than the average difference, the last point is taken as a suspected peak point. Since the first derivative cannot determine whether the first and last points are peak points, this calculation can prevent peaks in grayscale levels from appearing at both ends of the grayscale level, improving the accuracy of subsequent analysis. The number of pixels in the grayscale level corresponding to the suspected peak point in the grayscale histogram is higher than that of locally adjacent grayscale levels. Furthermore, the contrast coefficient can be obtained based on the number of suspected peak points, the gray-level interval characteristics of suspected peak points, and the gray-level range characteristics of the gray-level histogram; preferably, in this embodiment of the invention, the step of obtaining the contrast coefficient includes: In the formula, R represents the contrast coefficient of the weak texture region block. Indicates normalization, N represents the number of gray levels in the weak texture region block, and n represents the number of suspected peak points. The larger the value of D, the more pronounced the multi-peak feature of the gray-level histogram of the weakly textured region. D represents the average number of gray-level intervals corresponding to adjacent suspected peak points. The larger the value of D, the more uniform the multi-peak distribution of the gray-level histogram and the greater the difference in gray levels. This represents the maximum gray level of a weakly textured region. The minimum gray level representing a weakly textured region, when A larger contrast coefficient means a wider gray-level distribution in the gray-level histogram. Therefore, a larger contrast coefficient means a more pronounced contrast in weak-texture regions, requiring a smaller contrast limit threshold to prevent excessive stretching of local gray values, reduce detail loss or artifacts, and maintain the original structural features of the image. Conversely, a smaller contrast coefficient allows for a larger contrast limit threshold, permitting greater contrast variations during equalization, resulting in a more uniform gray-level distribution and highlighting image details. Therefore, an adaptive contrast limit threshold for weak-texture regions is obtained based on the contrast coefficient. Preferably, in this embodiment of the invention, the step of obtaining the adaptive contrast limit threshold includes: In the formula, K represents the adaptive contrast limit threshold for weak texture regions, a represents the preset minimum contrast limit threshold, b represents the preset maximum contrast limit threshold, and R represents the contrast coefficient. The contrast limit threshold in the CLAHE algorithm is typically set between 0.01 and 0.1. Therefore, in this embodiment of the invention, the preset minimum contrast limit threshold is set to 0.01, and the preset maximum contrast limit threshold is set to 0.1. Implementers can determine these thresholds according to their specific implementation scenarios. This indicates the adjustment baseline; the larger the contrast coefficient, the smaller the adaptive contrast limit threshold, and vice versa.

[0026] Step S3: Obtain the comprehensive nearest neighbor distance and sparsity based on the distribution characteristics and number of pixels with the same gray level in the weak texture region block; obtain the partition length based on the sparsity and comprehensive nearest neighbor distance; divide the weak texture region block according to the partition length to obtain different sub-regions; obtain the local contrast limit threshold of the sub-region based on the difference characteristics of gray level distribution between the sub-region and the weak texture region block and the adaptive contrast limit threshold.

[0027] Based on the adaptive contrast limiting threshold, weak texture regions with different contrast characteristics can be enhanced to varying degrees. However, since the area of ​​weak texture regions is relatively large, there may be multiple different defects within them, and the defect distribution may be dense or sparse. If the defect distribution is sparse, such as randomly distributed scratches on the cover plate surface, setting a smaller area for adaptive enhancement can ensure that each defect is processed independently, avoiding uneven enhancement caused by defects spanning multiple areas. If the defect distribution is dense, such as dense scratches on the cover plate surface, setting a larger area can avoid texture breaks or artifacts caused by partition boundaries. Therefore, the sparsity of the distribution of pixels with the same gray level can be calculated within each weak texture region. If the sparsity feature is obvious, there may be sparsely distributed defect areas, and a smaller area should be used when partitioning again. If the sparsity feature is not obvious, it may be a complete defect or non-defect area, and a larger area can be used when partitioning. Therefore, the comprehensive nearest neighbor distance and sparsity are obtained based on the distribution characteristics and gray level quantity characteristics of pixels with the same gray level in the weak texture region. Preferably, in the embodiment of the present invention, the step of obtaining the comprehensive nearest neighbor distance and sparsity includes: In the formula, E represents the sparsity of the weak texture region block. Normalization is represented by G, which represents the number of gray levels in a weakly textured region. Fewer gray levels mean more similar and denser gray levels in the region. When there is only one gray level, the sparsity is 0. M represents the number of pixels in the weakly textured region. This represents the minimum Euclidean distance between the m-th pixel and other pixels of the same gray level. This represents the combined nearest neighbor distance. When... The smaller the value, the closer the pixels of the same gray level are; the smaller the combined nearest neighbor distance, the closer the pixels of each gray level in the region are, and the denser the distribution. Therefore, the fewer the number of gray levels and the smaller the combined nearest neighbor distance, the less sparse the weak texture region, and vice versa.

[0028] Furthermore, the comprehensive nearest neighbor distance characterizes the average nearest distance of each gray level in the weakly textured region block, which may be the inherent scale features of frosted grains, stripe intervals, scratches, and pits. Using the comprehensive nearest neighbor distance as the partitioning criterion can avoid over-segmentation caused by large regions being divided into small partitions, resulting in the loss of macroscopic features, or under-segmentation caused by small regions being divided into large partitions, resulting in blurred details. Therefore, the partition length is obtained based on the sparsity and the comprehensive nearest neighbor distance. Preferably, in this embodiment of the invention, the step of obtaining the partition length includes: In the formula, S represents the partition length, T represents the comprehensive nearest neighbor distance, and E represents the sparsity. A higher sparsity indicates a sparser distribution of potential defects, requiring a smaller area for adaptive enhancement; conversely, a lower sparsity indicates a denser distribution of potential defects, requiring a larger area for adaptive enhancement. Furthermore, the weak-texture region can be divided according to the partition length to obtain different sub-regions. Specifically, this involves constructing a partitioning window using the partition length as the window side length, and then dividing the weak-texture region based on the size of the partitioning window to obtain different sub-regions. When the weak-texture region is an irregular area, a boundary constraint-based mesh deformation method is used to make the new partition conform to the irregular boundary.

[0029] After obtaining different sub-regions, the pixel distribution of the sub-regions may change. Since the adaptive contrast limiting threshold is obtained based on the characteristics of the weak texture region block, directly using this threshold may introduce new problems. If the pixels in the sub-region are highly concentrated at a certain gray level, the limiting threshold may be too low, easily amplifying noise; if the gray level distribution is wide, the limiting threshold may be too high, suppressing details. Therefore, it is necessary to further adjust the adaptive limiting threshold. The contrast limiting threshold of the sub-region can be calculated using a proportional coefficient mapping method. Thus, based on the difference in gray level distribution between the sub-region and the corresponding weak texture region block, and the adaptive contrast limiting threshold, the local contrast limiting threshold of the sub-region is obtained. Preferably, in this embodiment of the invention, the step of obtaining the local contrast limiting threshold includes: calculating the ratio of the number of pixels at the gray level with the most pixels in the sub-region to the total number of pixels in the sub-region, obtaining a first value; the larger the first value, the more concentrated the pixels in the sub-region are at a certain gray level. The second value is obtained by calculating the ratio of the number of pixels at the most concentrated gray level in the weak texture region block to the total number of pixels in the weak texture region block. A larger second value indicates that the pixels in the weak texture region block are more concentrated at a certain gray level. The first ratio is then calculated by comparing the first and second values. A larger first ratio indicates a more concentrated gray level distribution in the sub-region, requiring an increase in the adaptive contrast limiting threshold; conversely, a smaller first ratio requires a decrease. The product of the first ratio and the adaptive contrast limiting threshold is then calculated to obtain the local contrast limiting threshold for the sub-region. This local contrast limiting threshold further improves the adaptive enhancement effect and better reflects local texture characteristics.

[0030] Step S4: Enhance all sub-regions using the CLAHE algorithm based on the local contrast limit threshold, stitch the enhanced regions and non-weak texture regions together to obtain the image to be detected; perform surface defect detection on the image to be detected.

[0031] After obtaining the local contrast limit thresholds for all sub-regions, image enhancement can be performed on all sub-regions using the CLAHE algorithm based on these thresholds. The enhanced regions and non-weak texture regions are then stitched together to obtain the image to be detected. It should be noted that CLAHE-limited contrast adaptive histogram equalization is an existing technology, and its specific steps will not be elaborated further. The enhanced sub-regions and the image regions of the non-weak texture regions in the surface image are then stitched together to obtain the image to be detected. Image enhancement only on sub-regions avoids the influence of the design texture of the cover plate surface on the enhancement of subtle defects, improving the accuracy of image enhancement. Furthermore, the texture features of the non-weak texture regions are relatively obvious, eliminating the need for excessive enhancement. Finally, surface defect detection is performed based on the image to be detected. In this embodiment, existing edge detection algorithms are used for detection, and the identified defect locations are marked. Implementers can perform defect detection based on the image to be detected according to their specific implementation scenarios; no limitations are imposed here. Defect detection using the image to be detected improves the accuracy of cover plate surface defect detection.

[0032] In summary, this invention provides a method for detecting surface defects on motorcycle covers based on image detection. It obtains weak-texture regions based on the texture features of the surface image; identifies potential peak points based on the gray-level distribution features of the weak-texture regions; obtains an adaptive contrast limiting threshold based on the number of potential peak points, the gray-level interval features of the potential peak points, and the gray-level range features of the gray-level histogram; obtains a comprehensive nearest neighbor distance and sparsity based on the distribution features and number of pixels with the same gray level in the weak-texture regions; and obtains sub-regions based on the sparsity and the comprehensive nearest neighbor distance. This invention obtains a local contrast limiting threshold based on the gray-level distribution of the sub-region and its corresponding weak-texture region, and performs image enhancement; thus, it performs surface defect detection on the image to be detected, improving the accuracy of defect detection.

[0033] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0034] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

Claims

1. A method for detecting surface defects on a motorcycle cover plate based on image detection, characterized in that, The method includes the following steps: Obtain a surface image of the motorcycle cover; Weak texture region blocks are obtained based on the texture features of the surface image; suspected peak points are obtained based on the gray-level distribution features of the gray-level histogram of the weak texture region blocks; a contrast coefficient is obtained based on the number of suspected peak points, the gray-level interval features of the suspected peak points, and the gray-level range features of the gray-level histogram; and an adaptive contrast limiting threshold is obtained based on the contrast coefficient of the weak texture region blocks. The comprehensive nearest neighbor distance and sparsity are obtained based on the distribution characteristics and number of pixels with the same gray level in the weak texture region block; the partition length is obtained based on the sparsity and the comprehensive nearest neighbor distance; the weak texture region block is divided according to the partition length to obtain different sub-regions; the local contrast limit threshold of the sub-region is obtained based on the difference characteristics of the gray level distribution between the sub-region and the weak texture region block and the adaptive contrast limit threshold. Based on the local contrast limiting threshold, image enhancement is performed on all sub-regions using the CLAHE algorithm. The enhanced regions and non-weak texture regions are then stitched together to obtain the image to be detected. Surface defect detection is then performed on the image to be detected.

2. The method for detecting surface defects of a motorcycle cover plate based on image detection according to claim 1, characterized in that, The step of obtaining weak texture region blocks based on the texture features of the surface image includes: The LBP values ​​of pixels in the surface image are obtained, the variance of the LBP values ​​of pixels in each preset window region of the surface image is calculated and normalized to obtain significant texture feature values; the regions in the surface image whose significant texture feature values ​​are lower than the preset texture threshold are divided into regions using the SLIC superpixel algorithm to obtain different weak texture region blocks.

3. The method for detecting surface defects of a motorcycle cover plate based on image detection according to claim 1, characterized in that, The step of obtaining suspected peak points based on the gray-level distribution characteristics of the gray-level histogram of the weakly textured region block includes: The curve corresponding to the gray-level histogram is obtained by kernel density estimation; the suspected peak points are obtained based on the variation characteristics of the first derivative of the curve.

4. The method for detecting surface defects of a motorcycle cover plate based on image detection according to claim 1, characterized in that, The step of obtaining the contrast coefficient based on the quantity characteristics of the suspected peak points, the gray-level interval characteristics of the suspected peak points, and the gray-level range characteristics of the gray-level histogram includes: In the formula, R represents the contrast coefficient of the weak texture area block. Let N represent the number of gray levels in the weak texture region block, n represent the number of suspected peak points, and D represent the average number of gray level intervals between adjacent suspected peak points. This represents the maximum gray level of a weakly textured region. This represents the minimum gray level of a weakly textured region.

5. The method for detecting surface defects of a motorcycle cover plate based on image detection according to claim 1, characterized in that, The step of obtaining the adaptive contrast limit threshold of the weak texture region block based on the contrast coefficient includes: In the formula, K represents the adaptive contrast limit threshold of the weak texture area block, a represents the preset minimum contrast limit threshold, b represents the preset maximum contrast limit threshold, and R represents the contrast coefficient.

6. The method for detecting surface defects of a motorcycle cover plate based on image detection according to claim 1, characterized in that, The step of obtaining the comprehensive nearest neighbor distance and sparsity based on the distribution characteristics and gray level quantity characteristics of pixels with the same gray level in the weak texture region block includes: In the formula, E represents the sparsity of the weak texture region block. This indicates normalization, where G represents the number of gray levels in the weakly textured region block, and M represents the number of pixels in the weakly textured region block. This represents the minimum Euclidean distance between the m-th pixel and other pixels of the same gray level. This represents the combined nearest neighbor distance.

7. The method for detecting surface defects of a motorcycle cover plate based on image detection according to claim 1, characterized in that, The step of obtaining the partition length based on the sparsity and the comprehensive nearest neighbor distance includes: In the formula, S represents the partition length, T represents the comprehensive nearest neighbor distance, and E represents the sparsity.

8. The method for detecting surface defects of a motorcycle cover plate based on image detection according to claim 1, characterized in that, The step of dividing the weak texture region block according to the partition length to obtain different sub-regions includes: A partitioning window is constructed based on the partition length as the window side length. The weak texture region block is then divided according to the size of the partitioning window to obtain different sub-regions.

9. The method for detecting surface defects of a motorcycle cover plate based on image detection according to claim 1, characterized in that, The step of obtaining the local contrast limit threshold of the sub-region based on the difference in grayscale distribution between the sub-region and the corresponding weak texture region block, and the adaptive contrast limit threshold, includes: Calculate the ratio of the number of pixels with the most gray level in the sub-region to the total number of pixels in the sub-region to obtain a first value; calculate the ratio of the number of pixels with the most gray level in the weak texture region block to the total number of pixels in the weak texture region block to obtain a second value; calculate the ratio of the first value to the second value to obtain a first ratio; calculate the product of the first ratio and the adaptive contrast limiting threshold to obtain the local contrast limiting threshold of the sub-region.