Scratch detection method, apparatus, device and medium for transparent film

By employing techniques such as image multiplication, Sobel edge detection, and Gaussian filtering, combined with adaptive segmentation thresholds, the problems of low contrast and noise interference in transparent film scratch detection are solved, achieving efficient and accurate scratch detection results.

CN120894353BActive Publication Date: 2025-12-12ZHIYIBO INTELLIGENT TECH (SUZHOU) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511395411.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-28
Publication Date
2025-12-12
Estimated Expiration
2045-09-28

AI Technical Summary

Technical Problem

Existing methods for detecting scratches on transparent films have shortcomings in terms of detection accuracy, adaptability, and reliability. In particular, they are difficult to effectively improve the contrast between scratched areas and normal areas, and are easily affected by noise interference and uneven lighting, leading to false detections and missed detections.

Method used

By employing image multiplication processing and grayscale dynamic range mapping techniques, combined with Sobel edge detection and Gaussian filtering, and through dual-path processing of linear and logarithmic transformations, multimodal image fusion of the scratch region is performed using an adaptive segmentation threshold to improve contrast and suppress noise interference, thereby achieving efficient and accurate scratch detection.

Benefits of technology

It significantly improves the accuracy and reliability of scratch detection on transparent films, enhances the contrast of scratch edges, reduces false detection rate, adapts to the detection needs under different production conditions, and improves detection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120894353B_ABST
    Figure CN120894353B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of scratch detection method, device, equipment and medium for transparent film, comprising: first, the image multiplication processing and dynamic range mapping of transparent film gray scale image are carried out, target gray scale image is obtained by threshold segmentation;Then, the pixel gradient amplitude is calculated based on the image and is synthesized edge gradient image, first significant image is generated by Gaussian filtering and gray linear transformation;While, the original target image is logarithmically transformed to obtain second significant image;Then, the gray mean of two significant images is calculated respectively, and the adaptive segmentation threshold is determined by combining preset threshold value, the defect region is extracted by double-image threshold segmentation and intersection is obtained to obtain initial scratch area;Finally, according to preset area condition, the final scratch area is obtained by screening.This method effectively solves the problems of low contrast, uneven illumination and other problems in transparent film scratch detection by multi-feature fusion and adaptive threshold technology, significantly improves the detection efficiency and accuracy, and has high engineering application value.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of visual detection, and in particular to a scratch detection method, device, equipment and medium for a transparent film. BACKGROUND

[0002] The transparent film is widely used in many industries due to its lightness, flexibility, high light transmission and other good characteristics. The transparent film is an important component for making flexible screen protection films, and is often used in folding screens and curved screens in the display field. If there are scratches on the transparent film, the overall display effect of the screen will be affected, so it is necessary to detect the scratches on the transparent film.

[0003] The scratch detection of the transparent film is an important link in the quality control of the production process. The traditional detection method mainly relies on manual visual inspection, which is low in efficiency and accuracy, and is easily affected by subjective factors, and is difficult to meet the needs of modern industrial production for high-efficiency and high-precision detection. At present, the transparent film scratch detection mainly faces the following technical difficulties:

[0004] (1) Low contrast problem: the scratch of the transparent film is close to the refractive index of the substrate, and the contrast is very low under conventional optical imaging, and it is difficult to extract slight scratches through traditional threshold segmentation method;

[0005] (2) Noise interference: dust, ripples or uneven light on the surface of the film will produce false defect signals, which is easy to cause the false detection rate to rise;

[0006] (3) Lack of adaptability: the existing method is difficult to detect both obvious scratches and fine scratches, and lacks a defect enhancement mechanism for multi-feature fusion.

[0007] With the development of image processing technology, the automatic detection method based on machine vision has gradually become a research hotspot. For example, Chinese patent document CN119273684A proposes a covering film surface defect detection method based on machine vision, which gradually optimizes the segmentation threshold in the iterative updating process of the Otsu algorithm, calculates the scratch segmentation coefficient and the quantitative value of the segmentation effect by using the fitting curve and clustering technology, and selects the best segmentation threshold for image segmentation. However, this method is mainly aimed at the overall defects of the film, and has not been optimized for the scratch, which is a common and important defect type.

[0008] Chinese patent document CN117218122B proposes a watch shell quality detection method based on image data. This method improves the non-maximum suppression of the Canny operator, analyzes the weight of the gradient of each pixel point in different directions, adjusts the gradient size by combining the degree of light influence, improves the sensitivity of edge detection to scratch areas, and reduces the sensitivity to reflective areas. However, this method is sensitive to image contrast and noise, and is prone to false positives and false negatives.

[0009] Chinese patent document CN117058137B introduces a visual detection method for the production quality of laminated glass. This method uses a sliding window technique to detect the edges of the laminated glass grayscale image, obtains the initial gradient segmentation threshold value of each pixel point, and corrects it according to the difference in gradient segmentation threshold value. The corrected threshold value is used to identify the bubble edge pixel points, and then the production quality of laminated glass is detected. However, the threshold selection of this method mainly depends on experience and lacks adaptability, making it difficult to adapt to detection needs under different production conditions.

[0010] In summary, the existing scratch detection methods still have room for improvement in terms of detection accuracy, adaptability, and reliability. In particular, for transparent films with low contrast and inconspicuous scratch features, how to effectively improve the contrast between scratch areas and normal areas and reduce false positives and false negatives is a technical problem that needs to be solved urgently. SUMMARY

[0011] The main purpose of the present application is to provide a scratch detection method for transparent films, which can achieve accurate and efficient automatic detection of different degrees of scratch defects on the surface of transparent films during production and manufacturing, greatly improving the efficiency of transparent film scratch defect detection and the accuracy and reliability of the detection results.

[0012] The present application achieves the above-mentioned purposes through the following technical solutions: a scratch detection method for transparent films, comprising the following steps:

[0013] S1: Collecting a plurality of transparent film grayscale images;

[0014] S2: Performing image multiplication processing on the transparent film grayscale images to obtain a first target image. The minimum and maximum gray values of the pixels in the first target image are mapped to a new gray dynamic range to obtain a second target image. The second target image is subjected to threshold segmentation to extract the effective product area, which is then mapped onto the transparent film grayscale image to obtain a target grayscale image;

[0015] S3: Performing Sobel edge detection on the pixels in the target grayscale image, calculating the gradient amplitude in the horizontal and vertical directions respectively, and synthesizing the gradient amplitudes in the two directions to obtain an edge gradient image;

[0016] S4: After performing Gaussian filtering on the edge gradient image, calculate the overall image grayscale mean. Determine the first grayscale threshold and the second grayscale threshold based on the overall image grayscale mean. Use the first grayscale threshold and the second grayscale threshold to perform grayscale linear transformation on the edge gradient image to obtain the first salient image.

[0017] S5: Based on the pixel grayscale values ​​in the target grayscale image, perform a logarithmic transformation on the target grayscale image to obtain the second salient image;

[0018] S6: Calculate the mean gray value of the first salient image and the second salient image respectively, and determine the adaptive segmentation threshold of the first salient image and the second salient image based on the mean gray value of the two images and the preset salient threshold.

[0019] S7: The first salient image and the second salient image are subjected to threshold segmentation processing using the adaptive segmentation threshold. The intersection of the defect regions extracted from the two is processed to obtain the initial scratch region. The initial scratch region is then filtered according to the preset judgment conditions to obtain the final scratch region.

[0020] Preferably, in step S2, obtaining the first target image includes:

[0021] Let any grayscale image of a transparent thin film be... The position of each pixel in the grayscale image of the transparent film The grayscale value is multiplied by itself, and the result is scaled and shifted to obtain the first target image. The calculation formula is:

[0022] ,

[0023] In the formula This indicates that the output of the first target image is in pixels. The grayscale value at the location, This indicates that the grayscale image of the input transparent film is in pixels. The grayscale value at the location, Indicates the scaling factor. Indicates the offset;

[0024] If the calculated grayscale value of a pixel in the first target image is lower or higher than the value range of the current image data type, then the grayscale value is the minimum or maximum value of that data type.

[0025] Preferably, in step S2, obtaining the second target image includes:

[0026] For any first target image , first traversing all the pixel points in the first target image to obtain the minimum gray value and the maximum gray value actually existing in the current image, mapping the minimum gray value and the maximum gray value into a new gray dynamic range, the new gray dynamic range selecting the minimum value 0 and the maximum value 255 supported by the current image data type, converting each pixel in the first target image to obtain the second target image , the calculation formula is:

[0027] , ,

[0028] ,

[0029] In the formula, represents the gray value of the second target image at the pixel position, represents the gray value of the first target image at the pixel position, represents the minimum gray value of the pixel in the first target image, represents the maximum gray value of the pixel in the first target image.

[0030] Preferably, in step S3, the obtaining of the edge gradient image comprises:

[0031] For any one of the second target images, the effective product area is extracted by threshold segmentation processing, and is mapped on the transparent film gray image to obtain a target gray image. According to the target gray image, a fixed size convolution kernel is used to traverse the entire image area, an edge detection is performed by using a Sobel operator, a gradient amplitude value in horizontal and vertical directions of each pixel is calculated respectively, an edge gradient image is obtained by performing an absolute value weighted summation on the gradient amplitude values in the two directions, and the synthesis method is:

[0032] ,

[0033] In the formula, represents a new gradient amplitude value synthesized by the edge gradient image at the pixel position, represents a weight coefficient, represents a gradient amplitude value in the horizontal direction x of the target gray image at the pixel position, represents a gradient amplitude value in the vertical direction y of the target gray image at the pixel position.

[0034] Preferably, in step S4, the obtaining of the first saliency image comprises:

[0035] For any one edge gradient image, a Gaussian filter is used for processing to filter out granular noise area to obtain a pre-processed image, the overall image gray mean value Mean is calculated according to the pre-processed image traversing all pixels, the first gray threshold and the second gray threshold are determined according to the overall image gray mean value, the first gray threshold is recorded as Mean-a, which represents a number lower than the overall image gray mean value by a constant a, the second gray threshold is recorded as Mean+b, which represents a number higher than the overall image gray mean value by a constant b, the first gray threshold and the second gray threshold are used for gray linear transformation of the edge gradient image to map to a target gray range to obtain a first saliency image, the calculation formula is:

[0036] ,

[0037] In the formula, represents the pixel gray value of the output first saliency image at , represents the pixel gray value of the input edge gradient image at , represents the first gray threshold, represents the second gray threshold, represents the minimum gray value of the target gray range, represents the maximum gray value of the target gray range.

[0038] Preferably, in step S5, the obtaining of the second saliency image comprises:

[0039] The gray value of any one of the target gray image is logarithmically converted to obtain a second saliency image, the calculation formula is:

[0040] ,

[0041] ,

[0042] In the formula, represents the pixel gray value of the output second saliency image at after logarithmic conversion, represents the pixel gray value of the input target gray image at , represents the maximum pixel gray value in the input target gray image, represents a normalization constant, represents the base of logarithm.

[0043] Preferably, in step S6, the obtaining of the adaptive segmentation threshold comprises:

[0044] According to the first and second saliency images, a width of the first saliency image in a horizontal direction is calculated, the first saliency image is averagely divided into N image regions in a vertical direction, a mean gray value of each image region is calculated, an adaptive segmentation threshold of a current image region is obtained according to the mean gray value plus a preset saliency threshold, and all adaptive segmentation thresholds of the first saliency image are obtained by traversing from the first image region to the Nth image region.

[0045] Preferably, in step S7, the obtaining of the final scratch region comprises:

[0046] According to the adaptive segmentation thresholds of the first and second saliency images obtained in step S6, threshold segmentation processing is performed on the image regions divided in the first and second saliency images respectively, all defect regions extracted from the first saliency image and all defect regions extracted from the second saliency image are intersected to obtain an initial scratch region, the initial scratch region is screened according to a preset judgment condition to obtain a final scratch region, the preset judgment condition is judged in a manner of setting a scratch region area threshold, the area of each obtained initial scratch region is calculated, if the area is greater than or equal to the set scratch region area threshold, the scratch region is output; if the area is less than the set scratch region area threshold, the scratch region is not output.

[0047] Another object of the present application is to provide a scratch detection device for transparent film, comprising:

[0048] An image acquisition device is configured to acquire a plurality of gray scale images of the transparent film.

[0049] An image multiplication processing module is configured to perform image multiplication processing on the acquired gray scale images of the transparent film to obtain a first target image, and map the minimum and maximum gray scale values of the pixels in the first target image into a new gray scale dynamic range to obtain a second target image.

[0050] A threshold segmentation extraction module is configured to perform threshold segmentation extraction on the second target image to obtain an effective product region, and map the effective product region on the gray scale image of the transparent film to obtain a target gray scale image.

[0051] An edge detection module is configured to perform Sobel edge detection on the pixels in the target gray scale image to calculate the gradient amplitudes in the horizontal and vertical directions respectively, and synthesize the gradient amplitudes in the two directions to obtain an edge gradient image.

[0052] A Gaussian filter processing module is configured to calculate the overall image gray scale mean value after Gaussian filter processing based on the edge gradient image, and determine a first gray scale threshold and a second gray scale threshold according to the overall image gray scale mean value.

[0053] The gray scale linear transformation processing module is configured to perform gray scale linear transformation on the edge gradient image by using the first gray scale threshold and the second gray scale threshold to obtain a first saliency image.

[0054] The logarithmic transformation processing module is configured to perform logarithmic transformation processing on the target gray scale image according to pixel gray scale values in the target gray scale image to obtain a second saliency image.

[0055] The adaptive segmentation threshold determination module is configured to calculate gray scale means of the first saliency image and the second saliency image respectively, and determine an adaptive segmentation threshold of the first saliency image and the second saliency image according to the gray scale means of the two images and a preset saliency threshold.

[0056] The scratch extraction module is configured to perform threshold segmentation processing on the first saliency image and the second saliency image respectively by using the adaptive segmentation threshold, and obtain an initial scratch region by taking an intersection of defect regions extracted from the two images, and screen the initial scratch region according to a preset judgment condition to obtain a final scratch region.

[0057] Another purpose of the present application is to provide a scratch detection device for a transparent film, comprising:

[0058] The memory is used for storing the computer program.

[0059] The processor is used for executing the computer program to realize the scratch detection method for the transparent film as described above.

[0060] Compared with the prior art, the scratch detection method, device, equipment and medium for the transparent film have the following beneficial effects: different degrees of scratch defects existing on the surface of the transparent film will have different image features presented on the image, the contrast of the obvious scratch region is high, and the contrast of the slight scratch defect is low, and the traditional threshold segmentation method cannot effectively segment them out; the target gray scale image of the present application obtains a first saliency image and a second saliency image in turn through two image processing methods, which can improve the contrast between the scratch defect region and the normal region on the corresponding image, takes the intersection of the defect regions extracted from the first saliency image and the second saliency image as the scratch region, improves the accuracy and reliability of the scratch detection result of the transparent film, and screening according to the preset judgment condition can meet the control requirements under different actual production conditions.

[0061] (1) Enhance the defect contrast: through image multiplication processing and gray scale dynamic range mapping technology, effectively pull apart the gray scale difference between the transparent film region and the background, combined with Sobel edge detection and gradient enhancement of Gaussian filter, significantly improve the contrast of the scratch edge, solve the problem that the traditional method is not sensitive to low contrast scratch detection;

[0062] (2) Multi-modal image fusion: Linear transformation and logarithmic transformation dual-path processing are adopted, which respectively compresses the highlight area and expands the dark area details, overcomes the image quality difference caused by uneven illumination and material warping, so that the scratch features in different brightness areas are enhanced, and the detection robustness is significantly improved;

[0063] (3) Adaptive threshold segmentation: The gray mean value is calculated by partitioning and combined with dynamic threshold adjustment, which effectively suppresses the false detection caused by the uneven gray of the film movement direction, and further eliminates noise interference by taking the intersection of the defect areas of the double saliency images, and improves the scratch positioning accuracy;

[0064] (4) Strong process compatibility: The preset judgment condition supports flexible configuration (such as area threshold), which can adapt to the differentiated control requirements of different production lines for slight / severe scratches, and the actual application scene adaptability is better than that of the fixed threshold segmentation method;

[0065] (5) Computational efficiency optimization: Background elimination and partitioning processing reduce redundant calculation, improve algorithm execution efficiency while ensuring detection accuracy, and are more suitable for industrial real-time detection scenarios. BRIEF DESCRIPTION OF DRAWINGS

[0066] Figure 1 is a flowchart of the scratch detection method for a transparent film in embodiment one of the present application;

[0067] Figure 2 is a principle diagram of the scratch detection device for a transparent film in embodiment two of the present application. DETAILED DESCRIPTION

[0068] In order to further illustrate the technical means and effects adopted by the present application to achieve the predetermined invention purpose, the specific implementation, structure, features and effects of a scratch detection method for a transparent film according to the present application are described in detail as follows. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, the specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.

[0069] 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 the present application belongs.

[0070] Embodiment one:

[0071] The transparent film surface has different degrees of scratch defects, and the defect characteristics presented on the image have differences. The contrast of the weak scratch defects on the image is low. The traditional method cannot effectively segment out the slight scratch defects by threshold segmentation on the transparent film image. Therefore, the embodiment provides a scratch detection method for a transparent film. The specific scheme of the scratch detection method for the transparent film is specifically described below with reference to the drawings.

[0072] Please refer to Figure 1 which shows a step flow chart of a scratch detection method for a transparent film provided by an embodiment of the present application. The method comprises the following steps:

[0073] Step S1: acquiring a plurality of transparent film gray scale images by a camera. The specific process is as follows:

[0074] An industrial camera is used to shoot a plurality of images of the transparent film. A plurality of gray scale images obtained by performing gray scale processing on each of the acquired images are recorded as the transparent film gray scale images. The gray scale processing is a known technology, and will not be described herein.

[0075] At this point, the transparent film gray scale images of all the transparent films are obtained by the above method.

[0076] Step S2: performing image multiplication processing according to the acquired transparent film gray scale images to obtain a new image recorded as a first target image. The minimum gray scale value and the maximum gray scale value of the pixels in the first target image are mapped to a new gray scale dynamic range to obtain a new image recorded as a second target image. The second target image is subjected to threshold segmentation to extract an effective product region, and the effective product region is mapped on the transparent film gray scale image to obtain a new image recorded as a target gray scale image.

[0077] It should be noted that the transparent film is made of a plurality of optical films made of transparent materials. The gray scale difference between the actual product image region and the background region of the transparent film in the gray scale image collected by the industrial camera is very small. In order to effectively process the product region, the redundant background region needs to be removed to increase the contrast difference between the two and reduce unnecessary data calculation. The target gray scale image obtained by image processing is used for subsequent analysis and processing.

[0078] Specifically, taking any one transparent film gray scale image as an example, the gray scale value corresponding to each pixel in the transparent film gray scale image is multiplied by itself to obtain a new image recorded as a first target image, wherein the specific calculation formula is as follows:

[0079] ;

[0080] In the formula, This indicates that the output of the first target image is in pixels. The grayscale value at the location, This indicates that the grayscale image of the input transparent film is in pixels. The grayscale value at the location, This represents the scaling factor, with a value range of -255 to 255. This embodiment uses... Let's take an example to illustrate. This represents the offset, with a value ranging from -512 to 512. This embodiment uses... Taking this example, if the calculated grayscale value of a pixel in the first target image is lower or higher than the value range of the current image data type, the grayscale value will be forced to the minimum or maximum value of that data type. In this embodiment, the acquired image data type is byte, and the corresponding value range is 0~255. The grayscale value of pixels in the background area is fixed, while the grayscale value of pixels in the transparent film is changing. The first target image can highlight the difference in grayscale values ​​between the two, emphasizing the actual product area of ​​the transparent film, facilitating further processing. It should be noted that image multiplication is a known technique and will not be elaborated upon in this embodiment.

[0081] Furthermore, after acquiring the first target image, all pixels in the first target image are traversed to obtain the minimum and maximum grayscale values ​​that actually exist in the current image. These minimum and maximum grayscale values ​​are then mapped to a new grayscale dynamic range. The new grayscale dynamic range is selected from the minimum value of 0 and the maximum value of 255 supported by the current image data type. The new image obtained by transforming each pixel in the first target image is denoted as the second target image. The specific calculation formula is as follows:

[0082] , ;

[0083] ;

[0084] In the formula Indicates the second target image in pixels grayscale value at the location, Indicates the first target image in pixels The grayscale value at the location, This represents the minimum grayscale value of a pixel in the first target image. represents the maximum gray value of pixels in the first target image; the obtained second target image will make the background area darker and the transparent film area brighter, and the difference in the gray values of the two areas will be further enlarged, and finally the effective product area of the transparent film is extracted according to the second target image through threshold segmentation processing, and is mapped on the transparent film gray image to obtain a new image, which is denoted as a target gray image. The threshold segmentation is a known technology, and will not be described herein.

[0085] At this point, the target gray image of the transparent film is obtained through the above method.

[0086] Step S3: Sobel edge detection is performed on the pixel points in the target gray image to calculate the gradient amplitudes in the horizontal and vertical directions respectively, and the gradient amplitudes in the two directions are combined to obtain a new image, which is denoted as an edge gradient image.

[0087] It should be noted that there are light, medium and heavy scratches of different degrees on the surface of the transparent film, and the defect characteristics presented on the obtained target gray image will have differences. The commonality of these scratch defects is that the pixel gray values at the edges change greatly. The edge gradients of the pixel points in the horizontal and vertical directions of the image are calculated by using this commonality, and the gradient amplitudes in the two directions are combined to obtain a value for measuring the degree of change of the pixel gray value. This value is used for subsequent positioning of the scratch area on the target gray image.

[0088] Specifically, taking the target gray image of any transparent film as an example, a fixed size convolution kernel is used to traverse the entire image area in the target gray image. In this embodiment, a 3*3 size convolution kernel is taken as an example for description, Sobel operator is used for edge detection, and the gradient amplitudes in the horizontal and vertical directions of each pixel are calculated respectively. A new image obtained by combining the gradient amplitudes in the two directions is denoted as an edge gradient image. The specific combination method is as follows:

[0089] ;

[0090] In the formula, represents the new gradient amplitude synthesized by the edge gradient image at the pixel position, represents a weight coefficient, which is taken as 0.5 in this embodiment, represents the gradient amplitude of the horizontal direction x calculated by the target gray image at the pixel position, represents the gradient amplitude of the vertical direction y calculated by the target gray image at the pixel The gradient amplitude of the position calculation vertical direction y is obtained by performing absolute value weight summation on the gradient amplitudes in the horizontal and vertical directions, and the greater the value, the more obvious the scratch edge. The Sobel operator edge detection is a known technology, and will not be described herein.

[0091] At this point, the edge gradient image of the transparent film is obtained by the above method.

[0092] Step S4: calculating the overall image gray mean value after Gaussian filtering processing according to the edge gradient image, determining the first gray threshold and the second gray threshold according to the overall image gray mean value, and obtaining the first saliency image by performing gray linear transformation on the edge gradient image using the first gray threshold and the second gray threshold.

[0093] It should be noted that the transparent film has granular point interference on the collected image due to the nature of the internal material, and these interference points need to be filtered out in subsequent image processing, while the edge details of the scratch defect to be extracted are also needed to be retained as much as possible. On the other hand, according to the characteristics of the scratch defects of different degrees shown on the obtained edge gradient image, the gray value changes of part of the scratch defect regions will be distributed in a relatively small range, resulting in unclear details, which will cause the scratch defect region to be difficult to extract. In order to further expand the gray change range and make the defect information in the image more obvious, the gray linear transformation is used to enlarge the gray difference between the normal product region and the defect region, so that the subsequent segmentation of the defect region is more accurate.

[0094] Specifically, taking the edge gradient image of any transparent film as an example, a new image obtained after filtering some granular points by using Gaussian filtering is recorded as a preprocessed image, the overall image gray mean value Mean is calculated according to the preprocessed image, the first and second gray thresholds are determined according to the overall image gray mean value, the first gray threshold is recorded as Mean-a, which represents a number lower than the overall image gray mean value by a constant a, and the second gray threshold is recorded as Mean+b, which represents a number higher than the overall image gray mean value by a constant b, and the first and second gray thresholds are used for gray linear transformation, which is mapped to the target gray range The new image is recorded as the first saliency image, and the specific calculation formula is:

[0095] ;

[0096] In the formula, represents the pixel gray value of the output first saliency image in represents the pixel gray value of the input edge gradient image in ​pixel grayscale values, This represents the first grayscale threshold. This indicates the second grayscale threshold. This represents the minimum grayscale value within the target grayscale range. This represents the maximum grayscale value within the target grayscale range. In this embodiment, it is used as... , Taking the image as an example, by using the overall image grayscale mean as a benchmark to determine the first and second grayscale thresholds, the grayscale values ​​within the range of the first and second grayscale thresholds are evenly distributed. This makes the originally subtle grayscale differences in the image larger and more obvious, thereby significantly improving the visual contrast of the image. It should be noted that Gaussian filtering is a well-known technique, and will not be described in detail in this embodiment.

[0097] Thus, the first significant image of the transparent film is obtained through the above method.

[0098] Step S5: Based on the pixel grayscale values ​​in the target grayscale image, perform a logarithmic transformation on the target grayscale image, and the resulting new image is denoted as the second salient image.

[0099] It should be noted that when using an industrial camera to capture images, the amount of light entering the center and edge areas of the lens differs. Additionally, the transparent film material is relatively soft and its surface may warp, resulting in an uneven image. The areas on the sides of the image will be darker than the center. While linear grayscale transformation can change the grayscale value of each pixel, linearly mapping the original grayscale range to a new specified grayscale range, this method strictly maintains the relative grayscale relationship between pixels and does not significantly enhance the detail in dark areas of the image. To balance the presence of both bright and dark areas in the image, logarithmic transformation is used to compress the grayscale values ​​of bright areas while expanding the dynamic range of grayscale in dark areas under low brightness, thereby significantly enhancing the detail and contrast of dark areas in the image.

[0100] Specifically, taking any grayscale image of a transparent film as an example, the grayscale values ​​of all pixels in the target grayscale image are logarithmically transformed, and the resulting image is denoted as the second salient image. The specific calculation formula is as follows:

[0101] ;

[0102] ;

[0103] In the formula, This indicates that the output of the second salient image is in The pixel grayscale value after logarithmic transformation Indicates the input target grayscale image in pixel grayscale values, represents the maximum pixel gray value in the input target gray image, represents a normalization constant, represents the base of the logarithm, and in the embodiment The value of the natural logarithm e is described by taking the value of the natural logarithm e as an example; +1 is to avoid the case of taking the logarithm of zero, and the normalization constant is to map the new gray value after the logarithmic conversion of each pixel gray value to the current image data type 0~255 range.

[0104] At this point, the second saliency image of the transparent film is obtained by the above method.

[0105] Step S6: Calculate the gray mean values of the first saliency image and the second saliency image respectively according to the first saliency image and the second saliency image, and determine the adaptive segmentation threshold of the first saliency image and the second saliency image according to the gray mean values of the two images and a preset saliency threshold.

[0106] It should be noted that there will be a case of non-uniform gray on the transparent film gray image collected by the camera, and direct threshold segmentation on the obtained first saliency image and second saliency image will cause some unnecessary regions to be extracted. The direction of this non-uniform gray change is along the moving direction of the transparent film, so the entire image region is divided into multiple regions for analysis according to this direction.

[0107] Specifically, according to the first saliency image and the second saliency image, taking the first saliency image as an example, the width of the first saliency image in the horizontal direction is calculated, and the N image regions are divided by averaging in the vertical direction. In the embodiment, N=10 is taken as an example for description, the gray mean value of each image region is calculated, and the adaptive segmentation threshold of the current image region is obtained by adding the preset saliency threshold according to the calculated gray mean value. In the embodiment, the preset saliency threshold is set to 60, and all adaptive segmentation thresholds under the first saliency image are obtained by traversing from the first image region to the tenth image region; similarly, all adaptive segmentation thresholds under the second saliency image are obtained.

[0108] At this point, all adaptive segmentation thresholds of the first saliency image and the second saliency image are obtained by the above method.

[0109] Step S7: The adaptive segmentation threshold is used for threshold segmentation processing of the first saliency image and the second saliency image respectively, and the intersection processing of the defect regions extracted by the two is performed to obtain the initial scratch region, and the final scratch region is obtained by screening the initial scratch region according to a preset determination condition.

[0110] Specifically, according to all adaptive segmentation thresholds of the first saliency image and the second saliency image obtained in step S6, threshold segmentation processing is performed on the image regions divided in the first saliency image and the second saliency image respectively, all defect regions extracted from the first saliency image and all defect regions extracted from the second saliency image are intersected to obtain a scratch region, and the scratch region is filtered according to a preset determination condition to obtain a final scratch region. In this embodiment, the preset determination condition is judged by setting a scratch region area threshold, and the area of each obtained scratch region is calculated in sequence. If the area is greater than or equal to the set scratch region area threshold, the scratch region is output; if the area is less than the set scratch region area threshold, the scratch region is not output.

[0111] At this point, the scratch defect in the transparent film gray image is obtained by the above method.

[0112] The above only describes preferred embodiments of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

[0113] Embodiment two:

[0114] Please refer to Figure 2 The embodiment provides a scratch detection device for a transparent film, which comprises:

[0115] An image acquisition device acquires a plurality of transparent film gray images;

[0116] An image multiplication processing module is configured to perform image multiplication processing on the acquired transparent film gray images to obtain a first target image, and map the minimum gray value and the maximum gray value of the pixels in the first target image into a new gray dynamic range to obtain a second target image;

[0117] A threshold segmentation extraction module is configured to perform threshold segmentation extraction on the second target image to obtain an effective product region, and map the effective product region on the transparent film gray image to obtain a target gray image;

[0118] An edge detection module is configured to perform Sobel edge detection on the pixels in the target gray image to calculate the gradient amplitudes in the horizontal and vertical directions respectively, and synthesize the gradient amplitudes in the two directions to obtain an edge gradient image;

[0119] A Gaussian filter processing module is configured to calculate the overall image gray mean value after Gaussian filter processing on the edge gradient image, and determine a first gray threshold and a second gray threshold according to the overall image gray mean value;

[0120] The gray scale linear transformation processing module is configured to perform gray scale linear transformation on the edge gradient image by using the first gray scale threshold and the second gray scale threshold to obtain a first saliency image.

[0121] The logarithmic transformation processing module is configured to perform logarithmic transformation processing on the target gray scale image according to pixel gray scale values in the target gray scale image to obtain a second saliency image.

[0122] The adaptive segmentation threshold determination module is configured to calculate gray scale means of the first saliency image and the second saliency image respectively, and determine adaptive segmentation thresholds of the first saliency image and the second saliency image according to the gray scale means of the two images and a preset saliency threshold.

[0123] The scratch extraction module is configured to perform threshold segmentation processing on the first saliency image and the second saliency image respectively by using the adaptive segmentation thresholds, and obtain an initial scratch region by taking an intersection of defect regions extracted from the two images, and obtain a final scratch region by screening the initial scratch region according to a preset judgment condition.

[0124] Embodiment three:

[0125] The embodiment provides a scratch detection device for a transparent film, which comprises:

[0126] A memory is configured to store a computer program.

[0127] A processor is configured to execute the computer program to implement a scratch detection method for a transparent film, wherein the scratch detection method for the transparent film is the same as the method steps in the embodiment one.

[0128] Embodiment four:

[0129] The embodiment provides a computer readable storage medium, and a computer program stored on the computer readable storage medium, wherein the computer program is executed by a processor to implement a scratch detection method for a transparent film, and the scratch detection method for the transparent film is the same as the method steps in the embodiment one.

[0130] The above only describes the preferred embodiments of the present application and should not be used to limit the present application, and any modification, equivalent replacement, improvement, etc. made within the principles of the present application should be included in the protection scope of the present application.

Claims

1. A method for scratch detection of a transparent film, characterized by, The method comprises the following steps: S1: collecting a plurality of transparent film gray scale images; S2: performing image multiplication processing on the transparent film gray scale images to obtain a first target image, mapping the minimum gray scale value and the maximum gray scale value of the pixels in the first target image into a new gray scale dynamic range to obtain a second target image, performing threshold segmentation on the second target image to extract an effective product region, and mapping the effective product region on the transparent film gray scale image to obtain a target gray scale image; The first target image is obtained by: Let any one transparent film gray scale image be The gray scale value of each pixel position in the transparent film gray scale image is multiplied by itself, and the multiplication result is scaled and offset to obtain a first target image The calculation formula is: ​ , wherein denotes the output first target image gray value at pixel position, denotes the input transparent film gray scale image gray value at pixel position, denotes the scaling factor, denotes the offset; If the calculation result of the gray scale value of the pixels in the first target image is lower than or higher than the value range of the current image data type, the gray scale value is the minimum value or the maximum value of the data type; The second target image is obtained by: For any one of the first target image , first traverse all the pixel points in the first target image to obtain the minimum and maximum gray values actually existing in the current image, and map the minimum and maximum gray values to a new gray dynamic range, the minimum value 0 and the maximum value 255 supported by the current image data type are selected as the new gray dynamic range, and each pixel in the first target image is converted to obtain the second target image , the calculation formula is: , , , wherein denotes the gray value of the second target image at pixel position, denotes the gray value of the first target image at pixel position, denotes the minimum gray value of a pixel in the first target image, denotes the maximum gray value of a pixel in the first target image; S3: performing Sobel edge detection on the pixels in the target gray scale image, calculating the gradient amplitudes in the horizontal and vertical directions respectively, and synthesizing the gradient amplitudes in the two directions to obtain an edge gradient image; S4: calculating the overall image gray scale mean value after performing Gaussian filtering processing on the edge gradient image, determining a first gray scale threshold and a second gray scale threshold according to the overall image gray scale mean value, and performing gray scale linear transformation on the edge gradient image by using the first gray scale threshold and the second gray scale threshold to obtain a first saliency image; S5: performing logarithmic transformation processing on the target gray scale image according to the pixel gray scale value in the target gray scale image to obtain a second saliency image; S6: calculating the gray scale means of the first saliency image and the second saliency image respectively, and determining an adaptive segmentation threshold of the first saliency image and the second saliency image according to the gray scale means of the two images and a preset saliency threshold; S7: performing threshold segmentation processing on the first saliency image and the second saliency image by using the adaptive segmentation threshold, taking the intersection of the defect regions extracted from the two images to obtain an initial scratch region, and screening the initial scratch region according to a preset judgment condition to obtain a final scratch region.

2. The method for scratch detection of a transparent film according to claim 1, wherein In step S3, the edge gradient image is obtained by: For any one of the second target images, an effective product region is extracted by threshold segmentation processing, and the effective product region is mapped on the transparent film gray scale image to obtain a target gray scale image. The entire image region is traversed by using a fixed-size convolution kernel in the target gray scale image, edge detection is performed by using a Sobel operator, the gradient amplitudes of each pixel in the horizontal and vertical directions are calculated respectively, the edge gradient image is obtained by performing absolute value weight summation on the gradient amplitudes in the two directions, and the synthesis method is: , wherein denotes the new gradient magnitude resulting from the synthesis of the edge gradient image at pixel position x, y, denotes the weight coefficient, denotes the gradient magnitude in horizontal direction x calculated for the target gray scale image at pixel position x, y, denotes the gradient magnitude in vertical direction y calculated for the target gray scale image at pixel position x, y.

3. The method for scratch detection of a transparent film according to claim 1, wherein In step S4, the first saliency image is obtained by: For any one edge gradient image, a Gaussian filter is used for processing, and a pretreatment image is obtained after filtering out granular noise areas. According to the pretreatment image, the overall image gray mean value Mean is calculated by traversing all pixels. According to the overall image gray mean value, the first gray threshold and the second gray threshold are determined. The first gray threshold is denoted as Mean-a, which represents a number lower than the overall image gray mean value by a constant a. The second gray threshold is denoted as Mean+b, which represents a number higher than the overall image gray mean value by a constant b. The first gray threshold and the second gray threshold are used for gray linear transformation of the edge gradient image, which is mapped to a target gray range to obtain a first saliency image, and the calculation formula is: , wherein represents a pixel gray value of the output first saliency image at represents a pixel gray value of the input edge gradient image at represents a first gray threshold value, represents a second gray threshold value, represents a minimum gray value of a target gray range, represents a maximum gray value of the target gray range.​​ 4. The method for scratch detection of a transparent film according to claim 1, wherein In step S5, the second saliency image is obtained by: The gray scale values of all the pixels in any one of the target gray scale images are logarithmically converted to obtain a second saliency image, and the calculation formula is: , , In the formula, represents the pixel gray value of the output second saliency image in the logarithmic transformation of the pixel gray value, represents the pixel gray value of the input target gray image in the logarithmic transformation of the pixel gray value, represents the maximum pixel gray value in the input target gray image, represents a normalization constant, represents the base of the logarithm.

5. The method for scratch detection of a transparent film according to claim 1, wherein In step S6, the adaptive segmentation threshold is obtained by: According to the first and second saliency images, a width of the first saliency image in a horizontal direction is calculated, the first saliency image is averagely divided into N image regions in a vertical direction, a mean gray value of each image region is calculated, an adaptive segmentation threshold of a current image region is obtained according to the mean gray value plus a preset saliency threshold, and all adaptive segmentation thresholds of the first saliency image are obtained by traversing from the first image region to the Nth image region.

6. The method for scratch detection of a transparent film according to claim 1, wherein In step S7, the obtaining of the final scratch region comprises: According to the adaptive segmentation thresholds of the first and second saliency images obtained in step S6, threshold segmentation processing is performed on the image regions divided in the first and second saliency images respectively, all defect regions extracted from the first saliency image and all defect regions extracted from the second saliency image are intersected to obtain an initial scratch region, and the initial scratch region is filtered according to a preset judgment condition to obtain the final scratch region. The preset judgment condition is judged in a manner of setting a scratch region area threshold, the area of each obtained initial scratch region is calculated, if the area is greater than or equal to the set scratch region area threshold, the scratch region is output; if the area is less than the set scratch region area threshold, the scratch region is not output.

7. A scratch detection device for a transparent film, characterized by Comprise: An image acquisition device is configured to obtain a plurality of transparent film gray scale images; An image multiplication processing module is configured to perform image multiplication processing on the obtained transparent film gray scale images to obtain a first target image, and map the minimum and maximum gray scale values of the pixels in the first target image into a new gray scale dynamic range to obtain a second target image; The obtaining of the first target image comprises: An arbitrary transparent film gray scale image is set as The gray scale value of each pixel position in the transparent film gray scale image is multiplied by itself, and the multiplication result is scaled and offset to obtain a first target image The calculation formula is as follows: ​ , wherein represents the gray value of the output first target image at pixel position, represents the gray value of the input transparent film gray scale image at pixel position, represents a scaling factor, represents an offset; If the calculation result of the gray scale value of the pixel in the first target image is lower than or higher than the value range of the current image data type, the gray scale value is the minimum or maximum value of the data type; The obtaining of the second target image comprises: For any one of the first target image , first traverse all the pixel points in the first target image to obtain the minimum and maximum gray values actually existing in the current image, and map the minimum and maximum gray values to a new gray dynamic range, the minimum value 0 and the maximum value 255 supported by the current image data type are selected as the new gray dynamic range, and each pixel in the first target image is converted to obtain the second target image , the calculation formula is: , , , wherein denotes the gray value of the second target image at pixel position, denotes the gray value of the first target image at pixel position, denotes the minimum gray value of a pixel in the first target image, denotes the maximum gray value of a pixel in the first target image; A threshold segmentation extraction module is configured to perform threshold segmentation extraction on the second target image to obtain an effective product region, and map the effective product region on the transparent film gray scale image to obtain a target gray scale image; An edge detection module is configured to perform Sobel edge detection on the pixels in the target gray scale image to calculate the gradient amplitudes in the horizontal and vertical directions respectively, and synthesize the gradient amplitudes in the two directions to obtain an edge gradient image; A Gaussian filter processing module is configured to calculate the overall image gray scale mean value after Gaussian filter processing on the edge gradient image, and determine a first gray scale threshold and a second gray scale threshold according to the overall image gray scale mean value; A gray scale linear transformation processing module is configured to perform gray scale linear transformation on the edge gradient image by using the first and second gray scale thresholds to obtain a first saliency image; A logarithmic transformation processing module is configured to perform logarithmic transformation processing on the target gray scale image according to the pixel gray scale values in the target gray scale image to obtain a second saliency image; The adaptive segmentation threshold determination module is configured to calculate the gray mean values of the first and second saliency images respectively, and determine the adaptive segmentation threshold of the first and second saliency images according to the gray mean values of the two images and a preset saliency threshold; The scratch extraction module is configured to perform threshold segmentation processing on the first and second saliency images respectively by using the adaptive segmentation threshold, take the intersection of the extracted defect regions to obtain an initial scratch region, and screen the initial scratch region according to a preset judgment condition to obtain a final scratch region.

8. A scratch detection apparatus for a transparent film, characterized by, The method comprises: a memory for storing a computer program; a processor for executing the computer program to implement the scratch detection method for a transparent film according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer program is stored on the computer readable storage medium and is executed by the processor to implement the scratch detection method for a transparent film according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • A visual inspection method for laminated glass production quality

    CN117058137B

  • Watch case quality inspection method based on image data

    CN117218122B

  • Cover film surface defect detection method based on machine vision

    CN119273684A

  • Intelligent detection method for surface flaws and defects of optical film

    CN117232791A

  • Intelligent detection method for appearance flaws of OLED display optical film

    CN119251235A