Sampling-based high-speed nonlinear color correction method and device and storage medium
Through a high-speed nonlinear color correction method based on sampling, a lookup table is generated by grayscale color card images and combined with an interpolation algorithm, the problem of color consistency calibration between multiple devices is solved, and efficient color correction and stable visual detection is achieved. Effect.
Patent Information
- Application Number
- CN202411810365.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-12-10
AI Technical Summary
The existing color correction methods have poor color correction effects in color correction with higher grayscale or lower, and are large in computing and time-consuming, making it difficult to achieve color consistency calibration between multiple devices.
Using high-speed nonlinear color correction method based on sampling, a lookup table is generated by shooting multiple gray-scale color card images, combined with an interpolation algorithm, color consistency correction between multiple devices is achieved, suitable for light source brightness and camera contrast difference. Scene.
It realizes color consistency correction between multiple devices, reduces the computing volume and time-consuming, is suitable for real-time detection needs, and improves the stability of visual detection.
Smart Images

Figure CN119299864A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of color correction, and in particular relates to a high-speed nonlinear color correction method, device and storage medium based on sampling. Background Art
[0002] There are generally two commonly used color correction methods. One is to directly shoot the white balance grayscale card and then use the automatic white balance in the camera for correction. The other is to shoot the complete color card and then call the automatic color correction algorithm for color correction. The method of directly shooting the white balance grayscale card can only roughly correct the color. Since the photosensitivity of the photosensitive chip and the color difference of the light source are not linear, the correction effect in actual application is not ideal. There is only a certain correction effect on the brightness near the grayscale of the grayscale card. There is still a large color difference between the colors with higher and lower grayscales. The method of shooting the entire color card for correction has a better correction effect and the corrected color is more natural, but it has a large amount of calculation and takes a long time to run. At the same time, the correction effect will also decrease for grayscales that are far away from the grayscale of the correction color card. Summary of the invention
[0003] The present invention provides a high-speed nonlinear color correction method, device and storage medium based on sampling, aiming to solve at least one of the technical problems existing in the prior art.
[0004] The technical solution of the present invention relates to a high-speed nonlinear color correction method based on sampling, and the method comprises the following steps:
[0005] S100, based on the preset exposure time and gain, the reference device takes photos of N-level grayscale color cards to generate N first grayscale color card images;
[0006] S200, adjusting the exposure time and gain of the device to be calibrated so that the exposure time and gain of the device to be calibrated are consistent with the preset exposure time and gain, and the device to be calibrated takes pictures of the same N-level grayscale color card to generate N second grayscale color card images;
[0007] S300, respectively extracting the RGB channel grayscale values of each first grayscale color card image and each second grayscale color card image, and generating a reference device lookup table and a device to be calibrated lookup table;
[0008] S400, the device to be calibrated takes a photo of a physical image, extracts the RGB value of each pixel of the physical image, and respectively calculates the value range of the RGB value of each pixel of the physical image corresponding to the reference device lookup table and the device to be calibrated lookup table;
[0009] S500: Calculate the corrected RGB value of each pixel in the real object image.
[0010] Further, in step S100 and step S200,
[0011] The number of the first grayscale color card images and the second grayscale color card images is consistent with the number of color cards in the N-level grayscale color card.
[0012] Further, the step S300 includes:
[0013] S310, obtaining the RGB value of each pixel of a single first grayscale color card image, calculating the R channel mean, the G channel mean and the B channel mean, and combining them into an RGB mean array of the first grayscale color card image;
[0014] S320, repeating step S310, traversing each first grayscale color card image, generating RGB mean value arrays of N first grayscale color card images, and combining the RGB mean value arrays of the N first grayscale color card images into a reference device lookup table;
[0015] S330, obtaining the RGB value of each pixel of a single second grayscale color card image, calculating the R channel mean, the G channel mean and the B channel mean, and combining them into an RGB mean array of the second grayscale color card image;
[0016] S340, repeat step S330, traverse each second grayscale color card image, generate RGB mean value arrays of N second grayscale color card images, and combine the RGB mean value arrays of the N second grayscale color card images into a lookup table for the device to be calibrated.
[0017] Furthermore, the horizontal axis of the reference device lookup table represents the Nth first grayscale color card image, and the vertical axis represents the average grayscale of the R channel, the G channel, and the B channel in the Nth first grayscale color card image. , and ;
[0018] The horizontal axis of the lookup table of the device to be calibrated represents the Nth second grayscale color card image, and the vertical axis represents the average grayscale of the R channel, the G channel and the B channel in the Nth second grayscale color card image. , and .
[0019] Further, the step S400 includes:
[0020] S410, the device to be calibrated takes a photo of a physical image, and extracts the RGB values R', G' and B' of each pixel point of the physical image;
[0021] S420, respectively calculating the three channel values of each pixel point of the physical image to fall into the numerical range of the corresponding channel in the lookup table of the device to be calibrated;
[0022] S430, corresponding to the value range of the corresponding channel in the reference device lookup table according to the position of each pixel point of the real image in the lookup table of the device to be calibrated.
[0023] Further, in step S420,
[0024] For the R channel, calculate the R channel value R' of each pixel point of the physical image to fall within the range of the R channel of the second grayscale color card image. and The interval composed of <R’< , n is the nth second grayscale color card image, and n <N;
[0025] For the G channel, calculate the G channel value G' of each pixel point of the physical image to fall within the range of the G channel of the second grayscale color card image. and The interval composed of <G’< , m is the mth second grayscale color card image, and m <N;
[0026] For the B channel, calculate the B channel value B' of each pixel point of the physical image to fall within the range of the B channel of the second grayscale color card image. and The interval composed of <B’< , k is the kth second grayscale color card image, and k <N。
[0027] Further, in step S430,
[0028] For the R channel, the positions n and n+1 of each pixel of the physical image in the lookup table of the device to be calibrated are mapped to the positions n and n+1 of the R channel of the reference device lookup table, that is, and ;
[0029] For the G channel, the positions m and m+1 of each pixel point of the physical image in the lookup table of the device to be calibrated are mapped to the positions m and m+1 of the G channel of the reference device lookup table, that is, ;
[0030] For the B channel, the positions k and k+1 of each pixel point of the physical image in the lookup table of the device to be calibrated are mapped to the positions k and k+1 of the B channel of the reference device lookup table, that is, .
[0031] Further, in step S500, the corrected RGB values of each pixel in the physical image are:
[0032] The R channel value after correction is R,
[0033]
[0034] Among them, R' is the R channel value of each pixel in the real image, R' falls within the left end point of the R channel range of the second grayscale color card image, R' falls within the right end point of the R channel range of the second grayscale color card image, is the value of each pixel in the physical image corresponding to the position n in the lookup table of the device to be calibrated and the position n in the R channel of the reference device lookup table, The value of each pixel in the physical image corresponding to the position n+1 in the lookup table of the device to be calibrated and the position n+1 in the R channel of the reference device lookup table;
[0035] The G channel value after correction is G,
[0036]
[0037] Among them, G' is the G channel value of each pixel in the real image, G' falls into the left end point of the G channel range of the second grayscale color card image, G' falls into the right end point of the G channel range of the second grayscale color card image, is the value of each pixel in the physical image corresponding to the position m in the lookup table of the device to be calibrated and the position m in the G channel of the reference device lookup table, The value of each pixel in the physical image corresponding to the position m+1 in the lookup table of the device to be calibrated and the position m+1 in the G channel of the reference device lookup table;
[0038] After correction, the B channel value is B.
[0039]
[0040] Among them, B' is the B channel value of each pixel in the real image, B' falls within the left end point of the B channel range of the second grayscale color card image, B' falls within the right end point of the B channel range of the second grayscale color card image, is the value of each pixel in the physical image corresponding to the position k in the lookup table of the device to be calibrated and the position k in the B channel of the reference device lookup table, It is the value of each pixel in the physical image that corresponds to the k+1 position in the lookup table of the device to be calibrated and the k+1 position in the B channel of the reference device lookup table.
[0041] Furthermore, the present invention also proposes a high-speed nonlinear color correction device based on sampling, which is used to implement the high-speed nonlinear color correction method based on sampling. The high-speed nonlinear color correction device based on sampling includes:
[0042] Host computer;
[0043] A reference device, the reference device being electrically connected to the host computer;
[0044] The device to be calibrated is electrically connected to the host computer.
[0045] Furthermore, the present invention also provides a computer-readable storage medium having program instructions stored thereon, and when the program instructions are executed by a processor, the sampling-based high-speed nonlinear color correction method is implemented.
[0046] Compared with the prior art, the present invention has the following characteristics:
[0047] The present invention provides a high-speed nonlinear color correction method, device and storage medium based on sampling, which are mainly used for color consistency calibration between multiple devices. Although multiple devices with the same detection requirements are configured exactly the same, due to the consistency deviation of the photosensitive chip and the light source lamp beads, the actual pictures taken will always have a certain deviation. In order to achieve visual detection more stably, it is necessary to calibrate the pictures taken by each device to be consistent. The present invention establishes a mapping table by collecting a variety of camera contrasts and exposure times, and then uses a table lookup method combined with an interpolation algorithm to correct the color of the image taken by the target camera light source to be consistent with the reference camera light source, thereby achieving consistency correction between multiple devices. The present invention mainly provides a high-speed nonlinear color correction algorithm to achieve color correction with less computational effort, and is suitable for scenes where multiple devices use the same configuration and the light source brightness, camera contrast and exposure time are not much different. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 Flowchart of a high-speed nonlinear color correction method based on sampling.
[0049] Figure 2 are N first grayscale color card images (N=10) in the sampling-based high-speed nonlinear color correction method.
[0050] Figure 3 are N second grayscale color card images (N=10) in the sampling-based high-speed nonlinear color correction method.
[0051] Figure 4 The present invention is an image to be corrected in one embodiment of a high-speed nonlinear color correction method based on sampling.
[0052] Figure 5The corrected image is one embodiment of the high-speed nonlinear color correction method based on sampling. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] The concept, specific structure and technical effects of the present invention will be clearly and completely described below in combination with the embodiments and drawings to fully understand the purpose, scheme and effect of the present invention.
[0055] It should be noted that, unless otherwise specified, when a feature is referred to as being "fixed" or "connected" to another feature, it may be directly fixed or connected to another feature, or it may be indirectly fixed or connected to another feature. The singular forms "a", "said" and "the" used herein are also intended to include the plural forms, unless the context clearly indicates otherwise. In addition, unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art. The terms used in this specification are intended only to describe specific embodiments and are not intended to limit the invention. The term "and / or" used herein includes any combination of one or more of the related listed items.
[0056] It should be understood that although the terms first, second, third, etc. may be used to describe various elements in the present disclosure, these elements should not be limited to these terms. These terms are only used to distinguish elements of the same type from each other. For example, without departing from the scope of the present disclosure, the first element may also be referred to as the second element, and similarly, the second element may also be referred to as the first element. The use of any and all examples or exemplary language ("for example", "such as", etc.) provided herein is intended only to better illustrate embodiments of the present invention, and unless otherwise required, will not impose limitations on the scope of the present invention. In addition, the industry term "posture" used herein refers to the position and attitude of a certain element relative to a spatial coordinate system.
[0057] Reference Figures 1 to 5 The embodiment of the present invention provides a high-speed nonlinear color correction method based on sampling, referring to Figure 1 , the method comprising the following steps:
[0058] S100, based on the preset exposure time and gain, the reference device takes photos of N-level grayscale color cards to generate N first grayscale color card images;
[0059] S200, adjusting the exposure time and gain of the device to be calibrated so that the exposure time and gain of the device to be calibrated are consistent with the preset exposure time and gain, and the device to be calibrated takes pictures of the same N-level grayscale color card to generate N second grayscale color card images;
[0060] S300, respectively extracting the RGB channel grayscale values of each first grayscale color card image and each second grayscale color card image, and generating a reference device lookup table and a device to be calibrated lookup table;
[0061] S400, the device to be calibrated takes a photo of a physical image, extracts the RGB value of each pixel of the physical image, and respectively calculates the value range of the RGB value of each pixel of the physical image corresponding to the reference device lookup table and the device to be calibrated lookup table;
[0062] S500: Calculate the corrected RGB value of each pixel in the real object image.
[0063] Specifically, in step S100 and step S200, the same N-level grayscale color card is used.
[0064] In step S100, each first grayscale color card image is an image of a color card among N grayscale color cards taken by a reference device. Figure 2 For example, 01 indicates that the reference device captures the image of the first color card among the N-level grayscale color cards, and 10 indicates that the reference device captures the image of the tenth color card among the N-level grayscale color cards.
[0065] In step S200, each second grayscale color card image is an image of a color card among the N-level grayscale color cards taken by the device to be calibrated. Figure 3 For example, 01 means that the device to be calibrated takes the image of the first color card among the N-level grayscale color cards, and 10 means that the device to be calibrated takes the image of the tenth color card among the N-level grayscale color cards.
[0066] Compared with the prior art, the present invention has the following characteristics:
[0067] The present invention provides a high-speed nonlinear color correction method, device and storage medium based on sampling, which are mainly used for color consistency calibration between multiple devices. Although multiple devices with the same detection requirements are configured exactly the same, due to the consistency deviation of the photosensitive chip and the light source lamp beads, the actual pictures taken will always have a certain deviation. In order to achieve visual detection more stably, it is necessary to calibrate the pictures taken by each device to be consistent. The present invention establishes a mapping table by collecting a variety of camera contrasts and exposure times, and then uses a table lookup method combined with an interpolation algorithm to correct the color of the image taken by the target camera light source to be consistent with the reference camera light source, thereby achieving consistency correction between multiple devices. The present invention mainly provides a high-speed nonlinear color correction algorithm, which realizes color correction with less computational effort, and is suitable for scenes where multiple devices use the same configuration and the light source brightness, camera contrast and exposure time are not much different.
[0068] Further, refer to Figure 2 and Figure 3 In the step S100 and the step S200,
[0069] The number of the first grayscale color card images and the second grayscale color card images is consistent with the number of color cards in the N-level grayscale color card.
[0070] In some specific embodiments, the number of N-level grayscale color cards is 9 or 10, namely, a 9-level grayscale color card and a 10-level grayscale color card; therefore, the number of the first grayscale color card images and the second grayscale color card images is 9 or 10.
[0071] Further, refer to Figure 1 , the step S300 comprises:
[0072] S310, obtaining the RGB value of each pixel of a single first grayscale color card image, calculating the R channel mean, the G channel mean and the B channel mean, and combining them into an RGB mean array of the first grayscale color card image;
[0073] S320, repeating step S310, traversing each first grayscale color card image, generating RGB mean value arrays of N first grayscale color card images, and combining the RGB mean value arrays of the N first grayscale color card images into a reference device lookup table;
[0074] S330, obtaining the RGB value of each pixel of a single second grayscale color card image, calculating the R channel mean, the G channel mean and the B channel mean, and combining them into an RGB mean array of the second grayscale color card image;
[0075] S340, repeat step S330, traverse each second grayscale color card image, generate RGB mean value arrays of N second grayscale color card images, and combine the RGB mean value arrays of the N second grayscale color card images into a lookup table for the device to be calibrated.
[0076] In a specific embodiment, in step S310 and step S320, referring to Table 1, the reference device lookup table is:
[0077] Table 1,
[0078] 1 2 3 4 5 6 7 8 9 10 R 67.09 79.50 93.38 109.73 130.00 152.41 181.27 213.54 249.52 255.00 G 67.77 80.46 94.56 111.13 131.72 154.38 183.47 216.53 252.29 255.00 B 69.74 82.75 97.21 114.27 135.38 158.64 188.47 221.70 251.68 254.99
[0079] Reference Figure 2 , use the reference device to shoot 10 first grayscale color card images, extract the RGB channel grayscale values of the 10 first grayscale color card images respectively, with 1-10 as the X-axis and the average grayscale value of the three color channels of the image taken by each level of the color card as the Y-axis. The R channel obtains 10 points (1, R1) ~ (10, R10), the G channel obtains 10 points (1, G1) ~ (10, G10), and the B channel obtains 10 points (1, B1) ~ (10, B10).
[0080] In a specific embodiment, in step S330 and step S340, referring to Table 2, the lookup table of the device to be calibrated is:
[0081] Table 2,
[0082] 1 2 3 4 5 6 7 8 9 10 R 57.08 67.68 79.43 93.20 110.63 129.81 154.20 181.08 211.60 240.89 G 58.24 69.19 81.35 95.60 113.64 133.38 158.30 185.56 215.67 242.28 B 51.64 61.34 72.10 84.70 100.63 118.21 140.44 164.83 193.50 233.41
[0083] Reference Figure 3 , use the device to be calibrated to take 10 grayscale color card images, extract the RGB channel grayscale values of the 10 second grayscale color card images respectively, with 1-10 as the X-axis, and the average grayscale value of the three color channels of the image taken by each level of color card as the Y-axis, and get 10 points (1, R1')~(10, R10') for the R channel, 10 points (1, G1')~(10, G10') for the G channel, and 10 points (1, B1')~(10, B10') for the B channel.
[0084] Furthermore, the horizontal axis of the reference device lookup table represents the Nth first grayscale color card image, and the vertical axis represents the average grayscale of the R channel, the G channel, and the B channel in the Nth first grayscale color card image. , and ;
[0085] The horizontal axis of the lookup table of the device to be calibrated represents the Nth second grayscale color card image, and the vertical axis represents the average grayscale of the R channel, the G channel and the B channel in the Nth second grayscale color card image. , and .
[0086] Further, refer to Figure 1 , the step S400 comprises:
[0087] S410, the device to be calibrated takes a photo of a physical image, and extracts the RGB values R', G' and B' of each pixel point of the physical image;
[0088] S420, respectively calculating the three channel values of each pixel point of the physical image to fall into the value range of the corresponding channel in the lookup table of the device to be calibrated;
[0089] S430, corresponding to the value range of the corresponding channel in the reference device lookup table according to the position of each pixel point of the real image in the lookup table of the device to be calibrated.
[0090] Specifically, by looking up the reference device lookup table and the device to be calibrated lookup table and applying an interpolation algorithm, the grayscale of each channel of each pixel on the device to be calibrated is mapped to the grayscale of each channel of the reference device, where the average grayscale of the RGB channels of the ath image in the reference device lookup table is recorded as , , ; The average grayscale of the RGB channels in the ath image in the lookup table of the device to be calibrated is recorded as , , .
[0091] Further, refer to Figure 1 In step S420,
[0092] For the R channel, calculate the R channel value R' of each pixel point of the physical image to fall within the range of the R channel of the second grayscale color card image. and The interval composed of <R’< , n is the nth second grayscale color card image, and n <N;
[0093] For the G channel, calculate the G channel value G' of each pixel point of the physical image to fall within the range of the G channel of the second grayscale color card image. and The interval composed of <G’< , m is the mth second grayscale color card image, and m <N;
[0094] For the B channel, calculate the B channel value B' of each pixel point of the physical image to fall within the range of the B channel of the second grayscale color card image. and The interval composed of <B’< , k is the kth second grayscale color card image, and k <N。
[0095] Further, refer to Figure 1In the step S430,
[0096] For the R channel, the positions n and n+1 of each pixel of the physical image in the lookup table of the device to be calibrated are mapped to the positions n and n+1 of the R channel of the reference device lookup table, that is, and ;
[0097] For the G channel, the positions m and m+1 of each pixel point of the physical image in the lookup table of the device to be calibrated are mapped to the positions m and m+1 of the G channel of the reference device lookup table, that is, ;
[0098] For the B channel, the positions k and k+1 of each pixel point of the physical image in the lookup table of the device to be calibrated are mapped to the positions k and k+1 of the B channel of the reference device lookup table, that is, .
[0099] Further, in step S500, the corrected RGB values of each pixel in the physical image are:
[0100] The R channel value after correction is R,
[0101]
[0102] Among them, R' is the R channel value of each pixel in the real image, R' falls within the left end point of the R channel range of the second grayscale color card image, R' falls within the right end point of the R channel range of the second grayscale color card image, is the value of each pixel in the physical image corresponding to the position n in the lookup table of the device to be calibrated and the position n in the R channel of the reference device lookup table, The value of each pixel in the physical image corresponding to the position n+1 in the lookup table of the device to be calibrated and the position n+1 in the R channel of the reference device lookup table;
[0103] The G channel value after correction is G,
[0104]
[0105] Among them, G' is the G channel value of each pixel in the real image, G' falls into the left end point of the G channel range of the second grayscale color card image, G' falls into the right end point of the G channel range of the second grayscale color card image, is the value of each pixel in the physical image corresponding to the position m in the lookup table of the device to be calibrated and the position m in the G channel of the reference device lookup table, The value of each pixel in the physical image corresponding to the position m+1 in the lookup table of the device to be calibrated and the position m+1 in the G channel of the reference device lookup table;
[0106] After correction, the B channel value is B.
[0107]
[0108] Among them, B' is the B channel value of each pixel in the real image, B' falls within the left end point of the B channel range of the second grayscale color card image, B' falls within the right end point of the B channel range of the second grayscale color card image, is the value of each pixel in the physical image corresponding to the position k in the lookup table of the device to be calibrated and the position k in the B channel of the reference device lookup table, It is the value of each pixel in the physical image that corresponds to the k+1 position in the lookup table of the device to be calibrated and the k+1 position in the B channel of the reference device lookup table.
[0109] In a specific embodiment, the RGB value of a point in the image to be calibrated is R'=80, G'=100, B'=110, then:
[0110] The R channel is located in the 79.43-93.20 range of the 3rd and 4th graphs of the lookup table of the device to be calibrated.
[0111] The G channel is located in the 95.60-113.64 range of the 4th and 5th graphs of the lookup table of the device to be calibrated.
[0112] Channel B is located in the range of 100.63-118.21 in the 5th and 6th graphs of the lookup table of the device to be calibrated.
[0113] At this time, check the reference device lookup table and the device to be calibrated lookup table to obtain:
[0114] =79.43, =93.2;
[0115] =95.6, =113.64;
[0116] =100.63, =118.21;
[0117] =93.38, =109.73;
[0118] =111.13, =131.72;
[0119] =135.38, =158.64;
[0120] Substituting the corrected R channel value into the R formula, the corrected G channel value into the G formula, and the corrected B channel value into the B formula, you can calculate the corrected RGB value of the point.
[0121] Reference Figure 4 and Figure 5 ,Since the correction algorithm is just a simple table lookup mapping, the ,computation amount is small and the time consumption is short, it ,can meet the requirements for image preprocessing in real-time ,detection.
[0122] Furthermore, the present invention also proposes a high-speed nonlinear color correction device based on sampling, which is used to implement the high-speed nonlinear color correction method based on sampling. The high-speed nonlinear color correction device based on sampling includes:
[0123] Host computer;
[0124] A reference device, the reference device being electrically connected to the host computer;
[0125] The device to be calibrated is electrically connected to the host computer.
[0126] Furthermore, the present invention also provides a computer-readable storage medium having program instructions stored thereon, and when the program instructions are executed by a processor, the sampling-based high-speed nonlinear color correction method is implemented.
[0127] It should be appreciated that the method steps in the embodiments of the present invention can be implemented or implemented by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer readable memory. The method can use standard programming techniques. Each program can be implemented in a high-level process or object-oriented programming language to communicate with a computer system. However, if necessary, the program can be implemented in an assembly or machine language. In any case, the language can be a compiled or interpreted language. In addition, the program can be run on a programmed ASIC for this purpose.
[0128] Furthermore, the operations of the processes described herein may be performed in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by context. The processes described herein (or variations and / or combinations thereof) may be performed under the control of one or more computer systems configured with executable instructions, and may be implemented as code (e.g., executable instructions, one or more computer programs, or one or more applications) that is executed collectively on one or more processors, by hardware, or a combination thereof. The computer program includes a plurality of instructions that may be executed by one or more processors.
[0129] Further, the method can be implemented in any type of computing platform that is operably connected to a suitable computer, including but not limited to a personal computer, a minicomputer, a mainframe, a workstation, a network or distributed computing environment, a separate or integrated computer platform, or in communication with a charged particle tool or other imaging device, etc. Various aspects of the present invention can be implemented in machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into a computing platform, such as a hard disk, an optical read and / or write storage medium, a RAM, a ROM, etc., so that it can be read by a programmable computer, and when the storage medium or device is read by the computer, it can be used to configure and operate the computer to perform the process described herein. In addition, the machine-readable code, or portions thereof, can be transmitted via a wired or wireless network. When such media includes instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor, the invention described herein includes these and other different types of non-transitory computer-readable storage media. When programmed according to the methods and techniques of the present invention, the present invention can also include the computer itself.
[0130] The computer program can be applied to input data to perform the functions described herein, thereby converting the input data to generate output data stored in a non-volatile memory. The output information can also be applied to one or more output devices such as a display. In a preferred embodiment of the present invention, the converted data represents physical and tangible objects, including specific visual depictions of physical and tangible objects produced on the display.
[0131] The above is only a preferred embodiment of the present invention. The present invention is not limited to the above implementation. As long as the technical effect of the present invention is achieved by the same means, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the scope of protection of the present invention. Within the scope of protection of the present invention, its technical scheme and / or implementation method may have various modifications and changes.
Claims
1. A high-speed nonlinear color correction method based on sampling, characterized in that: The method comprises the following steps: S100, based on the preset exposure time and gain, the reference device takes photos of N-level grayscale color cards to generate N first grayscale color card images; S200, adjusting the exposure time and gain of the device to be calibrated so that the exposure time and gain of the device to be calibrated are consistent with the preset exposure time and gain, and the device to be calibrated takes pictures of the same N-level grayscale color card to generate N second grayscale color card images; S300, respectively extracting the RGB channel grayscale values of each first grayscale color card image and each second grayscale color card image, and generating a reference device lookup table and a device to be calibrated lookup table; S400, the device to be calibrated takes a photo of a physical image, extracts the RGB value of each pixel of the physical image, and respectively calculates the value range of the RGB value of each pixel of the physical image corresponding to the reference device lookup table and the device to be calibrated lookup table; S500: Calculate the corrected RGB value of each pixel in the real object image.
2. The high-speed nonlinear color correction method based on sampling according to claim 1, characterized in that: In the steps S100 and S200, The number of the first grayscale color card images and the second grayscale color card images is consistent with the number of color cards in the N-level grayscale color card.
3. The high-speed nonlinear color correction method based on sampling according to claim 1, characterized in that: The step S300 includes: S310, obtaining the RGB value of each pixel of a single first grayscale color card image, calculating the R channel mean, the G channel mean and the B channel mean, and combining them into an RGB mean array of the first grayscale color card image; S320, repeating step S310, traversing each first grayscale color card image, generating RGB mean value arrays of N first grayscale color card images, and combining the RGB mean value arrays of the N first grayscale color card images into a reference device lookup table; S330, obtaining the RGB value of each pixel of a single second grayscale color card image, calculating the R channel mean, the G channel mean and the B channel mean, and combining them into an RGB mean array of the second grayscale color card image; S340, repeat step S330, traverse each second grayscale color card image, generate RGB mean value arrays of N second grayscale color card images, and combine the RGB mean value arrays of the N second grayscale color card images into a lookup table for the device to be calibrated.
4. The high-speed nonlinear color correction method based on sampling according to claim 3, characterized in that: The horizontal axis of the reference device lookup table represents the Nth first grayscale color card image, and the vertical axis represents the average grayscale of the R channel, the G channel, and the B channel in the Nth first grayscale color card image. , and ; The horizontal axis of the lookup table of the device to be calibrated represents the Nth second grayscale color card image, and the vertical axis represents the average grayscale of the R channel, the G channel and the B channel in the Nth second grayscale color card image. , and .
5. The high-speed nonlinear color correction method based on sampling according to claim 1, characterized in that: The step S400 includes: S410, the device to be calibrated takes a photo of a physical image, and extracts the RGB values R', G' and B' of each pixel point of the physical image; S420, respectively calculating the three channel values of each pixel point of the physical image to fall into the numerical range of the corresponding channel in the lookup table of the device to be calibrated; S430, corresponding to the value range of the corresponding channel in the reference device lookup table according to the position of each pixel point of the real image in the lookup table of the device to be calibrated.
6. The high-speed nonlinear color correction method based on sampling according to claim 5, characterized in that: In the step S420, For the R channel, calculate the R channel value R' of each pixel point of the physical image to fall within the range of the R channel of the second grayscale color card image. and The interval composed of <R’< , n is the nth second grayscale color card image, and n <N; For the G channel, calculate the G channel value G' of each pixel point of the physical image to fall within the range of the G channel of the second grayscale color card image. and The interval composed of <G’< , m is the mth second grayscale color card image, and m <N; For the B channel, calculate the B channel value B' of each pixel point of the physical image to fall within the range of the B channel of the second grayscale color card image. and The interval composed of <B’< , k is the kth second grayscale color card image, and k <N。 7. The high-speed nonlinear color correction method based on sampling according to claim 6, characterized in that: In the step S430, For the R channel, the positions n and n+1 of each pixel of the physical image in the lookup table of the device to be calibrated are mapped to the positions n and n+1 of the R channel of the reference device lookup table, that is, and ; For the G channel, the positions m and m+1 of each pixel point of the physical image in the lookup table of the device to be calibrated are mapped to the positions m and m+1 of the G channel of the reference device lookup table, that is, ; For the B channel, the positions k and k+1 of each pixel point of the physical image in the lookup table of the device to be calibrated are mapped to the positions k and k+1 of the B channel of the reference device lookup table, that is, .
8. The high-speed nonlinear color correction method based on sampling according to claim 7, characterized in that: In step S500, the corrected RGB values of each pixel in the physical image are: The R channel value after correction is R, ; Among them, R' is the R channel value of each pixel in the real image, R' falls within the left end point of the R channel range of the second grayscale color card image, R' falls within the right end point of the R channel range of the second grayscale color card image, is the value of each pixel in the physical image corresponding to the position n in the lookup table of the device to be calibrated and the position n in the R channel of the reference device lookup table, The value of each pixel in the physical image corresponding to the position n+1 in the lookup table of the device to be calibrated and the position n+1 in the R channel of the reference device lookup table; The G channel value after correction is G, ; Among them, G' is the G channel value of each pixel in the real image, G' falls into the left end point of the G channel range of the second grayscale color card image, G' falls into the right end point of the G channel range of the second grayscale color card image, is the value of each pixel in the physical image corresponding to the position m in the lookup table of the device to be calibrated and the position m in the G channel of the reference device lookup table, The value of each pixel in the physical image corresponding to the position m+1 in the lookup table of the device to be calibrated and the position m+1 in the G channel of the reference device lookup table; After correction, the B channel value is B. ; Among them, B' is the B channel value of each pixel in the real image, B' falls within the left end point of the B channel range of the second grayscale color card image, B' falls within the right end point of the B channel range of the second grayscale color card image, is the value of each pixel in the physical image corresponding to the position k in the lookup table of the device to be calibrated and the position k in the B channel of the reference device lookup table, It is the value of each pixel in the physical image that corresponds to the k+1 position in the lookup table of the device to be calibrated and the k+1 position in the B channel of the reference device lookup table.
9. A high-speed nonlinear color correction device based on sampling, used to implement the high-speed nonlinear color correction method based on sampling as claimed in any one of claims 1 to 8, characterized in that: The high-speed nonlinear color correction device based on sampling comprises: Host computer; A reference device, the reference device being electrically connected to the host computer; The device to be calibrated is electrically connected to the host computer. 10 . A computer-readable storage medium having program instructions stored thereon, wherein the program instructions are executed by a processor to implement the method according to claim 1 .
Citation Information
Patent Citations
Method for correcting non-uniformity of image of Bayer filter array color camera
CN102622739A
Digital duplication color rendition method for painting and calligraphy artworks
CN103587268A
Color correction method for traditional Chinese medicine lingual surface diagnosis image
CN110460830A
Image color real-time correction method, device and system
CN111355941A
Color correction method, storage medium and related equipment
CN116033133A