WO2021143281A1 - Color shading correction method, terminal device, and computer-readable storage medium - Google Patents
Color shading correction method, terminal device, and computer-readable storage medium Download PDFInfo
- Publication number
- WO2021143281A1 WO2021143281A1 PCT/CN2020/125379 CN2020125379W WO2021143281A1 WO 2021143281 A1 WO2021143281 A1 WO 2021143281A1 CN 2020125379 W CN2020125379 W CN 2020125379W WO 2021143281 A1 WO2021143281 A1 WO 2021143281A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- image
- color
- corrected
- target channel
- pixel
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 91
- 238000003705 background correction Methods 0.000 title claims abstract description 88
- 239000011159 matrix material Substances 0.000 claims description 53
- 238000004590 computer program Methods 0.000 claims description 31
- 238000012937 correction Methods 0.000 claims description 28
- 238000007781 pre-processing Methods 0.000 claims description 21
- 230000008569 process Effects 0.000 abstract description 19
- 238000012545 processing Methods 0.000 abstract description 19
- 238000004422 calculation algorithm Methods 0.000 abstract description 8
- 230000006870 function Effects 0.000 description 23
- 238000010586 diagram Methods 0.000 description 21
- 238000001228 spectrum Methods 0.000 description 13
- 238000004891 communication Methods 0.000 description 9
- 230000003595 spectral effect Effects 0.000 description 6
- 239000003086 colorant Substances 0.000 description 5
- 238000002834 transmittance Methods 0.000 description 5
- 238000004364 calculation method Methods 0.000 description 4
- 238000006243 chemical reaction Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 238000007726 management method Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000001514 detection method Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 230000003321 amplification Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000002474 experimental method Methods 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 238000003199 nucleic acid amplification method Methods 0.000 description 2
- 238000000513 principal component analysis Methods 0.000 description 2
- 230000005236 sound signal Effects 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 230000001133 acceleration Effects 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000013480 data collection Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 230000009977 dual effect Effects 0.000 description 1
- 230000014509 gene expression Effects 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 238000003709 image segmentation Methods 0.000 description 1
- 238000012905 input function Methods 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000009527 percussion Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 238000010897 surface acoustic wave method Methods 0.000 description 1
- 238000003786 synthesis reaction Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N1/00—Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
- H04N1/40—Picture signal circuits
- H04N1/401—Compensating positionally unequal response of the pick-up or reproducing head
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/90—Dynamic range modification of images or parts thereof
- G06T5/94—Dynamic range modification of images or parts thereof based on local image properties, e.g. for local contrast enhancement
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N1/00—Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
- H04N1/46—Colour picture communication systems
- H04N1/56—Processing of colour picture signals
- H04N1/60—Colour correction or control
- H04N1/6083—Colour correction or control controlled by factors external to the apparatus
- H04N1/6086—Colour correction or control controlled by factors external to the apparatus by scene illuminant, i.e. conditions at the time of picture capture, e.g. flash, optical filter used, evening, cloud, daylight, artificial lighting, white point measurement, colour temperature
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/80—Camera processing pipelines; Components thereof
- H04N23/84—Camera processing pipelines; Components thereof for processing colour signals
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N25/00—Circuitry of solid-state image sensors [SSIS]; Control thereof
- H04N25/60—Noise processing, e.g. detecting, correcting, reducing or removing noise
- H04N25/61—Noise processing, e.g. detecting, correcting, reducing or removing noise the noise originating only from the lens unit, e.g. flare, shading, vignetting or "cos4"
Definitions
- This application belongs to the field of image processing technology, and in particular relates to a color shading correction method, terminal equipment, chip, and computer-readable storage medium.
- Color shading is part of lens shading.
- the reason for the color shading is that the camera module usually installs an infrared cut filter (IR-Cut Filter) before the image sensor in order to block the influence of infrared light on the image sensor.
- IR-Cut Filter infrared cut filter
- the light transmittance of the infrared cut filter changes with the angle of incidence, resulting in high red light transmittance in the center area of the infrared cut filter and low red light transmittance in the edge area, which leads to the appearance of images taken by the terminal device The phenomenon of reddish center.
- shading correction parameters are generally used to perform color shading correction on an image.
- the shadow correction coefficient corresponding to the color temperature is found based on the color temperature in the real scene, and then the color shadow correction is performed on the image.
- the color temperature information in the real scene is very complicated, and it is impossible to obtain all color temperature correction parameters in advance through experiments. Based on this, the accuracy of the existing color shading correction method is low.
- the embodiments of the present application provide a color correction method, a terminal device, a chip, and a computer-readable storage medium to solve the problem of low accuracy of the existing color shading correction.
- an embodiment of the present application provides a color shading correction method. First, an image to be corrected is acquired; then, based on pre-calibrated color shading data, the color shading correction is performed on the image to be corrected, and the color shading data includes Color shading data for at least two monochromatic lights.
- the embodiment of the present application performs color shading correction on the image by using the color shading data of a variety of monochromatic light, effectively covering the color shading forms in various color temperature scenes, and improving the accuracy of color shading correction.
- performing color shading correction on the image to be corrected includes:
- the pixel value of the target channel of the image to be corrected in the second color space is obtained, and the target channel Is a channel that is not related to brightness, and the second color space is a color space that is not related to brightness;
- the color shading correction is performed on the image to be corrected.
- the image to be corrected is divided into multiple first image blocks, and the pixel statistical values of the first image blocks are used to represent the image blocks, which can effectively reduce the amount of calculation.
- converting the pixel statistical value of the first image block to the second color space independent of the brightness can reduce or avoid the influence of the brightness on the color value, so as to further improve the accuracy of the color shading correction.
- the method further includes:
- performing color shading correction on the image to be corrected includes:
- color shadow estimation is performed according to the pixel position, the color shadow data, and the pixel value of the target channel to obtain the color shadow of each target channel of the image to be corrected
- the matrix includes:
- obtaining the initial color shadow matrix of each target channel according to the pixel position, the color shadow data, and the pixel value of the target channel includes:
- the initial color shadow matrix of each target channel is obtained.
- using the color shadow matrix of the target channel to perform color shadow correction on the image to be corrected includes:
- the corrected image in the second color space is converted to a target color space to obtain a corrected image in the target color space, where the target color space is the first color space or the third color space.
- the method further includes:
- obtaining the pixel statistical value of each first image block includes:
- the pixel statistical value of each first image block is obtained.
- the method before acquiring the image to be corrected, the method further includes:
- N is a positive integer greater than or equal to 2;
- the pixel statistical value of each second image block is converted from the fourth color space to the fifth color space, the pixel value of the target channel of the gray board image in the fifth color space is obtained, and the fifth The color space is a color space that has nothing to do with brightness;
- the color shading data is obtained based on the pixel values of the target channel of the gray panel image of the N monochromatic lights.
- the method further includes:
- the base of each target channel is extracted from the color shading data.
- the monochromatic light is monochromatic light in the visible light range.
- obtaining the pixel statistical value of each first image block includes:
- the average value of pixels of each of the first image blocks is counted, and the average value of pixels is used as the pixel statistical value of the first image block.
- an embodiment of the present application provides a terminal device including a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
- the processor executes the computer program when the computer program is executed.
- an embodiment of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned first aspect is implemented. method.
- an embodiment of the present application provides a chip that includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
- the processor executes the computer program, the implementation is as follows: The method of any one of the above-mentioned first aspects.
- embodiments of the present application provide a computer program product, which when the computer program product runs on a terminal device, causes the terminal device to execute the method described in any one of the foregoing first aspects.
- FIG. 1 is a schematic diagram of acquiring image data through a camera module provided by an embodiment of the application
- FIG. 2 is a block diagram of a part of the structure of a mobile phone provided by an embodiment of the application;
- FIG. 3 is a schematic diagram of the software structure of the mobile phone 200 according to an embodiment of the application.
- FIG. 4 is a schematic block diagram of the flow of a color shading correction method provided by an embodiment of the application
- FIG. 5 is a schematic block diagram of another flow of a color shading correction method provided by an embodiment of the application.
- FIG. 6 is a schematic diagram of a method for dividing a gray board graph provided by an embodiment of the application.
- FIG. 7 is a schematic block diagram of another flow of the color shading correction method provided by an embodiment of the application.
- FIG. 8 is a schematic block diagram of the flow of a spectrum calibration process provided by an embodiment of the application.
- FIG. 9 is a schematic diagram of a color shading correction process provided by an embodiment of the application.
- FIG. 10 is a schematic block diagram of the structure of a color shading correction device provided by an embodiment of the application.
- the color shading correction solution provided by the embodiments of the present application can be applied to a terminal device that integrates a camera module and has a shooting function.
- the camera module generally includes a lens, an infrared cut-off filter, and an image sensor.
- the lens is generally composed of one or more lenses.
- the image sensor may generally be a CCD image sensor or a CMOS image sensor.
- the image sensor 13 converts the light signal into an electrical signal to collect image data.
- the angle will change.
- the light transmittance of the infrared cut filter changes with the incident angle, that is, the light of the same wavelength, the incident angle is different, the transmittance will be correspondingly different, which causes the problem of color shadows in the captured image.
- Color shading generally has the following characteristics: the same camera module has different color shading expressions at different color temperatures; the same color temperature may have different spectrums, resulting in the same color temperature may also have different color shading forms.
- light at the same color temperature may have different spectra, that is, light of the same color may be composed of different monochromatic lights.
- a certain color of light may be composed of three monochromatic lights of A, B, and C, or it may be composed of three monochromatic lights of A, D, and E.
- the color temperature spectrum in the actual application stage and the color temperature spectrum in the experimental stage may be different, and the problem of inaccurate color shadow correction may occur.
- the spectrum of a certain color temperature includes three monochromatic lights of A, B, and C
- the spectrum of this color temperature includes three monochromatic lights of A, D, and E.
- the color shading correction is performed by pre-calibrated color shading data of various monochromatic spectrums, which can effectively cover the color shading forms appearing in various color temperature scenes, thereby improving the accuracy of the color shading correction.
- the camera module is integrated, and the type of terminal device with the shooting function can be any type.
- the terminal device can be but not limited to a mobile phone, a tablet computer, a notebook computer, a netbook or a personal digital assistant, etc., which is wrong here.
- the specific type of terminal equipment is limited.
- the terminal device may specifically include at least one processor, a memory, and a computer program that is stored in the memory and can run on the at least one processor.
- the processor executes the computer program, each of the color shading correction methods provided in the embodiments of the present application is implemented. step.
- the processor can be a central processing unit (Central Processing Unit, CPU), the processor can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
- the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
- the memory may be an internal storage unit of the terminal device in some embodiments. In other embodiments, it may also be an external storage device of the terminal device.
- the memory may also include both an internal storage unit of the terminal device and an external storage device.
- the memory is used to store the operating system, application programs, boot loader (BootLoader), data and other programs, such as program codes of computer programs.
- the memory can also be used to temporarily store data that has been output or will be output.
- the terminal device may also include, but is not limited to, a lens, an infrared cut-off filter, an image sensor, a DSP chip, a display, an input and output device, etc.
- FIG. 2 shows a block diagram of a part of the structure of the mobile phone provided in the embodiment of the present application.
- the mobile phone may include: a radio frequency (RF) circuit 210, a memory 220, an input unit 230, a display unit 240, a sensor 250, an audio circuit 260, a wireless fidelity (WiFi) module 270, a processing 280, power supply 290 and other components.
- RF radio frequency
- the structure of the mobile phone shown in FIG. 2 does not constitute a limitation on the mobile phone, and may include more or less components than those shown in the figure, or a combination of some components, or different component arrangements.
- the RF circuit 210 can be used for receiving and sending signals during information transmission and communication or during a call. In particular, after receiving the downlink information of the base station, it is processed by the processor 280; in addition, the designed uplink data is sent to the base station.
- the RF circuit includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, and the like.
- the RF circuit 210 can also communicate with the network and other devices through wireless communication.
- the above-mentioned wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division) Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), Email, Short Messaging Service (SMS), etc.
- GSM Global System of Mobile Communication
- GPRS General Packet Radio Service
- CDMA Code Division Multiple Access
- WCDMA Wideband Code Division Multiple Access
- LTE Long Term Evolution
- Email Short Messaging Service
- the memory 220 may be used to store software programs and modules.
- the processor 280 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 220.
- the memory 220 may mainly include a program storage area and a data storage area.
- the program storage area may store an operating system, an application program required by at least one function (such as a sound playback function, an image playback function, etc.), etc.; Data created by the use of mobile phones (such as audio data, phone book, etc.), etc.
- the memory 220 may include a high-speed random access memory, and may also include a non-volatile memory, for example, at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
- the input unit 230 may be used to receive inputted number or character information, and generate key signal input related to user settings and function control of the mobile phone 200.
- the input unit 230 may include a touch panel 231 and other input devices 232.
- the touch panel 231 also called a touch screen, can collect the user's touch operations on or near it (for example, the user uses any suitable objects or accessories such as fingers, stylus, etc.) on the touch panel 231 or near the touch panel 231. Operation), and drive the corresponding connection device according to the preset program.
- the touch panel 231 may include two parts: a touch detection device and a touch controller.
- the touch detection device detects the user's touch position, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it To the processor 280, and can receive and execute the commands sent by the processor 280.
- the touch panel 231 can be implemented in multiple types such as resistive, capacitive, infrared, and surface acoustic wave.
- the input unit 230 may also include other input devices 232.
- other input devices 232 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackball, mouse, joystick, and the like.
- the display unit 240 may be used to display information input by the user or information provided to the user and various menus of the mobile phone.
- the display unit 240 may include a display panel 241.
- the display panel 241 may be configured in the form of a liquid crystal display (Liquid Crystal Display, LCD), an organic light emitting diode (Organic Light-Emitting Diode, OLED), etc.
- the touch panel 231 can cover the display panel 241. When the touch panel 231 detects a touch operation on or near it, it transmits it to the processor 280 to determine the type of the touch event, and then the processor 280 responds to the touch event. The type provides corresponding visual output on the display panel 241.
- the touch panel 231 and the display panel 241 are used as two independent components to realize the input and input functions of the mobile phone, but in some embodiments, the touch panel 231 and the display panel 241 may be integrated. Realize the input and output functions of the mobile phone.
- the mobile phone 200 may also include at least one sensor 250, such as a light sensor, a motion sensor, an image sensor, and other sensors.
- the light sensor may include an ambient light sensor and a proximity sensor.
- the ambient light sensor can adjust the brightness of the display panel 241 according to the brightness of the ambient light.
- the proximity sensor can close the display panel 241 and/or when the mobile phone is moved to the ear. Or backlight.
- the accelerometer sensor can detect the magnitude of acceleration in various directions (usually three-axis), and can detect the magnitude and direction of gravity when it is stationary. It can be used to identify mobile phone posture applications (such as horizontal and vertical screen switching, related Games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, percussion), etc.
- the image sensor can convert light signals into electrical signals to collect image data.
- the mobile phone can also include a lens and an infrared cut-off filter that cooperate with the image sensor to complete image data collection.
- the mobile phone can also be equipped with other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc., which will not be repeated here.
- sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc., which will not be repeated here.
- the audio circuit 260, the speaker 261, and the microphone 262 can provide an audio interface between the user and the mobile phone.
- the audio circuit 260 can transmit the electrical signal converted from the received audio data to the speaker 261, and the speaker 161 converts it into a sound signal for output.
- the microphone 262 converts the collected sound signals into electrical signals, which are received by the audio circuit 260 and converted into audio data, and then processed by the audio data output processor 280, and sent to, for example, another mobile phone via the RF circuit 210. Or output the audio data to the memory 220 for further processing.
- WiFi is a short-distance wireless transmission technology.
- the mobile phone can help users send and receive emails, browse web pages, and access streaming media through the WiFi module 270. It provides users with wireless broadband Internet access.
- FIG. 2 shows the WiFi module 270, it is understandable that it is not a necessary component of the mobile phone 200 and can be omitted as needed without changing the essence of the invention.
- the processor 280 is the control center of the mobile phone. It uses various interfaces and lines to connect various parts of the entire mobile phone. It executes by running or executing software programs and/or modules stored in the memory 220 and calling data stored in the memory 220. Various functions and processing data of the mobile phone can be used to monitor the mobile phone as a whole.
- the processor 280 may include one or more processing units; preferably, the processor 280 may integrate an application processor and a modem processor, where the application processor mainly processes the operating system, user interface, application programs, etc. , The modem processor mainly deals with wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 280.
- the processor obtains the image data, and then performs image preprocessing, image block processing, and conversion to brightness-independent image data.
- the steps of chromaticity space, determining the main color of the image data, color shading estimation and color shading correction are used to correct the collected image data with color shading problems, obtain the corrected image, and display the corrected image Display on the screen.
- the mobile phone 200 also includes a power source 290 (such as a battery) for supplying power to various components.
- a power source 290 such as a battery
- the power source may be logically connected to the processor 280 through a power management system, so that functions such as charging, discharging, and power consumption management can be managed through the power management system.
- the mobile phone 200 may also include a camera.
- the position of the camera on the mobile phone 200 may be front or rear, which is not limited in the embodiment of the present application.
- the mobile phone 200 may include a single camera, a dual camera, or a triple camera, etc., which is not limited in the embodiment of the present application.
- the mobile phone 200 may include three cameras, of which one is a main camera, one is a wide-angle camera, and one is a telephoto camera.
- the lens generally includes one or more convex lenses.
- the multiple cameras may be all front-mounted, or all rear-mounted, or partly front-mounted and another part rear-mounted, which is not limited in the embodiment of the present application.
- FIG. 3 is a schematic diagram of the software structure of the mobile phone 200 according to an embodiment of the present application.
- the Android system is divided into four layers, namely the application layer, the application framework layer (framework, FWK), the system layer, and the hardware abstraction layer.
- the communication between the layers is through a software interface.
- the application layer can be a series of application packages, which can include applications such as short message, calendar, camera, video, navigation, gallery, and call.
- the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
- the application framework layer may include some predefined functions, such as functions for receiving events sent by the application framework layer.
- the application framework layer can include a window manager, a resource manager, and a notification manager.
- the window manager is used to manage window programs.
- the window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, take a screenshot, etc.
- the content provider is used to store and retrieve data and make these data accessible to applications.
- the data may include videos, images, audios, phone calls made and received, browsing history and bookmarks, phone book, etc.
- the resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so on.
- the notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages, and it can automatically disappear after a short stay without user interaction.
- the notification manager is used to notify download completion, message reminders, and so on.
- the notification manager can also be a notification that appears in the status bar at the top of the system in the form of a chart or a scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, text messages are prompted in the status bar, prompt sounds, electronic devices vibrate, and indicator lights flash.
- the application framework layer can also include:
- a view system the view system includes visual controls, for example, controls that display text, controls that display pictures, and so on.
- the view system can be used to build applications.
- the display interface can be composed of one or more views.
- a display interface that includes a short message notification icon may include a view that displays text and a view that displays pictures.
- the phone manager is used to provide the communication function of the mobile phone 200. For example, the management of the call status (including connecting, hanging up, etc.).
- the system layer can include multiple functional modules. For example: sensor service module, physical state recognition module, 3D graphics processing library (for example: OpenGL ES), etc.
- the sensor service module is used to monitor the sensor data uploaded by various sensors at the hardware layer and determine the physical state of the mobile phone 200;
- Physical state recognition module used to analyze and recognize user gestures, faces, etc.
- the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing.
- the system layer can also include:
- the surface manager is used to manage the display subsystem and provides a combination of 2D and 3D layers for multiple applications.
- the media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files.
- the media library can support multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
- the hardware abstraction layer is the layer between hardware and software.
- the hardware abstraction layer can include display drivers, camera drivers, sensor drivers, etc., used to drive related hardware at the hardware layer, such as display screens, cameras, sensors, and so on.
- FIGS. 2 and 3 are only examples of terminal devices.
- the terminal device is a tablet computer or other device
- the related introduction can be referred to the corresponding content in FIG. 2 and FIG. 3, which will not be repeated here.
- the color shading correction scheme may include a spectrum calibration stage and a practical stage.
- the spectrum calibration stage is the process of indexing the color shading data of various monochromatic lights.
- the practical stage refers to the process of using the calibrated color shading data to perform color shading correction on the image after the color shading data of various monochromatic lights are calibrated. .
- FIG. 4 is a schematic block diagram of the flow of a color shading correction method provided by an embodiment of this application.
- the process may specifically refer to the color shading correction process in the practical stage.
- the method can include the following steps:
- Step S401 Obtain an image to be corrected.
- the terminal device can obtain the image to be corrected by shooting through an integrated camera module, so as to obtain the above-mentioned image to be corrected.
- the camera module integrated in the terminal device generally includes a lens, an infrared cut filter, and an image sensor.
- the image to be corrected may also be an image collected in advance through a terminal integrated with a camera module. In this case, the image to be corrected may be obtained by reading the pre-stored image.
- the image to be corrected refers to an image that needs color shading correction.
- the image is generally taken by a terminal integrated with a camera module, and the image generally has a problem of color shading.
- Step S402 Perform color shading correction on the image to be corrected based on the pre-calibrated color shading data, the color shading data includes color shading data of at least two monochromatic lights.
- the aforementioned pre-calibrated color shading data includes at least two color shading data of monochromatic light.
- monochromatic light includes all monochromatic light in the visible light range. In general, the more monochromatic light, the more color temperature scenes covered, and the better the color shading correction effect.
- the process of performing color shading correction based on the color shading data of a variety of monochromatic light may specifically include: first performing image preprocessing on the image to be corrected, and then performing image segmentation on the image to be corrected after image preprocessing, to obtain multiple Image blocks, and count the pixel statistics of each image block, and use the pixel statistics as the pixel value of the image block; then, the pixel statistics of the image block can be converted to a color space that has nothing to do with brightness, and record that has nothing to do with brightness Then, the main color of the image to be corrected can be determined, and the pixel position of the corresponding pixel of the main color can be obtained; finally, according to the value of the channel independent of the brightness, the color shading data of a variety of monochromatic lights and the main The color corresponds to the pixel position of the pixel.
- the color shading is estimated first to obtain the color shading matrix, and then the color shading matrix is used for color shading correction to obtain a corrected image.
- the image to be corrected may not be divided into blocks, but the entire image to be corrected may be directly processed. However, the entire image to be corrected has a large amount of data and a large amount of calculation. In comparison, the image to be corrected is divided into blocks and then processed, which can reduce the amount of calculation.
- the pixel position of the pixel corresponding to the main color may not be used for color shading estimation, but a specific color may be used for color shading estimation.
- the former can avoid as much as possible the problem of inaccuracy of color shading estimation due to the lack of specific colors, thereby further improving the accuracy of color shading correction.
- the base of each channel extracted from the color shading data can be used for color shading estimation, which can effectively reduce the storage space requirements of the algorithm compared to using all the color shading data for color shading correction.
- image preprocessing may not be performed on the image to be corrected.
- the embodiment of the present application performs color shading correction on the image by using the color shading data of a variety of monochromatic light, effectively covering the color shading forms in various color temperature scenes, and improving the accuracy of the color shading correction.
- the method may include the following steps:
- Step S501 Obtain an image to be corrected.
- Step S502 After dividing the to-be-corrected image into first image blocks, the pixel statistical value of each first image block is obtained.
- the image to be corrected is divided into blocks to divide the image to be corrected into multiple first ones.
- the image block, and the pixel statistical value of the first image block is used to represent the image block.
- the image division method can be grid division, circular division, or other division methods.
- the gray board map on the left side of Fig. 6 uses a grid division method
- the gray board map on the right side of Fig. 6 uses a circular division.
- the above-mentioned pixel statistical value may be the pixel average value or the median value. Specifically, after the image to be corrected is divided into blocks and M first image blocks are obtained, the pixel statistical values of the M first image blocks are respectively counted, and the pixel statistical values are used to represent the corresponding first image blocks.
- a grid division method is used to perform block processing on the image to be corrected to obtain M first image blocks. Based on the pixel value of each pixel in the first image block, the average pixel value of each image block is counted, and the pixel average value is used as the pixel statistical value of the first image block, that is, the pixel average value is used to represent the pixels of the first image block Value, each first image block corresponds to a pixel average value.
- Step S503 After the pixel statistical value of each first image block is converted from the first color space to the second color space, the pixel value of the target channel of the image to be corrected in the second color space is obtained, and the target channel is brightness-independent Channel, the second color space is a color space that has nothing to do with brightness.
- the first color space refers to the color space where the image to be corrected is originally located, and the first color space may be, for example, RGB or RYB.
- the second color space refers to a color space that has nothing to do with brightness, and the color space may be, for example, but not limited to HSV, HSI, Lab, or YCrCb.
- the target channel refers to a channel that is not related to brightness in the second color space.
- the second color space is HSV
- the channel that is not related to brightness includes the H channel and the S channel.
- channels that are not related to brightness include Cr channels and Cb channels.
- Converting the pixel value of the image to be corrected to the second color space that is not related to brightness can avoid or reduce the impact of brightness on color values.
- the pixel value of the channel independent of the brightness can be recorded.
- the channels that are not related to brightness include the H channel and the S channel, and the pixel values of the H channel and the S channel are recorded.
- the second color space is YCrCb
- the channels that are not related to brightness include the Cr channel and the Cb channel
- the pixel values of the Cr channel and the Cb channel are recorded.
- Step S504 Perform color shading correction on the image to be corrected according to the pre-calibrated color shading data and the pixel value of the target channel.
- the pre-calibrated color shading data can include N*C*M data.
- the base extracted from the color shading data can be used for color shading correction.
- k representative values are extracted from the N*M data as the base of the color shading data of the channel.
- the extracted base can be used to represent the pixel value of the target channel in any color space.
- specific colors can be used for color shading correction.
- the main color of the image to be corrected can be determined first, and the pixel position of the pixel corresponding to the main color can be recorded, and the color shading correction is performed based on the pixel position, so as to improve the accuracy of the color shading correction.
- the color shadow estimation can be performed first according to the pre-calibrated color shadow data and the pixel value of the target channel to obtain the color shadow matrix of the image to be corrected. Then, use the color shading matrix for color shading correction.
- FIG. 7 shows a schematic block diagram of another flow of the color shading correction method provided by the embodiment of the present application, the method may include the following steps:
- Step S701 Obtain an image to be corrected.
- Step S702 After dividing the image to be corrected into first image blocks, obtain the pixel statistical value of each first image block.
- the method further includes: performing image preprocessing on the image to be corrected.
- the image to be corrected after image preprocessing may be divided into first image blocks, and then the pixel statistical value of each first image block can be obtained.
- the image preprocessing may include, but is not limited to, initial stage image processing operations such as black level correction and white balance.
- Step S703 After converting the pixel statistical value of each first image block from the first color space to the second color space, the pixel value of the target channel of the image to be corrected in the second color space is obtained, and the target channel is brightness-independent Channel, the second color space is a color space that has nothing to do with brightness.
- Step S704 Determine the main color of the image to be corrected according to the pixel statistical value of each first image block, and obtain the pixel position of the pixel corresponding to the main color.
- the main color of the image to be corrected refers to the color with the largest number of pixels in the image to be corrected. After the main color of the image to be corrected is determined, the pixel position of the pixel corresponding to the main color is recorded.
- the main color of the image to be corrected is red. And record the pixel position of the red pixel.
- clustering or threshold segmentation can be used to determine the main color of the image to be corrected.
- Step S705 Perform color shadow estimation according to the pixel position, the color shadow data and the pixel value of the target channel to obtain the color shadow matrix of each target channel of the image to be corrected.
- Step S705 may specifically include the following two steps.
- the first step According to the pixel position, the color shadow data and the pixel value of the target channel, the initial color shadow matrix of each target channel is obtained.
- color shading data can be used for color shading correction, or the base of color shading data can be used for color shading correction.
- the base of each target channel extracted from the color shading data may be used to calculate the weight coefficient of the initial color shading matrix of each target channel according to the pixel position and the pixel value of the target channel. Then, according to the basis and weight coefficient of each target channel, the initial color shadow matrix of each target channel is obtained.
- the value of the pixel corresponding to the main color of the c-th target channel in the second color space is denoted as Q c
- the weight coefficient of the initial color shading matrix is calculated by the following formula 1.
- ⁇ B 1 ,B 2 ,B 3 ,...,B K ⁇ refers to the base of the C-th target channel.
- ⁇ a 1 ,a 2 ,a 3 ,...,a K ⁇ refers to the weight coefficient of the initial color shading matrix.
- the weight coefficient of the initial color shadow matrix of each target channel is obtained, namely ⁇ a 1 , a 2 , a 3 ,..., a K ⁇ . Then, get the initial color shading matrix of each target channel through the following formula 2.
- S r refers to the initial color shadow matrix of the target channel.
- the second step expand the initial color shadow matrix to obtain the color shadow matrix of each target channel of the image to be corrected.
- the size of S r is the result of reducing the size, so it needs to be enlarged to the size of the original image to be corrected.
- the method of amplification can be, but is not limited to, bilinear interpolation. After amplification, take the reciprocal of each value to get the final color shadow matrix of each target channel.
- the use of the pixel position of the main color in the image to be corrected is used to estimate the color shadow of the image, instead of using a specific color to estimate the color shadow, it can avoid the inaccurate color shadow estimation due to the lack of specific colors as much as possible To further improve the accuracy of color shading correction.
- Step S706 Use the color shadow matrix of the target channel to perform color shadow correction on the image to be corrected.
- the color shading matrix of each target channel is respectively multiplied by the corresponding pixel value of the target channel of the image to be corrected in the second color space to obtain the corrected image in the second color space; then, the second color space is The corrected image of is converted to the target color space to obtain a corrected image in the target color space, where the target color space is the first color space or the third color space.
- the above-mentioned third color space may be a color space related to brightness, for example, the third color space is RYB or RGB.
- the corrected image in the second color space can be converted back to the original color space of the image to be corrected (that is, the first color space), or it can be converted back to a color space that is different from the original color space of the image to be corrected ( That is, the third color space).
- the first color space of the image to be corrected is RGB
- the second color space is HSV.
- the corrected image in HSV color space can be converted to RGB color space to complete color shading correction .
- the process may include:
- Step S801 Obtain gray panel images under N types of monochromatic light, where N is a positive integer greater than or equal to 2.
- a narrow-band light source or a laser can be used to generate monochromatic light in the visible wavelength range, for example, from 380nm to 780nm, each Tnm generates a monochromatic light source, and then the terminal device with integrated camera module is used to photograph each monochromatic light.
- the gray board image obtained by shooting may be a gray board image as shown in FIG. 6.
- Step S802 Perform image preprocessing on the gray board image.
- image preprocessing includes but is limited to operations such as black level correction and white balance.
- Step S803 Divide the preprocessed gray board image into second image blocks, and obtain the pixel statistical value of each second image block.
- the second image block refers to the image block corresponding to the gray plate image in the spectral calibration stage.
- the image division method can be grid division or circular division as shown in FIG. 6. After the image is divided into blocks, the pixel statistics of each second image block are calculated, and the pixel statistics may be the average value or the median of the pixels. The pixel statistical value of each second image block is used to represent the pixel value of the second image block.
- Step S804 After the pixel statistical value of each second image block is converted from the fourth color space to the fifth color space, the pixel value of the target channel of the gray plate image in the fifth color space is obtained, and the fifth color space is the same as the brightness Irrelevant color space.
- the fourth color space refers to the color space where the grayboard image is originally located
- the fifth color space refers to a color space that has nothing to do with brightness, which can be equivalent to the second color space above.
- the target channel refers to a channel that has nothing to do with brightness.
- Step S805 Obtain color shading data based on the pixel values of the target channel of the gray panel image of the N types of monochromatic light.
- the color shading data may include N*C*M data.
- N*C*M pieces of data can be used directly for color shading correction, but a large amount of storage space is required.
- a small number of bases can be extracted from N*C*M data, and the bases can be used for color shading correction.
- the method further includes: step S806, extracting the base of each target channel from the color shading data.
- k representative values are extracted from N*M data as the base of the target channel.
- the method of extracting the basis can be but not limited to dimensionality reduction or clustering.
- methods such as PCA (Principal Component Analysis) or K-means are used to extract k representative values from N*M data.
- the extracted basis is The value of the image on the c-th channel.
- ⁇ a 1 ,a 2 ,a 3 ,...,a K ⁇ are the weight coefficients.
- the value of the target channel in any color space can be expressed as a combination of bases.
- the camera module integrated in the terminal device collects image data under N types of monochromatic light, and then performs image preprocessing, image block processing, conversion to brightness-independent chromaticity space, and recording color. Extraction of the value and basis of the chroma channel in the degree space.
- the chromaticity space is the same as the above-mentioned second color space, and the chromaticity space may be, for example, but not limited to, color spaces such as HSV, HIS, or YCrCb.
- the chroma channel refers to the channel that is not related to the brightness in the image to be corrected, and can be equivalent to the target channel above.
- Base extraction refers to extracting the base of each target channel from the color shading data.
- the terminal equipment collects the image data in the real scene through the integrated camera module, and then performs image preprocessing on the image data, image block processing, and conversion to a chromaticity space independent of brightness to determine the main color of the image And obtain the pixel position of the main color corresponding to the pixel, and then use the base extracted in the spectral calibration stage to estimate the color shadow to obtain the color shadow matrix of the image, and finally use the color shadow matrix to perform color shadow correction to obtain the corrected image.
- FIG. 10 shows a schematic block diagram of the structure of the color shading correction device provided in an embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
- the device may include:
- the obtaining module 101 is used to obtain an image to be corrected.
- the color shading correction module 102 is configured to perform color shading correction on the image to be corrected based on pre-calibrated color shading data.
- the color shading data includes color shading data of at least two monochromatic lights.
- the aforementioned color shading correction module may include:
- the image block unit is used to divide the to-be-corrected image into first image blocks to obtain the pixel statistical value of each first image block.
- the color space conversion unit is used to convert the pixel statistical value of each first image block from the first color space to the second color space to obtain the pixel value of the target channel of the image to be corrected in the second color space, where the target channel is For channels that are not related to brightness, the second color space is a color space that is not related to brightness.
- the color shading correction unit is used to perform color shading correction on the image to be corrected according to the pre-calibrated color shading data and the pixel value of the target channel.
- the above-mentioned device may further include a main color pixel position obtaining module, configured to determine the main color of the image to be corrected according to the pixel statistical value of each first image block, and obtain the pixel points corresponding to the main color Pixel position;
- the aforementioned color shading correction unit is specifically used for:
- the above-mentioned color shading correction unit is specifically used for:
- the initial color shadow matrix of each target channel is obtained
- the initial color shadow matrix is expanded to obtain the color shadow matrix of each target channel of the image to be corrected.
- color shading correction unit is specifically used for:
- the initial color shadow matrix of each target channel is obtained.
- color shading correction unit is specifically used for:
- the corrected image in the second color space is converted to the target color space to obtain the corrected image in the target color space, and the target color space is the first color space or the third color space.
- the foregoing device may further include:
- Image preprocessing module used to perform image preprocessing on the image to be corrected
- the above-mentioned image block unit is specifically used for:
- the pixel statistical value of each first image block is obtained.
- the foregoing apparatus may further include:
- Spectral calibration module used to obtain gray board images under N kinds of monochromatic light, N is a positive integer greater than or equal to 2; preprocess the gray board images; divide the gray board images after image preprocessing into the first Two image blocks, and the pixel statistical value of each second image block is obtained; after the pixel statistical value of each second image block is converted from the fourth color space to the fifth color space, the gray board image under the fifth color space is obtained
- the fifth color space is a color space that has nothing to do with brightness; based on the pixel values of the target channel of the gray plate image of the N monochromatic light, the color shading data is obtained.
- the above-mentioned spectral calibration module is also used to extract the base of each target channel from the color shading data.
- the monochromatic light is monochromatic light in the visible light range.
- the above-mentioned image block unit is specifically used to: perform grid division on the image to be corrected to obtain the first image block; count the average value of the pixels of each first image block, and use the average value of the pixels as the first image block.
- the pixel statistics of an image block is specifically used to: perform grid division on the image to be corrected to obtain the first image block; count the average value of the pixels of each first image block, and use the average value of the pixels as the first image block.
- the above-mentioned color shading correction device has the function of realizing the above-mentioned color shading correction method. This function can be realized by hardware or by executing corresponding software by hardware.
- the hardware or software includes one or more modules corresponding to the above-mentioned functions. Is software and/or hardware.
- the embodiments of the present application also provide a computer-readable storage medium, and the computer-readable storage medium stores a computer program.
- the computer program is executed by a processor, the steps in the foregoing method embodiments can be realized.
- An embodiment of the present application also provides a chip, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
- the processor implements the method in any one of the foregoing method embodiments when the processor executes the computer program.
- the embodiments of the present application provide a computer program product.
- the computer program product runs on a terminal device, the terminal device can realize the steps in the foregoing method embodiments when executed.
- the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
- the computer program can be stored in a computer-readable storage medium. When executed by the processor, the steps of the foregoing method embodiments can be implemented.
- the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate form.
- the computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the photographing device/terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), and random access memory (RAM, Random Access Memory), electric carrier signal, telecommunications signal and software distribution medium.
- ROM read-only memory
- RAM random access memory
- electric carrier signal telecommunications signal and software distribution medium.
- U disk mobile hard disk, floppy disk or CD-ROM, etc.
- computer-readable media cannot be electrical carrier signals and telecommunication signals.
- the disclosed device and method may be implemented in other ways.
- the device embodiments described above are merely illustrative.
- the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be divided. It can be combined or integrated into another system, or some features can be ignored or not implemented.
- the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
Abstract
Provided are a color shading correction method, a terminal device and a computer-readable storage medium, which are applicable to the technical field of image processing. The method comprises: acquiring an image to be corrected (S401); and on the basis of pre-calibrated color shading data, carrying out color shading correction on the image to be corrected, wherein the color shading data comprises color shading data of at least two types of monochromatic light (S402). In the method, by means of carrying out color shading correction on an image by using color shading data of a plurality of types of monochromatic light, color shading forms in various color temperature scenarios can be effectively covered, and the accuracy of color shading correction is improved. In the process of carrying out color shading correction by using color shading data of a plurality of types of monochromatic light, color shading estimation can be carried out by using pixel positions of pixel points corresponding to a main color of an image to be corrected, so as to further improve the accuracy of color shading correction; and color shading correction can be carried out by using a small number of bases extracted from the color shading data, so as to reduce the requirements of an algorithm for storage space.
Description
本申请要求于2020年01月13日提交国家知识产权局、申请号为202010030184.1、申请名称为“颜色阴影校正方法、终端设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the State Intellectual Property Office, the application number is 202010030184.1, and the application name is "color shading correction method, terminal equipment and computer-readable storage medium" on January 13, 2020, and its entire content Incorporated in this application by reference.
本申请属于图像处理技术领域,尤其涉及一种颜色阴影校正方法、终端设备、芯片及计算机可读存储介质。This application belongs to the field of image processing technology, and in particular relates to a color shading correction method, terminal equipment, chip, and computer-readable storage medium.
随着人工智能(Artificial Intelligence,AI)、终端设备和图像处理等科学技术的不断发展,手机等终端设备的设计越来越轻巧,所集成的相机模组的体积也越来越小,从而导致终端设备通过相机模组拍摄的图像中出现相同颜色景物在图像中心处和边缘处颜色不一致的问题,这一现象被称为颜色阴影。With the continuous development of science and technology such as Artificial Intelligence (AI), terminal equipment, and image processing, the design of mobile phones and other terminal equipment is becoming lighter and lighter, and the volume of integrated camera modules is becoming smaller and smaller, resulting in The problem of inconsistent colors between the center and the edges of the scene of the same color in the image captured by the terminal device through the camera module is called color shading.
颜色阴影(color shading)是镜头阴影(lens shading)的一部分。出现颜色阴影的原因是相机模组为了阻绝红外光对图像传感器的影响,通常在图像传感器之前加装红外截止滤光片(IR-Cut Filter)。红外截止滤光片的光透率随着入射角度的变化而变化,导致红外截止滤光片中心区域红光透过率高,边缘区域红光透过率低,从而导致终端设备拍摄的图像出现中心偏红的现象。为了提高终端设备拍摄的图像效果,一般需要对拍摄的图片进行颜色阴影校正。Color shading is part of lens shading. The reason for the color shading is that the camera module usually installs an infrared cut filter (IR-Cut Filter) before the image sensor in order to block the influence of infrared light on the image sensor. The light transmittance of the infrared cut filter changes with the angle of incidence, resulting in high red light transmittance in the center area of the infrared cut filter and low red light transmittance in the edge area, which leads to the appearance of images taken by the terminal device The phenomenon of reddish center. In order to improve the image effect taken by the terminal device, it is generally necessary to perform color shading correction on the taken pictures.
目前,一般是使用阴影校正参数对图像进行颜色阴影校正。通过预先保存图像的光源色温信息和对应色温的阴影校正系数,然后基于现实场景中的色温查找到对应色温的阴影校正系数,再对图像进行颜色阴影校正。但是,现实场景中的色温信息非常复杂,不可能将所有色温的校正参数都通过实验方式预先获得。基于此,现有的颜色阴影校正方式的准确率较低。Currently, shading correction parameters are generally used to perform color shading correction on an image. By pre-saving the light source color temperature information of the image and the shadow correction coefficient corresponding to the color temperature, the shadow correction coefficient corresponding to the color temperature is found based on the color temperature in the real scene, and then the color shadow correction is performed on the image. However, the color temperature information in the real scene is very complicated, and it is impossible to obtain all color temperature correction parameters in advance through experiments. Based on this, the accuracy of the existing color shading correction method is low.
发明内容Summary of the invention
本申请实施例提供一种颜色校正方法、终端设备、芯片及计算机可读存储介质,以解决现有颜色阴影校正的准确率较低的问题。The embodiments of the present application provide a color correction method, a terminal device, a chip, and a computer-readable storage medium to solve the problem of low accuracy of the existing color shading correction.
第一方面,本申请实施例提供一种颜色阴影校正方法,首先,获取待校正图像;然后,基于预先标定的颜色阴影数据,对所述待校正图像进行颜色阴影校正,所述颜色阴影数据包括至少两种单色光的颜色阴影数据。In the first aspect, an embodiment of the present application provides a color shading correction method. First, an image to be corrected is acquired; then, based on pre-calibrated color shading data, the color shading correction is performed on the image to be corrected, and the color shading data includes Color shading data for at least two monochromatic lights.
可以看出,本申请实施例通过使用多种单色光的颜色阴影数据对图像进行颜色阴影校正,有效地覆盖各种色温场景下的颜色阴影形式,提高了颜色阴影校正准确率。It can be seen that the embodiment of the present application performs color shading correction on the image by using the color shading data of a variety of monochromatic light, effectively covering the color shading forms in various color temperature scenes, and improving the accuracy of color shading correction.
在第一方面的一种可能的实现方式中,基于预先标定的颜色阴影数据,对所述待校正图像进行颜色阴影校正,包括:In a possible implementation of the first aspect, based on pre-calibrated color shading data, performing color shading correction on the image to be corrected includes:
将所述待校正图像划分成第一图像块后,获得每个所述第一图像块的像素统计值;After dividing the image to be corrected into first image blocks, obtain the pixel statistical value of each of the first image blocks;
将每个所述第一图像块的像素统计值从第一颜色空间转换至第二颜色空间后,获得所述第二颜色空间下所述待校正图像的目标通道的像素值,所述目标通道为与亮度无关的通道,所述第二颜色空间为与亮度无关的颜色空间;After converting the pixel statistical value of each of the first image blocks from the first color space to the second color space, the pixel value of the target channel of the image to be corrected in the second color space is obtained, and the target channel Is a channel that is not related to brightness, and the second color space is a color space that is not related to brightness;
根据预先标定的颜色阴影数据和所述目标通道的像素值,对所述待校正图像进行颜色阴影校正。According to the pre-calibrated color shading data and the pixel value of the target channel, the color shading correction is performed on the image to be corrected.
需要说明的是,对待校正图像划分成多个第一图像块,并使用第一图像块的像素统计值代表图像块,可以有效地减少计算量。此外,将第一图像块的像素统计值转换至与亮度无关的第二颜色空间,可以减少或者避免亮度对颜色数值的影响,以进一步提高颜色阴影校正的准确率。It should be noted that the image to be corrected is divided into multiple first image blocks, and the pixel statistical values of the first image blocks are used to represent the image blocks, which can effectively reduce the amount of calculation. In addition, converting the pixel statistical value of the first image block to the second color space independent of the brightness can reduce or avoid the influence of the brightness on the color value, so as to further improve the accuracy of the color shading correction.
在第一方面的一种可能的实现方式中,所述方法还包括:In a possible implementation manner of the first aspect, the method further includes:
根据每个所述第一图像块的像素统计值,确定所述待校正图像的主颜色,获取所述主颜色对应像素点的像素位置;Determine the main color of the image to be corrected according to the pixel statistical value of each of the first image blocks, and obtain the pixel position of the pixel corresponding to the main color;
根据预先标定的颜色阴影数据和所述目标通道的像素值,对所述待校正图像进行颜色阴影校正,包括:According to the pre-calibrated color shading data and the pixel value of the target channel, performing color shading correction on the image to be corrected includes:
根据所述像素位置、所述颜色阴影数据和所述目标通道的像素值进行颜色阴影估计,得到所述待校正图像各个目标通道的颜色阴影矩阵;Performing color shadow estimation according to the pixel position, the color shadow data, and the pixel value of the target channel to obtain the color shadow matrix of each target channel of the image to be corrected;
使用所述目标通道的颜色阴影矩阵,对所述待校正图像进行颜色阴影校正。Using the color shadow matrix of the target channel, perform color shadow correction on the image to be corrected.
需要说明的是,利用待校正图像中主颜色的像素位置对图像进行颜色阴影校正,而不是采用某种特定的颜色进行颜色阴影校正,可以尽可能地避免因特定颜色缺失导致颜色阴影估计不准确的问题,以进一步提高颜色阴影校正准确率。It should be noted that using the pixel position of the main color in the image to be corrected is used to perform color shading correction on the image, rather than using a specific color for color shading correction, which can avoid inaccurate color shadow estimation due to the lack of specific colors as much as possible To further improve the accuracy of color shading correction.
在第一方面的一种可能的实现方式中,根据所述像素位置、所述颜色阴影数据和所述目标通道的像素值进行颜色阴影估计,得到所述待校正图像的各个目标通道的颜色阴影矩阵,包括:In a possible implementation of the first aspect, color shadow estimation is performed according to the pixel position, the color shadow data, and the pixel value of the target channel to obtain the color shadow of each target channel of the image to be corrected The matrix includes:
根据所述像素位置、所述颜色阴影数据和所述目标通道的像素值,得到各个所述目标通道的初始颜色阴影矩阵;Obtaining the initial color shadow matrix of each target channel according to the pixel position, the color shadow data, and the pixel value of the target channel;
将所述初始颜色阴影矩阵进行扩展操作,得到所述待校正图像的各个目标通道的颜色阴影矩阵。Perform an expansion operation on the initial color shadow matrix to obtain the color shadow matrix of each target channel of the image to be corrected.
在第一方面的一种可能的实现方式中,根据所述像素位置、所述颜色阴影数据和所述目标通道的像素值,得到各个所述目标通道的初始颜色阴影矩阵,包括:In a possible implementation of the first aspect, obtaining the initial color shadow matrix of each target channel according to the pixel position, the color shadow data, and the pixel value of the target channel includes:
使用从所述颜色阴影数据中提取出的每个所述目标通道的基,根据所述像素位置和所述目标通道的像素值,计算每个所述目标通道的初始颜色阴影矩阵的权重系数;Using the base of each target channel extracted from the color shadow data to calculate the weight coefficient of the initial color shadow matrix of each target channel according to the pixel position and the pixel value of the target channel;
根据每个所述目标通道的基和所述权重系数,得到各个所述目标通道的初始颜色阴影矩阵。According to the basis of each target channel and the weight coefficient, the initial color shadow matrix of each target channel is obtained.
需要说明的是,使用颜色阴影数据的基进行阴影校正,相较于使用全部的颜色阴影数据进行阴影校正,前者可以有效地降低算法对存储空间的要求。It should be noted that using the base of color shadow data for shadow correction, compared to using all color shadow data for shadow correction, the former can effectively reduce the storage space requirements of the algorithm.
在第一方面的一种可能的实现方式中,使用所述目标通道的颜色阴影矩阵,对所述待校正图像进行颜色阴影校正,包括:In a possible implementation of the first aspect, using the color shadow matrix of the target channel to perform color shadow correction on the image to be corrected includes:
将各个所述目标通道的颜色阴影矩阵分别与所述第二颜色空间下所述待校正图像的目标通道的对应像素值相乘,得到所述第二颜色空间下的校正图像;Multiply the color shadow matrix of each target channel by the corresponding pixel value of the target channel of the image to be corrected in the second color space to obtain the corrected image in the second color space;
将所述第二颜色空间下的校正图像转换至目标颜色空间,得到目标颜色空间下的校正图像,所述目标颜色空间为所述第一颜色空间或第三颜色空间。The corrected image in the second color space is converted to a target color space to obtain a corrected image in the target color space, where the target color space is the first color space or the third color space.
在第一方面的一种可能的实现方式中,在获取待校正图像之后,还包括;In a possible implementation manner of the first aspect, after acquiring the image to be corrected, the method further includes:
对所述待校正图像进行图像预处理;Performing image preprocessing on the image to be corrected;
将所述待校正图像划分成第一图像块后,获得每个所述第一图像块的像素统计值,包括:After dividing the image to be corrected into first image blocks, obtaining the pixel statistical value of each first image block includes:
将图像预处理后的待校正图像划分成第一图像块后,获得每个所述第一图像块的像素统计值。After the image to be corrected after image preprocessing is divided into first image blocks, the pixel statistical value of each first image block is obtained.
在第一方面的一种可能的实现方式中,在获取待校正图像之前,还包括:In a possible implementation manner of the first aspect, before acquiring the image to be corrected, the method further includes:
分别获取N种单色光下的灰板图,N为大于或等于2的正整数;Obtain the gray board images under N kinds of monochromatic light respectively, where N is a positive integer greater than or equal to 2;
对所述灰板图进行图像预处理;Perform image preprocessing on the gray board image;
将图像预处理后的灰板图划分成第二图像块,并获得每个所述第二图像块的像素统计值;Dividing the pre-processed gray board image into second image blocks, and obtaining the pixel statistical value of each second image block;
将每个所述第二图像块的像素统计值从第四颜色空间转换至第五颜色空间之后,获得所述第五颜色空间下所述灰板图的目标通道的像素值,所述第五颜色空间为与亮度无关的颜色空间;After the pixel statistical value of each second image block is converted from the fourth color space to the fifth color space, the pixel value of the target channel of the gray board image in the fifth color space is obtained, and the fifth The color space is a color space that has nothing to do with brightness;
基于N种单色光的所述灰板图的目标通道的像素值,获得所述颜色阴影数据。The color shading data is obtained based on the pixel values of the target channel of the gray panel image of the N monochromatic lights.
在第一方面的一种可能的实现方式中,在基于N种单色光的所述灰板图的目标通道的像素值,获得所述颜色阴影数据之后,还包括:In a possible implementation of the first aspect, after obtaining the color shading data based on the pixel values of the target channel of the gray panel image of the N monochromatic lights, the method further includes:
从所述颜色阴影数据中提取出各个目标通道的基。The base of each target channel is extracted from the color shading data.
在第一方面的一种可能的实现方式中,所述单色光为可见光范围内的单色光。In a possible implementation of the first aspect, the monochromatic light is monochromatic light in the visible light range.
在第一方面的一种可能的实现方式中,将所述待校正图像划分成第一图像块后,获得每个所述第一图像块的像素统计值,包括:In a possible implementation of the first aspect, after dividing the image to be corrected into first image blocks, obtaining the pixel statistical value of each first image block includes:
对所述待校正图像进行网格划分,得到所述第一图像块;Meshing the image to be corrected to obtain the first image block;
统计每个所述第一图像块的像素平均值,将所述像素平均值作为所述第一图像块的像素统计值。The average value of pixels of each of the first image blocks is counted, and the average value of pixels is used as the pixel statistical value of the first image block.
第二方面,本申请实施例提供一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如上述第一方面任一项所述的方法。In a second aspect, an embodiment of the present application provides a terminal device including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The processor executes the computer program when the computer program is executed. A method as described in any one of the first aspect above.
第三方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如上述第一方面任一项所述的方法。In a third aspect, an embodiment of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned first aspect is implemented. method.
第四方面,本申请实施例提供一种芯片,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如上述第一方面任一项所述的方法。In a fourth aspect, an embodiment of the present application provides a chip that includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor. When the processor executes the computer program, the implementation is as follows: The method of any one of the above-mentioned first aspects.
第五方面,本申请实施例提供一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得终端设备执行上述第一方面任一项所述的方法。In a fifth aspect, embodiments of the present application provide a computer program product, which when the computer program product runs on a terminal device, causes the terminal device to execute the method described in any one of the foregoing first aspects.
可以理解的是,上述第二方面至第五方面的有益效果可以参见上述第一方面中的相关描述,在此不再赘述。It is understandable that, for the beneficial effects of the second aspect to the fifth aspect described above, reference may be made to the relevant description in the first aspect described above, and details are not repeated here.
图1为本申请实施例提供的通过相机模组获取图像数据的示意图;FIG. 1 is a schematic diagram of acquiring image data through a camera module provided by an embodiment of the application;
图2为本申请实施例提供的手机的部分结构的框图;2 is a block diagram of a part of the structure of a mobile phone provided by an embodiment of the application;
图3为本申请实施例的手机200的软件结构示意图;FIG. 3 is a schematic diagram of the software structure of the mobile phone 200 according to an embodiment of the application;
图4为本申请实施例提供的一种颜色阴影校正方法的流程示意框图FIG. 4 is a schematic block diagram of the flow of a color shading correction method provided by an embodiment of the application
图5为本申请实施例提供的颜色阴影校正方法的另一种流程示意框图;FIG. 5 is a schematic block diagram of another flow of a color shading correction method provided by an embodiment of the application;
图6为本申请实施例提供的灰板图分块方式示意图;FIG. 6 is a schematic diagram of a method for dividing a gray board graph provided by an embodiment of the application;
图7为本申请实施例提供的颜色阴影校正方法的又一种流程示意框图;FIG. 7 is a schematic block diagram of another flow of the color shading correction method provided by an embodiment of the application;
图8为本申请实施例提供的光谱标定过程的流程示意框图;FIG. 8 is a schematic block diagram of the flow of a spectrum calibration process provided by an embodiment of the application;
图9为本申请实施例提供的颜色阴影校正过程的示意图;FIG. 9 is a schematic diagram of a color shading correction process provided by an embodiment of the application;
图10为本申请实施例提供的颜色阴影校正装置的结构示意框图。FIG. 10 is a schematic block diagram of the structure of a color shading correction device provided by an embodiment of the application.
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。In the following description, for the purpose of illustration rather than limitation, specific details such as a specific system structure and technology are proposed for a thorough understanding of the embodiments of the present application.
本申请实施例提供的颜色阴影校正方案可以应用于集成有相机模组,具备拍摄功能的终端设备。相机模组一般包括镜头、红外截止滤光片和图像传感器,镜头一般是由一个或多个透镜组成,图像传感器一般可以为CCD图像传感器或者CMOS图像传感器。终端设备通过相机模组拍摄图像数据的过程可以参见图1示出的通过相机模组获取图像数据的示意图。The color shading correction solution provided by the embodiments of the present application can be applied to a terminal device that integrates a camera module and has a shooting function. The camera module generally includes a lens, an infrared cut-off filter, and an image sensor. The lens is generally composed of one or more lenses. The image sensor may generally be a CCD image sensor or a CMOS image sensor. For the process of capturing image data by the terminal device through the camera module, refer to the schematic diagram of image data acquired through the camera module shown in FIG. 1.
如图1所示,光线依次通过镜头11、红外截止滤光片12后,到达图像传感器13,图像传感器13将光信号转换为电信号,以采集得到图像数据。在此过程中,光线经过镜头11折射后,角度会发生变化。而红外截止滤光片的光透率随着入射角度的变化而改变,即同一种波长的光,入射角度不同,透过率也会相应地不同,从而使得拍摄的图像出现颜色阴影的问题。As shown in FIG. 1, after light passes through the lens 11 and the infrared cut filter 12 in sequence, it reaches the image sensor 13, and the image sensor 13 converts the light signal into an electrical signal to collect image data. In this process, after the light is refracted by the lens 11, the angle will change. The light transmittance of the infrared cut filter changes with the incident angle, that is, the light of the same wavelength, the incident angle is different, the transmittance will be correspondingly different, which causes the problem of color shadows in the captured image.
颜色阴影一般具备以下特点:相同的相机模组在不同色温下的颜色阴影表现形式不相同;相同色温可能有不同的光谱,从而导致相同的色温也可能有不同的颜色阴影形式。Color shading generally has the following characteristics: the same camera module has different color shading expressions at different color temperatures; the same color temperature may have different spectrums, resulting in the same color temperature may also have different color shading forms.
具体来说,相同色温下的光可能具备不同的光谱,即同一种颜色的光可能是由不同的单色光组成的。例如,某一种颜色的光可能是由A、B、C三种单色光组成的,也有可能是由A、D、E三种单色光组成的。Specifically, light at the same color temperature may have different spectra, that is, light of the same color may be composed of different monochromatic lights. For example, a certain color of light may be composed of three monochromatic lights of A, B, and C, or it may be composed of three monochromatic lights of A, D, and E.
基于此,如果事先通过实验的方式获得所有色温对应的颜色阴影校正参数,并建立色温和颜色阴影校正参数的一一对应关系;然后,在实际应用时,根据当前光源的色温查找到对应的颜色阴影校正参数,再使用该颜色阴影校正参数进行校正,可能会因为实际应用阶段的色温光谱和实验阶段的色温光谱不同,出现颜色阴影校正不准确的问题。例如,实验阶段时,某一色温的光谱包括A、B、C三种单色光,而实际应用阶段,该色温的光谱包括A、D、E三种单色光。此时,相同色温下,实验阶段的颜色阴影形式和实际应用阶段的颜色阴影形式不同,导致颜色校正不准确。Based on this, if you obtain all the color shadow correction parameters corresponding to the color temperature through experiments in advance, and establish a one-to-one correspondence between the color temperature and the color shadow correction parameters; then, in actual application, find the corresponding color according to the color temperature of the current light source Shadow correction parameters, and then use the color shadow correction parameters for correction, the color temperature spectrum in the actual application stage and the color temperature spectrum in the experimental stage may be different, and the problem of inaccurate color shadow correction may occur. For example, in the experimental stage, the spectrum of a certain color temperature includes three monochromatic lights of A, B, and C, while in the actual application stage, the spectrum of this color temperature includes three monochromatic lights of A, D, and E. At this time, under the same color temperature, the color shading form in the experimental phase and the color shading form in the actual application phase are different, resulting in inaccurate color correction.
而本申请实施例中,通过预先标定的多种单色光谱的颜色阴影数据进行颜色阴影校正,可以有效地覆盖各种色温场景下出现的颜色阴影形式,从而提高了颜色阴影校正的准确率。In the embodiment of the present application, the color shading correction is performed by pre-calibrated color shading data of various monochromatic spectrums, which can effectively cover the color shading forms appearing in various color temperature scenes, thereby improving the accuracy of the color shading correction.
在本申请实施例中,集成有相机模组,具备拍摄功能的终端设备类型可以是任意的,终端设备可以为但不限于手机、平板电脑、笔记本电脑、上网本或个人数字助理等,在此不对终端设备的具体类型进行限定。In the embodiment of this application, the camera module is integrated, and the type of terminal device with the shooting function can be any type. The terminal device can be but not limited to a mobile phone, a tablet computer, a notebook computer, a netbook or a personal digital assistant, etc., which is wrong here. The specific type of terminal equipment is limited.
终端设备具体可以包括至少一个处理器、存储器,以及存储在存储器中并可在至少一个处理器上运行的计算机程序,处理器执行计算机程序时实现上述本申请实施例提供的颜色阴影校正方法的各个步骤。The terminal device may specifically include at least one processor, a memory, and a computer program that is stored in the memory and can run on the at least one processor. When the processor executes the computer program, each of the color shading correction methods provided in the embodiments of the present application is implemented. step.
处理器可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。存储器在一些实施例中可以是终端设备的内部存储单元。而在另一些实施例中也可以是终端设备的外部存储设备。The processor can be a central processing unit (Central Processing Unit, CPU), the processor can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like. The memory may be an internal storage unit of the terminal device in some embodiments. In other embodiments, it may also be an external storage device of the terminal device.
进一步地,存储器还可以既包括终端设备的内部存储单元也包括外部存储设备。存储器用于 存储操作系统、应用程序、引导装载程序(BootLoader)、数据以及其他程序等,例如计算机程序的程序代码等。存储器还可以用于暂时地存储已经输出或者将要输出的数据。Further, the memory may also include both an internal storage unit of the terminal device and an external storage device. The memory is used to store the operating system, application programs, boot loader (BootLoader), data and other programs, such as program codes of computer programs. The memory can also be used to temporarily store data that has been output or will be output.
另外,该终端设备还可以包括但不限于镜头、红外截止滤光片、图像传感器、DSP芯片、显示器和输入输出设备等。In addition, the terminal device may also include, but is not limited to, a lens, an infrared cut-off filter, an image sensor, a DSP chip, a display, an input and output device, etc.
作为示例而非限定,以终端设备为手机为例,图2示出的是与本申请实施例提供的手机的部分结构的框图。参考图2,该手机可以包括:射频(Radio Frequency,RF)电路210、存储器220、输入单元230、显示单元240、传感器250、音频电路260、无线保真(wireless fidelity,WiFi)模块270、处理器280、以及电源290等部件。本领域技术人员可以理解,图2中示出的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。As an example and not a limitation, taking the terminal device as a mobile phone as an example, FIG. 2 shows a block diagram of a part of the structure of the mobile phone provided in the embodiment of the present application. Referring to FIG. 2, the mobile phone may include: a radio frequency (RF) circuit 210, a memory 220, an input unit 230, a display unit 240, a sensor 250, an audio circuit 260, a wireless fidelity (WiFi) module 270, a processing 280, power supply 290 and other components. Those skilled in the art can understand that the structure of the mobile phone shown in FIG. 2 does not constitute a limitation on the mobile phone, and may include more or less components than those shown in the figure, or a combination of some components, or different component arrangements.
下面结合图2对手机的各个构成部件进行具体的介绍:The following describes the components of the mobile phone in detail with reference to Figure 2:
RF电路210可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,给处理器280处理;另外,将设计上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路210还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System of Mobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE))、电子邮件、短消息服务(Short Messaging Service,SMS)等。The RF circuit 210 can be used for receiving and sending signals during information transmission and communication or during a call. In particular, after receiving the downlink information of the base station, it is processed by the processor 280; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, and the like. In addition, the RF circuit 210 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division) Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), Email, Short Messaging Service (SMS), etc.
存储器220可用于存储软件程序以及模块,处理器280通过运行存储在存储器220的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器220可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器220可以包括高速随机存取存储器,还可以包括非易失性存储器,例如,至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 220 may be used to store software programs and modules. The processor 280 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 220. The memory 220 may mainly include a program storage area and a data storage area. The program storage area may store an operating system, an application program required by at least one function (such as a sound playback function, an image playback function, etc.), etc.; Data created by the use of mobile phones (such as audio data, phone book, etc.), etc. In addition, the memory 220 may include a high-speed random access memory, and may also include a non-volatile memory, for example, at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
输入单元230可用于接收输入的数字或字符信息,以及产生与手机200的用户设置以及功能控制有关的键信号输入。具体地,输入单元230可包括触控面板231以及其他输入设备232。触控面板231,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板231上或在触控面板231附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触控面板231可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器280,并能接收处理器280发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板231。除了触控面板231,输入单元230还可以包括其他输入设备232。具体地,其他输入设备232可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。The input unit 230 may be used to receive inputted number or character information, and generate key signal input related to user settings and function control of the mobile phone 200. Specifically, the input unit 230 may include a touch panel 231 and other input devices 232. The touch panel 231, also called a touch screen, can collect the user's touch operations on or near it (for example, the user uses any suitable objects or accessories such as fingers, stylus, etc.) on the touch panel 231 or near the touch panel 231. Operation), and drive the corresponding connection device according to the preset program. Optionally, the touch panel 231 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch position, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it To the processor 280, and can receive and execute the commands sent by the processor 280. In addition, the touch panel 231 can be implemented in multiple types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 231, the input unit 230 may also include other input devices 232. Specifically, other input devices 232 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackball, mouse, joystick, and the like.
显示单元240可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元240可包括显示面板241,可选的,可以采用液晶显示器(Liquid Crystal Display,LCD)、 有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板241。进一步的,触控面板231可覆盖显示面板241,当触控面板231检测到在其上或附近的触摸操作后,传送给处理器280以确定触摸事件的类型,随后处理器280根据触摸事件的类型在显示面板241上提供相应的视觉输出。The display unit 240 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 240 may include a display panel 241. Optionally, the display panel 241 may be configured in the form of a liquid crystal display (Liquid Crystal Display, LCD), an organic light emitting diode (Organic Light-Emitting Diode, OLED), etc. Further, the touch panel 231 can cover the display panel 241. When the touch panel 231 detects a touch operation on or near it, it transmits it to the processor 280 to determine the type of the touch event, and then the processor 280 responds to the touch event. The type provides corresponding visual output on the display panel 241.
虽然在图2中,触控面板231与显示面板241是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板231与显示面板241集成而实现手机的输入和输出功能。Although in FIG. 2, the touch panel 231 and the display panel 241 are used as two independent components to realize the input and input functions of the mobile phone, but in some embodiments, the touch panel 231 and the display panel 241 may be integrated. Realize the input and output functions of the mobile phone.
手机200还可包括至少一种传感器250,比如,光传感器、运动传感器、图像传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板241的亮度,接近传感器可在手机移动到耳边时,关闭显示面板241和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等。图像传感器可以将光信号转换成电信号,以采集到图像数据。当然,手机还可以包括与图像传感器相互配合,以完成图像数据采集的镜头和红外截止滤光片等。The mobile phone 200 may also include at least one sensor 250, such as a light sensor, a motion sensor, an image sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 241 according to the brightness of the ambient light. The proximity sensor can close the display panel 241 and/or when the mobile phone is moved to the ear. Or backlight. As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in various directions (usually three-axis), and can detect the magnitude and direction of gravity when it is stationary. It can be used to identify mobile phone posture applications (such as horizontal and vertical screen switching, related Games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, percussion), etc. The image sensor can convert light signals into electrical signals to collect image data. Of course, the mobile phone can also include a lens and an infrared cut-off filter that cooperate with the image sensor to complete image data collection.
另外,手机还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。In addition, the mobile phone can also be equipped with other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc., which will not be repeated here.
音频电路260、扬声器261、传声器262可提供用户与手机之间的音频接口。音频电路260可将接收到的音频数据转换后的电信号,传输到扬声器261,由扬声器161转换为声音信号输出。另一方面,传声器262将收集的声音信号转换为电信号,由音频电路260接收后转换为音频数据,再将音频数据输出处理器280处理后,经RF电路210以发送给比如另一手机,或者将音频数据输出至存储器220以便进一步处理。The audio circuit 260, the speaker 261, and the microphone 262 can provide an audio interface between the user and the mobile phone. The audio circuit 260 can transmit the electrical signal converted from the received audio data to the speaker 261, and the speaker 161 converts it into a sound signal for output. On the other hand, the microphone 262 converts the collected sound signals into electrical signals, which are received by the audio circuit 260 and converted into audio data, and then processed by the audio data output processor 280, and sent to, for example, another mobile phone via the RF circuit 210. Or output the audio data to the memory 220 for further processing.
WiFi属于短距离无线传输技术,手机通过WiFi模块270可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图2示出了WiFi模块270,但是可以理解的是,其并不属于手机200的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。WiFi is a short-distance wireless transmission technology. The mobile phone can help users send and receive emails, browse web pages, and access streaming media through the WiFi module 270. It provides users with wireless broadband Internet access. Although FIG. 2 shows the WiFi module 270, it is understandable that it is not a necessary component of the mobile phone 200 and can be omitted as needed without changing the essence of the invention.
处理器280是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器220内的软件程序和/或模块,以及调用存储在存储器220内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。可选的,处理器280可包括一个或多个处理单元;优选的,处理器280可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器280中。The processor 280 is the control center of the mobile phone. It uses various interfaces and lines to connect various parts of the entire mobile phone. It executes by running or executing software programs and/or modules stored in the memory 220 and calling data stored in the memory 220. Various functions and processing data of the mobile phone can be used to monitor the mobile phone as a whole. Optionally, the processor 280 may include one or more processing units; preferably, the processor 280 may integrate an application processor and a modem processor, where the application processor mainly processes the operating system, user interface, application programs, etc. , The modem processor mainly deals with wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 280.
例如,手机通过镜头、红外截止滤光片和图像传感器等采集到图像数据之后,处理器获取到该图像数据,再对该图像数据进行图像预处理、图像分块处理、转换至与亮度无关的色度空间、确定图像数据的主颜色、颜色阴影估计和颜色阴影校正等步骤,以对采集到的出现颜色阴影问题的图像数据进行校正,获得校正之后的图像,并将校正之后的图像通过显示屏进行显示。For example, after the mobile phone collects image data through the lens, infrared cut filter and image sensor, the processor obtains the image data, and then performs image preprocessing, image block processing, and conversion to brightness-independent image data. The steps of chromaticity space, determining the main color of the image data, color shading estimation and color shading correction are used to correct the collected image data with color shading problems, obtain the corrected image, and display the corrected image Display on the screen.
手机200还包括给各个部件供电的电源290(比如电池),优选的,电源可以通过电源管理系统与处理器280逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The mobile phone 200 also includes a power source 290 (such as a battery) for supplying power to various components. Preferably, the power source may be logically connected to the processor 280 through a power management system, so that functions such as charging, discharging, and power consumption management can be managed through the power management system.
尽管未示出,手机200还可以包括摄像头。可选地,摄像头在手机200的上的位置可以为前 置的,也可以为后置的,本申请实施例对此不作限定。Although not shown, the mobile phone 200 may also include a camera. Optionally, the position of the camera on the mobile phone 200 may be front or rear, which is not limited in the embodiment of the present application.
可选地,手机200可以包括单摄像头、双摄像头或三摄像头等,本申请实施例对此不作限定。例如,手机200可以包括三摄像头,其中,一个为主摄像头、一个为广角摄像头、一个为长焦摄像头。镜头一般包括一个或多个凸透镜。Optionally, the mobile phone 200 may include a single camera, a dual camera, or a triple camera, etc., which is not limited in the embodiment of the present application. For example, the mobile phone 200 may include three cameras, of which one is a main camera, one is a wide-angle camera, and one is a telephoto camera. The lens generally includes one or more convex lenses.
可选地,当手机200包括多个摄像头时,这多个摄像头可以全部前置,或者全部后置,或者一部分前置、另一部分后置,本申请实施例对此不作限定。Optionally, when the mobile phone 200 includes multiple cameras, the multiple cameras may be all front-mounted, or all rear-mounted, or partly front-mounted and another part rear-mounted, which is not limited in the embodiment of the present application.
在介绍完手机的硬件组成之后,下面将对手机200的软件结构进行介绍。After introducing the hardware components of the mobile phone, the software structure of the mobile phone 200 will be introduced below.
图3是本申请实施例的手机200的软件结构示意图。以手机200操作系统为Android系统为例,在一些实施例中,将Android系统分为四层,分别为应用程序层、应用程序框架层(framework,FWK)、系统层以及硬件抽象层,层与层之间通过软件接口通信。FIG. 3 is a schematic diagram of the software structure of the mobile phone 200 according to an embodiment of the present application. Taking the mobile phone 200 operating system as the Android system as an example, in some embodiments, the Android system is divided into four layers, namely the application layer, the application framework layer (framework, FWK), the system layer, and the hardware abstraction layer. The communication between the layers is through a software interface.
如图3所示,所述应用程序层可以一系列应用程序包,应用程序包可以包括短信息,日历,相机,视频,导航,图库,通话等应用程序。As shown in Fig. 3, the application layer can be a series of application packages, which can include applications such as short message, calendar, camera, video, navigation, gallery, and call.
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层可以包括一些预先定义的函数,例如用于接收应用程序框架层所发送的事件的函数。The application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer. The application framework layer may include some predefined functions, such as functions for receiving events sent by the application framework layer.
如图3所示,应用程序框架层可以包括窗口管理器、资源管理器以及通知管理器等。As shown in Figure 3, the application framework layer can include a window manager, a resource manager, and a notification manager.
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。The window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, take a screenshot, etc. The content provider is used to store and retrieve data and make these data accessible to applications. The data may include videos, images, audios, phone calls made and received, browsing history and bookmarks, phone book, etc.
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so on.
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。The notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages, and it can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, and so on. The notification manager can also be a notification that appears in the status bar at the top of the system in the form of a chart or a scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, text messages are prompted in the status bar, prompt sounds, electronic devices vibrate, and indicator lights flash.
应用程序框架层还可以包括:The application framework layer can also include:
视图系统,所述视图系统包括可视控件,例如,显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。A view system, the view system includes visual controls, for example, controls that display text, controls that display pictures, and so on. The view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface that includes a short message notification icon may include a view that displays text and a view that displays pictures.
电话管理器用于提供手机200的通信功能。例如通话状态的管理(包括接通,挂断等)。The phone manager is used to provide the communication function of the mobile phone 200. For example, the management of the call status (including connecting, hanging up, etc.).
系统层可以包括多个功能模块。例如:传感器服务模块,物理状态识别模块,三维图形处理库(例如:OpenGL ES)等。The system layer can include multiple functional modules. For example: sensor service module, physical state recognition module, 3D graphics processing library (for example: OpenGL ES), etc.
传感器服务模块,用于对硬件层各类传感器上传的传感器数据进行监测,确定手机200的物理状态;The sensor service module is used to monitor the sensor data uploaded by various sensors at the hardware layer and determine the physical state of the mobile phone 200;
物理状态识别模块,用于对用户手势、人脸等进行分析和识别;Physical state recognition module, used to analyze and recognize user gestures, faces, etc.;
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing.
系统层还可以包括:The system layer can also include:
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。The surface manager is used to manage the display subsystem and provides a combination of 2D and 3D layers for multiple applications.
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如,MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files. The media library can support multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
硬件抽象层是硬件和软件之间的层。硬件抽象层可以包括显示驱动,摄像头驱动,传感器驱动等,用于驱动硬件层的相关硬件,如显示屏、摄像头、传感器等。The hardware abstraction layer is the layer between hardware and software. The hardware abstraction layer can include display drivers, camera drivers, sensor drivers, etc., used to drive related hardware at the hardware layer, such as display screens, cameras, sensors, and so on.
需要说明的是,图2和图3仅仅终端设备的一种示例。当终端设备为平板电脑或者其它设备时,相关介绍可以参见图2和图3中的相应内容,在此不再一一赘述。It should be noted that FIGS. 2 and 3 are only examples of terminal devices. When the terminal device is a tablet computer or other device, the related introduction can be referred to the corresponding content in FIG. 2 and FIG. 3, which will not be repeated here.
在介绍完本申请实施例的终端设备可能涉及的情况之后,下面将详细阐述本申请实施例提供的颜色阴影校正方案。After introducing the possible situations of the terminal device of the embodiment of the present application, the color shading correction solution provided by the embodiment of the present application will be described in detail below.
本申请实施例中,颜色阴影校正方案可以包括光谱标定阶段和实用阶段。光谱标定阶段是指标定各种单色光的颜色阴影数据的过程,实用阶段是指在标定得到各种单色光的颜色阴影数据之后,使用标定的颜色阴影数据对图像进行颜色阴影校正的过程。In the embodiment of the present application, the color shading correction scheme may include a spectrum calibration stage and a practical stage. The spectrum calibration stage is the process of indexing the color shading data of various monochromatic lights. The practical stage refers to the process of using the calibrated color shading data to perform color shading correction on the image after the color shading data of various monochromatic lights are calibrated. .
参见图4,为本申请实施例提供的一种颜色阴影校正方法的流程示意框图,该过程可以具体是指实用阶段的颜色阴影校正过程。该方法可以包括以下步骤:Refer to FIG. 4, which is a schematic block diagram of the flow of a color shading correction method provided by an embodiment of this application. The process may specifically refer to the color shading correction process in the practical stage. The method can include the following steps:
步骤S401、获取待校正图像。Step S401: Obtain an image to be corrected.
可以理解的是,终端设备可以通过集成的相机模组拍摄得到待校正图像,以获得上述待校正图像。终端设备集成的相机模组一般包括镜头、红外截止滤光片和图像传感器。当然,上述待校正图像也可以是预先通过集成有相机模组的终端采集的图像,此时,可以通过读取预先存储的图像,以获得上述待校正图像。It is understandable that the terminal device can obtain the image to be corrected by shooting through an integrated camera module, so as to obtain the above-mentioned image to be corrected. The camera module integrated in the terminal device generally includes a lens, an infrared cut filter, and an image sensor. Of course, the image to be corrected may also be an image collected in advance through a terminal integrated with a camera module. In this case, the image to be corrected may be obtained by reading the pre-stored image.
待校正图像是指需要进行颜色阴影校正的图像,该图像一般是集成有相机模组的终端拍摄得到的,且该图像一般存在颜色阴影的问题。The image to be corrected refers to an image that needs color shading correction. The image is generally taken by a terminal integrated with a camera module, and the image generally has a problem of color shading.
步骤S402、基于预先标定的颜色阴影数据,对待校正图像进行颜色阴影校正,颜色阴影数据包括至少两种单色光的颜色阴影数据。Step S402: Perform color shading correction on the image to be corrected based on the pre-calibrated color shading data, the color shading data includes color shading data of at least two monochromatic lights.
需要说明的是,上述预先标定的颜色阴影数据包括至少两种单色光的颜色阴影数据。可选地,单色光包括可见光范围内所有单色光。一般情况下,单色光的数量越多,所覆盖的色温场景越多,颜色阴影校正效果越好。It should be noted that the aforementioned pre-calibrated color shading data includes at least two color shading data of monochromatic light. Optionally, monochromatic light includes all monochromatic light in the visible light range. In general, the more monochromatic light, the more color temperature scenes covered, and the better the color shading correction effect.
具体应用中,基于多种单色光的颜色阴影数据进行颜色阴影校正的过程可以具体包括:先对待校正图像进行图像预处理,再对图像预处理后的待校正图像进行图像分块,得到多个图像块,并统计每个图像块的像素统计值,用像素统计值作为图像块的像素值;接着,可以将图像块的像素统计值转换至与亮度无关的颜色空间,并记录与亮度无关的通道的数值;然后,可以确定出待校正图像的主颜色,并获取主颜色对应像素点的像素位置;最后,根据与亮度无关的通道的数值、多种单色光的颜色阴影数据和主颜色对应像素点的像素位置,先进行颜色阴影估计,得到颜色阴影矩阵,再使用颜色阴影矩阵进行颜色阴影校正,得到校正的图像。In specific applications, the process of performing color shading correction based on the color shading data of a variety of monochromatic light may specifically include: first performing image preprocessing on the image to be corrected, and then performing image segmentation on the image to be corrected after image preprocessing, to obtain multiple Image blocks, and count the pixel statistics of each image block, and use the pixel statistics as the pixel value of the image block; then, the pixel statistics of the image block can be converted to a color space that has nothing to do with brightness, and record that has nothing to do with brightness Then, the main color of the image to be corrected can be determined, and the pixel position of the corresponding pixel of the main color can be obtained; finally, according to the value of the channel independent of the brightness, the color shading data of a variety of monochromatic lights and the main The color corresponds to the pixel position of the pixel. The color shading is estimated first to obtain the color shading matrix, and then the color shading matrix is used for color shading correction to obtain a corrected image.
需要说明的是,在一些实施例中,可以不用将待校正图像进行分块,而是直接对整张待校正图像进行处理。但是,整张待校正图像的数据量较多,计算量较大。相较而言,将待校正图像进行分块之后再进行处理,可以减少计算量。It should be noted that, in some embodiments, the image to be corrected may not be divided into blocks, but the entire image to be corrected may be directly processed. However, the entire image to be corrected has a large amount of data and a large amount of calculation. In comparison, the image to be corrected is divided into blocks and then processed, which can reduce the amount of calculation.
在一些实施例中,可以不使用主颜色对应像素点的像素位置进行颜色阴影估计,而是可以特定颜色进行颜色阴影估计。相较而言,前者可以尽可能地避免由于特定颜色缺少导致颜色阴影估计不准确率的问题,从而进一步提高颜色阴影校正准确率。In some embodiments, the pixel position of the pixel corresponding to the main color may not be used for color shading estimation, but a specific color may be used for color shading estimation. In comparison, the former can avoid as much as possible the problem of inaccuracy of color shading estimation due to the lack of specific colors, thereby further improving the accuracy of color shading correction.
在一些实施例中,可以使用从颜色阴影数据中提取出的各个通道的基进行颜色阴影估计,其 相较于使用全部颜色阴影数据进行颜色阴影校正,可以有效地降低算法对存储空间的要求。当然,在其它一些实施例中,也可以不对待校正图像进行图像预处理。In some embodiments, the base of each channel extracted from the color shading data can be used for color shading estimation, which can effectively reduce the storage space requirements of the algorithm compared to using all the color shading data for color shading correction. Of course, in some other embodiments, image preprocessing may not be performed on the image to be corrected.
可以看出,本申请实施例通过使用多种单色光的颜色阴影数据对图像进行颜色阴影校正,有效地覆盖各种色温场景下的颜色阴影形式,提高了颜色阴影校正准确率。It can be seen that the embodiment of the present application performs color shading correction on the image by using the color shading data of a variety of monochromatic light, effectively covering the color shading forms in various color temperature scenes, and improving the accuracy of the color shading correction.
参见图5示出的本申请实施例提供的颜色阴影校正方法的另一种流程示意框图,该方法可以包括以下步骤:Referring to FIG. 5, which shows a schematic block diagram of another flow of the color shading correction method provided by the embodiment of the present application, the method may include the following steps:
步骤S501、获取待校正图像。Step S501: Obtain an image to be corrected.
步骤S502、将待校正图像划分成第一图像块后,获得每个第一图像块的像素统计值。Step S502: After dividing the to-be-corrected image into first image blocks, the pixel statistical value of each first image block is obtained.
具体应用中,由于待校正图像的宽高较大,像素点较多,数据量很大,为了减少了计算量,将待校正图像进行分块处理,以将待校正图像划分成多个第一图像块,并且,用第一图像块的像素统计值代表该图像块。In specific applications, due to the large width and height of the image to be corrected, more pixels, and a large amount of data, in order to reduce the amount of calculation, the image to be corrected is divided into blocks to divide the image to be corrected into multiple first ones. The image block, and the pixel statistical value of the first image block is used to represent the image block.
图像划分方式可以为网格划分,可以是圆形划分,也可以是其它划分方式。参见图6示出的灰板图分块方式示意图,如图6所示,图6左边的灰板图使用网格划分方式,图6右边的灰板图使用圆形划分。The image division method can be grid division, circular division, or other division methods. Refer to the schematic diagram of the gray board map division method shown in Fig. 6, as shown in Fig. 6, the gray board map on the left side of Fig. 6 uses a grid division method, and the gray board map on the right side of Fig. 6 uses a circular division.
需要说明的是,上述像素统计值可以是像素平均值或者中位数。具体来说,对待校正图像进行分块处理之后,得到M个第一图像块之后,分别统计这M个第一图像块的像素统计值,并用像素统计值代表相应的第一图像块。It should be noted that the above-mentioned pixel statistical value may be the pixel average value or the median value. Specifically, after the image to be corrected is divided into blocks and M first image blocks are obtained, the pixel statistical values of the M first image blocks are respectively counted, and the pixel statistical values are used to represent the corresponding first image blocks.
例如,使用网格划分方式对待校正图像进行分块处理,得到M个第一图像块。基于第一图像块内的各个像素点的像素值,统计每一个图像块的像素平均值,并用像素平均值作为第一图像块的像素统计值,即用像素平均值代表第一图像块的像素值,每一个第一图像块对应一个像素平均值。For example, a grid division method is used to perform block processing on the image to be corrected to obtain M first image blocks. Based on the pixel value of each pixel in the first image block, the average pixel value of each image block is counted, and the pixel average value is used as the pixel statistical value of the first image block, that is, the pixel average value is used to represent the pixels of the first image block Value, each first image block corresponds to a pixel average value.
步骤S503、将每个第一图像块的像素统计值从第一颜色空间转换至第二颜色空间后,获得第二颜色空间下待校正图像的目标通道的像素值,目标通道为与亮度无关的通道,第二颜色空间为与亮度无关的颜色空间。Step S503: After the pixel statistical value of each first image block is converted from the first color space to the second color space, the pixel value of the target channel of the image to be corrected in the second color space is obtained, and the target channel is brightness-independent Channel, the second color space is a color space that has nothing to do with brightness.
需要说明的是,第一颜色空间是指待校正图像原本所在的颜色空间,该第一颜色空间可以例如为RGB或RYB等。第二颜色空间是指与亮度无关的颜色空间,该颜色空间可以例如为但不限于HSV、HSI、Lab或YCrCb等。目标通道是指第二颜色空间下与亮度无关的通道,例如,当第二颜色空间为HSV时,与亮度无关的通道(即目标通道)包括H通道和S通道。又例如,当第二颜色空间为YCrCb,与亮度无关的通道(即目标通道)包括Cr通道和Cb通道。It should be noted that the first color space refers to the color space where the image to be corrected is originally located, and the first color space may be, for example, RGB or RYB. The second color space refers to a color space that has nothing to do with brightness, and the color space may be, for example, but not limited to HSV, HSI, Lab, or YCrCb. The target channel refers to a channel that is not related to brightness in the second color space. For example, when the second color space is HSV, the channel that is not related to brightness (that is, the target channel) includes the H channel and the S channel. For another example, when the second color space is YCrCb, channels that are not related to brightness (ie, target channels) include Cr channels and Cb channels.
将待校正图像的像素值转换至与亮度无关的第二颜色空间可以避免或者降低亮度对颜色数值的影响。Converting the pixel value of the image to be corrected to the second color space that is not related to brightness can avoid or reduce the impact of brightness on color values.
将第一图像块的像素值转换至第二颜色空间之后,可以记录与亮度无关的通道的像素值。例如,当第二颜色空间为HSV时,与亮度无关的通道(即目标通道)包括H通道和S通道,则记录H通道和S通道的像素值。又例如,当第二颜色空间为YCrCb,与亮度无关的通道(即目标通道)包括Cr通道和Cb通道,则记录Cr通道和Cb通道的像素值。After converting the pixel value of the first image block to the second color space, the pixel value of the channel independent of the brightness can be recorded. For example, when the second color space is HSV, the channels that are not related to brightness (ie, the target channel) include the H channel and the S channel, and the pixel values of the H channel and the S channel are recorded. For another example, when the second color space is YCrCb, and the channels that are not related to brightness (ie, the target channel) include the Cr channel and the Cb channel, the pixel values of the Cr channel and the Cb channel are recorded.
步骤S504、根据预先标定的颜色阴影数据和目标通道的像素值,对待校正图像进行颜色阴影校正。Step S504: Perform color shading correction on the image to be corrected according to the pre-calibrated color shading data and the pixel value of the target channel.
需要说明的是,当单色光谱有N种,目标通道的数量记为C,第一图像块的数量记为M,则 预先标定的颜色阴影数据可以包括N*C*M个数据。It should be noted that when there are N types of monochromatic spectra, the number of target channels is denoted as C, and the number of first image blocks is denoted as M, the pre-calibrated color shading data can include N*C*M data.
具体应用中,可以使用全部的颜色阴影数据,即N*C*M个数据,进行颜色阴影校正。但保存N*C*M个数据需要大量的存储空间,此时,为了降低算法对存储空间的要求,可以使用从颜色阴影数据中提取的基进行颜色阴影校正。具体来说,对应每一个通道,从N*M数据中提取出k个具备代表性的数值,作为该通道的颜色阴影数据的基。提取出每个目标通道的基之后,可以使用提取出的基表示任意颜色空间下该目标通道的像素值。In specific applications, all color shading data, that is, N*C*M data, can be used for color shading correction. But saving N*C*M data requires a lot of storage space. At this time, in order to reduce the storage space requirements of the algorithm, the base extracted from the color shading data can be used for color shading correction. Specifically, corresponding to each channel, k representative values are extracted from the N*M data as the base of the color shading data of the channel. After extracting the base of each target channel, the extracted base can be used to represent the pixel value of the target channel in any color space.
具体应用中,可以使用特定的颜色进行颜色阴影校正。但是,在一些情况下可能存在该特定颜色缺少,从而导致颜色阴影校正不准确的问题。此时,可以先确定出待校正图像的主颜色,并记录主颜色对应的像素点的像素位置,基于该像素位置进行颜色阴影校正,以提高颜色阴影校正准确率。In specific applications, specific colors can be used for color shading correction. However, in some cases, there may be a lack of the specific color, resulting in inaccurate color shading correction. At this time, the main color of the image to be corrected can be determined first, and the pixel position of the pixel corresponding to the main color can be recorded, and the color shading correction is performed based on the pixel position, so as to improve the accuracy of the color shading correction.
具体地,可以先根据预先标定的颜色阴影数据和目标通道的像素值进行颜色阴影估计,得到待校正图像的颜色阴影矩阵。然后,再使用颜色阴影矩阵进行颜色阴影校正。Specifically, the color shadow estimation can be performed first according to the pre-calibrated color shadow data and the pixel value of the target channel to obtain the color shadow matrix of the image to be corrected. Then, use the color shading matrix for color shading correction.
参见图7示出的本申请实施例提供的颜色阴影校正方法的又一种流程示意框图,该方法可以包括以下步骤:Referring to FIG. 7 shows a schematic block diagram of another flow of the color shading correction method provided by the embodiment of the present application, the method may include the following steps:
步骤S701、获取待校正图像。Step S701: Obtain an image to be corrected.
步骤S702、将待校正图像划分成第一图像块后,获得每个第一图像块的像素统计值。Step S702: After dividing the image to be corrected into first image blocks, obtain the pixel statistical value of each first image block.
可选地,在获取待校正图像之后,还包括;对待校正图像进行图像预处理。此时,可以将图像预处理后的待校正图像划分成第一图像块后,获得每个第一图像块的像素统计值。Optionally, after acquiring the image to be corrected, the method further includes: performing image preprocessing on the image to be corrected. At this time, the image to be corrected after image preprocessing may be divided into first image blocks, and then the pixel statistical value of each first image block can be obtained.
其中,图像预处理可以包括但不限于黑电平校正和白平衡等初始阶段的图像处理操作。The image preprocessing may include, but is not limited to, initial stage image processing operations such as black level correction and white balance.
步骤S703、将每个第一图像块的像素统计值从第一颜色空间转换至第二颜色空间后,获得第二颜色空间下待校正图像的目标通道的像素值,目标通道为与亮度无关的通道,第二颜色空间为与亮度无关的颜色空间。Step S703: After converting the pixel statistical value of each first image block from the first color space to the second color space, the pixel value of the target channel of the image to be corrected in the second color space is obtained, and the target channel is brightness-independent Channel, the second color space is a color space that has nothing to do with brightness.
需要说明的是,上述步骤S701~S703与上述步骤S501~S503相同,相关介绍请参见上文相应内容,在此不再赘述。It should be noted that the above steps S701 to S703 are the same as the above steps S501 to S503. For related introduction, please refer to the corresponding content above, which will not be repeated here.
步骤S704、根据每个第一图像块的像素统计值,确定待校正图像的主颜色,获取主颜色对应像素点的像素位置。Step S704: Determine the main color of the image to be corrected according to the pixel statistical value of each first image block, and obtain the pixel position of the pixel corresponding to the main color.
需要说明的是,待校正图像的主颜色是指待校正图像中包括的像素点数量最多的颜色,确定出待校正图像的主颜色之后,记录主颜色对应像素点的像素点位置。It should be noted that the main color of the image to be corrected refers to the color with the largest number of pixels in the image to be corrected. After the main color of the image to be corrected is determined, the pixel position of the pixel corresponding to the main color is recorded.
例如,待校正图像中红色的像素点数量最多,则确定待校正图像的主颜色为红色。并记录红色像素点的像素点位置。For example, if the number of red pixels in the image to be corrected is the largest, it is determined that the main color of the image to be corrected is red. And record the pixel position of the red pixel.
具体应用中,可以通过聚类或者阈值分割法确定待校正图像的主颜色。In specific applications, clustering or threshold segmentation can be used to determine the main color of the image to be corrected.
步骤S705、根据像素位置、颜色阴影数据和目标通道的像素值进行颜色阴影估计,得到待校正图像各个目标通道的颜色阴影矩阵。Step S705: Perform color shadow estimation according to the pixel position, the color shadow data and the pixel value of the target channel to obtain the color shadow matrix of each target channel of the image to be corrected.
具体应用中,可以先估算出各个目标通道的初始颜色阴影矩阵,再将初始颜色阴影矩阵进行扩增,获得上述颜色阴影矩阵。步骤S705具体可以包括以下两个步骤。In specific applications, the initial color shadow matrix of each target channel can be estimated first, and then the initial color shadow matrix can be amplified to obtain the aforementioned color shadow matrix. Step S705 may specifically include the following two steps.
第一步:根据像素位置、颜色阴影数据和目标通道的像素值,得到各个目标通道的初始颜色阴影矩阵。The first step: According to the pixel position, the color shadow data and the pixel value of the target channel, the initial color shadow matrix of each target channel is obtained.
可以理解的是,可以使用全部的颜色阴影数据进行颜色阴影校正,也可以使用颜色阴影数据 的基进行颜色阴影校正。It is understandable that all the color shading data can be used for color shading correction, or the base of color shading data can be used for color shading correction.
在一些实施例中,可以使用从颜色阴影数据中提取出的每个目标通道的基,根据像素位置和目标通道的像素值,计算每个目标通道的初始颜色阴影矩阵的权重系数。然后,再根据每个目标通道的基和权重系数,得到各个目标通道的初始颜色阴影矩阵。In some embodiments, the base of each target channel extracted from the color shading data may be used to calculate the weight coefficient of the initial color shading matrix of each target channel according to the pixel position and the pixel value of the target channel. Then, according to the basis and weight coefficient of each target channel, the initial color shadow matrix of each target channel is obtained.
具体地,第二颜色空间下第c个目标通道的主颜色对应像素点的数值记为Q
c,通过下式1计算出初始颜色阴影矩阵的权重系数。
Specifically, the value of the pixel corresponding to the main color of the c-th target channel in the second color space is denoted as Q c , and the weight coefficient of the initial color shading matrix is calculated by the following formula 1.
其中,{B
1,B
2,B
3,...,B
K}是指第C个目标通道的基。{a
1,a
2,a
3,...,a
K}是指初始颜色阴影矩阵的权重系数。Ω={(x,y)}是指主颜色对应像素点的像素位置。
Among them, {B 1 ,B 2 ,B 3 ,...,B K } refers to the base of the C-th target channel. {a 1 ,a 2 ,a 3 ,...,a K } refers to the weight coefficient of the initial color shading matrix. Ω={(x,y)} refers to the pixel position of the corresponding pixel of the main color.
求解上式(1),得到每个目标通道的初始颜色阴影矩阵的权重系数,即{a
1,a
2,a
3,...,a
K}。然后,再通过下式2得到每个目标通道的初始颜色阴影矩阵。
Solving the above formula (1), the weight coefficient of the initial color shadow matrix of each target channel is obtained, namely {a 1 , a 2 , a 3 ,..., a K }. Then, get the initial color shading matrix of each target channel through the following formula 2.
S
r=a
1B
1+a
2B
2+a
3B
3+...+a
kB
k (2)
S r =a 1 B 1 +a 2 B 2 +a 3 B 3 +...+a k B k (2)
其中,S
r是指目标通道的初始颜色阴影矩阵。
Among them, S r refers to the initial color shadow matrix of the target channel.
需要说明的是,使用颜色阴影数据的基进行阴影校正,相较于使用全部的颜色阴影数据进行阴影校正,前者可以有效地降低算法对存储空间的要求。It should be noted that using the base of color shadow data for shadow correction, compared to using all color shadow data for shadow correction, the former can effectively reduce the storage space requirements of the algorithm.
第二步:将初始颜色阴影矩阵进行扩展操作,得到待校正图像的各个目标通道的颜色阴影矩阵。The second step: expand the initial color shadow matrix to obtain the color shadow matrix of each target channel of the image to be corrected.
需要说明的是,S
r的尺寸大小是缩小尺寸之后的结果,故需要将其扩增到原始待校正图像的大小。扩增的方式可以为但不限于双线性插值等。扩增之后,再将各个数值取倒数,即可得到各个目标通道最终的颜色阴影矩阵。
It should be noted that the size of S r is the result of reducing the size, so it needs to be enlarged to the size of the original image to be corrected. The method of amplification can be, but is not limited to, bilinear interpolation. After amplification, take the reciprocal of each value to get the final color shadow matrix of each target channel.
需要说明的是,利用待校正图像中主颜色的像素位置对图像进行颜色阴影估计,而不是采用某种特定的颜色进行颜色阴影估计,可以尽可能地避免因特定颜色缺失导致颜色阴影估计不准确的问题,以进一步提高颜色阴影校正准确率。It should be noted that the use of the pixel position of the main color in the image to be corrected is used to estimate the color shadow of the image, instead of using a specific color to estimate the color shadow, it can avoid the inaccurate color shadow estimation due to the lack of specific colors as much as possible To further improve the accuracy of color shading correction.
步骤S706、使用目标通道的颜色阴影矩阵,对待校正图像进行颜色阴影校正。Step S706: Use the color shadow matrix of the target channel to perform color shadow correction on the image to be corrected.
具体地,首先将各个目标通道的颜色阴影矩阵分别与第二颜色空间下待校正图像的目标通道的对应像素值相乘,得到第二颜色空间下的校正图像;然后,将第二颜色空间下的校正图像转换至目标颜色空间,得到目标颜色空间下的校正图像,目标颜色空间为第一颜色空间或第三颜色空间。Specifically, first, the color shading matrix of each target channel is respectively multiplied by the corresponding pixel value of the target channel of the image to be corrected in the second color space to obtain the corrected image in the second color space; then, the second color space is The corrected image of is converted to the target color space to obtain a corrected image in the target color space, where the target color space is the first color space or the third color space.
其中,上述第三颜色空间可以是与亮度有关的颜色空间,例如,第三颜色空间为RYB或RGB。也就是说,可以将第二颜色空间下的校正图像转换回待校正图像原本所在的颜色空间(即第一颜色空间),也可以转换回不同于待校正图像原本所在的颜色空间的颜色空间(即第三颜色空间)。Wherein, the above-mentioned third color space may be a color space related to brightness, for example, the third color space is RYB or RGB. In other words, the corrected image in the second color space can be converted back to the original color space of the image to be corrected (that is, the first color space), or it can be converted back to a color space that is different from the original color space of the image to be corrected ( That is, the third color space).
例如,待校正图像的第一颜色空间为RGB,第二颜色空间为HSV,此时,在得到HSV的校正图像之后,可以将HSV颜色空间下的校正图像转换至RGB颜色空间,完成颜色阴影校正。For example, the first color space of the image to be corrected is RGB, and the second color space is HSV. At this time, after the corrected image of HSV is obtained, the corrected image in HSV color space can be converted to RGB color space to complete color shading correction .
在介绍完颜色阴影校正的实用阶段相应过程之后,下面将对光谱标定阶段进行介绍。After introducing the corresponding process of the practical phase of color shading correction, the following will introduce the spectral calibration phase.
参见图8示出的光谱标定过程的流程示意框图,该过程可以包括:Referring to the schematic block diagram of the flow of the spectrum calibration process shown in FIG. 8, the process may include:
步骤S801、分别获取N种单色光下的灰板图,N为大于或等于2的正整数。Step S801: Obtain gray panel images under N types of monochromatic light, where N is a positive integer greater than or equal to 2.
具体地,可以使用窄带光源或者激光器产生可见光波长范围内的单色光,例如,从380nm到 780nm,每个T nm产生一种单色光源,然后通过集成相机模组的终端设备拍摄每种单色光下的灰板图。拍摄得到的灰板图可以如图6示出的灰板图。Specifically, a narrow-band light source or a laser can be used to generate monochromatic light in the visible wavelength range, for example, from 380nm to 780nm, each Tnm generates a monochromatic light source, and then the terminal device with integrated camera module is used to photograph each monochromatic light. Gray board diagram under shaded light. The gray board image obtained by shooting may be a gray board image as shown in FIG. 6.
步骤S802、对灰板图进行图像预处理。Step S802: Perform image preprocessing on the gray board image.
可以理解的是,图像预处理包括但限于黑电平校正和白平衡等操作。It can be understood that image preprocessing includes but is limited to operations such as black level correction and white balance.
步骤S803、将图像预处理后的灰板图划分成第二图像块,并获得每个第二图像块的像素统计值。Step S803: Divide the preprocessed gray board image into second image blocks, and obtain the pixel statistical value of each second image block.
需要说明的是,第二图像块是指光谱标定阶段的灰板图对应的图像块。图像划分方式可以如图6所示的网格划分或者圆形划分。图像分块之后,再统计出每个第二图像块的像素统计值,该像素统计可以为像素平均值或者中位数。用每个第二图像块的像素统计值代表该第二图像块的像素值。It should be noted that the second image block refers to the image block corresponding to the gray plate image in the spectral calibration stage. The image division method can be grid division or circular division as shown in FIG. 6. After the image is divided into blocks, the pixel statistics of each second image block are calculated, and the pixel statistics may be the average value or the median of the pixels. The pixel statistical value of each second image block is used to represent the pixel value of the second image block.
步骤S804、将每个第二图像块的像素统计值从第四颜色空间转换至第五颜色空间之后,获得第五颜色空间下灰板图的目标通道的像素值,第五颜色空间为与亮度无关的颜色空间。Step S804: After the pixel statistical value of each second image block is converted from the fourth color space to the fifth color space, the pixel value of the target channel of the gray plate image in the fifth color space is obtained, and the fifth color space is the same as the brightness Irrelevant color space.
需要说明的是,第四颜色空间是指灰板图原本所在的颜色空间,第五颜色空间是指与亮度无关的颜色空间,其可以与上文的第二颜色空间等同。目标通道是指与亮度无关的通道。It should be noted that the fourth color space refers to the color space where the grayboard image is originally located, and the fifth color space refers to a color space that has nothing to do with brightness, which can be equivalent to the second color space above. The target channel refers to a channel that has nothing to do with brightness.
步骤S805、基于N种单色光的灰板图的目标通道的像素值,获得颜色阴影数据。Step S805: Obtain color shading data based on the pixel values of the target channel of the gray panel image of the N types of monochromatic light.
例如,一共有N种单色光,目标通道的数量为C,第二图像块的数据为M,则颜色阴影数据可以包括N*C*M个数据。For example, there are N types of monochromatic lights, the number of target channels is C, and the data of the second image block is M, then the color shading data may include N*C*M data.
在一些实施例中,可以直接使用N*C*M个数据进行颜色阴影校正,但需要耗费大量的存储空间。在另一些实施例中,为降低算法对存储空间的要求,可以从N*C*M个数据提取出少量的基,使用基进行颜色阴影校正。In some embodiments, N*C*M pieces of data can be used directly for color shading correction, but a large amount of storage space is required. In other embodiments, in order to reduce the storage space requirement of the algorithm, a small number of bases can be extracted from N*C*M data, and the bases can be used for color shading correction.
可选地,还包括:步骤S806、从颜色阴影数据中提取出各个目标通道的基。Optionally, the method further includes: step S806, extracting the base of each target channel from the color shading data.
具体地,对于每个目标通道,从N*M个数据中提取出k个有代表性的数值作为该目标通道的基。提取基的方法可以为但不限于降维或者聚类。例如,使用PCA(Principal Component Analysis)或者K-means等方法从N*M个数据中提取出k个有代表性的数值。Specifically, for each target channel, k representative values are extracted from N*M data as the base of the target channel. The method of extracting the basis can be but not limited to dimensionality reduction or clustering. For example, methods such as PCA (Principal Component Analysis) or K-means are used to extract k representative values from N*M data.
例如,对于第c个通道,提取出的基为
图像在第c个通道上的数值可以表示为:
For example, for the c-th channel, the extracted basis is The value of the image on the c-th channel can be expressed as:
其中,{a
1,a
2,a
3,...,a
K}为权重系数。
Among them, {a 1 ,a 2 ,a 3 ,...,a K } are the weight coefficients.
也就是说,任意颜色空间下的目标通道的数值可以表示成基的组合。In other words, the value of the target channel in any color space can be expressed as a combination of bases.
为了更好地介绍本申请实施例提供的颜色阴影校正方法,下面将结合图9示出的颜色阴影校正过程的示意图。In order to better introduce the color shading correction method provided by the embodiments of the present application, the following will be combined with the schematic diagram of the color shading correction process shown in FIG. 9.
如图9所示,其包括光谱标定阶段和实用阶段。在光谱标定阶段中,通过终端设备集成的相机模组分别采集N种单色光下的图像数据,再分别进行图像预处理、图像分块处理、转换到与亮度无关的色度空间、记录色度空间下色度通道的数值和基提取。其中,色度空间与上述第二颜色空间相同,色度空间可以例如为但不限于HSV、HIS或YCrCb等颜色空间。色度通道是指待校正图像中与亮度无关的通道,与上文的目标通道可以等同。基提取是指从颜色阴影数据中提取出每个目标通道的基。As shown in Figure 9, it includes a spectrum calibration stage and a practical stage. In the spectral calibration stage, the camera module integrated in the terminal device collects image data under N types of monochromatic light, and then performs image preprocessing, image block processing, conversion to brightness-independent chromaticity space, and recording color. Extraction of the value and basis of the chroma channel in the degree space. Wherein, the chromaticity space is the same as the above-mentioned second color space, and the chromaticity space may be, for example, but not limited to, color spaces such as HSV, HIS, or YCrCb. The chroma channel refers to the channel that is not related to the brightness in the image to be corrected, and can be equivalent to the target channel above. Base extraction refers to extracting the base of each target channel from the color shading data.
在实用阶段,终端设备通过集成的相机模组采集真实场景下的图像数据,再依次对图像数据进行图像预处理,图像分块处理,转换至与亮度无关的色度空间,确定图像的主颜色并获取主颜 色对应像素点的像素位置,然后使用光谱标定阶段提取的基进行颜色阴影估计,得到图像的颜色阴影矩阵,最后使用颜色阴影矩阵进行颜色阴影校正,得到校正后的图像。In the practical stage, the terminal equipment collects the image data in the real scene through the integrated camera module, and then performs image preprocessing on the image data, image block processing, and conversion to a chromaticity space independent of brightness to determine the main color of the image And obtain the pixel position of the main color corresponding to the pixel, and then use the base extracted in the spectral calibration stage to estimate the color shadow to obtain the color shadow matrix of the image, and finally use the color shadow matrix to perform color shadow correction to obtain the corrected image.
可以看出,使用N种单色光的颜色阴影数据进行颜色阴影校正,可以有效地覆盖各种色温场景下的颜色阴影形式,提高了颜色阴影校正准确率。进一步地,提取出颜色阴影数据中的基,使用基进行颜色阴影校正,可以有效地降低算法对存储空间的要求。进一步地,利用图像中主颜色对应像素点的位置进行颜色阴影估计,可以提高颜色阴影估计的准确率,从而提高颜色阴影校正准确率。It can be seen that using the color shadow data of N types of monochromatic light for color shadow correction can effectively cover the color shadow forms in various color temperature scenes, and improve the accuracy of color shadow correction. Further, extracting the base in the color shading data and using the base to perform color shading correction can effectively reduce the storage space requirements of the algorithm. Further, using the position of the main color corresponding pixel in the image to perform color shadow estimation can improve the accuracy of color shadow estimation, thereby improving the accuracy of color shadow correction.
对应于上文实施例的颜色阴影校正方法,图10示出了本申请实施例提供的颜色阴影校正装置的结构示意框图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the color shading correction method of the above embodiment, FIG. 10 shows a schematic block diagram of the structure of the color shading correction device provided in an embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
参照图10,该装置可以包括:Referring to FIG. 10, the device may include:
获取模块101,用于获取待校正图像。The obtaining module 101 is used to obtain an image to be corrected.
颜色阴影校正模块102,用于基于预先标定的颜色阴影数据,对待校正图像进行颜色阴影校正,颜色阴影数据包括至少两种单色光的颜色阴影数据。The color shading correction module 102 is configured to perform color shading correction on the image to be corrected based on pre-calibrated color shading data. The color shading data includes color shading data of at least two monochromatic lights.
在一种可能的实现方式中,上述颜色阴影校正模块可以包括:In a possible implementation manner, the aforementioned color shading correction module may include:
图像分块单元,用于将待校正图像划分成第一图像块后,获得每个第一图像块的像素统计值。The image block unit is used to divide the to-be-corrected image into first image blocks to obtain the pixel statistical value of each first image block.
颜色空间转换单元,用于将每个第一图像块的像素统计值从第一颜色空间转换至第二颜色空间后,获得第二颜色空间下待校正图像的目标通道的像素值,目标通道为与亮度无关的通道,第二颜色空间为与亮度无关的颜色空间。The color space conversion unit is used to convert the pixel statistical value of each first image block from the first color space to the second color space to obtain the pixel value of the target channel of the image to be corrected in the second color space, where the target channel is For channels that are not related to brightness, the second color space is a color space that is not related to brightness.
颜色阴影校正单元,用于根据预先标定的颜色阴影数据和目标通道的像素值,对待校正图像进行颜色阴影校正。The color shading correction unit is used to perform color shading correction on the image to be corrected according to the pre-calibrated color shading data and the pixel value of the target channel.
在一种可能的实现方式中,上述装置还可以包括主颜色像素位置获取模块,用于:根据每个第一图像块的像素统计值,确定待校正图像的主颜色,获取主颜色对应像素点的像素位置;In a possible implementation manner, the above-mentioned device may further include a main color pixel position obtaining module, configured to determine the main color of the image to be corrected according to the pixel statistical value of each first image block, and obtain the pixel points corresponding to the main color Pixel position;
上述颜色阴影校正单元具体用于:The aforementioned color shading correction unit is specifically used for:
根据像素位置、颜色阴影数据和目标通道的像素值进行颜色阴影估计,得到待校正图像各个目标通道的颜色阴影矩阵;Perform color shadow estimation according to the pixel position, color shadow data and the pixel value of the target channel to obtain the color shadow matrix of each target channel of the image to be corrected;
使用目标通道的颜色阴影矩阵,对待校正图像进行颜色阴影校正。Use the color shadow matrix of the target channel to perform color shadow correction on the image to be corrected.
在一种可能的实现方式中,上述颜色阴影校正单元具体用于:In a possible implementation manner, the above-mentioned color shading correction unit is specifically used for:
根据像素位置、颜色阴影数据和目标通道的像素值,得到各个目标通道的初始颜色阴影矩阵;According to the pixel position, color shadow data and the pixel value of the target channel, the initial color shadow matrix of each target channel is obtained;
将初始颜色阴影矩阵进行扩展操作,得到待校正图像的各个目标通道的颜色阴影矩阵。The initial color shadow matrix is expanded to obtain the color shadow matrix of each target channel of the image to be corrected.
进一步地,上述颜色阴影校正单元具体用于:Further, the above-mentioned color shading correction unit is specifically used for:
使用从颜色阴影数据中提取出的每个目标通道的基,根据像素位置和目标通道的像素值,计算每个目标通道的初始颜色阴影矩阵的权重系数;Using the base of each target channel extracted from the color shadow data, calculate the weight coefficient of the initial color shadow matrix of each target channel according to the pixel position and the pixel value of the target channel;
根据每个目标通道的基和权重系数,得到各个目标通道的初始颜色阴影矩阵。According to the basis and weight coefficient of each target channel, the initial color shadow matrix of each target channel is obtained.
进一步地,上述颜色阴影校正单元具体用于:Further, the above-mentioned color shading correction unit is specifically used for:
将各个目标通道的颜色阴影矩阵分别与第二颜色空间下待校正图像的目标通道的对应像素值相乘,得到第二颜色空间下的校正图像;Multiply the color shadow matrix of each target channel with the corresponding pixel value of the target channel of the image to be corrected in the second color space to obtain the corrected image in the second color space;
将第二颜色空间下的校正图像转换至目标颜色空间,得到目标颜色空间下的校正图像,目标颜色空间为第一颜色空间或第三颜色空间。The corrected image in the second color space is converted to the target color space to obtain the corrected image in the target color space, and the target color space is the first color space or the third color space.
在一种可能的实现方式中,上述装置还可以包括;In a possible implementation manner, the foregoing device may further include:
图像预处理模块,用于对待校正图像进行图像预处理;Image preprocessing module, used to perform image preprocessing on the image to be corrected;
上述图像分块单元具体用于:The above-mentioned image block unit is specifically used for:
将图像预处理后的待校正图像划分成第一图像块后,获得每个第一图像块的像素统计值。After the image to be corrected after image preprocessing is divided into first image blocks, the pixel statistical value of each first image block is obtained.
在一种可能的实现方式中,上述装置还可以包括:In a possible implementation manner, the foregoing apparatus may further include:
光谱标定模块,用于分别获取N种单色光下的灰板图,N为大于或等于2的正整数;对灰板图进行图像预处理;将图像预处理后的灰板图划分成第二图像块,并获得每个第二图像块的像素统计值;将每个第二图像块的像素统计值从第四颜色空间转换至第五颜色空间之后,获得第五颜色空间下灰板图的目标通道的像素值,第五颜色空间为与亮度无关的颜色空间;基于N种单色光的灰板图的目标通道的像素值,获得颜色阴影数据。Spectral calibration module, used to obtain gray board images under N kinds of monochromatic light, N is a positive integer greater than or equal to 2; preprocess the gray board images; divide the gray board images after image preprocessing into the first Two image blocks, and the pixel statistical value of each second image block is obtained; after the pixel statistical value of each second image block is converted from the fourth color space to the fifth color space, the gray board image under the fifth color space is obtained The fifth color space is a color space that has nothing to do with brightness; based on the pixel values of the target channel of the gray plate image of the N monochromatic light, the color shading data is obtained.
在一种可能的实现方式中,上述光谱标定模块还用于:从颜色阴影数据中提取出各个目标通道的基。In a possible implementation manner, the above-mentioned spectral calibration module is also used to extract the base of each target channel from the color shading data.
在一种可能的实现方式中,单色光为可见光范围内的单色光。In a possible implementation manner, the monochromatic light is monochromatic light in the visible light range.
在一种可能的实现方式中,上述图像分块单元具体用于:对待校正图像进行网格划分,得到第一图像块;统计每个第一图像块的像素平均值,将像素平均值作为第一图像块的像素统计值。In a possible implementation, the above-mentioned image block unit is specifically used to: perform grid division on the image to be corrected to obtain the first image block; count the average value of the pixels of each first image block, and use the average value of the pixels as the first image block. The pixel statistics of an image block.
上述颜色阴影校正装置具有实现上述颜色阴影校正方法的功能,该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现,硬件或软件包括一个或多个与上述功能相对应的模块,模块可以是软件和/或硬件。The above-mentioned color shading correction device has the function of realizing the above-mentioned color shading correction method. This function can be realized by hardware or by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the above-mentioned functions. Is software and/or hardware.
需要说明的是,上述装置/模块之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。It should be noted that the information interaction and execution process between the above-mentioned devices/modules are based on the same concept as the method embodiments of this application, and their specific functions and technical effects can be found in the method embodiments. I won't repeat it here.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the division of the above functional units and modules is used as an example. In practical applications, the above functions can be allocated to different functional units and modules as needed. Module completion, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist alone physically, or two or more units can be integrated into one unit. The above-mentioned integrated units can be hardware-based Formal realization can also be realized in the form of a software functional unit. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the present application. For the specific working process of the units and modules in the foregoing system, reference may be made to the corresponding process in the foregoing method embodiment, which will not be repeated here.
本申请实施例还提供一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,计算机程序被处理器执行时实现可实现上述各个方法实施例中的步骤。The embodiments of the present application also provide a computer-readable storage medium, and the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps in the foregoing method embodiments can be realized.
本申请实施例还提供一种芯片,包括存储器、处理器以及存储在存储器中并可在处理器上运行的计算机程序,处理器执行计算机程序时实现如上述各个方法实施例任一项的方法。An embodiment of the present application also provides a chip, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The processor implements the method in any one of the foregoing method embodiments when the processor executes the computer program.
本申请实施例提供一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得终端设备执行时实现可实现上述各个方法实施例中的步骤。The embodiments of the present application provide a computer program product. When the computer program product runs on a terminal device, the terminal device can realize the steps in the foregoing method embodiments when executed.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执 行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到拍照装置/终端设备的任何实体或装置、记录介质、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the implementation of all or part of the processes in the above-mentioned embodiment methods in the present application can be accomplished by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When executed by the processor, the steps of the foregoing method embodiments can be implemented. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the photographing device/terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), and random access memory (RAM, Random Access Memory), electric carrier signal, telecommunications signal and software distribution medium. For example, U disk, mobile hard disk, floppy disk or CD-ROM, etc. In some jurisdictions, according to legislation and patent practices, computer-readable media cannot be electrical carrier signals and telecommunication signals.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own focus. For parts that are not described in detail or recorded in an embodiment, reference may be made to related descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。A person of ordinary skill in the art may realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
在本申请所提供的实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed device and method may be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be divided. It can be combined or integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, a person of ordinary skill in the art should understand that it can still implement the foregoing The technical solutions recorded in the examples are modified, or some of the technical features are equivalently replaced; these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the application, and should be included in Within the scope of protection of this application.
Claims (13)
- 一种颜色阴影校正方法,其特征在于,包括:A color shading correction method, characterized in that it comprises:获取待校正图像;Obtain the image to be corrected;基于预先标定的颜色阴影数据,对所述待校正图像进行颜色阴影校正,所述颜色阴影数据包括至少两种单色光的颜色阴影数据。Based on the pre-calibrated color shading data, perform color shading correction on the image to be corrected, and the color shading data includes color shading data of at least two monochromatic light.
- 如权利要求1所述的方法,其特征在于,基于预先标定的颜色阴影数据,对所述待校正图像进行颜色阴影校正,包括:8. The method of claim 1, wherein, based on pre-calibrated color shading data, performing color shading correction on the image to be corrected comprises:将所述待校正图像划分成第一图像块后,获得每个所述第一图像块的像素统计值;After dividing the image to be corrected into first image blocks, obtain the pixel statistical value of each of the first image blocks;将每个所述第一图像块的像素统计值从第一颜色空间转换至第二颜色空间后,获得所述第二颜色空间下所述待校正图像的目标通道的像素值,所述目标通道为与亮度无关的通道,所述第二颜色空间为与亮度无关的颜色空间;After converting the pixel statistical value of each of the first image blocks from the first color space to the second color space, the pixel value of the target channel of the image to be corrected in the second color space is obtained, and the target channel Is a channel that is not related to brightness, and the second color space is a color space that is not related to brightness;根据预先标定的颜色阴影数据和所述目标通道的像素值,对所述待校正图像进行颜色阴影校正。According to the pre-calibrated color shading data and the pixel value of the target channel, the color shading correction is performed on the image to be corrected.
- 如权利要求2所述的方法,其特征在于,所述方法还包括:The method according to claim 2, wherein the method further comprises:根据每个所述第一图像块的像素统计值,确定所述待校正图像的主颜色,获取所述主颜色对应像素点的像素位置;Determine the main color of the image to be corrected according to the pixel statistical value of each of the first image blocks, and obtain the pixel position of the pixel corresponding to the main color;根据预先标定的颜色阴影数据和所述目标通道的像素值,对所述待校正图像进行颜色阴影校正,包括:According to the pre-calibrated color shading data and the pixel value of the target channel, performing color shading correction on the image to be corrected includes:根据所述像素位置、所述颜色阴影数据和所述目标通道的像素值进行颜色阴影估计,得到所述待校正图像各个目标通道的颜色阴影矩阵;Performing color shadow estimation according to the pixel position, the color shadow data, and the pixel value of the target channel to obtain the color shadow matrix of each target channel of the image to be corrected;使用所述目标通道的颜色阴影矩阵,对所述待校正图像进行颜色阴影校正。Using the color shadow matrix of the target channel, perform color shadow correction on the image to be corrected.
- 如权利要求3所述的方法,其特征在于,根据所述像素位置、所述颜色阴影数据和所述目标通道的像素值进行颜色阴影估计,得到所述待校正图像的各个目标通道的颜色阴影矩阵,包括:The method of claim 3, wherein the color shadow estimation is performed according to the pixel position, the color shadow data, and the pixel value of the target channel to obtain the color shadow of each target channel of the image to be corrected The matrix includes:根据所述像素位置、所述颜色阴影数据和所述目标通道的像素值,得到各个所述目标通道的初始颜色阴影矩阵;Obtaining the initial color shadow matrix of each target channel according to the pixel position, the color shadow data, and the pixel value of the target channel;将所述初始颜色阴影矩阵进行扩展操作,得到所述待校正图像的各个目标通道的颜色阴影矩阵。Perform an expansion operation on the initial color shadow matrix to obtain the color shadow matrix of each target channel of the image to be corrected.
- 如权利要求4所述的方法,其特征在于,根据所述像素位置、所述颜色阴影数据和所述目标通道的像素值,得到各个所述目标通道的初始颜色阴影矩阵,包括:The method of claim 4, wherein obtaining the initial color shadow matrix of each target channel according to the pixel position, the color shadow data, and the pixel value of the target channel comprises:使用从所述颜色阴影数据中提取出的每个所述目标通道的基,根据所述像素位置和所述目标通道的像素值,计算每个所述目标通道的初始颜色阴影矩阵的权重系数;Using the base of each target channel extracted from the color shadow data to calculate the weight coefficient of the initial color shadow matrix of each target channel according to the pixel position and the pixel value of the target channel;根据每个所述目标通道的基和所述权重系数,得到各个所述目标通道的初始颜色阴影矩阵。According to the basis of each target channel and the weight coefficient, the initial color shadow matrix of each target channel is obtained.
- 如权利要求3所述的方法,其特征在于,使用所述目标通道的颜色阴影矩阵,对所述待校正图像进行颜色阴影校正,包括:The method according to claim 3, wherein, using the color shadow matrix of the target channel to perform color shadow correction on the image to be corrected comprises:将各个所述目标通道的颜色阴影矩阵分别与所述第二颜色空间下所述待校正图像的目标通道的对应像素值相乘,得到所述第二颜色空间下的校正图像;Multiply the color shadow matrix of each target channel by the corresponding pixel value of the target channel of the image to be corrected in the second color space to obtain the corrected image in the second color space;将所述第二颜色空间下的校正图像转换至目标颜色空间,得到目标颜色空间下的校正图像,所述目标颜色空间为所述第一颜色空间或第三颜色空间。The corrected image in the second color space is converted to a target color space to obtain a corrected image in the target color space, where the target color space is the first color space or the third color space.
- 如权利要求2所述的方法,其特征在于,在获取待校正图像之后,还包括;The method according to claim 2, characterized in that, after acquiring the image to be corrected, the method further comprises;对所述待校正图像进行图像预处理;Performing image preprocessing on the image to be corrected;将所述待校正图像划分成第一图像块后,获得每个所述第一图像块的像素统计值,包括:After dividing the image to be corrected into first image blocks, obtaining the pixel statistical value of each first image block includes:将图像预处理后的待校正图像划分成第一图像块后,获得每个所述第一图像块的像素统计值。After the image to be corrected after image preprocessing is divided into first image blocks, the pixel statistical value of each first image block is obtained.
- 如权利要求1至7任一项所述的方法,其特征在于,在获取待校正图像之前,还包括:The method according to any one of claims 1 to 7, characterized in that, before acquiring the image to be corrected, the method further comprises:分别获取N种单色光下的灰板图,N为大于或等于2的正整数;Obtain the gray board images under N kinds of monochromatic light respectively, where N is a positive integer greater than or equal to 2;对所述灰板图进行图像预处理;Perform image preprocessing on the gray board image;将图像预处理后的灰板图划分成第二图像块,并获得每个所述第二图像块的像素统计值;Dividing the pre-processed gray board image into second image blocks, and obtaining the pixel statistical value of each second image block;将每个所述第二图像块的像素统计值从第四颜色空间转换至第五颜色空间之后,获得所述第五颜色空间下所述灰板图的目标通道的像素值,所述第五颜色空间为与亮度无关的颜色空间;After the pixel statistical value of each second image block is converted from the fourth color space to the fifth color space, the pixel value of the target channel of the gray board image in the fifth color space is obtained, and the fifth The color space is a color space that has nothing to do with brightness;基于N种单色光的所述灰板图的目标通道的像素值,获得所述颜色阴影数据。The color shading data is obtained based on the pixel values of the target channel of the gray panel image of the N monochromatic lights.
- 如权利要求8所述的方法,其特征在于,在基于N种单色光的所述灰板图的目标通道的像素值,获得所述颜色阴影数据之后,还包括:The method according to claim 8, wherein after obtaining the color shading data based on the pixel values of the target channel of the gray panel image of the N monochromatic lights, the method further comprises:从所述颜色阴影数据中提取出各个目标通道的基。The base of each target channel is extracted from the color shading data.
- 如权利要求2所述的方法,其特征在于,将所述待校正图像划分成第一图像块后,获得每个所述第一图像块的像素统计值,包括:3. The method according to claim 2, wherein after dividing the image to be corrected into first image blocks, obtaining the pixel statistical value of each first image block comprises:对所述待校正图像进行网格划分,得到所述第一图像块;Meshing the image to be corrected to obtain the first image block;统计每个所述第一图像块的像素平均值,将所述像素平均值作为所述第一图像块的像素统计值。The average value of pixels of each of the first image blocks is counted, and the average value of pixels is used as the pixel statistical value of the first image block.
- 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至10任一项所述的方法。A terminal device, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program as claimed in claims 1 to 10. The method of any one of.
- 一种芯片,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至10任一项所述的方法。A chip comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program as claimed in claims 1 to 10 Any of the methods.
- 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至10任一项所述的方法。A computer-readable storage medium storing a computer program, wherein the computer program implements the method according to any one of claims 1 to 10 when the computer program is executed by a processor.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010030184.1A CN113129222A (en) | 2020-01-13 | 2020-01-13 | Color shading correction method, terminal device and computer-readable storage medium |
CN202010030184.1 | 2020-01-13 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021143281A1 true WO2021143281A1 (en) | 2021-07-22 |
Family
ID=76770984
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/125379 WO2021143281A1 (en) | 2020-01-13 | 2020-10-30 | Color shading correction method, terminal device, and computer-readable storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113129222A (en) |
WO (1) | WO2021143281A1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115484408A (en) * | 2022-09-07 | 2022-12-16 | 北京拙河科技有限公司 | Snow surface reflection coefficient generation method and device based on high-precision camera shooting |
CN118509720A (en) * | 2023-12-15 | 2024-08-16 | 荣耀终端有限公司 | Image processing method, electronic device, storage medium, and program product |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113744332A (en) * | 2021-09-07 | 2021-12-03 | 汇顶科技(成都)有限责任公司 | Image correction method, storage method, device, electronic device and storage medium |
CN113763278B (en) * | 2021-09-10 | 2024-07-16 | 昆山丘钛微电子科技股份有限公司 | Image correction method and device |
CN115049746B (en) * | 2022-05-30 | 2024-06-14 | 北京理工大学 | Image color correction method, device, electronic equipment and storage medium |
CN116405614B (en) * | 2022-06-10 | 2024-01-30 | 上海玄戒技术有限公司 | Lens shading correction method and device, electronic equipment, chip and medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102629967A (en) * | 2012-04-18 | 2012-08-08 | 山东神思电子技术股份有限公司 | Correction method for non-uniform illumination of copying device |
WO2013056387A1 (en) * | 2011-10-17 | 2013-04-25 | Liu Travis | Universal gamut mapping and color management method |
CN104766348A (en) * | 2014-01-07 | 2015-07-08 | 厦门美图网科技有限公司 | Off-color detection method based on color space |
CN104766276A (en) * | 2014-01-07 | 2015-07-08 | 厦门美图网科技有限公司 | Off-color correction method based on color space |
CN109155071A (en) * | 2017-06-30 | 2019-01-04 | 华为技术有限公司 | A kind of method and terminal of color detection |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9270959B2 (en) * | 2013-08-07 | 2016-02-23 | Qualcomm Incorporated | Dynamic color shading correction |
US9361537B2 (en) * | 2013-11-27 | 2016-06-07 | Intel Corporation | Techniques to reduce color artifacts in a digital image |
US9186909B1 (en) * | 2014-09-26 | 2015-11-17 | Intel Corporation | Method and system of lens shading color correction using block matching |
-
2020
- 2020-01-13 CN CN202010030184.1A patent/CN113129222A/en active Pending
- 2020-10-30 WO PCT/CN2020/125379 patent/WO2021143281A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2013056387A1 (en) * | 2011-10-17 | 2013-04-25 | Liu Travis | Universal gamut mapping and color management method |
CN102629967A (en) * | 2012-04-18 | 2012-08-08 | 山东神思电子技术股份有限公司 | Correction method for non-uniform illumination of copying device |
CN104766348A (en) * | 2014-01-07 | 2015-07-08 | 厦门美图网科技有限公司 | Off-color detection method based on color space |
CN104766276A (en) * | 2014-01-07 | 2015-07-08 | 厦门美图网科技有限公司 | Off-color correction method based on color space |
CN109155071A (en) * | 2017-06-30 | 2019-01-04 | 华为技术有限公司 | A kind of method and terminal of color detection |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115484408A (en) * | 2022-09-07 | 2022-12-16 | 北京拙河科技有限公司 | Snow surface reflection coefficient generation method and device based on high-precision camera shooting |
CN118509720A (en) * | 2023-12-15 | 2024-08-16 | 荣耀终端有限公司 | Image processing method, electronic device, storage medium, and program product |
Also Published As
Publication number | Publication date |
---|---|
CN113129222A (en) | 2021-07-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021143281A1 (en) | Color shading correction method, terminal device, and computer-readable storage medium | |
WO2019153920A1 (en) | Method for image processing and related device | |
CN107230192B (en) | Image processing method, image processing device, computer-readable storage medium and mobile terminal | |
US10510136B2 (en) | Image blurring method, electronic device and computer device | |
WO2017071219A1 (en) | Method for detecting skin region and device for detecting skin region | |
CN106297657B (en) | A kind of brightness adjusting method and terminal of AMOLED display screens | |
CN112950525B (en) | Image detection method and device and electronic equipment | |
WO2021037227A1 (en) | Image processing method, electronic device and cloud server | |
WO2018171493A1 (en) | Image processing method and device, and storage medium | |
WO2021143284A1 (en) | Image processing method and apparatus, terminal and storage medium | |
US10181203B2 (en) | Method for processing image data and apparatus for the same | |
CN111127595B (en) | Image processing method and electronic equipment | |
WO2018072271A1 (en) | Image display optimization method and device | |
CN108280813A (en) | A kind of image processing method, terminal and computer readable storage medium | |
CN106445970B (en) | Loading processing method and device for placeholder map | |
CN110618852B (en) | View processing method, view processing device and terminal equipment | |
CN110097570B (en) | Image processing method and device | |
US20190377113A1 (en) | Picture Display Method and Electronic Device | |
WO2019184017A1 (en) | Control display method and electronic device | |
CN110944163A (en) | Image processing method and electronic equipment | |
CN108924439B (en) | Image processing method and related product | |
CN105513098B (en) | Image processing method and device | |
CN106775548B (en) | page processing method and device | |
CN111104193B (en) | Application program active interface display method and device, storage medium and terminal equipment | |
WO2017152386A1 (en) | Display method and handheld electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20914464 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 20914464 Country of ref document: EP Kind code of ref document: A1 |