An image detection method and device, electronic equipment and storage medium
By comparing the similarity between texture-dense regions in the reconstructed image from the Bayer array image and the ground truth image, the problem of low efficiency in manual browsing detection is solved, and fast and accurate image quality detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU HIKROBOT TECH CO LTD
- Filing Date
- 2023-11-06
- Publication Date
- 2026-08-04
AI Technical Summary
In existing technologies, the efficiency of detecting image quality by manually browsing and reconstructing images is relatively low.
By acquiring an RGB image with content identical to that of the Bayer array as the ground truth image, the image quality of the image to be detected is determined by comparing the pixel similarity between the texture-dense regions in the image to be detected and the corresponding regions in the ground truth image.
It eliminates the need for manual image viewing, enabling rapid and accurate image quality detection, reducing manual inspection time, and improving detection efficiency.
Smart Images

Figure CN117474875B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image detection method, apparatus, electronic device and storage medium. Background Technology
[0002] With the rapid development of computer technology, people are using image information more and more widely, and the requirements for image quality are gradually increasing. Currently, the sensors in image acquisition devices often acquire Bayer array images, where each pixel location stores only the information corresponding to one of the three colors: red, green, and blue. Therefore, the Bayer array image can be reconstructed using color interpolation algorithms (also known as demosaic algorithms) to obtain an RGB (Red, Green, Blue) image with complete color information (which can be called a reconstructed image).
[0003] In related technologies, the image quality of reconstructed images is detected by manually browsing them; however, this method is not very efficient. Summary of the Invention
[0004] The purpose of this application is to provide an image detection method, apparatus, electronic device, and storage medium to improve detection efficiency. The specific technical solution is as follows:
[0005] A first aspect of this application provides an image detection method, the method comprising:
[0006] An RGB image with the same image content as the Bayer array image is obtained as the ground truth image, and an RGB image reconstructed from the Bayer array image based on a color interpolation algorithm is obtained as the image to be detected.
[0007] Based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, the final detection result of the image to be detected is obtained; wherein, the first image region represents an image region containing a texture density greater than a preset density; the position of the second image region in the ground truth image is consistent with the position of the first image region in the image to be detected.
[0008] Optionally, obtaining the final detection result of the image to be detected based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image includes:
[0009] The final detection result of the image to be detected is obtained based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, as well as the similarity between all pixels contained in the ground truth image and the image to be detected.
[0010] Optionally, obtaining the final detection result of the image to be detected based on the similarity between pixels contained in a first image region in the image to be detected and a second image region in the ground truth image, and the similarity between all pixels contained in the ground truth image and the image to be detected, includes:
[0011] Calculate the similarity between all pixels contained in the ground truth image and the image to be detected to obtain a first detection result;
[0012] If the first detection result indicates that the image quality of the image to be detected meets the overall quality screening conditions, the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image is calculated to obtain the final detection result of the image to be detected.
[0013] If the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening conditions, then the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening conditions.
[0014] Optionally, calculating the similarity between the pixels contained in the first image region of the image to be detected and the second image region of the ground truth image to obtain the final detection result of the image to be detected includes:
[0015] Calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image to obtain a second detection result;
[0016] If the second detection result indicates that the image quality of the image to be detected meets the local quality screening conditions, then the final detection result of the image to be detected indicates that the image quality of the image to be detected meets the final quality screening conditions.
[0017] If the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening condition, then the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition.
[0018] Optionally, obtaining the final detection result of the image to be detected based on the similarity between pixels contained in a first image region in the image to be detected and a second image region in the ground truth image, and the similarity between all pixels contained in the ground truth image and the image to be detected, includes:
[0019] Calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image to obtain a second detection result;
[0020] If the image quality of the image to be detected satisfies the local quality screening condition as indicated by the second detection result, the similarity between all pixels contained in the ground truth image and the image to be detected is calculated to obtain the first detection result.
[0021] If the first detection result indicates that the image quality of the image to be detected meets the overall quality screening conditions, then the final detection result of the image to be detected indicates that the image quality of the image to be detected meets the final quality screening conditions.
[0022] If the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening condition, then the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition.
[0023] If the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening condition, then the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition.
[0024] Optionally, calculating the similarity between all pixels contained in the ground truth image and the image to be detected to obtain a first detection result includes:
[0025] Based on multiple overall image quality assessment algorithms, the similarity between all pixels contained in the ground image and the image to be detected is calculated respectively.
[0026] When at least one similarity calculated is greater than a first preset threshold, the first detection result is determined to indicate that the image quality of the image to be detected meets the overall quality screening condition.
[0027] Optionally, calculating the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image to obtain the second detection result includes:
[0028] Based on multiple overall image quality assessment algorithms, the similarity between the pixels contained in the first image region of the image to be detected and the second image region of the ground truth image is calculated respectively.
[0029] When all the calculated similarities are greater than the second preset threshold, it is determined that the second detection result indicates that the image quality of the image to be detected meets the local quality screening condition.
[0030] Optionally, before obtaining the final detection result of the image to be detected based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, the method further includes:
[0031] A mask image is obtained by performing edge detection on the ground truth image; wherein the mask image is used to represent image regions in the ground truth image where the density of texture is greater than a preset density;
[0032] Based on the mask image, a first image region in the image to be detected is determined, and an image region in the ground truth image that is in the same position as the first image region is determined as the second image region.
[0033] Optionally, obtaining the mask image based on edge detection of the ground truth image includes:
[0034] The positions of edge pixels in the ground truth image are obtained by performing edge detection on the ground truth image.
[0035] The ground truth image is binarized based on the obtained edge pixel positions to obtain a binarized image; wherein, in the binarized image, the pixel values of the edge pixels are different from those of other pixels.
[0036] The region occupied by edge pixels in the binarized image is subjected to image closing operation to obtain the processed binarized image;
[0037] From the processed binarized image, determine a preset number of connected components that contain edge pixels and have the largest area;
[0038] A mask image is generated based on the determined connected components; wherein, in the mask image, the determined connected components have different pixel values than other regions.
[0039] Optionally, the method further includes:
[0040] If the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening criteria, the image to be detected is displayed so that the user can detect the image quality of the image to be detected.
[0041] A second aspect of this application also provides an image detection apparatus, the apparatus comprising:
[0042] The image acquisition module is used to acquire an RGB image that is consistent with the image content contained in the Bayer array image as the ground truth image, and to acquire an RGB image reconstructed from the Bayer array image based on a color interpolation algorithm as the image to be detected.
[0043] The final detection result determination module is used to obtain the final detection result of the image to be detected based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image; wherein, the first image region represents an image region containing a texture density greater than a preset density; the position of the second image region in the ground truth image is consistent with the position of the first image region in the image to be detected.
[0044] Optionally, the final detection result determination module includes:
[0045] The final detection result determination submodule is used to obtain the final detection result of the image to be detected based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, as well as the similarity between all pixels contained in the ground truth image and the image to be detected.
[0046] Optionally, the final detection result determination submodule includes:
[0047] The first detection result determination unit is used to calculate the similarity between all pixels contained in the ground image and the image to be detected, and to obtain the first detection result.
[0048] The final detection result determination unit is used to calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, when the image quality of the image to be detected, as characterized by the first detection result, meets the overall quality screening conditions, so as to obtain the final detection result of the image to be detected.
[0049] The first determining unit is configured to determine that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition when the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening condition.
[0050] Optionally, the final detection result determination unit includes:
[0051] The second detection result determination subunit is used to calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, and to obtain the second detection result.
[0052] The final detection result determination subunit is used to determine whether the final detection result of the image to be detected satisfies the final quality screening condition, provided that the image quality of the image to be detected satisfies the local quality screening condition.
[0053] The first determining subunit is configured to determine, when the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening condition, that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition.
[0054] Optionally, the final detection result determination submodule includes:
[0055] The second detection result determination subunit is used to calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, and to obtain the second detection result.
[0056] The first detection result determination unit is used to calculate the similarity between all pixels contained in the ground image and the image to be detected, and obtain the first detection result, when the image quality of the image to be detected, as characterized by the second detection result, meets the local quality screening condition.
[0057] An image quality determination unit is used to determine, when the first detection result indicates that the image quality of the image to be detected meets the overall quality screening conditions, that the final detection result indicates that the image quality of the image to be detected meets the final quality screening conditions.
[0058] The second determining unit is configured to determine that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition when the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening condition.
[0059] The third determining unit is used to determine that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition when the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening condition.
[0060] Optionally, the first detection result determination unit is specifically used to calculate the similarity between all pixels contained in the ground truth image and the image to be detected based on multiple overall image quality assessment algorithms.
[0061] When at least one similarity calculated is greater than a first preset threshold, the first detection result is determined to indicate that the image quality of the image to be detected meets the overall quality screening condition.
[0062] Optionally, the second detection result determination subunit is specifically used to calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image based on multiple overall image quality assessment algorithms.
[0063] When all the calculated similarities are greater than the second preset threshold, it is determined that the second detection result indicates that the image quality of the image to be detected meets the local quality screening condition.
[0064] Optionally, the device further includes:
[0065] An edge detection module is used to obtain a mask image based on edge detection of the ground image before obtaining the final detection result of the image to be detected based on the similarity between pixels contained in a first image region in the image to be detected and a second image region in the ground image; wherein, the mask image is used to represent image regions in the ground image where the density of texture is greater than a preset density.
[0066] The image region determination module is used to determine a first image region in the image to be detected based on the mask image, and to determine an image region in the ground truth image that is at the same position as the first image region as a second image region.
[0067] Optionally, the edge detection module is specifically used to perform edge detection on the ground truth image to obtain the position of edge pixels in the ground truth image;
[0068] The ground truth image is binarized based on the obtained edge pixel positions to obtain a binarized image; wherein, in the binarized image, the pixel values of the edge pixels are different from those of other pixels.
[0069] The region occupied by edge pixels in the binarized image is subjected to image closing operation to obtain the processed binarized image;
[0070] From the processed binarized image, determine a preset number of connected components that contain edge pixels and have the largest area;
[0071] A mask image is generated based on the determined connected components; wherein, in the mask image, the determined connected components have different pixel values than other regions.
[0072] Optionally, the device further includes:
[0073] An image display module is used to display the image to be detected when the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening conditions, so that the user can detect the image quality of the image to be detected.
[0074] A third aspect of this application also provides an electronic device, comprising:
[0075] Memory, used to store computer programs;
[0076] The processor, when executing a program stored in memory, implements any of the image detection methods described above.
[0077] A fourth aspect of this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the image detection methods described above.
[0078] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the image detection methods described above.
[0079] This application provides an image detection method that can acquire an RGB image with the same image content as a Bayer array image as a ground truth image, and acquire an RGB image reconstructed from the Bayer array image based on a color interpolation algorithm as a detection image; based on the similarity between the pixels contained in a first image region in the detection image and a second image region in the ground truth image, the final detection result of the detection image is obtained; wherein, the first image region represents an image region containing a texture density greater than a preset density; the position of the second image region in the ground truth image is consistent with the position of the first image region in the detection image.
[0080] Based on the above processing, the image to be detected and an RGB image (i.e., the ground truth image) containing the same image content as the Bayer array image can be obtained. Then, the image regions with dense texture (i.e., the density of the texture contained is greater than a preset density) in the image to be detected (i.e., the first image region) and the image regions in the ground truth image that are in the same position as the first image region (i.e., the second image region) can be compared to determine the similarity between the pixels contained in the first image region and the second image region.
[0081] Because the RGB image (i.e., the image to be detected) reconstructed from the Bayer array image using color interpolation algorithms may have image quality issues, and these issues often occur in texture-dense regions, resulting in low image quality in these texture-dense regions. For example, image quality issues could include moiré patterns, false colors, or zipper effects. Therefore, the image quality of the image to be detected can be determined based on the image quality of texture-dense regions within the texture-dense regions. A higher similarity between the pixels in the first and second image regions indicates that the first image region is closer to the second image region in the ground truth image; that is, a higher image quality in the first image region corresponds to a higher image quality in the image to be detected.
[0082] In this way, the image quality of the image to be inspected can be detected without the need for manual browsing of the image, thus reducing the time spent on manual browsing and improving detection efficiency.
[0083] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description
[0084] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0085] Figure 1 This is a first flowchart of an image detection method provided in an embodiment of this application;
[0086] Figure 2a A schematic diagram of a high-frequency texture region provided in an embodiment of this application;
[0087] Figure 2b A schematic diagram of another high-frequency texture region provided in an embodiment of this application;
[0088] Figure 2c A schematic diagram of yet another high-frequency texture region provided in the embodiments of this application;
[0089] Figure 3 This is a second flowchart of the image detection method provided in the embodiments of this application;
[0090] Figure 4 A flowchart for generating a mask image is provided in an embodiment of this application;
[0091] Figure 5a A schematic diagram of a truth image provided in an embodiment of this application;
[0092] Figure 5b A schematic diagram of a mask image provided in an embodiment of this application;
[0093] Figure 6 This is a third flowchart of the image detection method provided in the embodiments of this application;
[0094] Figure 7 This is a fourth flowchart of the image detection method provided in the embodiments of this application;
[0095] Figure 8 This is a schematic diagram of the structure of an image detection device provided in an embodiment of this application;
[0096] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0097] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.
[0098] With the rapid development of computer technology, people are using image information more and more widely, and the requirements for image quality are gradually increasing. Currently, the sensors in image acquisition devices often acquire Bayer array images, where each pixel location stores only the information corresponding to one of the three colors: red, green, and blue. Therefore, Bayer array images can be reconstructed using color interpolation algorithms to obtain an RGB image with complete color information (which can be called a reconstructed image).
[0099] In related technologies, the image quality of reconstructed images is detected by manually browsing them; however, this method is not very efficient.
[0100] To improve detection efficiency, this application provides an image detection method, see [link to relevant documentation]. Figure 1 , Figure 1 A first flowchart of an image detection method provided in an embodiment of this application, the method comprising:
[0101] Step S101: Obtain an RGB image with the same image content as the Bayer array image as the ground truth image, and obtain an RGB image reconstructed from the Bayer array image based on a color interpolation algorithm as the image to be detected.
[0102] Step S102: Based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, the final detection result of the image to be detected is obtained.
[0103] The first image region represents an image region containing a texture density greater than a preset density; the position of the second image region in the ground truth image is the same as the position of the first image region in the image to be detected.
[0104] Based on the above processing, the image to be detected and an RGB image (i.e., the ground truth image) containing the same image content as the Bayer array image can be obtained. Then, the image regions with dense texture (i.e., the density of the texture contained is greater than a preset density) in the image to be detected (i.e., the first image region) and the image regions in the ground truth image that are in the same position as the first image region (i.e., the second image region) can be compared to determine the similarity between the pixels contained in the first image region and the second image region.
[0105] Because the RGB image (i.e., the image to be detected) reconstructed from the Bayer array image using color interpolation algorithms may have image quality issues, and these issues often occur in texture-dense regions, resulting in low image quality in these texture-dense regions. For example, image quality issues could include moiré patterns, false colors, or zipper effects. Therefore, the image quality of the image to be detected can be determined based on the image quality of texture-dense regions within the texture-dense regions. A higher similarity between the pixels in the first and second image regions indicates that the first image region is closer to the second image region in the ground truth image; that is, a higher image quality in the first image region corresponds to a higher image quality in the image to be detected.
[0106] In this way, the image quality of the image to be inspected can be detected without the need for manual browsing of the image, thus reducing the time spent on manual browsing and improving detection efficiency.
[0107] In step S101, a Bayer array image can be acquired, and a color interpolation algorithm can be used to reconstruct the acquired Bayer array image to obtain a reconstructed RGB image (i.e., the image to be detected). Since the performance of the color interpolation algorithm used is uncertain, the image quality of the image to be detected needs to be subsequently tested to obtain the final detection result. An RGB image with the same image content as the Bayer array image is acquired and used as the ground truth image. The ground truth image can be used as the basis for determining the image quality of the image to be detected.
[0108] For example, you can obtain Bayer array images and RGB images with the same image content as the Bayer array images from an open-source dataset. Such open-source datasets could be Kodak or MCM (an open-source dataset).
[0109] The open-source dataset contains images of the Bayer array and image pairs consisting of standard images with the same content as the Bayer array images. The standard images can be in TIF (Tag Image File) format or RGBA (Red, Green, Blue, Alpha, an image format). Correspondingly, standard images with the same content as the Bayer array images can be obtained and converted to RGB format to serve as ground truth images.
[0110] Alternatively, images of the Bayer array captured by an image acquisition device can be obtained, and the Bayer array images can be reconstructed using a deep learning model pre-trained on an open-source dataset, or a high-performance traditional color interpolation algorithm, to obtain the ground truth image. During this process, the best-performing RGB image from the reconstructed images can be manually selected as the ground truth image through a review process. For example, the traditional color interpolation algorithm mentioned above could be the Hamiltonian interpolation algorithm or the VNG (an interpolation algorithm) algorithm.
[0111] In step S102, image regions with texture density greater than a preset density in the image to be detected (i.e., first image regions) and image regions in the ground truth image whose positions correspond to the first image regions in the image to be detected (i.e., second image regions) can be identified. An image region with texture density greater than a preset density indicates that the texture in that image region is relatively dense, and this image region can be called a high-frequency texture region. For example, in actual processing, the texture density in an image region can be understood as the number of textures contained in a unit area of the image region. A higher texture density in the image region indicates that the texture in that image region is relatively dense.
[0112] Because each pixel in a Bayer array image stores only one of the three colors—red, green, and blue—reconstructing the Bayer array image using color interpolation algorithms results in image quality issues such as moiré patterns and zipper effects in the resulting RGB image (the image to be detected). Furthermore, these image quality problems often occur in high-frequency texture regions, leading to poor image quality in those areas.
[0113] like Figure 2a As shown, Figure 2a This is a schematic diagram of a high-frequency texture region provided in an embodiment of this application. Figure 2aThe area within the dashed box represents a high-frequency texture region. For example... Figure 2b As shown, Figure 2b This is a schematic diagram of another high-frequency texture region provided in an embodiment of this application. Figure 2b The curtain area within the dashed frame is a high-frequency texture area. For example... Figure 2c As shown, Figure 2c This is a schematic diagram of another high-frequency texture region provided in an embodiment of this application. Figure 2c The water ripple area within the dashed box is a high-frequency texture area.
[0114] Therefore, the image quality of the image to be detected can be determined by assessing the image quality of the high-frequency texture regions (i.e., the first image region) in the image to be detected. The similarity between the pixels contained in the first and second image regions is determined by comparing the first image region in the image to be detected with an image region in the ground truth image that is in the same position as the first image region (i.e., the second image region). A higher similarity between the pixels contained in the first and second image regions indicates that the first image region is closer to the second image region in the ground truth image, and correspondingly, the image quality of the first image region is higher. Therefore, the image quality of the first image region can be determined based on the similarity between the pixels contained in the first and second image regions, and thus, the image quality of the image to be detected (i.e., the final detection result) can be determined.
[0115] In one embodiment, the image detection method further includes: displaying the image to be detected when the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening conditions, so that the user can detect the image quality of the image to be detected.
[0116] In this embodiment of the application, if the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening conditions, it means that the image quality of the image to be detected determined by the image detection method is not high. In this case, the image to be detected can be displayed, and the user can detect the image quality of the image to be detected.
[0117] In this way, image detection methods can be used to filter out images that meet the final quality screening criteria, reducing the number of images requiring user inspection. Specifically, image detection methods can assist in evaluating the performance of color interpolation algorithms, reducing the workload of manual inspection and improving efficiency. Furthermore, even when the image quality of the images identified by image detection methods is poor, the subjective experience of viewing them by the human eye may not be affected; that is, the human eye may perceive the image as having a good visual effect. Therefore, further user-inspected image quality checks can help identify images with better visual perception, further improving detection accuracy.
[0118] In one implementation, multiple Bayer array images can be acquired. Correspondingly, the acquired Bayer array images can be reconstructed using a color interpolation algorithm with performance to be determined, resulting in multiple images to be detected. Furthermore, RGB images with the same image content as the multiple Bayer array images can be acquired, resulting in multiple ground truth images. Then, each image to be detected can be detected based on each ground truth image to determine the image quality of each image. Based on the determined image quality of each image to be detected, the performance of the color interpolation algorithm with performance to be determined can be determined. For example, when the proportion of images meeting the final quality screening criteria reaches a specified threshold, the performance of the used color interpolation algorithm is considered superior. For example, the specified threshold can be 0.8 or 0.9.
[0119] Thus, for any image to be detected, automatic image quality detection can be achieved based on the method provided in the embodiments of this application. Only when the final detection result of the image to be detected indicates that the image quality of the image to be detected does not meet the final quality screening conditions, it is provided to the user for manual detection, which can reduce the workload of manual detection in the performance evaluation process and improve detection efficiency.
[0120] Furthermore, the image detection method provided in this application can be applied to image signal processing and industrial camera research, which can improve the efficiency of color interpolation algorithm performance evaluation, thereby improving the research efficiency of color interpolation algorithm and camera imaging algorithm, promoting the automation of color interpolation algorithm performance evaluation, and reducing labor costs.
[0121] In one embodiment, in Figure 1 Based on this, see Figure 3 , Figure 3 This is a second flowchart of the image detection method provided in an embodiment of this application. Before step S102, the method further includes:
[0122] Step S103: Obtain a mask image based on edge detection of the ground truth image.
[0123] The mask image is used to represent image regions in the ground truth image where the density of the texture is greater than a preset density.
[0124] Step S104: Based on the mask image, determine the first image region in the image to be detected, and determine the image region in the ground truth image that is in the same position as the first image region, as the second image region.
[0125] In this embodiment, edge detection can be performed on the ground truth image to determine its texture. Based on the texture in the ground truth image, high-frequency texture regions can be identified, and a mask image can be generated from these regions. The mask image has the same size as the ground truth image, and pixels within the mask image that correspond to the high-frequency texture regions in the ground truth image have a pixel value of 1, while pixels in other regions have a pixel value of 0. Furthermore, by multiplying the mask image by both the ground truth image and the image to be detected, a first image region in the image to be detected and a second image region in the ground truth image that corresponds to the first image region can be determined.
[0126] Based on the above processing, high-frequency texture regions (i.e., the first image region) and image regions whose positions coincide with those of the high-frequency texture regions in the image to be detected (i.e., the second image region) can be identified. This allows for comparison of the similarity between the pixels contained in the first and second image regions, determining the image quality of the first image region. This further ensures that the image quality of the image to be detected can be assessed, reducing the time spent manually browsing the image and improving detection efficiency.
[0127] In one embodiment, step S103 includes:
[0128] Step 1: Based on edge detection of the ground truth image, obtain the position of edge pixels in the ground truth image.
[0129] Step 2: Binarize the ground truth image based on the positions of the obtained edge pixels to obtain a binarized image.
[0130] In a binarized image, edge pixels have different pixel values than other pixels.
[0131] Step 3: Perform image closing operation on the region occupied by edge pixels in the binarized image to obtain the processed binarized image.
[0132] Step 4: From the processed binarized image, determine a preset number of connected components that contain edge pixels and have the largest area.
[0133] Step 5: Generate a mask image based on the determined connected components.
[0134] In the mask image, the identified connected components have different pixel values than other regions.
[0135] In this embodiment of the application, edge detection can be performed directly on the ground truth image to determine the position of edge pixels in the ground truth image, that is, to determine the texture in the ground truth image.
[0136] Alternatively, the ground truth image can be denoised to obtain a denoised ground truth image. Then, edge detection can be performed on the denoised ground truth image to obtain the positions of edge pixels in the ground truth image. That is, before edge detection, the ground truth image can be denoised using a preset denoising algorithm to obtain a denoised ground truth image. Then, edge detection can be performed on the denoised ground truth image using a preset edge detection algorithm. For example, the preset denoising algorithm can be Gaussian filtering or median filtering; the preset edge detection algorithm can utilize the Laplacian operator or the Canny operator (an edge detection operator). Those skilled in the art can set the preset edge detection algorithm and the preset edge detection algorithm as needed, without specific limitations. In this way, noise in the ground truth image can be reduced before edge detection, which can reduce the impact of noise in the ground truth image on the accuracy of edge detection and improve the accuracy of the determined positions of edge pixels in the ground truth image. Correspondingly, the accuracy of the determined first image region and second image region can also be improved, further ensuring the accuracy of the final detection result of the image to be detected.
[0137] The image region occupied by edge pixels can be called an edge region. Based on the edge regions, the ground-value image is binarized to obtain a binarized image. In the binarized image, pixels within the edge regions (i.e., edge pixels) are white with a grayscale value of 255, while pixels in other regions are black with a grayscale value of 0. Image closing operations are then performed on the edge regions in the binarized image to obtain the processed binarized image. That is, dilation of the edge regions in the binarized image connects multiple discrete edge regions that are relatively close together to form a new edge region, and it can remove small particle noise in the edge regions. Erosion of the edge regions in the dilated binarized image separates edge regions with fine connectivity and removes burrs or small protrusions from the image. Thus, in the processed binarized image, multiple discrete and closely spaced textures can be identified as belonging to the same edge region; that is, dense textures can be identified as belonging to the same edge region, and the area of this edge region is relatively large.
[0138] From the processed binarized image, a predetermined number of connected components containing edge pixels and having the largest area are identified. In other words, the largest edge regions are determined, which in turn identify image regions with closely spaced textures and a large number of such regions—i.e., densely textured regions (i.e., high-frequency texture regions). For example, edge regions can be sorted in descending order based on the number of pixels they contain to determine the top predetermined number of edge regions. This predetermined number could be 6, 7, or 8. If the number of edge regions is less than the predetermined number, then the determined edge regions include all edge regions. Furthermore, a mask image can be generated based on the determined connected components. In the mask image, pixels within the determined connected components have a pixel value of 1, while pixels in other regions have a pixel value of 0.
[0139] Based on the above processing, it can be further ensured that the high-frequency texture region (i.e., the first image region) in the image to be detected, and the image region whose position is consistent with the high-frequency texture region in the image to be detected (i.e., the second image region) can be identified. In this way, it is possible to compare the similarity between the pixels contained in the first image region and the second image region, determine the image quality of the first image region, and further ensure that the image quality of the image to be detected can be detected, thereby reducing the time consumed by manual browsing of the image to be detected and improving detection efficiency.
[0140] In one embodiment, see Figure 4 , Figure 4 A flowchart for generating a mask image is provided for embodiments of this application. A mask image can be generated through the following steps:
[0141] Step S401: Obtain the ground truth image. That is, obtain an RGB image that has the same image content as the Bayer array image, and use it as the ground truth image.
[0142] Step S402: Gaussian filtering. That is, the ground truth image is denoised by Gaussian filtering to obtain the denoised ground truth image.
[0143] Step S403: Laplacian edge detection. That is, edge detection is performed on the denoised ground truth image using the Laplacian operator to obtain the positions of edge pixels in the ground truth image.
[0144] Step S404: Adaptive binarization. That is, step two in the above embodiment.
[0145] Step S405: Image closing operation. That is, step three in the above embodiment.
[0146] Step S406: Connected component analysis and sorting by the number of pixels. That is, connected component analysis is performed on the processed binarized image to determine each connected component containing edge pixels, and the connected components are sorted in descending order according to the number of edge pixels they contain.
[0147] Step S407: Determine whether the number of connected components is greater than n. If the number of connected components is greater than n, proceed to step S408; if the number of connected components is not greater than n, proceed to step S409. n is a preset number in the above embodiment.
[0148] Step S408: Select the first n connected components as high-frequency texture regions and generate a mask image. That is, steps four and five in the above embodiment.
[0149] Step S409: Set n to the number of connected components and execute step S408.
[0150] Step S410: Output the mask image. That is, obtain the mask image.
[0151] In this embodiment, a mask image representing high-frequency texture regions in the ground truth image can be generated. Based on the mask image, high-frequency texture regions in both the ground truth image and the image to be detected can be determined. That is, image regions in the image to be detected that are prone to color interpolation errors can be identified, and subsequent detection of these identified image regions can further improve detection efficiency.
[0152] In one embodiment, see Figure 5a , Figure 5a This is a schematic diagram of a truth image provided in an embodiment of this application. Figure 5b This is a schematic diagram of a mask image provided in an embodiment of this application. (In conjunction with...) Figure 5a and Figure 5b visible, Figure 5b The white area in the image represents the high-frequency texture region in the ground truth image 5a.
[0153] In one embodiment, in Figure 1 Based on this, see Figure 6 , Figure 6 A third flowchart of the image detection method provided in this application embodiment. Step S102 includes:
[0154] Step S1021: Based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, and the similarity between all pixels contained in the ground truth image and the image to be detected, the final detection result of the image to be detected is obtained.
[0155] In this embodiment, the similarity between all pixels in the ground truth image and the image to be detected (referred to as overall similarity) and the similarity between pixels in a first image region in the image to be detected and a second image region in the ground truth image (referred to as local similarity) can be calculated. Then, the final detection result of the image to be detected can be determined based on the overall similarity and local similarity. Overall similarity characterizes the overall image quality of the image to be detected, while local similarity characterizes the image quality of high-frequency texture regions in the image to be detected.
[0156] Based on the above processing, the final detection result of the image to be detected can be determined by combining the overall image quality of the image to be detected and the image quality of the high-frequency texture regions in the image to be detected. That is, detecting the image to be detected from both a global and local perspective can reduce the possibility of inaccurate final detection results caused by detecting only local areas, thereby improving the accuracy of the final detection result of the image to be detected.
[0157] The final detection result of the image to be detected can be determined by combining both overall and local perspectives using any of the following three methods:
[0158] In method one, step S1021 includes:
[0159] Step S10211: Calculate the similarity between all pixels contained in the ground truth image and the image to be detected to obtain the first detection result.
[0160] Step S10212: If the first detection result indicates that the image quality of the image to be detected meets the overall quality screening conditions, calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image to obtain the final detection result of the image to be detected.
[0161] Step S10213: If the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening conditions, then determine that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening conditions.
[0162] In this embodiment, a first detection result can be determined based on the calculated overall similarity. The first detection result can characterize whether the image quality of the image to be detected meets the overall quality screening criteria. If the image quality of the image to be detected meets the overall quality screening criteria, it indicates that the overall image quality of the image to be detected is high; if the image quality of the image to be detected does not meet the overall quality screening criteria, it indicates that the overall image quality of the image to be detected is low.
[0163] When the first detection result indicates that the image quality of the image to be detected meets the overall quality screening conditions, the local similarity is calculated to obtain the final detection result of the image to be detected.
[0164] When the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening criteria, it can be determined that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening criteria. Therefore, there is no need to calculate local similarity, and thus no need to execute steps S103-S104 in the above embodiments. In this way, while combining both overall and local perspectives to determine the final detection result of the image to be detected, the number of steps required by the image detection method is reduced, thereby further improving detection efficiency.
[0165] See Figure 7 , Figure 7 This is a fourth flowchart of an image detection method provided in an embodiment of this application. The image detection method includes:
[0166] Step S701: Image truth value selection. That is, step S101 in the above embodiment.
[0167] Step S702: Overall quality assessment of color interpolation results. That is, step S10211 in the above embodiment.
[0168] Step S703: High-frequency texture region extraction. That is, steps S103-S104 in the above embodiment.
[0169] Step S704: High-frequency texture region quality assessment. That is, step S10212 in the above embodiment.
[0170] In this embodiment, it can be determined whether the image quality of the image to be detected meets the overall quality screening criteria. If the image quality of the image to be detected meets the overall quality screening criteria, it can be determined whether the image quality of the image to be detected meets the local quality screening criteria to obtain the final detection result. In this way, it can be ensured that the image detection method detects both flat regions (i.e., image regions other than high-frequency texture regions) and high-frequency texture regions in the image to be detected, thus achieving the determination of the final detection result of the image to be detected from both overall and local perspectives, improving the accuracy of the determined final detection result of the image to be detected.
[0171] In one embodiment, step S10212 includes:
[0172] If the first detection result indicates that the image quality of the image to be detected meets the overall quality screening conditions, the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image is calculated to obtain the second detection result.
[0173] If the second detection result indicates that the image quality of the image to be detected meets the local quality screening conditions, then the final detection result indicates that the image quality of the image to be detected meets the final quality screening conditions.
[0174] If the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening conditions, then the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening conditions.
[0175] In this embodiment, a second detection result can be determined based on the calculated local similarity. The second detection result can characterize whether the image quality of the image to be detected meets the local quality screening criteria.
[0176] If the image quality of the image to be detected meets the local quality screening criteria, it means that the image quality of the high-frequency texture region in the image to be detected is high. That is, the local image quality of the image to be detected is high, and it can be determined that the final detection result indicates that the image quality of the image to be detected meets the final quality screening criteria.
[0177] If the image quality of the image to be detected does not meet the local quality screening criteria, it means that the image quality of the high-frequency texture region in the image to be detected is low. That is, the local image quality of the image to be detected is low, and it can be determined that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening criteria.
[0178] In this way, the final detection result of the image to be detected can be determined by combining both the overall and local perspectives, which can further ensure the accuracy of the detection.
[0179] In method two, step S1021 includes:
[0180] The similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image is calculated to obtain the second detection result;
[0181] If the image quality of the image to be detected satisfies the local quality screening condition, the similarity between all pixels contained in the ground image and the image to be detected is calculated to obtain the first detection result.
[0182] If the first detection result indicates that the image quality of the image to be detected meets the overall quality screening conditions, then the final detection result indicates that the image quality of the image to be detected meets the final quality screening conditions.
[0183] If the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening criteria, then the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening criteria.
[0184] If the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening conditions, then the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening conditions.
[0185] In this embodiment, local similarity can be calculated first to determine the local image quality of the image to be detected. When the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening criteria, it can be determined that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening criteria, and therefore there is no need to calculate the overall similarity.
[0186] When the second detection result indicates that the image quality of the image to be detected meets the local quality screening criteria, the overall similarity is calculated to determine the overall image quality of the image to be detected, thus obtaining the first detection result. When the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening criteria, the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening criteria. When the first detection result indicates that the image quality of the image to be detected meets the overall quality screening criteria, the final detection result indicates that the image quality of the image to be detected meets the final quality screening criteria.
[0187] This allows for the determination of the final detection result of the image by combining both overall and local perspectives, thus further ensuring detection accuracy. Simultaneously, it reduces the steps required for image detection methods, thereby further improving detection efficiency.
[0188] In method three, step S1021 includes:
[0189] Calculate the similarity between all pixels contained in the ground truth image and the image to be detected to obtain the first detection result;
[0190] The similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image is calculated to obtain the second detection result;
[0191] If the first detection result indicates that the image quality of the image to be detected meets the overall quality screening condition, and the second detection result indicates that the image quality of the image to be detected meets the local quality screening condition, then the final detection result indicates that the image quality of the image to be detected meets the final quality screening condition.
[0192] In this embodiment, the overall similarity can be directly calculated to obtain the first detection result, and the local similarity can be calculated to obtain the second detection result. If the first detection result indicates that the image quality of the image to be detected meets the overall quality screening condition, and the second detection result indicates that the image quality of the image to be detected meets the local quality screening condition, then the final detection result of the image to be detected is determined to indicate that the image quality of the image to be detected meets the final quality screening condition. In this way, the final detection result of the image to be detected can be determined by combining both overall and local perspectives, thus further ensuring the accuracy of the detection.
[0193] In one embodiment, among the three methods described above, calculating the similarity between all pixels contained in the ground truth image and the image to be detected to obtain a first detection result includes: calculating the similarity between all pixels contained in the ground truth image and the image to be detected based on multiple overall image quality assessment algorithms; when at least one calculated similarity is greater than a first preset threshold, determining that the first detection result indicates that the image quality of the image to be detected meets the overall quality screening conditions.
[0194] In this embodiment, the overall image quality assessment algorithm may include at least two of the following: a Peak Signal-to-Noise Ratio (PSNR) assessment algorithm, a Structure Similarity Index Measure (SSIM) assessment algorithm, and a hue similarity assessment algorithm. The hue similarity assessment algorithm is used to calculate the similarity between the hues of pixels contained in two images. The ground truth image and the image to be detected can be converted to HSV (Hue, Saturatin, Value) format, where the hue value of a pixel is its hue. For an overall image quality assessment algorithm, a first preset threshold can be set. When at least one similarity is greater than the first preset threshold, it can be determined that the first detection result indicates that the image quality of the image to be detected meets the overall quality screening condition, i.e., the overall image quality of the image to be detected is good. When none of the obtained similarities are greater than the first preset threshold, it can be determined that the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening condition, i.e., the overall image quality of the image to be detected is poor.
[0195] For example, the PSNR value between the ground truth image and the image to be detected can be calculated using a peak signal-to-noise ratio (PSNR) evaluation algorithm, and the SSIM value between the ground truth image and the image to be detected can be calculated using a structural similarity index (SSIM) evaluation algorithm. The obtained PSNR and SSIM values are used as the overall similarity.
[0196] In one approach, the PSNR and SSIM values can be calculated based on the grayscale values of the pixels.
[0197] In another approach, the PSNR and SSIM values for the R, G, and B color channels can be calculated separately. The average of the PSNR values for the three color channels can be used as the PSNR value between the ground truth image and the image to be detected. The average of the SSIM values for the three color channels can be used as the SSIM value between the ground truth image and the image to be detected.
[0198] The first preset threshold corresponding to the peak signal-to-noise ratio evaluation algorithm is Threshold. PSNR For example, Threshold pSNR It can be 35 or 40. The first preset threshold corresponding to the structural similarity index evaluation algorithm is Threshold. SSIM For example, Threshold SSIM It can be 0.85 or 0.9.
[0199] If Bayer array images and ground truth images are obtained from open-source datasets, the similarity between the image to be detected and the ground truth image may not be high because the ground truth image is difficult to reconstruct using color interpolation algorithms. Therefore, the first preset threshold can be appropriately lowered. If Bayer array images are acquired from image acquisition devices, and the images can be reconstructed using a deep learning model pre-trained on an open-source dataset, or a high-performance traditional color interpolation algorithm, the resulting RGB image can be used as the ground truth image. Since the ground truth image is reconstructed using a traditional color interpolation algorithm or a deep learning model, the image to be detected is closer to the ground truth image. Therefore, the first preset threshold can be appropriately increased. This ensures that when the image quality of the image to be detected is good, it meets the final quality screening criteria, thus further guaranteeing the accuracy of the detection.
[0200] In one embodiment, among the three methods described above, calculating the similarity between pixels contained in a first image region in the image to be detected and a second image region in the ground truth image to obtain a second detection result includes:
[0201] Based on various overall image quality assessment algorithms, the similarity between pixels contained in the first image region of the image to be detected and the second image region of the ground truth image is calculated respectively.
[0202] When all the calculated similarities are greater than the second preset threshold, the second detection result indicates that the image quality of the image to be detected meets the local quality screening condition.
[0203] In this embodiment, the overall image quality assessment algorithm used can be the same as the overall image quality assessment algorithm used in the above embodiments to calculate the similarity between all pixels contained in the ground truth image and the image to be detected. For an overall image quality assessment algorithm, a second preset threshold can be set corresponding to that algorithm. For the same overall image quality assessment algorithm, the second preset threshold corresponding to that algorithm can be the same as the first preset threshold.
[0204] The first image region can be one or more. When there are multiple first image regions, there are correspondingly multiple second image regions. Furthermore, these multiple first image regions can be treated as a whole, and the multiple second image regions can be treated as a whole. Similarity is calculated based on various overall image quality assessment algorithms. When at least one similarity score is not greater than a second preset threshold, it can be determined that the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening condition, i.e., the local image quality of the image to be detected is poor. When all the obtained similarities are greater than the second preset threshold, it can be determined that the second detection result indicates that the image quality of the image to be detected meets the local quality screening condition, i.e., the local image quality of the image to be detected is good.
[0205] When there are multiple first image regions, for each first image region, the similarity between the pixels contained in the first image region and the second image region in the ground truth image can be calculated based on various overall image quality assessment algorithms. When at least one similarity is not greater than a second preset threshold, the image quality of the first image region can be determined to be poor. When all the obtained similarities are greater than the second preset threshold, the image quality of the first image region can be determined to be good. Furthermore, when at least one first image region has poor image quality, it can be determined that the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening condition, that is, the local image quality of the image to be detected is poor. When the image quality of each first image region is good, it can be determined that the second detection result indicates that the image quality of the image to be detected meets the local quality screening condition, that is, the local image quality of the image to be detected is good.
[0206] Based on the above processing, the image quality of a local part of the image to be detected can be determined. Thus, by combining the overall and local perspectives, the final detection result of the image to be detected can be determined, which can further ensure the accuracy of the detection.
[0207] Based on the same inventive concept, this application also provides an image detection device, see [link to relevant documentation]. Figure 8 , Figure 8 This is a schematic diagram of the structure of an image detection device provided in an embodiment of this application. The device includes:
[0208] The image acquisition module 801 is used to acquire an RGB image that is consistent with the image content contained in the Bayer array image as the ground truth image, and to acquire an RGB image reconstructed from the Bayer array image based on a color interpolation algorithm as the image to be detected.
[0209] The final detection result determination module 802 is used to obtain the final detection result of the image to be detected based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image; wherein, the first image region represents an image region containing a texture density greater than a preset density; the position of the second image region in the ground truth image is consistent with the position of the first image region in the image to be detected.
[0210] Based on the image detection apparatus provided in this application embodiment, it is possible to acquire an image to be detected and an RGB image (i.e., a ground truth image) that contains the same image content as the Bayer array image. Furthermore, it is possible to compare a texture-dense (i.e., texture density greater than a preset density) image region in the image to be detected with an image region in the ground truth image that is in the same position as the first image region (i.e., a second image region) to determine the similarity between the pixels contained in the first image region and the second image region.
[0211] Because the RGB image (i.e., the image to be detected) reconstructed from the Bayer array image using color interpolation algorithms may have image quality issues, and these issues often occur in texture-dense regions, resulting in low image quality in these texture-dense regions. For example, image quality issues could include moiré patterns, false colors, or zipper effects. Therefore, the image quality of the image to be detected can be determined based on the image quality of texture-dense regions within the texture-dense regions. A higher similarity between the pixels in the first and second image regions indicates that the first image region is closer to the second image region in the ground truth image; that is, a higher image quality in the first image region corresponds to a higher image quality in the image to be detected.
[0212] In this way, the image quality of the image to be inspected can be detected without the need for manual browsing of the image, thus reducing the time spent on manual browsing and improving detection efficiency.
[0213] In one embodiment, the final detection result determination module 802 includes:
[0214] The final detection result determination submodule is used to obtain the final detection result of the image to be detected based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, as well as the similarity between all pixels contained in the ground truth image and the image to be detected.
[0215] In one embodiment, the final detection result determination submodule includes:
[0216] The first detection result determination unit is used to calculate the similarity between all pixels contained in the ground image and the image to be detected, and to obtain the first detection result.
[0217] The final detection result determination unit is used to calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, when the image quality of the image to be detected, as characterized by the first detection result, meets the overall quality screening conditions, so as to obtain the final detection result of the image to be detected.
[0218] The first determining unit is configured to determine that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition when the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening condition.
[0219] In one embodiment, the final detection result determination unit includes:
[0220] The second detection result determination subunit is used to calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, and to obtain the second detection result.
[0221] The final detection result determination subunit is used to determine whether the final detection result of the image to be detected satisfies the final quality screening condition, provided that the image quality of the image to be detected satisfies the local quality screening condition.
[0222] The first determining subunit is configured to determine, when the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening condition, that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition.
[0223] In one embodiment, the final detection result determination submodule includes:
[0224] The second detection result determination subunit is used to calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, and to obtain the second detection result.
[0225] The first detection result determination unit is used to calculate the similarity between all pixels contained in the ground image and the image to be detected, and obtain the first detection result, when the image quality of the image to be detected, as characterized by the second detection result, meets the local quality screening condition.
[0226] An image quality determination unit is used to determine, when the first detection result indicates that the image quality of the image to be detected meets the overall quality screening conditions, that the final detection result indicates that the image quality of the image to be detected meets the final quality screening conditions.
[0227] The second determining unit is configured to determine that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition when the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening condition.
[0228] The third determining unit is used to determine that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition when the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening condition.
[0229] In one embodiment, the first detection result determination unit is specifically used to calculate the similarity between all pixels contained in the ground image and the image to be detected based on multiple overall image quality assessment algorithms.
[0230] When at least one similarity calculated is greater than a first preset threshold, the first detection result is determined to indicate that the image quality of the image to be detected meets the overall quality screening condition.
[0231] In one embodiment, the second detection result determination subunit is specifically used to calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image based on multiple overall image quality assessment algorithms.
[0232] When all the calculated similarities are greater than the second preset threshold, it is determined that the second detection result indicates that the image quality of the image to be detected meets the local quality screening condition.
[0233] In one embodiment, the apparatus further includes:
[0234] An edge detection module is used to obtain a mask image based on edge detection of the ground image before obtaining the final detection result of the image to be detected based on the similarity between pixels contained in a first image region in the image to be detected and a second image region in the ground image; wherein, the mask image is used to represent image regions in the ground image where the density of texture is greater than a preset density.
[0235] The image region determination module is used to determine a first image region in the image to be detected based on the mask image, and to determine an image region in the ground truth image that is at the same position as the first image region as a second image region.
[0236] In one embodiment, the edge detection module is specifically used to obtain the position of edge pixels in the ground truth image based on edge detection of the ground truth image;
[0237] The ground truth image is binarized based on the obtained edge pixel positions to obtain a binarized image; wherein, in the binarized image, the pixel values of the edge pixels are different from those of other pixels.
[0238] The region occupied by edge pixels in the binarized image is subjected to image closing operation to obtain the processed binarized image;
[0239] From the processed binarized image, determine a preset number of connected components that contain edge pixels and have the largest area;
[0240] A mask image is generated based on the determined connected components; wherein, in the mask image, the determined connected components have different pixel values than other regions.
[0241] In one embodiment, the apparatus further includes:
[0242] An image display module is used to display the image to be detected when the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening conditions, so that the user can detect the image quality of the image to be detected.
[0243] This application also provides an electronic device, such as... Figure 9 As shown, it includes:
[0244] Memory 901 is used to store computer programs;
[0245] When processor 902 executes a program stored in memory 901, it performs the following steps:
[0246] A red-green-blue RGB image with the same image content as the Bayer array image is obtained as the ground truth image, and an RGB image reconstructed from the Bayer array image based on a color interpolation algorithm is obtained as the image to be detected.
[0247] Based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, the final detection result of the image to be detected is obtained; wherein, the first image region represents an image region containing a texture density greater than a preset density; the position of the second image region in the ground truth image is consistent with the position of the first image region in the image to be detected.
[0248] Furthermore, the aforementioned electronic device may also include a communication bus and / or a communication interface, with the processor 902, communication interface, and memory 901 communicating with each other via the communication bus.
[0249] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0250] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0251] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0252] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0253] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the above-described image detection methods.
[0254] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the image detection methods described above.
[0255] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a solid-state drive (SSD), etc.
[0256] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0257] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, electronic devices, and storage media are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0258] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. An image detection method, characterized in that, The method includes: A red-green-blue RGB image with the same image content as the Bayer array image is obtained as the ground truth image, and an RGB image reconstructed from the Bayer array image based on a color interpolation algorithm is obtained as the image to be detected. Based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, the final detection result of the image to be detected is obtained; wherein, the first image region represents an image region containing a texture density greater than a preset density; the position of the second image region in the ground truth image is consistent with the position of the first image region in the image to be detected; Before obtaining the final detection result of the image to be detected based on the similarity between pixels contained in a first image region in the image to be detected and a second image region in the ground truth image, the method further includes: A mask image is obtained by performing edge detection on the ground truth image; wherein the mask image is used to represent image regions in the ground truth image where the density of texture is greater than a preset density; Based on the mask image, a first image region in the image to be detected is determined, and an image region in the ground truth image that is at the same position as the first image region is determined as the second image region; The step of obtaining a mask image based on edge detection of the ground truth image includes: The positions of edge pixels in the ground truth image are obtained by performing edge detection on the ground truth image. The ground truth image is binarized based on the obtained edge pixel positions to obtain a binarized image; wherein, in the binarized image, the pixel values of the edge pixels are different from those of other pixels. The region occupied by edge pixels in the binarized image is subjected to image closing operation to obtain the processed binarized image; From the processed binarized image, determine a preset number of connected components that contain edge pixels and have the largest area; A mask image is generated based on the determined connected components; wherein, in the mask image, the determined connected components have different pixel values than other regions.
2. The method according to claim 1, characterized in that, The final detection result of the image to be detected, based on the similarity between pixels contained in a first image region in the image to be detected and a second image region in the ground truth image, includes: The final detection result of the image to be detected is obtained based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, as well as the similarity between all pixels contained in the ground truth image and the image to be detected.
3. The method according to claim 2, characterized in that, The final detection result of the image to be detected is obtained based on the similarity between pixels contained in a first image region in the image to be detected and a second image region in the ground truth image, and the similarity between all pixels contained in the ground truth image and the image to be detected, including: Calculate the similarity between all pixels contained in the ground truth image and the image to be detected to obtain a first detection result; If the first detection result indicates that the image quality of the image to be detected meets the overall quality screening conditions, the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image is calculated to obtain the final detection result of the image to be detected. If the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening conditions, then the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening conditions.
4. The method according to claim 3, characterized in that, The step of calculating the similarity between pixels contained in a first image region in the image to be detected and a second image region in the ground truth image to obtain the final detection result of the image to be detected includes: Calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image to obtain a second detection result; If the second detection result indicates that the image quality of the image to be detected meets the local quality screening conditions, then the final detection result of the image to be detected indicates that the image quality of the image to be detected meets the final quality screening conditions. If the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening condition, then the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition.
5. The method according to claim 2, characterized in that, The final detection result of the image to be detected is obtained based on the similarity between pixels contained in a first image region in the image to be detected and a second image region in the ground truth image, and the similarity between all pixels contained in the ground truth image and the image to be detected, including: Calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image to obtain a second detection result; If the image quality of the image to be detected satisfies the local quality screening condition as indicated by the second detection result, the similarity between all pixels contained in the ground truth image and the image to be detected is calculated to obtain the first detection result. If the first detection result indicates that the image quality of the image to be detected meets the overall quality screening conditions, then the final detection result of the image to be detected indicates that the image quality of the image to be detected meets the final quality screening conditions. If the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening condition, then the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition. If the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening condition, then the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition.
6. The method according to claim 3 or 5, characterized in that, The calculation of the similarity between all pixels contained in the ground truth image and the image to be detected to obtain a first detection result includes: Based on multiple overall image quality assessment algorithms, the similarity between all pixels contained in the ground image and the image to be detected is calculated respectively. When at least one similarity calculated is greater than a first preset threshold, the first detection result is determined to indicate that the image quality of the image to be detected meets the overall quality screening condition.
7. The method according to claim 4 or 5, characterized in that, The step of calculating the similarity between pixels contained in a first image region in the image to be detected and a second image region in the ground truth image to obtain a second detection result includes: Based on multiple overall image quality assessment algorithms, the similarity between the pixels contained in the first image region of the image to be detected and the second image region of the ground truth image is calculated respectively. When all the calculated similarities are greater than the second preset threshold, it is determined that the second detection result indicates that the image quality of the image to be detected meets the local quality screening condition.
8. The method according to any one of claims 1-5, characterized in that, The method further includes: If the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening criteria, the image to be detected is displayed so that the user can detect the image quality of the image to be detected.
9. An image detection device, characterized in that, The device includes: The image acquisition module is used to acquire an RGB image that is consistent with the image content contained in the Bayer array image as the ground truth image, and to acquire an RGB image reconstructed from the Bayer array image based on a color interpolation algorithm as the image to be detected. The final detection result determination module is used to obtain the final detection result of the image to be detected based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image; wherein, the first image region represents an image region containing a texture density greater than a preset density; the position of the second image region in the ground truth image is consistent with the position of the first image region in the image to be detected; The device further includes: An edge detection module is used to obtain a mask image based on edge detection of the ground image before obtaining the final detection result of the image to be detected based on the similarity between pixels contained in a first image region in the image to be detected and a second image region in the ground image; wherein, the mask image is used to represent image regions in the ground image where the density of texture is greater than a preset density. The image region determination module is used to determine a first image region in the image to be detected based on the mask image, and to determine an image region in the ground truth image that is at the same position as the first image region as a second image region; The edge detection module is specifically used to perform edge detection on the ground truth image to obtain the position of edge pixels in the ground truth image. The ground truth image is binarized based on the obtained edge pixel positions to obtain a binarized image; wherein, in the binarized image, the pixel values of the edge pixels are different from those of other pixels. The region occupied by edge pixels in the binarized image is subjected to image closing operation to obtain the processed binarized image; From the processed binarized image, determine a preset number of connected components that contain edge pixels and have the largest area; A mask image is generated based on the determined connected components; wherein, in the mask image, the determined connected components have different pixel values than other regions.
10. The apparatus according to claim 9, characterized in that, The final detection result determination module includes: The final detection result determination submodule is used to obtain the final detection result of the image to be detected based on the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, as well as the similarity between all pixels contained in the ground truth image and the image to be detected.
11. The apparatus according to claim 10, characterized in that, The final detection result determination submodule includes: The first detection result determination unit is used to calculate the similarity between all pixels contained in the ground image and the image to be detected, and to obtain the first detection result. The final detection result determination unit is used to calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, when the image quality of the image to be detected, as characterized by the first detection result, meets the overall quality screening conditions, so as to obtain the final detection result of the image to be detected. The first determining unit is configured to determine that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition when the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening condition.
12. The apparatus according to claim 11, characterized in that, The final detection result determination unit includes: The second detection result determination subunit is used to calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, and to obtain the second detection result. The final detection result determination subunit is used to determine whether the final detection result of the image to be detected satisfies the final quality screening condition, provided that the image quality of the image to be detected satisfies the local quality screening condition. The first determining subunit is configured to determine, when the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening condition, that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition.
13. The apparatus according to claim 10, characterized in that, The final detection result determination submodule includes: The second detection result determination subunit is used to calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image, and to obtain the second detection result. The first detection result determination unit is used to calculate the similarity between all pixels contained in the ground image and the image to be detected, and obtain the first detection result, when the image quality of the image to be detected, as characterized by the second detection result, meets the local quality screening condition. An image quality determination unit is used to determine, when the first detection result indicates that the image quality of the image to be detected meets the overall quality screening conditions, that the final detection result indicates that the image quality of the image to be detected meets the final quality screening conditions. The second determining unit is configured to determine that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition when the first detection result indicates that the image quality of the image to be detected does not meet the overall quality screening condition. The third determining unit is used to determine that the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening condition when the second detection result indicates that the image quality of the image to be detected does not meet the local quality screening condition.
14. The apparatus according to claim 11 or 13, characterized in that, The first detection result determination unit is specifically used to calculate the similarity between all pixels contained in the ground image and the image to be detected based on multiple overall image quality assessment algorithms. When at least one similarity calculated is greater than a first preset threshold, the first detection result is determined to indicate that the image quality of the image to be detected meets the overall quality screening condition.
15. The apparatus according to claim 12 or 13, characterized in that, The second detection result determination subunit is specifically used to calculate the similarity between the pixels contained in the first image region in the image to be detected and the second image region in the ground truth image based on multiple overall image quality assessment algorithms. When all the calculated similarities are greater than the second preset threshold, it is determined that the second detection result indicates that the image quality of the image to be detected meets the local quality screening condition.
16. The apparatus according to any one of claims 9-13, characterized in that, The device further includes: An image display module is used to display the image to be detected when the final detection result indicates that the image quality of the image to be detected does not meet the final quality screening conditions, so that the user can detect the image quality of the image to be detected.
17. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 1-8.
18. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-8.