A camera linearity correction method and apparatus
By fitting and dynamically selecting correction coefficients for images from industrial cameras under different exposure conditions, the problem of inconsistent grayscale response characteristics of industrial cameras under different exposure conditions is solved, achieving consistency in the accuracy of image grayscale levels and colors, and improving the accuracy of image analysis and quantitative measurement.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2026-03-20
AI Technical Summary
Industrial cameras exhibit inconsistent grayscale response characteristics under different exposure conditions, leading to inconsistencies in grayscale level and color accuracy, which affects the accuracy of image analysis and quantitative measurement.
By determining the RGB channel measurements of the image at each exposure time, a fitting function is calculated, and correction coefficients are dynamically selected. Corrections are then performed based on the average grayscale value range at different exposure times, generating a correction coefficient matrix that adapts to different exposure conditions and image features.
It achieves consistent accuracy in image grayscale and color under different exposure conditions, improving the accuracy of image analysis and quantitative measurement.
Smart Images

Figure CN119071473B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of industrial camera correction, in particular to a camera linearity correction method and device. BACKGROUND
[0002] Industrial cameras are high-performance image acquisition devices mainly used in industrial applications. They convert light signals into digital images through imaging sensors and analyze and process them through image processing algorithms. Industrial cameras have high resolution, high sensitivity and powerful image processing capabilities, and are widely used in machine vision, non-destructive testing, automation and other fields.
[0003] Industrial cameras exhibit different gray response characteristics under different exposure conditions, such as low signal or high noise under low exposure, and signal oversaturation under high exposure. How to ensure that the images obtained under different scenes have consistency in gray level and color accuracy is very important for applications that require image analysis, pattern recognition or image-based quantitative measurement. SUMMARY
[0004] The present application provides a camera linearity correction method and device, which can dynamically determine the correction coefficient according to the characteristics of the actual image, and has strong adaptability to different exposure conditions and image features.
[0005] In a first aspect, the present application provides a camera linearity correction method, which comprises the following steps:
[0006] Determine the measurement value of the RGB channel of the image collected under each exposure time, wherein the gray value corresponding to different exposure times is located at different brightness positions of the full gray scale;
[0007] Fit the measurement value of each channel and the corresponding exposure time to obtain the fitting function of each channel;
[0008] Calculate the actual value of the channel according to the fitting function of each channel, and determine the correction coefficient of each channel under different exposure times according to the measurement value and the actual value;
[0009] Obtain the average gray value of all foreground pixels of the target image, and dynamically select the correction coefficient of each channel under different exposure times according to the range of the average gray value to determine the correction coefficient of all channels.
[0010] In combination with the first aspect, in an embodiment, the dynamic selection of the correction coefficient of each channel under different exposure times according to the range of the average gray value to determine the correction coefficient of all channels comprises:
[0011] generate a correction coefficient matrix according to the correction coefficients of each channel under different exposure times, wherein the number of rows of the matrix is the number of channels, and the number of columns of the matrix is the number of exposure times;
[0012] According to the relationship between the average gray value and the gray value corresponding to the different exposure times, the correction coefficient of the channel is determined based on the data in the corresponding column number of the matrix.
[0013] In combination with the first aspect, in an implementation manner, the correction coefficient of the channel is determined based on the data in the corresponding column number of K according to the relationship between the average gray value and the gray value corresponding to the different exposure times, including:
[0014] The gray values corresponding to the different exposure times are 5%, 20%, 40%, 60% and 80% of the full gray scale respectively;
[0015] If the average gray value is less than or equal to 0.05, linearityK(:,1) is used as the correction coefficient of the channel, wherein linearityK(:,1) represents the first column data of the matrix linearityK;
[0016] If the average gray value is greater than 0.8 and less than or equal to 1, linearityK(:,5) is used as the correction coefficient of the channel, wherein linearityK(:,5) represents the fifth column data of the matrix linearityK;
[0017] If the average gray value is between any two adjacent values of 0.05, 0.2, 0.4, 0.6 and 0.8, a linear interpolation coefficient is calculated by linear interpolation, and then the corresponding two column data in linearityK are weighted and averaged to obtain the correction coefficient of the channel.
[0018] In combination with the first aspect, in an implementation manner, the average gray value of all foreground pixels of the target image is obtained, including:
[0019] The target image is photographed and region extraction is performed, and the extracted region is converted into a gray scale image;
[0020] The gray scale image is binarized to obtain a binarized version of the gray scale image to determine an optimal threshold value;
[0021] The average gray value of all foreground pixels in the binarized image is calculated.
[0022] In combination with the first aspect, in an implementation manner, the measured value of the RGB channel of the image collected under each exposure time is determined, including:
[0023] A plurality of images for linear correction are collected under each exposure time;
[0024] The average value of the RGB channel of the plurality of images at each exposure time is calculated as a measured value of the RGB channel.
[0025] In combination with the first aspect, in an implementation, the fitting of the measured value of each channel and the corresponding exposure time to obtain a fitting function of each channel includes:
[0026] A linear fitting of a first order polynomial is performed with the exposure time as the independent variable and the measured value of the channel as the dependent variable to determine the slope and the intercept to obtain the fitting function of each channel.
[0027] In combination with the first aspect, in an implementation, the determination of the correction coefficient of each channel at different exposure times according to the measured value and the actual value includes:
[0028] The correction coefficient of each channel at different exposure times is determined according to the ratio of the actual value to the measured value.
[0029] In the second aspect, the embodiments of the present application provide a camera linearity correction device, which includes:
[0030] The acquisition module is configured to determine a measured value of an RGB channel of an image acquired at each exposure time, wherein the gray value corresponding to different exposure times is located at different brightness positions of the full gray scale.
[0031] The fitting module is configured to fit the measured value of each channel and the corresponding exposure time to obtain a fitting function of each channel.
[0032] The calculation module is configured to calculate an actual value of the channel according to the fitting function of each channel, and determine a correction coefficient of each channel at different exposure times according to the measured value and the actual value.
[0033] The selection module is configured to obtain an average gray value of all foreground pixels of a target image, and dynamically select the correction coefficient of each channel at different exposure times according to the range of the average gray value to determine the correction coefficient of all channels.
[0034] In combination with the second aspect, in an implementation, the selection module dynamically selects the correction coefficient of each channel at different exposure times according to the range of the average gray value to determine the correction coefficient of all channels, including:
[0035] A correction coefficient matrix is generated according to the correction coefficient of each channel at different exposure times, wherein the number of rows of the matrix is the number of channels, and the number of columns of the matrix is the number of exposure times.
[0036] The correction coefficient of the channel is determined based on the data in the corresponding column number of the matrix according to the relationship between the average gray value and the gray value corresponding to the different exposure times.
[0037] In combination with the second aspect, in an implementation, the selection module determines the correction coefficient of the channel based on the data in the column corresponding to K according to the relationship between the average gray value and the gray value corresponding to the different exposure times, including:
[0038] The gray values corresponding to the different exposure times are 5%, 20%, 40%, 60% and 80% of the full gray scale respectively;
[0039] If the average gray value is less than or equal to 0.05, linearityK(:, 1) is used as the correction coefficient of the channel, where linearityK(:, 1) represents the first column data of the matrix linearityK;
[0040] If the average gray value is greater than 0.8 and less than or equal to 1, linearityK(:, 5) is used as the correction coefficient of the channel, where linearityK(:, 5) represents the fifth column data of the matrix linearityK;
[0041] If the average gray value is between any two adjacent values of 0.05, 0.2, 0.4, 0.6 and 0.8, a linear interpolation coefficient is calculated by linear interpolation, and then the corresponding two column data in linearityK are weighted and averaged to obtain the correction coefficient of the channel.
[0042] The technical scheme provided by the embodiments of the present application has at least the following beneficial effects:
[0043] The camera linearity correction method in the present application determines the measurement value of the RGB channel of the image collected under each exposure time, where the gray value corresponding to the different exposure times is located at different brightness positions of the full gray scale; the measurement value of each channel is fitted with the corresponding exposure time to obtain a fitting function of each channel; the actual value of the channel is calculated according to the fitting function of each channel, and the correction coefficient of each channel under different exposure times is determined according to the measurement value and the actual value; the average gray value of all foreground pixels of the target image is obtained, and the correction coefficient of each channel under different exposure times is dynamically selected according to the range of the average gray value to determine the correction coefficient of all channels.
[0044] That is, by linear fitting, the present application can more accurately describe the change trend of the channel gray value under different exposure times, so as to effectively calculate the actual correction coefficient, and then dynamically select the appropriate correction coefficient according to the range of the average gray value, so that the correction process has certain flexibility and adjustability, and can better adapt to different image brightness and contrast changes. BRIEF DESCRIPTION OF DRAWINGS
[0045] Figure 1Flowchart of an embodiment of a camera linearity correction method of the present application;
[0046] Figure 2 Structure block diagram of an embodiment of a camera linearity correction device of the present application. DETAILED DESCRIPTION
[0047] In order to make the personnel in the art better understand the scheme of the present application, the technical scheme in the embodiments of the present application will be clearly and completely described below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.
[0048] The terms “include” and “have” and any variations thereof in the specification and claims of the present application and the above-described drawings are intended to cover the non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed, or can optionally include other steps or units inherent to the process, method, product or device. The terms “first”, “second” and “third” and the like descriptions are used to distinguish different objects, and do not represent the order or limit the types of “first”, “second” and “third”.
[0049] In the description of the embodiments of the present application, “exemplary”, “for example” or “for instance” is used to mean as an example, illustration or description. Any embodiment or design scheme described as “exemplary”, “for example” or “for instance” in the embodiments of the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. Rather, the words “exemplary”, “for example” or “for instance” are intended to present the relevant concept in a specific manner.
[0050] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; “and / or” in the text only describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone, and in addition, in the description of the embodiments of the present application, “multiple” means two or more than two.
[0051] In some of the processes described in this embodiment of the application, multiple operations or steps are included in a specific order, but it should be understood that these operations or steps can be performed in an order other than the order in which they appear in this embodiment of the application or in parallel, and the serial number of the operation is only used to distinguish different operations, and the serial number itself does not represent any execution order. In addition, these processes can include more or fewer operations, and these operations or steps can be performed in sequence or in parallel, and these operations or steps can be combined.
[0052] For the purpose, technical solutions and advantages of the present application, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
[0053] In a first aspect, the embodiments of the present application provide a camera linearity correction method.
[0054] In an embodiment, with reference to Figure 1 , Figure 1 The flowchart of an embodiment of the camera linearity correction method of the present application is shown in FIG. 1. As shown in FIG. 1, the camera linearity correction method comprises: Figure 1
[0055] S1, determining the measurement value of the RGB channel of the image collected under each exposure time, wherein the gray value corresponding to different exposure times is located at different brightness positions of the full gray scale;
[0056] The RGB channel value refers to the value of the red (Red), green (Green) and blue (Blue) color channels, which is used to represent color in a digital image.
[0057] In this embodiment, the image is collected by an industrial camera, and the center 200x200 region is selected. Under different exposure times, multiple images (such as three) for linearity correction are continuously collected, and for each image under each exposure time, the average value of its gray scale or RGB channel is calculated as the measurement value imgETMeanValue of the RGB channel.
[0058] In this embodiment, the exposure time is set to five, and the gray values corresponding to different exposure times are 5%, 20%, 40%, 60% and 80% of the full gray scale, respectively.
[0059] It can be understood that the number of types of exposure times and the number of images collected under each exposure time can be reasonably set as needed, which is not limited in this embodiment.
[0060] S2, fitting the measurement value of each channel and the corresponding exposure time to obtain a fitting function of each channel;
[0061] It can be understood that the magnitude and the corresponding exposure time are fitted for three channels, and then three fitting functions are obtained.
[0062] Specifically, in this embodiment, a linear fitting of a first order polynomial is performed with the exposure time as the independent variable and the measured value of the channel as the dependent variable, and the slope and the intercept are determined to obtain the fitting function of each channel.
[0063] It is worth noting that, due to the use of fitting curves, the correction coefficient is dynamically determined according to the characteristics of the actual image, and therefore it has strong adaptability to different exposure conditions and image characteristics. Through the linear fitting of the first order polynomial, the slope and the intercept can accurately describe the change trend of the channel gray scale under different exposure times, so as to effectively calculate the actual correction coefficient.
[0064] S3, calculating the actual value of each channel according to the fitting function of each channel, and determining the correction coefficient of each channel under different exposure times according to the measured value and the actual value;
[0065] After obtaining the fitting function, the actual value actualValue can be calculated according to the fitting parameters, and then the correction coefficient of each channel under different exposure times can be determined according to the ratio of the actual value to the measured value.
[0066] S4, obtaining the average gray value of all foreground pixels of the target image, and dynamically selecting the correction coefficient of each channel under different exposure times according to the range of the average gray value to determine the correction coefficient of all channels.
[0067] In specific implementation, the correction coefficient matrix is generated according to the correction coefficient of each channel under different exposure times, wherein the number of rows of the matrix is the number of channels, and the number of columns of the matrix is the number of exposure times; according to the relationship between the average gray value and the gray value corresponding to the different exposure times, the correction coefficient of the channel is determined based on the data in the corresponding column number of the matrix.
[0068] For obtaining the average gray value of all foreground pixels of the target image, in this embodiment:
[0069] First, a picture is taken, and a 200x200 region in the center thereof is extracted, and the extracted region is converted into a gray scale image.
[0070] Then, the Otsu method is used to binarize the gray scale image to obtain a binarized version of the image to determine the optimal threshold.
[0071] The Otsu method is an automatic threshold selection technique for image segmentation, which is a threshold determination method based on maximum inter-class variance, and is widely used in the field of image processing, especially in binary image processing. According to the Otsu method, the optimal binary threshold is determined, so that the correction process is automatically performed while ensuring image quality, reducing the need for manual intervention and improving processing efficiency.
[0072] Next, the average gray value meanGrayValue of all foreground pixels (white part) in the binary image is calculated;
[0073] Finally, the meanGrayValue is standardized to a value in the range of 0 to 1, and the value of the final channel correction coefficient dstlinearityK is determined according to the value range of meanGrayValue (saturation 5% / 20% / 40% / 60% / 80% corresponds to (0.05 / 0.2 / 0.4 / 0.6 / 0.8), which can also be modified to other values, as long as the saturation covers from low to high).
[0074] Thus, in this embodiment, the appropriate correction coefficient is dynamically selected according to the range of meanGrayValue, so that the correction process has certain flexibility and adjustability, and can better adapt to different image brightness and contrast changes.
[0075] The following is described with a specific example:
[0076] The gray values corresponding to different exposure times are 5%, 20%, 40%, 60% and 80% of the full gray scale, respectively;
[0077] If the average gray value is ≤0.05, linearityK(:,1) is used as the correction coefficient of the channel, where linearityK(:,1) represents the 1st column data of the matrix linearityK;
[0078] If 0.8<average gray value≤1, linearityK(:,5) is used as the correction coefficient of the channel, where linearityK(:,5) represents the 5th column data of the matrix linearityK;
[0079] If the average gray value is between any two adjacent values of 0.05, 0.2, 0.4, 0.6 and 0.8, a linear interpolation coefficient is calculated by linear interpolation, and then the weighted average of the corresponding two columns of data in linearityK is taken as the correction coefficient of the channel.
[0080] For example, if 0.05 < average gray value < 0.2, lCoeff is calculated by linear interpolation, and then linearityK(:, 1) and linearityK(:, 2) are weighted and averaged. Similarly, other intervals are processed: 0.2 to 0.4, 0.4 to 0.6, 0.6 to 0.8.
[0081] Finally, each channel of the image is traversed, and the pixel value of the original image is multiplied by the corresponding dstlinearityK coefficient to adjust the pixel value.
[0082] In summary, the camera linearity correction method in the present application determines the measured values of the RGB channels of the images collected at each exposure time, wherein the gray values corresponding to different exposure times are located at different brightness positions of the full gray scale; fits the measured values of each channel and the corresponding exposure time to obtain a fitting function of each channel; calculates the actual values of the channels according to the fitting function of each channel, and determines the correction coefficients of each channel at different exposure times according to the measured values and the actual values; obtains the average gray value of all foreground pixels of the target image, and dynamically selects the correction coefficients at different exposure times in each channel according to the range of the average gray value to determine the correction coefficients of all channels.
[0083] That is, the present application can more accurately describe the change trend of the channel gray value at different exposure times by linear fitting, so as to effectively calculate the actual correction coefficients, and dynamically select the appropriate correction coefficients according to the range of the average gray value, so that the correction process has certain flexibility and adjustability, and can better adapt to different image brightness and contrast changes.
[0084] In a second aspect, the embodiments of the present application also provide a camera linearity correction device.
[0085] In an embodiment, the camera linearity correction device comprises a collection module, a fitting module, a calculation module and a selection module. Figure 2 , Figure 2 The function module schematic diagram of an embodiment of the camera linearity correction device of the present application is shown in FIG. 1. As shown in FIG. 1, the camera linearity correction device comprises a collection module, a fitting module, a calculation module and a selection module. Figure 2
[0086] The collection module is configured to determine the measured values of the RGB channels of the images collected at each exposure time, wherein the gray values corresponding to different exposure times are located at different brightness positions of the full gray scale.
[0087] The fitting module is configured to fit the measured values of each channel and the corresponding exposure time to obtain a fitting function of each channel.
[0088] The calculation module is used to calculate the actual value of each channel based on the fitting function of each channel, and to determine the correction coefficient of each channel at different exposure times based on the measured value and the actual value.
[0089] The selection module is used to obtain the average gray value of all foreground pixels in the target image, and dynamically select from the correction coefficients of each channel at different exposure times according to the range of the average gray value, so as to determine the correction coefficients of all channels.
[0090] Further, in one embodiment, the selection module dynamically selects from the correction coefficients for each channel at different exposure times based on the range of the average grayscale value, to determine the correction coefficients for all channels, including:
[0091] A correction coefficient matrix K is generated based on the correction coefficients for each channel at different exposure times, where the number of rows in K is the number of channels and the number of columns in K is the number of exposure times.
[0092] Based on the relationship between the average gray value and the gray values corresponding to different exposure times, the correction coefficient of the channel is determined based on the data in the column corresponding to K.
[0093] Further, in one embodiment, the selection module determines the channel correction coefficient based on the data in the column corresponding to K, according to the relationship between the average gray value and the gray values corresponding to different exposure times, including:
[0094] The grayscale values corresponding to different exposure times are 5%, 20%, 40%, 60%, and 80% of the full grayscale, respectively;
[0095] If the average gray value is ≤0.05, then linearityK(:,1) is used as the channel correction coefficient, where linearityK(:,1) represents the data in the first column of K;
[0096] If 0.8 < average gray value ≤ 1, then use linearityK(:,5) as the channel correction coefficient, where linearityK(:,5) represents the 5th column of K;
[0097] If the average gray value is between any two adjacent values of 0.05, 0.2, 0.4, 0.6, and 0.8, then the linear interpolation coefficient is calculated through linear interpolation, and then the weighted average of the corresponding two columns of data in K is used as the channel correction coefficient.
[0098] The step of obtaining the average grayscale value of all foreground pixels in the target image includes:
[0099] Capture the target image and extract the region, then convert the extracted region into a grayscale image;
[0100] binarize the grayscale image to obtain a binarized version of the grayscale image to determine an optimal threshold value;
[0101] calculate an average grayscale value of all foreground pixels in the binarized image.
[0102] Further, in an embodiment, the collecting module determines the measurement value of the RGB channel of the image collected at each exposure time, including:
[0103] collect a plurality of images for linearity correction at each exposure time;
[0104] calculate the average value of the RGB channel of the plurality of images at each exposure time as the measurement value of the RGB channel.
[0105] Further, in an embodiment, the fitting module fits the measurement value of each channel and the corresponding exposure time to obtain a fitting function of each channel, including:
[0106] perform linear fitting of a first order polynomial with the exposure time as the independent variable and the measurement value of the channel as the dependent variable to determine the slope and the intercept to obtain the fitting function of each channel.
[0107] Further, in an embodiment, the calculating module determines the correction coefficient of each channel at different exposure times according to the measurement value and the actual value, including:
[0108] determine the correction coefficient of each channel at different exposure times according to the ratio of the actual value to the measurement value.
[0109] The functions of the modules in the camera linearity correction device correspond to the steps in the camera linearity correction method embodiments, and the functions and implementation processes will not be repeated here.
[0110] The above is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation using the content of the specification and drawings, or direct or indirect application in other related technical fields, is also included in the patent protection scope of the present application.
Claims
1. A method for camera linearity correction, characterized in that, The camera linearity correction method includes the following steps: Determine the RGB channel measurements of the image acquired at each exposure time, where the grayscale values corresponding to different exposure times are located at different brightness positions across the entire grayscale. The measured value of each channel is fitted to the corresponding exposure time to obtain the fitting function for each channel; The actual value of each channel is calculated based on the fitting function of each channel, and the correction coefficient of each channel at different exposure times is determined based on the measured value and the actual value. The average gray value of all foreground pixels in the target image is obtained. Based on the range of the average gray value, the correction coefficients for each channel at different exposure times are dynamically selected to determine the correction coefficients for all channels. The step of dynamically selecting from the correction coefficients for each channel at different exposure times based on the range of the average grayscale value to determine the correction coefficients for all channels includes: A correction coefficient matrix is generated based on the correction coefficients for different exposure times for each channel, where the number of rows in the matrix represents the number of channels and the number of columns represents the number of exposure times. Based on the relationship between the average gray value and the gray values corresponding to different exposure times, the correction coefficient of the channel is determined based on the data in the corresponding column of the matrix.
2. The camera linearity correction method as described in claim 1, characterized in that, The step of determining the channel correction coefficient based on the data in the column corresponding to K, according to the relationship between the average gray value and the gray values corresponding to different exposure times, includes: The grayscale values corresponding to different exposure times are 5%, 20%, 40%, 60%, and 80% of the full grayscale, respectively. If the average gray value is ≤0.05, then linearityK(:, 1) is used as the channel correction coefficient, where linearityK(:, 1) represents the data in the first column of the matrix linearityK; If 0.8 < average gray value ≤ 1, then linearityK(:, 5) is used as the channel correction coefficient, where linearityK(:, 5) represents the data in the 5th column of the matrix linearityK; If the average gray value is between any two adjacent values of 0.05, 0.2, 0.4, 0.6, and 0.8, then the linear interpolation coefficient is calculated through linear interpolation, and then the weighted average of the corresponding two columns of data in linearityK is used as the channel correction coefficient.
3. The camera linearity correction method as described in claim 1, characterized in that, The step of obtaining the average grayscale value of all foreground pixels in the target image includes: Capture the target image and extract the region, then convert the extracted region into a grayscale image; The grayscale image is binarized to obtain a binarized version of the grayscale image, in order to determine the optimal threshold; Calculate the average gray value of all foreground pixels in the binarized image.
4. The camera linearity correction method as described in claim 1, characterized in that, The determination of the RGB channel measurements of the image acquired at each exposure time includes: Acquire multiple images for linearity correction at each exposure time; Calculate the average value of the RGB channels of multiple images at each exposure time, and use it as the measurement value of the RGB channels.
5. The camera linearity correction method as described in claim 1, characterized in that, The process of fitting the measured value of each channel to the corresponding exposure time to obtain the fitting function for each channel includes: Using exposure time as the independent variable and the channel measurement as the dependent variable, a first-order polynomial linear fit is performed to determine the slope and intercept to obtain the fitting function for each channel.
6. The camera linearity correction method as described in claim 1, characterized in that, The process of determining the correction coefficient for each channel at different exposure times based on measured and actual values includes: The correction factor for each channel at different exposure times is determined based on the ratio of the actual value to the measured value.
7. A camera linearity correction device, characterized in that, The camera linearity correction device includes: The acquisition module is used to determine the measured values of the RGB channels of the image acquired at each exposure time, where the gray values corresponding to different exposure times are located at different brightness positions across the entire grayscale. The fitting module is used to fit the measured value of each channel with the corresponding exposure time to obtain the fitting function for each channel; The calculation module is used to calculate the actual value of each channel based on the fitting function of each channel, and to determine the correction coefficient of each channel at different exposure times based on the measured value and the actual value. The selection module is used to obtain the average gray value of all foreground pixels in the target image, and dynamically select from the correction coefficients of each channel at different exposure times according to the range of the average gray value, so as to determine the correction coefficients of all channels. The selection module dynamically selects from the correction coefficients for each channel at different exposure times based on the range of the average grayscale value, to determine the correction coefficients for all channels, including: A correction coefficient matrix is generated based on the correction coefficients for different exposure times for each channel, where the number of rows in the matrix represents the number of channels and the number of columns represents the number of exposure times. Based on the relationship between the average gray value and the gray values corresponding to different exposure times, the correction coefficient of the channel is determined based on the data in the corresponding column of the matrix.
8. The camera linearity correction device as described in claim 7, characterized in that, The selection module determines the channel correction coefficient based on the relationship between the average gray value and the gray values corresponding to different exposure times, using data from the column corresponding to K, including: The grayscale values corresponding to different exposure times are 5%, 20%, 40%, 60%, and 80% of the full grayscale, respectively. If the average gray value is ≤0.05, then linearityK(:, 1) is used as the channel correction coefficient, where linearityK(:, 1) represents the data in the first column of the matrix linearityK; If 0.8 < average gray value ≤ 1, then linearityK(:, 5) is used as the channel correction coefficient, where linearityK(:, 5) represents the data in the 5th column of the matrix linearityK; If the average gray value is between any two adjacent values of 0.05, 0.2, 0.4, 0.6, and 0.8, then the linear interpolation coefficient is calculated through linear interpolation, and then the weighted average of the corresponding two columns of data in linearityK is used as the channel correction coefficient.
Citation Information
Patent Citations
Color correction method and device, electronic equipment and storage medium
CN115471426A
Imaging ellipsometer measuring system imaging calibration method and system
CN117451632A