Image threshold segmentation method, system, device and storage medium for display screen defect detection
Through downsampling, edge expansion, filtering and adaptive window selection techniques, the problem of poor segmentation effect in complex background and high dynamic range images is solved, efficient and accurate defect detection is achieved, and defect areas can be accurately segmented.
Patent Information
- Application Number
- CN202411515283.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-10-29
AI Technical Summary
The existing image threshold segmentation method is weak in adaptability when facing images with complex backgrounds or high dynamic range, resulting in unsatisfactory segmentation effect and inability to accurately segment defect areas.
Through steps such as downsampling processing, edge expansion filling, preprocessing filtering, dynamic window selection and adaptive threshold segmentation, the selection window is dynamically generated, and the offset is adaptively adjusted according to the average grayscale value of the target image, threshold segmentation is performed, and the The binary image is upsampled to obtain a high-resolution target area image.
It improves the accuracy and robustness of image segmentation, can clearly distinguish defect areas and background areas, and significantly improves the efficiency and accuracy of defect detection.
Smart Images

Figure CN119027444B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of display panel defect detection, and in particular to an image threshold segmentation method, system, device and storage medium for display screen defect detection. Background Art
[0002] Image threshold segmentation is a basic image segmentation technology. It uses the difference in grayscale characteristics between the target area to be extracted and its background in the image, and regards the image as two types of areas with different grayscale levels, which are the combination of the target area and the background area. Then a more reasonable threshold is selected to determine whether each pixel in the image should belong to the target area or the background area, thereby generating a corresponding binary image.
[0003] There are many types of image threshold segmentation methods, the most common ones are threshold-based segmentation methods, region growing methods, and edge detection methods, etc. Each method is suitable for different types of segmentation needs. As for the threshold-based segmentation method, the threshold-based segmentation method is divided into global threshold segmentation method and local threshold segmentation method. The global threshold segmentation method is intuitive and fast in calculation, but it is often only suitable for the situation where the entire image is evenly distributed. When the background is slightly complex, it is easy to over-segment or fail to fully segment.
[0004] Although local thresholding can solve the problem of local threshold segmentation to a certain extent and reduce the situation where the segmentation effect is poor due to uneven imaging, the existing local threshold segmentation method has weak adaptability when facing complex backgrounds or images with high dynamic range, and the threshold segmentation effect is not ideal, resulting in poor image segmentation effect and inability to accurately segment the defective areas of the image. Summary of the invention
[0005] The present application provides an image threshold segmentation method, system, device and storage medium for display screen defect detection, which solves the problem of weak adaptability and unsatisfactory threshold segmentation effect when facing complex backgrounds or images with high dynamic range, resulting in poor image segmentation effect and inability to accurately segment the defective area of the image.
[0006] In a first aspect, the present application provides an image threshold segmentation method for display screen defect detection, the method comprising:
[0007] The initial image displayed on the display screen is captured by the camera;
[0008] Downsampling the initial image to obtain a downsampled image, wherein the size of the downsampled image is smaller than the size of the initial image;
[0009] Expanding and filling the edge of the downsampled image to obtain an extended image;
[0010] Performing preprocessing and filtering on the extended image to obtain a filtered image;
[0011] Dynamically generate a selection window according to a window selection strategy, and select a target image on the filtered image through the selection window;
[0012] Setting a contrast value associated with the mean of the selected window as an offset, and adaptively adjusting the offset according to the average gray value of the target image to obtain a segmentation threshold;
[0013] Performing threshold segmentation on the target image according to the segmentation threshold to obtain a binary image;
[0014] The binary image is processed, and the processed binary image is up-sampled to obtain a target area image.
[0015] Optionally, dynamically generating a selection window according to a window selection strategy, and selecting a target image on the filtered image through the selection window, comprises:
[0016] Dividing the filtered image into M*N different regions;
[0017] Calculate the standard deviation in each of the regions by using a target formula, wherein the standard deviation is used to evaluate the fluctuation of the grayscale values in different regions;
[0018] The target formula is: , where I represents the grayscale value of each regional image, m represents the grayscale average value of the corresponding regional image, and n represents the number of pixels in the region;
[0019] Dynamically generate the selection window according to the size relationship between the standard deviation and a predetermined threshold;
[0020] The target image is selected on the filtered image through the selection window.
[0021] Optionally, dynamically generating the selection window according to a size relationship between the standard deviation and a predetermined threshold value includes:
[0022] If the standard deviation is less than the predetermined threshold, dynamically generating a large window;
[0023] If the standard deviation is greater than the predetermined threshold, a small window is dynamically generated.
[0024] Optionally, setting a contrast value associated with the mean of the selected window as an offset, and adaptively adjusting the offset according to the average gray value of the target image to obtain a segmentation threshold includes:
[0025] The contrast value associated with the mean of the selected window is set as an offset, and the expression of the offset is:
[0026] , where ΔI(M) represents the offset, M represents the average gray value of the image, and Δt(M) represents the variable related to the average gray value;
[0027] The offset is adaptively adjusted according to the average gray value of the target image to obtain a segmentation threshold, and the expression of the segmentation threshold is:
[0028] , where ΔTh(x) represents the segmentation threshold, M represents the average grayscale value of the image, and ΔI(M) represents the offset.
[0029] Optionally, processing the binary image and performing upsampling processing on the processed binary image to obtain a target area image includes:
[0030] The detected binary images are merged and filtered by opening and closing operations to obtain a target binary image;
[0031] The target binary image is expanded by bilinear interpolation to obtain the target area image.
[0032] Optionally, extending and filling the edge of the downsampled image to obtain an extended image includes:
[0033] The edge of the downsampled image is expanded and filled using a continuous edge expansion method, a constant filling expansion method or a mirror edge expansion method to obtain an expanded image.
[0034] Optionally, performing pre-processing and filtering on the extended image to obtain a filtered image includes:
[0035] A Gaussian filtering algorithm or a bilateral filtering algorithm is used to perform pre-processing filtering on the extended image to obtain a filtered image.
[0036] A second aspect of the present application provides an image threshold segmentation system for display screen defect detection, the system comprising:
[0037] A collection unit, used for collecting the initial image displayed on the display screen through a camera;
[0038] A first acquisition unit, configured to perform downsampling processing on the initial image to acquire a downsampled image, wherein the size of the downsampled image is smaller than the size of the initial image;
[0039] A second acquisition unit, configured to expand and fill the edge of the downsampled image to acquire an extended image;
[0040] A processing unit, configured to perform pre-processing and filtering on the extended image to obtain a filtered image;
[0041] A selection unit, used for dynamically generating a selection window according to a window selection strategy, and selecting a target image on the filtered image through the selection window;
[0042] An adjustment unit, used for setting a contrast value associated with the mean of the selected window as an offset, and adaptively adjusting the offset according to the average gray value of the target image to obtain a segmentation threshold;
[0043] A third acquisition unit, configured to perform threshold segmentation on the target image according to the segmentation threshold to obtain a binary image;
[0044] The fourth acquisition unit is used to process the binary image and perform up-sampling processing on the processed binary image to obtain a target area image.
[0045] In a third aspect, the present application provides an image threshold segmentation device for display screen defect detection, the device comprising:
[0046] processor, memory, input-output unit, and bus;
[0047] The processor is connected to the storage, the input and output unit, and the bus;
[0048] The storage stores a program, and the processor calls the program to execute the first aspect and any optional method in the first aspect.
[0049] A fourth aspect of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed on a computer, the program executes the first aspect and any optional method in the first aspect.
[0050] It can be seen from the above technical solutions that this application has the following advantages:
[0051] (1) Through downsampling, the original high-resolution initial image is converted into a lower-resolution downsampled image, which reduces the amount of data for subsequent processing and significantly improves the efficiency of image processing.
[0052] (2) Edge expansion and filling of the downsampled image can ensure that important information will not be lost due to boundary effects in subsequent processing. Pre-processing filtering can remove noise in the image and enhance the contrast between defects and background in the image, making defects easier to detect.
[0053] (3) The selection window is dynamically generated according to the window selection strategy, and can be flexibly adjusted according to the characteristics of different areas in the image, thereby improving the accuracy of defect detection. By setting the contrast value related to the mean of the selection window as the offset and adaptively adjusting the offset according to the average grayscale value of the target image, a more accurate segmentation threshold is obtained. The adaptive mechanism can improve the robustness of threshold segmentation.
[0054] (4) The binary image obtained by threshold segmentation can clearly distinguish the defect area and the background area. After processing the binary image and then upsampling it, a high-resolution image of the target area can be obtained, that is, an enlarged image of the defect area, which helps to conduct a more detailed analysis and evaluation of the defects.
[0055] (5) The image threshold segmentation method for display screen defect detection achieves efficient, accurate and robust defect detection through downsampling, edge extension filling, preprocessing filtering, dynamic window selection, adaptive threshold segmentation and upsampling processing, which helps to improve the image segmentation effect and can accurately segment the defective area of the image, thereby facilitating the analysis of the defective image. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solution in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0057] Figure 1 A schematic flow chart of an embodiment of an image threshold segmentation method for display screen defect detection in the present application;
[0058] Figure 2 A schematic diagram of another embodiment of the image threshold segmentation method for display screen defect detection of the present application;
[0059] Figure 3 A schematic diagram of another embodiment of the image threshold segmentation method for display screen defect detection of the present application;
[0060] Figure 4 A schematic diagram of another embodiment of the image threshold segmentation method for display screen defect detection of the present application;
[0061] Figure 5 A schematic diagram of an embodiment of an image threshold segmentation system for display screen defect detection in the present application;
[0062] Figure 6 A schematic diagram of an embodiment of an image threshold segmentation device for display screen defect detection in the present application. DETAILED DESCRIPTION
[0063] The present application provides an image threshold segmentation method, system, device and storage medium for display screen defect detection, which solves the problem that when facing complex backgrounds or images with high dynamic range, the adaptability is weak and the threshold segmentation effect is not ideal, resulting in poor image segmentation effect and inability to accurately segment the defective area of the image. The application realizes efficient, accurate and robust defect detection, helps to improve the image segmentation effect, and can accurately segment the defective area of the image, thereby analyzing the defective image.
[0064] See also Figure 1 In a first aspect, the present application provides an embodiment of an image threshold segmentation method for display screen defect detection, comprising:
[0065] 101. Capturing an initial image displayed on the display screen through a camera;
[0066] 102. Perform downsampling processing on the initial image to obtain a downsampled image, wherein a size of the downsampled image is smaller than a size of the initial image;
[0067] 103. Expand and fill the edge of the downsampled image to obtain an extended image;
[0068] 104. Perform pre-processing and filtering on the extended image to obtain a filtered image;
[0069] 105. Dynamically generate a selection window according to a window selection strategy, and select a target image on the filtered image through the selection window;
[0070] 106. Setting a contrast value associated with the selected window mean as an offset, and adaptively adjusting the offset according to the average grayscale value of the target image to obtain a segmentation threshold;
[0071] 107. Perform threshold segmentation on the target image according to the segmentation threshold to obtain a binary image;
[0072] 108. Process the binary image, and perform up-sampling processing on the processed binary image to obtain a target area image.
[0073] In an embodiment of the present application, firstly, an initial image displayed on a display screen is captured by a camera, and then the initial image is downsampled to obtain a downsampled image, the size of the downsampled image is smaller than the size of the initial image, and then the edge of the downsampled image is expanded and filled to obtain an extended image, and then the extended image is preprocessed and filtered to obtain a filtered image, and then a selection window is dynamically generated according to a window selection strategy, and a target image is selected on the filtered image through the selection window, and a contrast value related to the mean of the selection window is set as an offset, and the offset is adaptively adjusted according to the average gray value of the target image to obtain a segmentation threshold, and then the target image is threshold segmented according to the segmentation threshold to obtain a binary image, and finally the binary image is processed, and the processed binary image is upsampled to obtain a target area image, wherein the target area image is an image in which the size of the binary image is restored to the original input size, or an image in which the resolution of the binary image is increased, and the target area image is helpful for more detailed analysis and evaluation of defects on the image.
[0074] In step 101, an initial image displayed on the display screen is captured by a camera. Specifically, a camera with high resolution and low noise is selected to ensure that the camera can capture details on the display screen. When shooting, the camera lens should maintain an appropriate distance and angle with the display screen, and ensure that the display screen is in uniform and appropriate lighting conditions to reduce the impact of shadows and reflections on image quality and avoid image distortion. After the initial image of the display screen is captured, step 102 is executed.
[0075] In step 102, the initial image is downsampled to obtain a downsampled image. Specifically, when performing the downsampling process, an appropriate downsampling algorithm should be selected, such as bilinear interpolation, bicubic interpolation or nearest neighbor interpolation, which can be set according to actual conditions and is not specifically limited here. These algorithms are used to calculate the average value or the closest value of adjacent pixels in the original image to generate a new pixel value, thereby obtaining a downsampled image.
[0076] It should be noted that the downsampling ratio is determined according to the size of the display screen defect. The resolution of the downsampled image should be low enough to reduce the amount of calculation, but sufficient details should be retained for subsequent processing, and quality assessment should be performed on the downsampled image to ensure that the main features of the image are not lost and the defective area is still visible. Downsampling can reduce the storage space and processing time occupied by the image. In addition, downsampling can help reduce the impact of image noise, such as random noise and moiré.
[0077] In step 103, the edge of the downsampled image is extended and filled to obtain an extended image. Specifically, when the downsampled image is extended, an appropriate edge extension method is selected, such as continuous edge, constant filling, and mirror edge to extend and fill the edge of the downsampled image to obtain the extended image. The specific extension method is not specifically limited here and can be set according to actual conditions.
[0078] The purpose of expanding the downsampled image is that when the window slides at the edge of the image, the window will not cover part of the pixels of the original image, so the boundary of the image needs to be expanded to reduce the over-detection of the edge area. When expanding the image, the expansion size is generally larger than half of the window used subsequently. For example, if the window is set to 100, the edge expansion pixel value is 50. After the expansion is performed to obtain the expanded image, step 104 is executed.
[0079] In step 104, the extended image is pre-processed and filtered to obtain a filtered image. Since the obtained image has various types of noise interference, one is the noise of some cameras taking pictures, the interference of the material on the screen, especially the inherent arrangement of similar pixels is easily mistaken as the foreground area when segmenting. The purpose of filtering the image is to ensure that the risk of over-segmentation caused by noise and background interference is reduced without losing the real defects. Specifically, one of the Gaussian filtering algorithm and the bilateral filtering algorithm is used to filter the image. Compared with the mean filtering and the median filtering, the Gaussian filtering algorithm and the bilateral filtering algorithm can take into account the characteristics of the pixel distribution itself, which is more conducive to eliminating background interference while retaining the boundary information of the defect.
[0080] In step 105, a selection window is dynamically generated according to the window selection strategy, and a target image is selected on the filtered image through the selection window. Specifically, a selection window of adaptive size is generated through the window selection strategy. The selection window can automatically adjust the window size of the selection window to adapt to the segmentation requirements under complex backgrounds, while ensuring accurate segmentation and reducing a certain amount of time complexity. By setting the window selection strategy, when there is inherent background texture interference in the image and the grayscale value fluctuations in areas such as edges are large, the problem of over-segmentation to false targets can be avoided.
[0081] After the selection window is generated, a target image is selected on the filtered image according to the selection window, where the target image is a partial image on the filtered image.
[0082] In step 106, the contrast value associated with the mean of the selected window is set as an offset, and the offset is adaptively adjusted by the average grayscale value of the target image to obtain a segmentation threshold; wherein, the average grayscale value of the target image in the selected window is calculated, and the contrast value is calculated based on the average grayscale value and set as the offset. The contrast value reflects the degree of difference in the grayscale values in the image and can be adjusted according to actual conditions. Then, the offset is adaptively adjusted according to the average grayscale value of the target image. If the average grayscale value of the target image is high, it means that the defective area is brighter, and the offset can be appropriately increased. If the average grayscale value is low, it means that the defective area is darker, and the offset can be appropriately reduced. The adjusted offset is processed by the target formula to obtain the segmentation threshold. The segmentation threshold should be located at a suitable position between the grayscale values of the defective area and the normal area to accurately distinguish the two.
[0083] In step 107, the target image is threshold segmented according to the segmentation threshold to obtain a binary image. Specifically, after the segmentation threshold is obtained according to step 106, the target image is threshold segmented using the segmentation threshold, and the local threshold cutting algorithm is used to cut the target image. After threshold segmentation, the target image is obtained to obtain a binary image. Specifically, for example, the pixel points with gray values higher than the segmentation threshold in the target image are set to white, and the pixel points with gray values lower than the segmentation threshold are set to black. In this way, the target image is converted into a binary image, in which the white area represents the defect area and the black area represents the normal area.
[0084] In step 108, the binary image is processed and upsampled to obtain a target area image. Specifically, the binary image is morphologically processed to filter noise and isolated points in the binary image by morphological processing or other methods to improve the accuracy of defect detection.
[0085] The processed binary image is then upsampled to restore its resolution to the same or similar level as the initial image. During the upsampling process, an interpolation algorithm can be used to estimate the value of the new pixel, such as bilinear interpolation, bicubic interpolation, etc., and the target area image can be extracted from the upsampled binary image. The target area image can be used to analyze and process the image defects.
[0086] The image threshold segmentation method for display screen defect detection achieves accurate detection and extraction of display screen defects through a series of refined image processing steps. It not only has the advantages of strong adaptability, fast processing speed, and high accuracy, but can also be flexibly adjusted and optimized according to different display screen types and defect characteristics, which helps to improve the image segmentation effect and can accurately segment the defective area of the image, thereby facilitating the analysis of the defective image.
[0087] Reference Figure 2 According to some embodiments of the present invention, in step 105, dynamically generating a selection window according to a window selection strategy, and selecting a target image on the filtered image through the selection window may specifically include, but is not limited to, the following:
[0088] 201. Divide the filtered image into M*N different regions;
[0089] 202. Calculate the standard deviation in each of the regions by using a target formula, wherein the standard deviation is used to evaluate the fluctuation of the grayscale values in different regions;
[0090] The target formula is: , where I represents the grayscale value of each regional image, m represents the grayscale average value of the corresponding regional image, and n represents the number of pixels in the region;
[0091] 203. Dynamically generate the selection window according to the size relationship between the standard deviation and a predetermined threshold;
[0092] 204. Select the target image on the filtered image through the selection window.
[0093] In an embodiment of the present application, the purpose of dividing the filtered image into M*N different areas is to perform a more detailed analysis of the filtered image, dividing it into multiple small areas, each of which can be processed and evaluated independently. Specifically, the number of rows and columns M and N for the division is determined, and then a uniform grid division method is used to divide the filtered image into small areas of M rows and N columns, each of which contains a portion of image pixels, and the divided areas are evenly distributed on the image.
[0094] Then, the standard deviation of each region is calculated by the target formula. The standard deviation is used to evaluate the fluctuation of the grayscale values in different regions and to reflect the uniformity of the grayscale values within the region. For each segmented region, the target formula is used to calculate its standard deviation. The target formula is:
[0095] , I represents the grayscale value of each region image, m represents the grayscale average value of the corresponding region image, and n represents the number of pixels in the region. The standard deviation of each region can be calculated through the target formula for subsequent analysis and window generation.
[0096] After calculating the standard deviation of each region, selection windows of different sizes are dynamically generated based on the comparison results of the standard deviation of each region with the predetermined threshold value. This is to adapt to the grayscale value fluctuations of different regions, so as to more accurately select the target image. Specifically, first, a predetermined threshold value is set, and then, for each region, its standard deviation is compared with the predetermined threshold value. If the standard deviation is less than the predetermined threshold value, it means that the grayscale value fluctuation of the region is small and may contain a large defect area, so a larger selection window is dynamically generated; if the standard deviation is greater than the predetermined threshold value, it means that the grayscale value fluctuation of the region is large and may contain small defects or noise, so a smaller selection window is dynamically generated.
[0097] Then, use the dynamically generated selection window to locate and select the target image on the filtered image. During the selection process, ensure that the selection window completely covers the target area and try to avoid including too much background or irrelevant areas. The selected target image will be used for subsequent defect detection and analysis.
[0098] By performing region segmentation, standard deviation calculation, dynamic window generation and target image selection on the filtered image, the accuracy and efficiency of defect detection are further improved. It can adapt to the grayscale value fluctuations in different regions, thereby more accurately detecting and extracting defective areas.
[0099] Reference Figure 3 According to some embodiments of the present invention, in step 106, setting the contrast value associated with the selected window mean as an offset, and adaptively adjusting the offset by the average gray value of the target image to obtain the segmentation threshold may specifically include, but is not limited to, the following:
[0100] 301. Set the contrast value associated with the selected window mean as an offset, where the offset is expressed as:
[0101] , where ΔI(M) represents the offset, M represents the average gray value of the image, and Δt(M) represents the variable related to the average gray value;
[0102] 302. Adaptively adjust the offset according to the average gray value of the target image to obtain the segmentation threshold. The expression of the segmentation threshold is:
[0103] , where ΔTh(x) represents the segmentation threshold, M represents the average grayscale value of the image, and ΔI(M) represents the offset.
[0104] In an embodiment of the present application, in order to more accurately determine the defects or features in the image, a contrast value related to the mean of the selected window is introduced as an offset, and this offset will be used for the subsequent adaptive adjustment of the segmentation threshold. Specifically, firstly, the average gray value M of the target image is calculated, and the average gray value M reflects the overall brightness level of the image, and then the variable Δt (M) related to the average gray value is determined. The variable Δt (M) is determined based on the average gray value M, and Δt (M) is a variable function based on the average gray value. Then, the average gray value M and the variable Δt (M) related to the average gray value are combined to calculate the offset ΔI (M), which will be used for the subsequent adaptive adjustment of the segmentation threshold.
[0105] After obtaining the offset adaptively adjusted by the average gray value of the target image, a segmentation threshold matching the image brightness level is obtained according to the offset. This segmentation threshold will be used to distinguish the foreground and background in the image, thereby extracting defects or features.
[0106] Specifically, the average grayscale value M of the target image is used as the basis for adaptive adjustment, and then the offset ΔI(M) is adaptively adjusted according to the average grayscale value M of the target image, which means that if the brightness level of the image changes, the offset will also be adjusted accordingly to ensure the accuracy of the segmentation threshold.
[0107] Then, the segmentation threshold ΔTh is calculated by combining the adjusted offset ΔI(M) and the average grayscale value M of the image. This segmentation threshold will be used to distinguish the foreground and background pixels in the image.
[0108] Therefore, by introducing a contrast value related to the selected window mean as an offset and adaptively adjusting the offset according to the average grayscale value of the target image to obtain a segmentation threshold that matches the image brightness level, the accuracy and robustness of defect or feature extraction are effectively improved, allowing the algorithm to adapt to images with different brightness levels.
[0109] Reference Figure 4 According to some embodiments of the present invention, the processing of the binary image in step 108 and upsampling of the processed binary image to obtain the target area image may specifically include, but is not limited to, the following:
[0110] 401. Merge and filter the detected binary images through opening and closing operations to obtain a target binary image.
[0111] 402. Perform image expansion processing on the target binary image by using a bilinear interpolation method to obtain the target area image.
[0112] In an embodiment of the present application, the detected binary images are merged and filtered through opening and closing operations to obtain a target binary image. The purpose is to perform morphological processing on the initially detected binary image to eliminate noise, fill small holes, connect broken parts, and retain the real defect area, so as to obtain a more accurate target binary image.
[0113] Specifically, firstly, the detected binary image is opened, and the image can be corroded first, that is, the small white spots or thin lines in the image are removed, and then dilated, that is, the corroded part of the image is restored, but no additional part is removed, so that the small noise points in the image can be eliminated, while keeping the larger defect area unaffected. Next, the image is closed. The closing operation is opposite to the opening operation. The image is first dilated and then corroded. The closing operation can fill the small holes in the image and connect the broken parts to make the defect area more complete. After the processing of the opening and closing operations, the noise in the image is effectively suppressed, and the defect area is enhanced. At this time, the processed images can be merged and filtered to obtain the final target binary image. After obtaining the binary image, the target binary image is expanded by bilinear interpolation to obtain the target area image.
[0114] By performing morphological processing on the detected binary image to eliminate noise and enhance the defect area, and using bilinear interpolation to enlarge the defect area, a more detailed image of the target area can be obtained. This improves the accuracy and reliability of defect detection and provides a better basis for defect analysis and processing.
[0115] Reference Figure 5 In a second aspect, the present application provides an image threshold segmentation system for display screen defect detection, the system comprising:
[0116] The acquisition unit 501 is used to acquire the initial image displayed on the display screen through a camera;
[0117] A first acquisition unit 502 is configured to perform downsampling processing on the initial image to acquire a downsampled image, wherein the size of the downsampled image is smaller than the size of the initial image;
[0118] A second acquisition unit 503 is used to expand and fill the edge of the downsampled image to obtain an extended image;
[0119] The processing unit 504 is used to perform pre-processing and filtering on the extended image to obtain a filtered image;
[0120] A selection unit 505, configured to dynamically generate a selection window according to a window selection strategy, and select a target image on the filtered image through the selection window;
[0121] An adjusting unit 506, configured to set a contrast value associated with the selected window mean as an offset, and adaptively adjust the offset according to the average gray value of the target image to obtain a segmentation threshold;
[0122] A third acquisition unit 507 is used to perform threshold segmentation on the target image according to the segmentation threshold to obtain a binary image;
[0123] The fourth acquisition unit 508 is used to process the binary image and perform up-sampling on the processed binary image to obtain a target area image.
[0124] Reference Figure 6 In a third aspect, the present application provides an image threshold segmentation device for display screen defect detection, the device comprising:
[0125] Processor 601, memory 602, input and output unit 603 and bus 604;
[0126] The processor 601 is connected to the storage 602, the input and output unit 603 and the bus 604;
[0127] The storage 602 stores a program, and the processor 601 calls the program to execute the method as described in the first aspect and any one of the first aspects.
[0128] The present application also relates to a computer-readable storage medium, on which a program is stored. When the program is run on a computer, the computer executes the method as described in the first aspect and any one of the first aspects.
[0129] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0130] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0131] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0132] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0133] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk, etc., various media that can store program codes.
Claims
1. An image threshold segmentation method for display screen defect detection, characterized in that: The method comprises: The initial image displayed on the display screen is captured by the camera; Downsampling the initial image to obtain a downsampled image, wherein the size of the downsampled image is smaller than the size of the initial image; Expanding and filling the edge of the downsampled image to obtain an extended image; Performing preprocessing and filtering on the extended image to obtain a filtered image; Dynamically generate a selection window according to a window selection strategy, and select a target image on the filtered image through the selection window; Setting a contrast value associated with the mean of the selected window as an offset, and adaptively adjusting the offset according to the average gray value of the target image to obtain a segmentation threshold; Performing threshold segmentation on the target image according to the segmentation threshold to obtain a binary image; Processing the binary image, and performing upsampling processing on the processed binary image to obtain a target area image; Dynamically generating a selection window according to a window selection strategy, and selecting a target image on the filtered image through the selection window, including: Dividing the filtered image into M*N different regions; Calculate the standard deviation in each of the regions by using a target formula, wherein the standard deviation is used to evaluate the fluctuation of the grayscale values in different regions; The target formula is: , where I represents the grayscale value of each regional image, m represents the grayscale average value of the corresponding regional image, and n represents the number of pixels in the region; Dynamically generate the selection window according to the size relationship between the standard deviation and a predetermined threshold; Selecting the target image on the filtered image through the selection window; Dynamically generating the selection window according to the size relationship between the standard deviation and a predetermined threshold value includes: If the standard deviation is less than the predetermined threshold, dynamically generating a large window; If the standard deviation is greater than the predetermined threshold, a small window is dynamically generated.
2. The image threshold segmentation method for display screen defect detection according to claim 1, characterized in that: The contrast value associated with the mean of the selected window is set as an offset, and the offset is adaptively adjusted according to the average gray value of the target image to obtain a segmentation threshold, including: The contrast value associated with the mean of the selected window is set as an offset, and the expression of the offset is: , where ΔI(M) represents the offset, M represents the average gray value of the image, and Δt(M) represents the variable related to the average gray value; The offset is adaptively adjusted according to the average gray value of the target image to obtain the segmentation threshold. The expression of the segmentation threshold is: , where ΔTh(x) represents the segmentation threshold, M represents the average grayscale value of the image, and ΔI(M) represents the offset.
3. The image threshold segmentation method for display screen defect detection according to claim 1, characterized in that: Processing the binary image and performing upsampling on the processed binary image to obtain a target area image includes: The detected binary images are merged and filtered by opening and closing operations to obtain a target binary image; The target binary image is expanded by bilinear interpolation to obtain the target area image.
4. The image threshold segmentation method for display screen defect detection according to claim 1, characterized in that: Extending and filling the edge of the downsampled image to obtain an extended image, comprising: The edge of the downsampled image is expanded and filled using a continuous edge expansion method, a constant filling expansion method or a mirror edge expansion method to obtain an expanded image.
5. The image threshold segmentation method for display screen defect detection according to claim 1, characterized in that: The extended image is subjected to a pre-processing filtering process to obtain a filtered image, comprising: A Gaussian filtering algorithm or a bilateral filtering algorithm is used to perform pre-processing filtering on the extended image to obtain a filtered image.
6. An image threshold segmentation system for display screen defect detection, characterized in that: The system comprises: A collection unit, used for collecting the initial image displayed on the display screen through a camera; A first acquisition unit, configured to perform downsampling processing on the initial image to acquire a downsampled image, wherein the size of the downsampled image is smaller than the size of the initial image; A second acquisition unit, configured to expand and fill the edge of the downsampled image to acquire an extended image; A processing unit, configured to perform pre-processing and filtering on the extended image to obtain a filtered image; A selection unit, used for dividing the filtered image into M*N different regions; Calculate the standard deviation in each of the regions by using a target formula, wherein the standard deviation is used to evaluate the fluctuation of the grayscale values in different regions; The target formula is: , where I represents the grayscale value of each regional image, m represents the grayscale average value of the corresponding regional image, and n represents the number of pixels in the region; Dynamically generate the selection window according to the size relationship between the standard deviation and a predetermined threshold; Selecting the target image on the filtered image through the selection window; Dynamically generating the selection window according to the size relationship between the standard deviation and a predetermined threshold value includes: If the standard deviation is less than the predetermined threshold, dynamically generating a large window; If the standard deviation is greater than the predetermined threshold, dynamically generating a small window; An adjustment unit, used for setting a contrast value associated with the mean of the selected window as an offset, and adaptively adjusting the offset according to the average gray value of the target image to obtain a segmentation threshold; A third acquisition unit, configured to perform threshold segmentation on the target image according to the segmentation threshold to obtain a binary image; The fourth acquisition unit is used to process the binary image and perform up-sampling processing on the processed binary image to obtain a target area image.
7. An image threshold segmentation device for display screen defect detection, characterized in that: The device comprises: processor, memory, input-output unit, and bus; The processor is connected to the storage, the input and output unit, and the bus; The storage stores a program, and the processor calls the program to execute the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a program stored thereon, wherein the program, when executed on a computer, performs the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method for the detection of guns and ammunition in x-ray scans of containers for security assurance
CA2365045A1
Multi-scale difference and bilateral filtering target detection method of an adaptive window
CN109767439A
