Color correction method and device, electronic equipment and storage medium
By establishing a correspondence table for linear exposure time correction in the image acquisition device, the problem of color distortion in dark areas was solved, accurate color calibration of dark areas was achieved, and the color reproduction accuracy of the image acquisition device was improved.
Patent Information
- Application Number
- CN202211226376.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-09
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2042-10-09
AI Technical Summary
In existing technologies, image acquisition devices are prone to color distortion in dark areas under low-light conditions.
By establishing a correspondence table in the image acquisition device, linear correction is performed based on the image exposure time output by the sensor, replacing the actual value to obtain the target value, ensuring that the value of each channel of each pixel is linearly related to the exposure time.
It effectively overcomes the problem of color distortion in dark areas, ensures the accuracy of dark colors during the color calibration process, and improves the color reproduction accuracy of image acquisition equipment.
Smart Images

Figure CN115471426B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and more particularly, to a color correction method and device, an electronic device, and a storage medium. BACKGROUND
[0002] Image processing technology has made significant progress and application on various electronic devices. Taking a camera as an example, a certain degree of image processing is required after camera imaging to better restore the real scene of the captured image. However, due to hardware limitations, the captured image is prone to dark color distortion problems, and therefore, how to overcome the problem of the captured image being prone to dark color distortion has become a technical problem to be solved. SUMMARY
[0003] The purpose of the present application is to provide a color correction method, device, electronic device, and storage medium, comprising the following technical solutions:
[0004] A color correction method, the method comprising:
[0005] After obtaining a sensor output image in an image acquisition device, for each channel of each pixel in the image, a target value corresponding to the actual value is found in a preset corresponding relationship table;
[0006] The target value is used to replace the actual value to obtain a corrected image;
[0007] Each target value in the corresponding relationship table is in a linear relationship with the exposure time of the image output by the sensor.
[0008] The above method, preferably, the corresponding relationship table is determined by the following method:
[0009] An image of a same uniform area light source is captured by using N different exposure times by the image acquisition device to obtain N images;
[0010] For each of the N images, the mean value of the same channel of at least part of the pixels of the image is calculated;
[0011] For the i-th channel of the pixel, the mean value of the i-th channel in each image is determined as a target value corresponding to the mean value of the i-th channel in the target image in the N images, and the corresponding relationship table is obtained;
[0012] The target value corresponding to the mean value of the i-th channel in the target image is the mean value of the i-th channel of the target image; and the ratio of the target value corresponding to the mean value of the i-th channel in the non-target image to the mean value of the i-th channel in the target image is equal to the ratio of the exposure time of the non-target image to the exposure time of the target image.
[0013] Preferably, the method further comprises:
[0014] extracting a center region image of the image;
[0015] calculating the mean value of the same channel of the pixels in the center region image.
[0016] Preferably, the ratio of the area of the center region image to the area of the image is within a target range, and the target range is [1 / 4, 3 / 4].
[0017] Preferably, the target image is an image with the shortest exposure time among the N images.
[0018] Preferably, the uniform area light source comprises a multi-color temperature projection light box or a DNP light box.
[0019] Preferably, the method further comprises:
[0020] generating a color correction matrix based on the corrected image, wherein the color correction matrix is used for color calibration; or
[0021] color calibrating the corrected image.
[0022] A color correction device, comprising:
[0023] a searching module configured to, after obtaining a sensor output image in an image acquisition device, search, for each actual value of each channel of each pixel in the image, a target value corresponding to the actual value in a preset corresponding relationship table;
[0024] a correction module configured to replace the actual value with the target value to obtain a corrected image;
[0025] Preferably, each target value in the corresponding relationship table is in a linear relationship with the exposure time of the sensor output image.
[0026] An electronic device, comprising:
[0027] a memory configured to store a program;
[0028] A processor is configured to invoke and execute the program in the memory, and implement each step of the color correction method according to any one of the above by executing the program.
[0029] A readable storage medium has a computer program stored thereon, and the computer program, when executed by a processor, implements each step of the color correction method according to any one of the above.
[0030] It can be known from the above solution that the color correction method, device, electronic equipment and storage medium provided by the present application obtain the sensor output image in the image acquisition device, and for the actual value of each channel of each pixel in the image, find the target value corresponding to the actual value in the preset corresponding relationship table; the target value is used to replace the actual value to obtain the corrected image; and each target value in the above corresponding relationship table is in linear relationship with the exposure time of the sensor output image. Based on the corrected image obtained by the present application, the value of each channel of each pixel is in linear relationship with the exposure time of the sensor output image, which ensures the correct dark color in the subsequent color calibration process and overcomes the problem that the captured image is prone to dark color distortion. BRIEF DESCRIPTION OF DRAWINGS
[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required by the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0032] Figure 1 An implementation flowchart of the color correction method provided by the embodiments of the present application;
[0033] Figure 2 An implementation flowchart of determining the corresponding relationship table provided by the embodiments of the present application;
[0034] Figure 3 A structural schematic diagram of the color correction device provided by the embodiments of the present application;
[0035] Figure 4 A structural schematic diagram of the electronic equipment provided by the embodiments of the present application.
[0036] The terms "first", "second", "third", "fourth" and the like (if any) in the description, claims and above drawings are used to distinguish similar parts, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated herein. DETAILED DESCRIPTION
[0037] 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 of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0038] This study found that when an image acquisition device captures an image, due to the inherent characteristics of the sensor, the digital signal exhibits a non-linear relationship with the exposure time under dark (low light) conditions. This non-linear relationship leads to color distortion in the dark areas of the color-calibrated image. Therefore, it is necessary to correct the non-linear relationship of the image output by the sensor to overcome the problem of color distortion in the dark areas of the captured image (i.e., the image output by the image acquisition device).
[0039] The color correction method provided in this application embodiment is used in an image acquisition device, wherein...
[0040] Optionally, the image acquisition device can be a professional camera, such as a traditional consumer camera or an industrial camera.
[0041] Optionally, the image acquisition device can be an electronic device with image acquisition function and other functions, such as a mobile phone, tablet computer or other smart communication device, or a laptop computer, desktop computer or other computer device, as long as these devices have an image acquisition device and can acquire images.
[0042] like Figure 1 The diagram shown is a flowchart of one implementation of the color correction method provided in this application, which may include:
[0043] Step S101: After obtaining the sensor output image in the image acquisition device, for the actual value of each channel of each pixel in the image, find the target value corresponding to the actual value in a preset correspondence table. Each target value in the correspondence table is linearly related to the exposure time of the image output by the sensor (i.e., the exposure time when the sensor of the acquisition device acquires the image).
[0044] Here, "sensor" refers to the photosensitive element in an image acquisition device. When the image acquisition device acquires an image of a target object, after the sensor outputs the image, the device does not directly perform color calibration. Instead, it first performs color correction and then performs color calibration on the color-corrected image. Specifically,
[0045] Each pixel in the image output by the sensor can include multiple channels. For example, if the sensor outputs an RGB image, each pixel in the RGB image includes three channels of R, G and B.
[0046] For the i-th channel of the j-th pixel in the image output by the sensor, find the target value corresponding to the actual value of the i-th channel of the j-th pixel in the preset correspondence table.
[0047] j = 1, 2, 3, …, J, wherein J is the number of pixels included in the image output by the sensor.
[0048] i = 1, 2, 3, …, I, wherein I is the number of channels included in a single pixel in the image output by the sensor. For example, if the image output by the sensor is an RGB image, i = 1, 2, 3.
[0049] Step S102: replace the actual value with the target value to obtain a corrected image.
[0050] The color correction method provided by the embodiments of the present application obtains the image output by the sensor in the image acquisition device, and for the actual value of each channel of each pixel in the image, finds the target value corresponding to the actual value in the preset correspondence table. The actual value is replaced with the target value to obtain a corrected image. Since each target value in the correspondence table is in a linear relationship with the exposure time of the image output by the sensor, the value of each channel of each pixel in the corrected image is in a linear relationship with the exposure time of the image output by the sensor, which can ensure the correct dark color in the subsequent color calibration process and overcome the problem that the image captured by the image acquisition device is prone to color distortion in the dark part.
[0051] In an optional embodiment, the present application further provides a correspondence table determination method. As shown in Figure 2 The implementation flowchart for determining the correspondence table provided by the embodiments of the present application can include the following steps:
[0052] Step S201: capture images of the same uniform area light source by using N different exposure times by the image acquisition device to obtain N images.
[0053] As an example, the uniform area light source can be a multi-color temperature projection light box.
[0054] As an example, the uniform area light source can be a DNP light box.
[0055] As an example, the N different exposure times can be all exposure times that the image capturing device can implement. For example, if the minimum exposure time that the image capturing device can implement is 1 ms and the maximum exposure time that the image capturing device can implement is 2000 ms, then N = 2000, i.e., the exposure times are 1 ms, 2 ms, 3 ms, …, 1999 ms, 2000 ms.
[0056] When the N different exposure times are used by the image capturing device to capture images of the same uniform area light source, the lens of the image capturing device is directed to the same uniform area light source each time, and the image capturing device sets different exposure times each time an image is captured, until an image is captured based on all exposure times that the image capturing device can implement.
[0057] Step S202: For each of the N images, calculate the mean value of the same channel of at least part of the pixels of the image.
[0058] As an example, for the nth(n = 1, 2, 3, …, N) image of the N images, the mean value of the same channel of all pixels in the nthimage can be calculated.
[0059] As an example, for the nthimage of the N images, the mean value of the same channel of part of the pixels in the nthimage can be calculated. For example, a central region image of the image can be extracted; the mean value of the same channel of the pixels in the central region image is calculated. Optionally, the ratio of the area of the central region image to the area of the nthimage is within a target range, which can be [1 / 4, 3 / 4]. In actual applications, the edge region of the image output by the sensor of the image capturing device can have lens shading. If the mean value of the pixels of the entire image is calculated, the accuracy of the correspondence table can be relatively low due to the presence of lens shading. By calculating the mean value of the same channel of the pixels of the central region image, the influence of the presence of lens shading can be avoided, and thus the accuracy of the correspondence table can be improved. The area of the central region image cannot be too large or too small. Therefore, in this application, the area of the central region image is at least 1 / 4 of the area of the nthimage and at most 3 / 4 of the area of the nthimage.
[0060] Taking an RGB image as an example, a central 1 / 4 size region image of the nthimage can be extracted. For all pixels in the 1 / 4 size region image, the mean value of the R channel of all pixels in the 1 / 4 size region image is calculated, the mean value of the G channel of all pixels in the 1 / 4 size region image is calculated, and the mean value of the B channel of all pixels in the 1 / 4 size region image is calculated, to obtain the mean value of the R channel, the mean value of the G channel, and the mean value of the B channel of the nthimage.
[0061] Step S203: For the i-th channel of the pixel, taking the mean value of the i-th channel in the target image in the N images as the reference value, determine the target value corresponding to the mean value of the i-th channel in each image, and obtain the above correspondence table.
[0062] Wherein, the target value corresponding to the mean value of the i-th channel in the target image is the mean value of the i-th channel in the target image; the ratio of the target value corresponding to the mean value of the i-th channel in the non-target image to the mean value of the i-th channel in the target image (i.e. the target value) is equal to the ratio of the exposure time of the non-target image to the exposure time of the target image.
[0063] The target image can be any one of the N images. As an example, the target image can be the image with the shortest exposure time in the N images.
[0064] As an example, for the i-th channel of the n-th image, if the n-th image is the target image, the target value of the i-th channel of the n-th image is the mean value of the i-th channel of the n-th image; if the n-th image is not the target image, the ratio of the target value of the i-th channel of the n-th image to the mean value of the i-th channel of the target image is equal to the ratio of the exposure time of the n-th image to the exposure time of the target image.
[0065] As described in Table 1-3, one of the correspondence tables of R, G, B channels provided by the embodiments of the present application is as follows:
[0066] Table 1
[0067] [R digit ]]> [R ideal ]] 1 ms [R digit_1ms ]] 1 *R ideal_1ms ]]> 2 ms [R digit_2ms ]] 2 * R ideal_1ms ]] 3 ms [R digit_3ms ]]> 3 * R ideal_1ms ]] …… …… …… N ms [R digit_Nms ]] [N*R ideal_1ms ]]>
[0068] Table 2
[0069] G digit ]]> G ideal ]]> 1 ms G digit_1ms ]]> 1*G ideal_1ms ]]> 2 ms G digit_2ms ]]> 2*G ideal_1ms ]]> 3 ms G digit_3ms ]]> 3*G ideal_1ms ]]> …… …… …… N ms G digit_Nms ]]> N*G ideal_1ms ]]
[0070] Table 3
[0071] B digit ]]> B ideal ]]> 1 ms B digit_1ms ]]> 1 *B ideal_1ms ]] 2 ms B digit_2ms ]]> 2*B ideal_1ms ]]> 3 ms B digit_3ms ]]> 3*B ideal_1ms ]]> …… …… …… N ms B digit_Nms ]]> N*B ideal_1ms ]]>
[0072] In the three correspondence tables, the image with an exposure time of 1 ms is taken as the target image.
[0073] Taking Table 1 as an example, R digit_nms represents the mean value of the R channel in the image collected with an exposure time of n ms, R digit_nms represents the corresponding target value of the R channel. ideal value (i.e. n*R ideal_1ms ) represents the corresponding target value of the R channel. digit_nms
[0074] Since the actual value of the R channel in the RGB image collected by the image collection device in the actual application scene must fall within the range of Rdigit_1ms to R digit_Nms on a certain value, or the actual value of the R channel in the RGB image collected by the image collection device in the actual application scene is close to R digit_1ms to R digit_Nms on a certain value, and whether it falls on R digit_1ms to R digit_Nms on a certain value is related to the value accuracy of the data. Therefore, R digit in Table 1 can represent the actual value of the R channel in the RGB image collected by the image collection device in the actual application scene; R ideal value can represent the target value corresponding to the actual value of the R channel. When looking up the corresponding relationship table, if the actual value of the R channel in the RGB image collected by the image collection device in the actual application scene does not fall on any one of R digit_1ms to R digit_Nms , the R digit_1ms to R digit_Nms closest to the actual value of the R channel in the RGB image collected by the image collection device in the actual application scene can be taken as the target value corresponding to the actual value of the R channel. digit ideal
[0075] Similarly, the actual value of the G channel in the RGB image collected by the image collection device in the actual application scene must fall on a certain value between G digit_1ms to G digit_Nms , or the actual value of the G channel in the RGB image collected by the image collection device in the actual application scene is close to G digit_1ms to G digit_Nms , and whether it falls on G digit_1ms to G digit_Nms on a certain value is related to the value accuracy of the data. Therefore, G digit in Table 2 can represent the actual value of the G channel in the RGB image collected by the image collection device in the actual application scene; G ideal value can represent the target value corresponding to the actual value of the G channel. When looking up the corresponding relationship table, if the actual value of the G channel in the RGB image collected by the image collection device in the actual application scene does not fall on any one of G digit_1ms to G digit_Nms , the G digit_1ms to G digit_Nms closest to the actual value of the G channel in the RGB image collected by the image collection device in the actual application scene can be taken as the target value corresponding to the actual value of the G channel. digit ideal
[0076] The actual value of the B channel in the RGB image collected by the image collection device in the actual application scenario must fall on a certain value between B digit_1ms and B digit_Nms , or the actual value of the B channel in the RGB image collected by the image collection device in the actual application scenario is close to a certain value between B digit_1ms and B digit_Nms , and whether the actual value falls on a certain value between B digit_1ms and B digit_Nms depends on the precision of the data. Therefore, B digit in Table 3 can represent the actual value of the B channel in the RGB image collected by the image collection device in the actual application scenario; and B ideal can represent the target value corresponding to the actual value of the B channel. When looking up the corresponding relationship table, if the actual value of the B channel in the RGB image collected by the image collection device in the actual application scenario does not fall on any value between B digit_1ms and B digit_Nms , the B digit_1ms value closest to the actual value of the B channel in the RGB image collected by the image collection device in the actual application scenario between B digit_Nms and B digit may be taken as the target value corresponding to the actual value of the B channel. ideal
[0077] Optionally, the above corresponding relationship table can be determined before the image collection device is shipped and integrated in the image collection device before the image collection device is shipped.
[0078] Optionally, the above corresponding relationship table can be determined before the image collection device is shipped, or can be determined after the image collection device is shipped and packaged and uploaded to a designated server. If the user needs the color correction function after purchasing the image collection device, the above corresponding relationship table can be downloaded from the above designated server and installed in the image collection device. After that, the image collection device can perform color correction on the image output by the sensor based on the above corresponding relationship table.
[0079] Further, after obtaining the corrected image, the corrected image can be color calibrated.
[0080] The corrected image can be color calibrated by a preset color correction matrix (CCM), and the specific implementation process can refer to the existing color calibration method, which will not be described in detail here.
[0081] Since the color calibration is performed after the color correction of the image output by the sensor, the dark part of the image after color calibration can not be color cast, and the problem of color distortion in the dark part is overcome.
[0082] The color correction matrix is set before the image acquisition device is shipped, and is specifically obtained by collecting the image of the calibration board (i.e., the standard color card) and fitting the image of the calibration board output by the sensor. The color correction method provided in the embodiments of the application can be used for fitting the color correction matrix.
[0083] Specifically, before the image acquisition device is shipped, the image acquisition device can be used to collect the image of the calibration board (i.e., the target object). After obtaining the image of the calibration board output by the sensor of the image acquisition device, the actual value of each channel of each pixel in the image of the calibration board is found in the preset corresponding relationship table to obtain the target value corresponding to the actual value.
[0084] The target value is used to replace the actual value to obtain the corrected image of the calibration board.
[0085] The color correction matrix is fitted by using the corrected image of the calibration board, and the color correction matrix is used for color calibration of the collected image after the image acquisition device is shipped.
[0086] In summary, optionally, the color correction method provided in the embodiments of the application can further include:
[0087] The color correction matrix is generated based on the corrected image, and the color correction matrix is used for color calibration. This embodiment can be used before the image acquisition device is shipped.
[0088] Optionally, the color correction method provided in the embodiments of the application can further include:
[0089] The corrected image is color calibrated. This embodiment can be used after the image acquisition device is shipped.
[0090] The color correction method provided in the embodiments of the application performs nonlinear correction on the image acquisition device, so that the digital signal output by the image acquisition device has a reasonable linear relationship with the exposure time, so that the dark color (such as black) can also be fitted by the color correction matrix of the linear space, thereby making the color calibration of the image acquisition device more accurate, and the color restoration accuracy of the image acquisition device in actual use can be improved.
[0091] Corresponding to the method embodiments, the embodiments of the application also provide a color correction device, as shown in Figure 3 The color correction device provided in the embodiments of the application can include:
[0092] The color correction device comprises a searching module 301 and a correction module 302.
[0093] The searching module 301 is configured to, after obtaining a sensor output image in an image acquisition device, for each channel of each pixel in the image, search a preset corresponding relation table to obtain a target value corresponding to an actual value.
[0094] The correction module 302 is configured to replace the actual value with the target value to obtain a corrected image.
[0095] Each target value in the corresponding relation table is in a linear relationship with an exposure time of the sensor output image.
[0096] The color correction device provided by the embodiment of the present application obtains a sensor output image in an image acquisition device, for each channel of each pixel in the image, searches a preset corresponding relation table to obtain a target value corresponding to an actual value, and replaces the actual value with the target value to obtain a corrected image. Since each target value in the corresponding relation table is in a linear relationship with an exposure time of the sensor output image, each channel of each pixel in the corrected image is in a linear relationship with the exposure time of the sensor output image, which can ensure correct dark color in a subsequent color calibration process and overcome the problem that the image captured by the image acquisition device is prone to dark color distortion.
[0097] In an optional embodiment, the color correction device further comprises a determination module configured to determine the corresponding relation table, and specifically configured to:
[0098] The image acquisition device is used to capture images of a same uniform surface light source by using N different exposure times to obtain N images.
[0099] For each of the N images, the average value of a same channel of at least part of pixels in the image is calculated.
[0100] For the i-th channel of a pixel, the average value of the i-th channel in each image is determined based on the average value of the i-th channel in a target image in the N images to obtain the corresponding relation table.
[0101] The target value corresponding to the average value of the i-th channel in the target image is the average value of the i-th channel in the target image, and the ratio of the target value corresponding to the average value of the i-th channel in a non-target image to the average value of the i-th channel in the target image is equal to the ratio of the exposure time of the non-target image to the exposure time of the target image.
[0102] In an optional embodiment, when the determining module calculates the mean value of the same channel of at least part of pixels of each of the N images, the method comprises:
[0103] extracting a center region image of the image;
[0104] calculating the mean value of the same channel of pixels in the center region image.
[0105] In an optional embodiment, the ratio of the area of the center region image to the area of the image is within a target range, and the target range is [1 / 4, 3 / 4].
[0106] In an optional embodiment, the target image is an image with the shortest exposure time in the N images.
[0107] In an optional embodiment, the uniform surface light source comprises a multi-color temperature projection light box or a DNP light box.
[0108] In an optional embodiment, the color correction device further comprises:
[0109] a matrix generating module configured to generate a color correction matrix based on the corrected image, the color correction matrix being used for color calibration; or
[0110] a calibration module configured to calibrate the color of the corrected image.
[0111] Corresponding to the method embodiments, the present application further provides an electronic device, which is an image acquisition device, and a structural schematic diagram of the electronic device is shown in Figure 4 The electronic device can comprise at least one processor 1, at least one communication interface 2, at least one memory 3 and at least one communication bus 4.
[0112] In the embodiments of the present application, the number of the processor 1, the communication interface 2, the memory 3 and the communication bus 4 is at least one, and the processor 1, the communication interface 2 and the memory 3 complete the communication among each other through the communication bus 4.
[0113] The processor 1 can be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application, etc.
[0114] The memory 3 can contain a high-speed RAM memory, and can also include a non-volatile memory, etc., such as at least one disk memory.
[0115] The memory 3 stores a program, and the processor 1 can call the program stored in the memory 3, and the program is used for:
[0116] After obtaining the sensor output image in the image acquisition device, for the actual value of each channel of each pixel in the image, a target value corresponding to the actual value is found in a preset corresponding relationship table;
[0117] The target value is used to replace the actual value to obtain a corrected image.
[0118] Each target value in the corresponding relationship table is in linear relationship with the exposure time of the sensor output image.
[0119] Optionally, the refinement function and the extension function of the program can refer to the description above.
[0120] The embodiment of the application further provides a storage medium which can store a program suitable for processor execution, and the program is used for:
[0121] After obtaining the sensor output image in the image acquisition device, for the actual value of each channel of each pixel in the image, a target value corresponding to the actual value is found in a preset corresponding relationship table;
[0122] The target value is used to replace the actual value to obtain a corrected image.
[0123] Each target value in the corresponding relationship table is in linear relationship with the exposure time of the sensor output image.
[0124] Optionally, the refinement function and the extension function of the program can refer to the description above.
[0125] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the present application can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0126] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be realized by other ways. In addition, the coupling or direct coupling or communication connection between the displayed or discussed interfaces, devices or units can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.
[0127] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e. may be located in one place, or may be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0128] In addition, the functional units in each embodiment of the present application can be integrated into one processing unit, or each unit can be physically present alone, or two or more units can be integrated into one unit.
[0129] It should be understood that the features in the embodiments of the present application can be combined with each other to achieve the purpose of solving the above technical problems.
[0130] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the part of the prior art or the part of the technical solutions can be embodied in the form of software products. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the embodiments of the present application. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, and various program code storage media.
[0131] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to the embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A color correction method, characterized in that, The method includes: After obtaining the image output by the sensor in the image acquisition device, for the actual value of each channel of each pixel in the image, the target value corresponding to the actual value is found in a preset correspondence table; The corrected image is obtained by replacing the actual value with the target value. In this context, each target value in the correspondence table is linearly related to the exposure time of the image output by the sensor; The correspondence table is determined in the following way: The image acquisition device acquires images of the same uniform surface light source using N different exposure times, resulting in N images. For each of the N images, calculate the mean of the same channel for at least a portion of the pixels in that image; For the i-th channel of a pixel, the mean value of the i-th channel in the target image of the N images is used as the reference value to determine the target value corresponding to the mean value of the i-th channel in each image, thus obtaining the correspondence table; Wherein, the target value corresponding to the mean of the i-th channel in the target image is the mean of the i-th channel in the target image; the ratio of the target value corresponding to the mean of the i-th channel in the non-target image to the mean of the i-th channel in the target image is equal to the ratio of the exposure time of the non-target image to the exposure time of the target image; For each of the N images, calculating the mean value of the same channel for at least a portion of the pixels in that image includes: Extract the central region of the image; Calculate the mean value of the same channel of pixels in the central region image.
2. The method according to claim 1, characterized in that, The ratio of the area of the central region to the area of the image is within the target range, which is [1 / 4, 3 / 4].
3. The method according to claim 1, characterized in that, The target image is the image with the shortest exposure time among the N images.
4. The method according to claim 1, characterized in that, The uniform surface light source includes: a multi-color temperature projection light box, or a DNP light box.
5. The method according to claim 1, characterized in that, Also includes: A color correction matrix is generated based on the corrected image, and the color correction matrix is used for color calibration. or, The corrected image is then color-calibrated.
6. A color correction device, characterized in that, include: The lookup module is used to, after obtaining the sensor output image in the image acquisition device, for each channel of each pixel in the image, look up the target value corresponding to the actual value in a preset correspondence table; The correction module is used to replace the actual value with the target value to obtain the corrected image; In this context, each target value in the correspondence table is linearly related to the exposure time of the image output by the sensor; The correspondence table is determined in the following way: The image acquisition device acquires images of the same uniform surface light source using N different exposure times, resulting in N images. For each of the N images, the mean value of the same channel for at least a portion of the pixels in that image is calculated. For the i-th channel of a pixel, the target value corresponding to the mean value of the i-th channel in the target image among the N images is determined based on the mean value of the i-th channel in each image, resulting in the correspondence table. The target value corresponding to the mean value of the i-th channel in the target image is the mean value of the i-th channel in the target image. The ratio of the target value corresponding to the mean value of the i-th channel in a non-target image to the mean value of the i-th channel in the target image is equal to the ratio of the exposure time of the non-target image to the exposure time of the target image. For each of the N images, the average value of the same channel of at least a portion of the pixels in that image is calculated, specifically for: extracting the central region image of that image; and calculating the average value of the same channel of the pixels in the central region image.
7. An electronic device, comprising: Memory, used to store programs; A processor is configured to invoke and execute the program in the memory, thereby implementing the various steps of the color correction method as described in any one of claims 1-5.
8. A readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the color correction method as described in any one of claims 1-5.
Citation Information
Patent Citations
A linearity correction method and device for an industrial camera
CN113873222A