Color reproduction test method and device for wide-angle lens, electronic equipment, and medium
By acquiring the initial image of the wide-angle lens, extracting the color card area and performing color block edge detection and color filling, generating and reconstructing the color card image, solving the problem of low color restoration testing efficiency in the existing technology, and achieving efficient color restoration capability evaluation.
Patent Information
- Application Number
- CN202411163323.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2044-08-23
AI Technical Summary
In the prior art, the color restoration test of wide-angle lenses is inefficient and cannot complete distortion correction for a single image. Multiple angle images need to be stitched to achieve distortion correction.
By obtaining the initial image collected by the wide-angle lens, extracting the color card area, performing color block edge detection, obtaining color block contour coordinate data, using color block color data and preset color card templates for color filling, generating a reconstructed color card image, and calculating color index parameters to evaluate color restoration capabilities.
There is no need to perform distortion correction on the image, and directly generate and reconstruct the color card image, improving the efficiency of color restoration testing.
Smart Images

Figure CN119211516B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of digital image processing, and in particular to a color reproduction testing method and device for a wide-angle lens, an electronic device, and a storage medium. Background Art
[0002] In the prior art, before performing a color reproduction test on a wide-angle lens, the lens captures an image containing a standard color chart. This image is then subjected to distortion correction, and relevant performance indicators are calculated based on the standard color chart. These indicators indicate the wide-angle lens's ability to reproduce color. However, current processing methods are unable to fully correct distortion for a single image, or require stitching together images captured from multiple angles to achieve distortion correction, resulting in inefficient color reproduction testing. Therefore, improving the efficiency of wide-angle lens color reproduction testing has become a pressing issue. Summary of the Invention
[0003] The main purpose of the embodiments of the present application is to provide a color reproduction test method and device for a wide-angle lens, an electronic device, and a storage medium, aiming to improve the efficiency of the color reproduction test of a wide-angle lens.
[0004] To achieve the above objectives, a first aspect of an embodiment of the present application provides a method for testing color reproduction of a wide-angle lens, the method comprising:
[0005] Acquire an initial image of a preset color card captured by a wide-angle lens;
[0006] Extracting a color card area from the initial image;
[0007] Performing color block edge detection on the color card area to obtain color block outline coordinate data;
[0008] Performing color extraction on the color card area according to the color block outline coordinate data to obtain color block color data;
[0009] Performing color filling according to the color block color data and a preset color card template to obtain a reconstructed color card image;
[0010] An index calculation is performed based on the reconstructed color card image and the color data of the preset color card to obtain color index parameters, so as to evaluate the color reproduction capability of the wide-angle lens according to the color index parameters.
[0011] In some embodiments, extracting a color card area from the initial image includes:
[0012] Obtaining an initial pixel color value of the initial image;
[0013] Determine a segmentation threshold based on the initial pixel color value to obtain a first color threshold;
[0014] Converting the initial image into a first intermediate image in a luminance-chrominance color space, and converting the first color threshold into a luminance threshold on a luminance channel; wherein the luminance-chrominance color space includes the luminance channel;
[0015] Binarizing the first intermediate image according to the brightness threshold to obtain a brightness binarized image;
[0016] Performing contour detection on the brightness binary image to obtain target contour coordinate data;
[0017] The initial image is cropped based on the target outline coordinate data to obtain the color card area.
[0018] In some embodiments, determining a segmentation threshold based on the initial pixel color value to obtain a first color threshold includes:
[0019] Performing pixel color clustering on the initial pixel color values to obtain first color clustering data, wherein the first color clustering data includes a color value of each pixel corresponding to each cluster;
[0020] Filtering a target class and a color value of each pixel corresponding to the target class from the first color clustering data based on the number of pixels corresponding to each class;
[0021] The first color threshold is obtained by performing numerical calculation based on the color value of the pixel corresponding to the target class.
[0022] In some embodiments, performing color block edge detection on the color card area to obtain color block outline coordinate data includes:
[0023] Get the color value of the color card pixel in the color card area;
[0024] Determine a segmentation threshold based on the color value of the color card pixel to obtain a second color threshold;
[0025] Converting the color card area into a second intermediate image in a hue-saturation-lightness color space, and converting the second color threshold into a lightness threshold on a lightness channel; wherein the hue-saturation-lightness color space includes the lightness channel;
[0026] Binarizing the second intermediate image according to the brightness threshold to obtain a brightness binarized image;
[0027] Contour detection is performed on the brightness binary image to obtain the colour block contour coordinate data.
[0028] In some embodiments, performing color filling according to the color block color data and a preset color card template to obtain a reconstructed color card image includes:
[0029] Filling the border area of the color card template with color according to the second color threshold to obtain an intermediate color card image;
[0030] The color block area of the intermediate color card image is filled with color according to the color block color data to obtain the reconstructed color card image.
[0031] In some embodiments, performing color extraction on the color card area according to the color block outline coordinate data to obtain color block color data includes:
[0032] Perform pixel color extraction on the color card area according to the color block outline coordinate data to obtain a color block pixel color value of each pixel of the color block;
[0033] Calculating an average value of the color block pixel color values of all pixels of the color block to obtain a color average value;
[0034] Performing a gap evaluation on each pixel based on the color average value and the color value of each color block pixel to obtain an outlier pixel;
[0035] If the number of the outlier pixels is greater than a preset outlier number threshold, a predetermined proportion of the outlier pixels are deleted, and the color values of all pixels of the color block are returned to be averaged to obtain a color average value;
[0036] If the number of the outlier pixels is less than or equal to a preset pixel number threshold, the color average value is determined as the color block color data.
[0037] In some embodiments, performing a gap evaluation on each pixel based on the color average value and the color value of each color block pixel to obtain an outlier pixel includes:
[0038] Calculate the difference between the color average value and the color value of each pixel to obtain a color difference value of each pixel;
[0039] If the color difference value is greater than or equal to a preset difference threshold, the pixel is determined to be the outlier pixel.
[0040] To achieve the above-mentioned objectives, a second aspect of an embodiment of the present application provides a color reproduction testing device for a wide-angle lens, the device comprising:
[0041] An acquisition module, the acquisition module is used to acquire an initial image of a preset color card captured by a wide-angle lens;
[0042] A color card extraction module, the color card extraction module is used to extract a color card area from the initial image;
[0043] A color block outline detection module, which is used to perform color block edge detection on the color card area to obtain color block outline coordinate data;
[0044] A color extraction module, configured to extract color from the color card area according to the color block outline coordinate data to obtain color block color data;
[0045] A color card reconstruction module, configured to perform color filling according to the color block color data and a preset color card template to obtain a reconstructed color card image;
[0046] A parameter determination module is used to perform index calculation based on the reconstructed color card image and the color data of the preset color card to obtain color index parameters, so as to evaluate the color reproduction ability of the wide-angle lens according to the color index parameters.
[0047] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the method described in the first aspect when executing the computer program.
[0048] To achieve the above-mentioned purpose, the fourth aspect of the embodiments of the present application proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the method described in the first aspect.
[0049] The color reproduction testing method and device, electronic device, and storage medium for wide-angle lenses proposed in this application obtain an initial color chart image captured by the wide-angle lens and extract the color chart area. Next, the outlines of the color blocks are identified through edge detection, and color extraction is performed based on this outline data to obtain the color information of the color blocks. Next, the extracted color data and a preset color chart template are used to perform color filling to reconstruct the color chart image. Finally, by comparing the reconstructed color chart image with the color data of the preset color chart, color index parameters are calculated to evaluate the color reproduction capability of the wide-angle lens. Compared to existing testing methods, this method does not require distortion correction of the image captured by the wide-angle lens. Instead, a reconstructed color chart image is directly generated based on the captured image, and color reproduction capability is evaluated based on this color chart, thereby improving the efficiency of color reproduction testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 This is a flow chart of a color reproduction test method for a wide-angle lens provided in an embodiment of the present application;
[0051] Figure 2 yes Figure 1 Flowchart of step S102 in FIG.
[0052] Figure 3 yes Figure 2 Flowchart of step S202 in FIG.
[0053] Figure 4 yes Figure 1 Flowchart of step S103 in FIG.
[0054] Figure 5 yes Figure 1 Flowchart of step S104 in FIG.
[0055] Figure 6 yes Figure 5 Flowchart of step S503 in FIG.
[0056] Figure 7 yes Figure 1 Flowchart of step S105 in FIG.
[0057] Figure 8 2 is a schematic structural diagram of a color reproduction test device for a wide-angle lens provided in an embodiment of the present application;
[0058] Figure 9 Schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application;
[0059] Figure 10 is an initial image provided in an embodiment of the present application;
[0060] Figure 11 is an intermediate image provided in an embodiment of the present application;
[0061] Figure 12 is a binary image provided by an embodiment of the present application;
[0062] Figure 13 is a color card area image provided in an embodiment of the present application;
[0063] Figure 14 is another intermediate image provided in an embodiment of the present application;
[0064] Figure 15 is another binary image provided in an embodiment of the present application;
[0065] Figure 16 This is a reconstructed color card image provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0067] It should be noted that although the device schematics illustrate functional module divisions and the flowcharts illustrate logical sequences, in certain circumstances, the steps shown or described may be performed in a sequence that differs from the module divisions in the device or the sequence in the flowcharts. The terms "first," "second," and so on, in the specification, claims, and drawings, are used to distinguish similar items and are not necessarily used to describe a specific sequence or precedence.
[0068] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0069] First, let’s analyze some of the terms used in this application:
[0070] RGB color space: A color representation method based on the three basic color components red (Red), green (Green), and blue (Blue).
[0071] Lab color space: refers to a color representation model that includes three components: L (lightness), a (chromaticity axis a), and b (chromaticity axis b). L represents the brightness of the color, and its value range is usually from 0 to 100. The larger the L value, the closer the color is to white, and the smaller the L value, the closer the color is to black. a represents the change in color from green to red, with positive values indicating a reddish color and negative values indicating a greenish color. b (chromaticity axis b) represents the change in color from blue to yellow, with positive values indicating a yellowish color and negative values indicating a bluish color.
[0072] HSV (Hue, Saturation, Value) Color Space: Created by AR Smith in 1978 based on the intuitive properties of color, HSV is a color space also known as the Hexcone Model. This color space consists of three components: hue (H), saturation (S), and value (V). Hue represents the basic type of color, such as red, green, and blue. Saturation represents the purity or intensity of a color, or its vividness. Value represents the brightness or lightness of a color.
[0073] In related technologies, due to the large field of view and image distortion of wide-angle lenses, color reproduction tests for such lenses first require the wide-angle lens to capture an image containing a standard color chart, then perform distortion correction on the image, and then calculate relevant index parameters (such as color difference, saturation level, white balance error, etc.) for the corrected image based on the standard color chart. The index parameters are used to indicate the wide-angle lens's ability to restore color. However, current processing methods cannot complete complete distortion correction for a single image, or require stitching images from multiple acquisition angles to achieve distortion correction, resulting in low efficiency in color reproduction testing. Therefore, how to improve the efficiency of wide-angle lens color reproduction testing has become an urgent problem to be solved.
[0074] Based on this, the embodiments of the present application provide a method and device for color reproduction testing of a wide-angle lens, an electronic device, and a storage medium, aiming to improve the efficiency of color reproduction testing of a wide-angle lens.
[0075] The color reproduction test method and device, electronic device, and storage medium provided in the embodiments of the present application are specifically described through the following embodiments. First, the color reproduction test method in the embodiments of the present application is described.
[0076] Figure 1 This is an optional flow chart of the color reproduction test method of the wide-angle lens provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S106.
[0077] Step S101 : obtaining an initial image of a preset color card captured by a wide-angle lens.
[0078] Step S102: extracting a color card area from the initial image.
[0079] Step S103: performing color block edge detection on the color card area to obtain color block outline coordinate data.
[0080] Step S104 , performing color extraction on the color card area according to the color block outline coordinate data to obtain color block color data.
[0081] Step S105 , performing color filling according to the color block color data and a preset color card template to obtain a reconstructed color card image.
[0082] Step S106 , performing index calculation based on the reconstructed color card image and the color data of the preset color card to obtain color index parameters, so as to evaluate the color reproduction capability of the wide-angle lens according to the color index parameters.
[0083] In steps S101 to S106 shown in the embodiment of the present application, first, an initial color card image captured by a wide-angle lens is obtained, and the color card area is extracted. Then, the outline of the color block is identified by edge detection, and color extraction is performed based on these outline data to obtain the color information of the color block. Next, the extracted color data and the preset color card template are used to perform color filling to reconstruct the color card image. Finally, by comparing the reconstructed color card image with the color data of the preset color card, the color index parameters are calculated to evaluate the color reproduction ability of the wide-angle lens. Compared with the existing testing method, the present method does not require distortion correction of the image captured by the wide-angle lens, but directly generates a reconstructed color card image based on the captured image, and performs color reproduction ability evaluation based on the color card, thereby improving the efficiency of the color reproduction test.
[0084] In step S101 of some embodiments, the preset color chart can be a 24-color chart or a 12-color chart, and the tester can adjust this according to actual test requirements. The initial image is an image of the preset color chart captured by a wide-angle lens. It should be noted that in the application scenario of the color reproduction test in some embodiments, the test requires that the preset color chart occupy 50% to 70% of the initial image. In other words, the initial image will capture the background in addition to the preset color chart. In order to eliminate the interference of the background on subsequent image processing, it is necessary to extract the color chart image in the initial image.
[0085] See also Figure 2 In some embodiments, step S102 may include, but is not limited to, steps S201 to S206:
[0086] Step S201: Acquire the initial pixel color value of the initial image.
[0087] Step S202 : determining a segmentation threshold according to the initial pixel color value to obtain a first color threshold.
[0088] Step S203: Convert the initial image into a first intermediate image in a luminance-chrominance color space, and convert the first color threshold into a luminance threshold in a luminance channel, wherein the luminance-chrominance color space includes a luminance channel.
[0089] Step S204 : binarize the first intermediate image according to the brightness threshold to obtain a brightness binarized image.
[0090] Step S205 , performing contour detection on the brightness binary image to obtain target contour coordinate data.
[0091] Step S206 , cropping the initial image based on the target outline coordinate data to obtain a color card area.
[0092] In step S201 of some embodiments, the initial pixel color value is the RGB value of each pixel in the initial image.
[0093] In step S202 of some embodiments, the first color threshold is the RGB average value of the background. It should be noted that in the application scenario of the color reproduction test in some embodiments, the test requires that the background of the preset color card is a neutral gray of 18°, such as Figure 10 shown.
[0094] In step S203 of some embodiments, the luminance and chromaticity color space may be a Lab color space, and the first intermediate image may be an L channel image obtained by converting the initial image from the RGB color space to the Lab color space, such as Figure 11 As shown. It is understandable that the embodiment of the present application selects the image in the Lab color space and the L component channel because for the initial image in the color reproduction test scene, this color space and component channel have a better segmentation effect on the background area and the color card area. The selection of the color space and component channel can be adaptively modified according to the actual image to be processed. The brightness threshold is the brightness value of the brightness L channel in the Lab color space converted from the first color threshold.
[0095] In step S204 of some embodiments, the pixels in the first intermediate image whose brightness values are greater than or equal to the brightness threshold are set to 100, and the pixels whose brightness values are less than the brightness threshold are set to 0, thereby obtaining a binarization result. In some embodiments, the binarization result is further debinarized, and the final image obtained is a brightness binarized image, such as Figure 12 shown.
[0096] In step S205 of some embodiments, the target contour coordinate data may be a set of pixel coordinate data for the color card edge. Contour detection can be performed on the binary luminance image using a machine vision algorithm. In this embodiment, the contour detection function (findContours) of the OpenCV library is used to obtain contour level information in the binary luminance image. This contour level information includes the contours of multiple small color blocks and the contours of the color card edge. The largest contour, i.e., the contour of the color card edge, is selected and contour fitting is performed on it to obtain the target contour coordinate data.
[0097] In step S206 of some embodiments, four vertices in the target contour coordinate data are selected to locate the preset color card, and the target contour coordinate data is corrected based on the four vertices. It should be noted that the operation here is not to correct the distortion of the image, but to straighten the extracted contour data, and finally extract the minimum bounding rectangle of the color card, and crop the color card area according to the minimum bounding rectangle, such as Figure 13 shown.
[0098] Steps S201 to S206 shown in the embodiment of the present application accurately extract the color card area from the initial image through a series of image processing steps, providing a reliable data basis for subsequent color reproduction testing.
[0099] See also Figure 3 In some embodiments, step S202 determines the segmentation threshold value based on the initial pixel color value to obtain the first color threshold value, which may include but is not limited to steps S301 to S303:
[0100] Step S301 : performing pixel color clustering on the initial pixel color value to obtain first color clustering data.
[0101] Step S302 : Filtering out a target class and a color value of each pixel corresponding to the target class from the first color clustering data based on the number of pixels corresponding to each class.
[0102] Step S303 , performing numerical calculation based on the color value of the pixel corresponding to the target class to obtain a first color threshold.
[0103] In step S301 of some embodiments, the first color clustering data is the result of clustering the initial pixel color values, including the color value of each pixel corresponding to each class, which can be obtained by a K-clustering algorithm. For example, for an application scenario where the preset color palette is a 24-color palette, 25 centroids (24 colors plus a background gray class) are randomly distributed in the initial image in the RGB color space. The RGB values of all pixels in the initial image are clustered based on the spatial distance between the pixel RGB values and the 25 centroids, ultimately obtaining 25 classes and the pixels corresponding to each class.
[0104] In step S302 of some embodiments, the target class is classified as a background color class. In the color reproduction test scene of the present application, the target class is the 18° neutral gray class of the background, and this color accounts for the largest proportion in the initial image, so the background area can be extracted by selecting the class with the largest number of pixels.
[0105] In step S303 of some embodiments, the numerical calculation is to calculate the average value of the RGB values of the pixels classified as the target class.
[0106] Steps S301 to S303 shown in the embodiment of the present application ensure that the background color can be accurately extracted and used in the color reproduction test through pixel color clustering and screening, providing a reliable foundation for subsequent image processing and color correction.
[0107] See also Figure 4In some embodiments, step S103, i.e., performing color block edge detection on the color card area to obtain color block outline coordinate data, step S103 may include but is not limited to steps S401 to S405:
[0108] Step S401: obtaining the color values of the color card pixels in the color card area.
[0109] Step S402 : determining a segmentation threshold according to the color values of the color card pixels to obtain a second color threshold.
[0110] Step S403: Convert the color card area into a second intermediate image in a hue-saturation-lightness color space, and convert the second color threshold into a lightness threshold in a lightness channel. The hue-saturation-lightness color space includes a lightness channel.
[0111] Step S404: binarize the second intermediate image according to the brightness threshold to obtain a brightness binarized image.
[0112] Step S405 , performing contour detection on the brightness binary image to obtain color block contour coordinate data.
[0113] In step S401 of some embodiments, the color card pixel color value is the RGB value of each pixel in the color card area extracted in the above step.
[0114] In step S402 of some embodiments, the second color threshold is the RGB value of the black class in the color card. The calculation principle of this step is consistent with the calculation principle of the first color threshold. In the color reproduction test scenario of this application, since the border and one color block of the color card template are both black, the RGB values of the pixels in the color card are first clustered. The class with the largest number of pixels is the black class. The average value of all RGB values corresponding to the black class is calculated, and the obtained RGB average value is the second color threshold.
[0115] In step S403 of some embodiments, the hue, saturation, and lightness color space may be an HSV color space. The second intermediate image, i.e., the color card area, is converted from the RGB color space to the V channel image of the HSV color space, such as Figure 14 The brightness threshold is the brightness value of the V channel in the HSV color space converted from the second color threshold.
[0116] In step S404 of some embodiments, the pixels in the second intermediate image whose brightness values are greater than or equal to the brightness threshold are set to have a brightness value of 1, representing white, and the pixels whose brightness values are less than the brightness threshold are set to have a brightness value of 0, representing black. The resulting image brightness binarization image is as follows: Figure 15 shown.
[0117] In step S405 of some embodiments, the color block outline coordinate data can be a set of pixel coordinate data of the edges of all color blocks in the color card area image. A contour detection function (find Contours) is used to obtain the closed figure outline in the luminance binary image, and the area of the closed figure outline is statistically calculated, and the final color block outline coordinates are obtained by trimming the mean value. For example, in the color restoration test scene of the embodiment of the present application, the color block outline is a quadrilateral, and when confirming the black class, since the black color block and the edge are both displayed as black in the luminance binary image, there is no way to distinguish it from other color blocks when detecting the color block outline, so the outline of the black color block will not be found, and finally 23 color block outlines are found.
[0118] In steps S401 to S405 shown in the embodiment of the present application, the contours of the color blocks are accurately identified and extracted by performing secondary processing on the extracted color card area.
[0119] See also Figure 5 In some embodiments, step S104 may also include but is not limited to steps S501 to S505:
[0120] Step S501 : performing pixel color extraction on the color card area according to the color block outline coordinate data to obtain the color block pixel color value of each pixel of the color block.
[0121] Step S502 , calculating an average value of the color block pixel color values of all pixels in the color block to obtain a color average value.
[0122] Step S503 , performing a gap evaluation on each pixel according to the color average value and the color value of each color block pixel to obtain an outlier pixel.
[0123] Step S504 : If the number of outlier pixels is greater than a preset outlier number threshold, a predetermined proportion of outlier pixels are deleted, and the color values of all pixels in the color block are returned to be averaged to obtain a color average.
[0124] Step S505 : If the number of outlier pixels is less than or equal to a preset pixel number threshold, the color average value is determined as the color block color data.
[0125] In step S501 of some embodiments, the color block pixel color value is the RGB value of each pixel for the same color block. The color block outline coordinate data includes a set of outline coordinates of each color block. Pixels surrounded by the same color block outline coordinates can be determined as objects for which RGB values are extracted.
[0126] In step S502 of some embodiments, the RGB values of all pixels in the same color block are averaged to obtain an RGB average value, which is also a color average value.
[0127] In step S503 of some embodiments, please refer to Figure 6 In some embodiments, step S503 includes but is not limited to steps S601 to S602:
[0128] Step S601 , performing a difference calculation based on the color average value and the color value of each pixel to obtain a color difference value of each pixel.
[0129] Step S602: If the color difference value is greater than or equal to the preset difference threshold, the pixel is determined to be an outlier pixel.
[0130] In step S601 of some embodiments, the color difference value is the absolute value of the difference between the color average value and the RGB value of a pixel in the corresponding color block.
[0131] In step S602 of some embodiments, the preset difference threshold may be 100, which may be modified by the tester according to the test needs. The embodiments of the present application do not strictly limit the specific value of the preset difference threshold. An outlier pixel is a pixel whose RGB value differs too much from the RGB average value.
[0132] In steps S601 and S602 of the present embodiment, outlier pixels in a color block are identified by calculating the difference between the pixel and the average color value of the color block. This improves the accuracy of the color block average value and provides a more reliable data foundation for subsequent color reproduction testing and color difference analysis.
[0133] In some embodiments, in step S504, the preset outlier number threshold may be 5% of the number of pixels in the current color block. The predetermined ratio may also be 5%, which is not strictly limited in the present embodiment. If the number of outlier pixels exceeds the preset outlier number threshold, the process returns to step S502 and recalculates the average RGB value of the current color block.
[0134] In step S505 of some embodiments, if the number of outlier pixels is less than or equal to a preset outlier number threshold, the average RGB value in S502 is directly used as the RGB value of the current color block.
[0135] Steps S501 to S505 shown in the embodiment of the present application provide a more reliable data basis for subsequent color reproduction testing and color difference analysis by improving the accuracy of the color mean of the color blocks.
[0136] See also Figure 7 In some embodiments, step S105, i.e., performing color filling according to the color block color data and the preset color card template to obtain a reconstructed color card image, may include but is not limited to steps S701 to S702:
[0137] Step S701 : Filling the border area of the color card template with color according to the second color threshold value to obtain an intermediate color card image.
[0138] Step S702 : Filling the color block area of the intermediate color card image with color according to the color block color data to obtain a reconstructed color card image.
[0139] In step S701 of some embodiments, the color card template may be, for example, an image of 1920px by 1280px, with 24 color blocks of 240px by 240px arranged in an array, where the starting pixel coordinates of the first color block are (50, 50), and adjacent color blocks are spaced 50px apart. The border area is filled with the black RGB value, i.e., the second color threshold. In this embodiment, the black blocks are also filled with color based on the black RGB value to obtain an intermediate color card image. At this point, the intermediate color card image, except for the black block, has not yet been filled with color.
[0140] In step S702 of some embodiments, the 23 color block color data obtained in the above steps are sequentially filled into the intermediate color card image to finally obtain a reconstructed color card image, such as Figure 16 shown.
[0141] In steps S701 to S702 shown in the embodiment of the present application, a color card can be generated quickly and efficiently by extracting colors from a color card image and then directly filling the colors into a preset color card template.
[0142] In step S106 of some embodiments, the color data of the preset color chart can be color data widely used in the industry, such as the X-rite 24 color chart standard value. Color index parameters can be color difference, saturation level, and white balance error data. The reconstructed color chart image can be input into a professional image processing software program (such as Imatest, which is widely used in scientific research, industrial testing, medical imaging, and other fields, and iQ-Analyzer) to calculate and output color difference values, saturation, including color difference of brightness in different color spaces; color difference after calibrating saturation, and color difference after not calibrating saturation.
[0143] See also Figure 8 The present invention also provides a color reproduction test device for a wide-angle lens, which can implement the above-mentioned color reproduction test method for a wide-angle lens. The device includes:
[0144] The acquisition module is used to obtain an initial image of a preset color card captured by a wide-angle lens.
[0145] The color card extraction module is used to extract the color card area from the initial image.
[0146] The color block outline detection module is used to perform color block edge detection on the color card area to obtain color block outline coordinate data.
[0147] The color extraction module is used to extract the color of the color card area according to the color block outline coordinate data to obtain the color data of the color block.
[0148] The color card reconstruction module is used to perform color filling according to the color data of the color block and the preset color card template to obtain a reconstructed color card image.
[0149] The parameter determination module is used to perform index calculation based on the reconstructed color card image and the color data of the preset color card to obtain color index parameters, so as to evaluate the color reproduction ability of the wide-angle lens according to the color index parameters.
[0150] The specific implementation of the color reproduction testing device for a wide-angle lens is substantially the same as the specific embodiment of the color reproduction testing method for a wide-angle lens described above, and will not be described in detail herein.
[0151] The present application also provides an electronic device comprising a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the wide-angle lens color reproduction test method. The electronic device can be any smart terminal, including a tablet computer and an in-vehicle computer.
[0152] See also Figure 9 , Figure 9 The hardware structure of an electronic device according to another embodiment is shown. The electronic device includes:
[0153] The processor 901 can be implemented as a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.
[0154] Memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). Memory 902 can store an operating system and other application programs. When implementing the technical solutions provided in the embodiments of this specification through software or firmware, the relevant program code is stored in memory 902 and is called by processor 901 to execute the color reproduction test method for a wide-angle lens in the embodiments of this application.
[0155] Input / output interface 903, used to implement information input and output;
[0156] Communication interface 904, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WiFi, Bluetooth, etc.);
[0157] Bus 905 , which transmits information between various components of the device (e.g., processor 901 , memory 902 , input / output interface 903 , and communication interface 904 );
[0158] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0159] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-mentioned color reproduction test method for a wide-angle lens.
[0160] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0161] The embodiments of the present application provide a method and device for testing color reproduction of a wide-angle lens, an electronic device, and a storage medium. The method obtains an initial color card image captured by a wide-angle lens and extracts the color card area. Then, the outline of the color block is identified through edge detection, and color extraction is performed based on these outline data to obtain the color information of the color block. Next, the extracted color data and a preset color card template are used to perform color filling to reconstruct the color card image. Finally, by comparing the reconstructed color card image with the color data of the preset color card, the color index parameters are calculated to evaluate the color reproduction ability of the wide-angle lens. Compared with existing testing methods, this method does not require distortion correction of the image captured by the wide-angle lens, but directly generates a reconstructed color card image based on the captured image, thereby improving the efficiency of the color reproduction test.
[0162] The embodiments described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0163] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0164] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0165] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0166] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0167] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0168] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0169] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0170] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0171] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes multiple instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: various media that can store programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0172] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and essence of the present invention should be within the scope of the present invention.
Claims
1. A method for testing the color reproduction of a wide-angle lens, characterized in that: The method comprises: Acquire an initial image of a preset color chart captured by a wide-angle lens; Extracting a color card area from the initial image; Performing color block edge detection on the color card area to obtain color block outline coordinate data; Performing color extraction on the color card area according to the color block outline coordinate data to obtain color block color data; Performing color filling according to the color block color data and a preset color card template to obtain a reconstructed color card image; performing index calculation based on the reconstructed color card image and the color data of the preset color card to obtain color index parameters, so as to evaluate the color reproduction capability of the wide-angle lens according to the color index parameters; The color block edge detection is performed on the color card area to obtain color block outline coordinate data, including: Get the color value of the color card pixel in the color card area; Determine the segmentation threshold according to the color value of the color card pixel to obtain a second color threshold; wherein the second color threshold is the RGB value of the black class in the color card; Converting the color card area into a second intermediate image in a hue-saturation-lightness color space, and converting the second color threshold into a lightness threshold on a lightness channel; wherein the hue-saturation-lightness color space includes the lightness channel; Binarizing the second intermediate image according to the brightness threshold to obtain a brightness binarized image; Performing contour detection on the brightness binary image to obtain the color block contour coordinate data; The color filling is performed according to the color block color data and a preset color card template to obtain a reconstructed color card image, including: Filling the border area of the color card template and the black block of the color card template with color according to the second color threshold to obtain an intermediate color card image; The color block area of the intermediate color card image is filled with color according to the color block color data to obtain the reconstructed color card image.
2. The method according to claim 1, characterized in that The step of extracting a color card area from the initial image includes: Obtaining an initial pixel color value of the initial image; Determine a segmentation threshold based on the initial pixel color value to obtain a first color threshold; Converting the initial image into a first intermediate image in a luminance-chrominance color space, and converting the first color threshold into a luminance threshold on a luminance channel; wherein the luminance-chrominance color space includes the luminance channel; Binarizing the first intermediate image according to the brightness threshold to obtain a brightness binarized image; Performing contour detection on the brightness binary image to obtain target contour coordinate data; The initial image is cropped based on the target outline coordinate data to obtain the color card area.
3. The method according to claim 2, characterized in that The step of determining a segmentation threshold value according to the initial pixel color value to obtain a first color threshold value includes: Performing pixel color clustering on the initial pixel color values to obtain first color clustering data, wherein the first color clustering data includes a color value of each pixel corresponding to each cluster; Filtering a target class and a color value of each pixel corresponding to the target class from the first color clustering data based on the number of pixels corresponding to each class; The first color threshold is obtained by performing numerical calculation based on the color value of the pixel corresponding to the target class.
4. The method according to claim 1, wherein The step of performing color extraction on the color card area according to the color block outline coordinate data to obtain color block color data includes: Perform pixel color extraction on the color card area according to the color block outline coordinate data to obtain a color block pixel color value of each pixel of the color block; Calculating an average value of the color block pixel color values of all pixels of the color block to obtain a color average value; Performing a gap evaluation on each pixel based on the color average value and the color value of each color block pixel to obtain an outlier pixel; If the number of the outlier pixels is greater than a preset outlier number threshold, a predetermined proportion of the outlier pixels are deleted, and the color values of all pixels of the color block are returned to be averaged to obtain a color average value; If the number of the outlier pixels is less than or equal to a preset pixel number threshold, the color average value is determined as the color block color data.
5. The method according to claim 4, characterized in that The step of performing a gap evaluation on each pixel according to the color average value and the color value of each color block pixel to obtain an outlier pixel includes: Calculate the difference between the color average value and the color value of each pixel to obtain a color difference value of each pixel; If the color difference value is greater than or equal to a preset difference threshold, the pixel is determined to be the outlier pixel.
6. A color reproduction test device for a wide-angle lens, characterized in that: The device comprises: An acquisition module, the acquisition module is used to acquire an initial image of a preset color card captured by a wide-angle lens; A color card extraction module, the color card extraction module is used to extract a color card area from the initial image; A color block outline detection module, which is used to perform color block edge detection on the color card area to obtain color block outline coordinate data; A color extraction module, configured to extract color from the color card area according to the color block outline coordinate data to obtain color block color data; A color card reconstruction module, configured to perform color filling according to the color block color data and a preset color card template to obtain a reconstructed color card image; a parameter determination module, configured to perform index calculation based on the reconstructed color card image and the color data of the preset color card to obtain color index parameters, so as to evaluate the color reproduction capability of the wide-angle lens according to the color index parameters; The color reproduction test device is further used to: perform color block edge detection on the color card area to obtain color block outline coordinate data, including: Get the color value of the color card pixel in the color card area; Determine the segmentation threshold according to the color value of the color card pixel to obtain a second color threshold; wherein the second color threshold is the RGB value of the black class in the color card; Converting the color card area into a second intermediate image in a hue-saturation-lightness color space, and converting the second color threshold into a lightness threshold on a lightness channel; wherein the hue-saturation-lightness color space includes the lightness channel; Binarizing the second intermediate image according to the brightness threshold to obtain a brightness binarized image; Performing contour detection on the brightness binary image to obtain the color block contour coordinate data; The color filling is performed according to the color block color data and a preset color card template to obtain a reconstructed color card image, including: Filling the border area of the color card template and the black block of the color card template with color according to the second color threshold to obtain an intermediate color card image; The color block area of the intermediate color card image is filled with color according to the color block color data to obtain the reconstructed color card image.
7. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Color cast detection method and device, equipment and storage medium
CN113840135A