WO2022100082A1 - Image processing method and apparatus, electronic device, and readable storage medium - Google Patents

Image processing method and apparatus, electronic device, and readable storage medium Download PDF

Info

Publication number
WO2022100082A1
WO2022100082A1 PCT/CN2021/098613 CN2021098613W WO2022100082A1 WO 2022100082 A1 WO2022100082 A1 WO 2022100082A1 CN 2021098613 W CN2021098613 W CN 2021098613W WO 2022100082 A1 WO2022100082 A1 WO 2022100082A1
Authority
WO
WIPO (PCT)
Prior art keywords
ratio
channel
saturation
image
change ratio
Prior art date
Application number
PCT/CN2021/098613
Other languages
French (fr)
Chinese (zh)
Inventor
李永超
赵博
洪星智
Original Assignee
海宁奕斯伟集成电路设计有限公司
北京奕斯伟计算技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 海宁奕斯伟集成电路设计有限公司, 北京奕斯伟计算技术有限公司 filed Critical 海宁奕斯伟集成电路设计有限公司
Publication of WO2022100082A1 publication Critical patent/WO2022100082A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image

Definitions

  • the present disclosure relates to the technical field of image processing, and in particular, to an image processing method, an apparatus, an electronic device, and a storage medium.
  • Y in the YUV color space represents the brightness, which is the grayscale value; while “U” and “V” represent the color saturation of the image, which is used to specify the color of the pixel.
  • brightness and saturation are well separated, but if only brightness or saturation is processed, and saturation and brightness corresponding to brightness or saturation are not done. Processing, it will cause the problem of color and brightness mismatch, such as the phenomenon of color washing or oversaturation in the image.
  • the corresponding compensation processing is performed on the saturation of the image.
  • the compensation processing will cause the color clipping problem, which is manifested as darkening of the color or loss of details in the image.
  • the present disclosure provides an image processing method, apparatus, electronic device, and storage medium.
  • the present disclosure provides an image processing method, the method comprising: acquiring an RGB image; converting the RGB image into a YUV image; pulling a Y channel of the YUV image from a first luminance component rising to the second luminance component; calculating the change ratio of the luminance component of the Y channel according to the first luminance component and the second luminance component; and compensating the saturation of the U channel and the V channel of the YUV image according to the change ratio weight.
  • the calculation formula of the change ratio is: Wherein, Ratio is the change ratio, Y out is the second luminance component, Y in is the first luminance component, and ⁇ is a preset extreme value that is not zero.
  • the compensated saturation component, V in is the original saturation component of the V channel, and V out is the compensated saturation component of the V channel.
  • the step of compensating the saturation components of the U channel and the V channel of the YUV image according to the change ratio includes: judging whether the change ratio is less than a preset value; if the ratio is smaller than the preset value, adjust the change ratio to be the first ratio; when it is determined that the change ratio is greater than or equal to the preset value, adjust the change ratio to the second ratio; and according to the first ratio
  • the scale or the second scale compensates the saturation components of the U channel and the V channel of the YUV image.
  • the step of adjusting the change ratio to the first ratio includes: acquiring luminance data of the YUV image; acquiring a first gain coefficient corresponding to the luminance data; and adjusting according to the first gain coefficient
  • the change ratio is the first ratio.
  • the step of adjusting the change ratio to the second ratio includes: acquiring saturation data of the YUV image; acquiring a second gain coefficient corresponding to the saturation data; and according to the second gain The coefficient adjusts the change ratio to be the second ratio.
  • the present disclosure provides an image processing apparatus, the image processing apparatus comprising: an acquisition module for acquiring an RGB image; a conversion module for converting the RGB image into a YUV image; The module is used to pull the Y channel of the YUV image from the first brightness component to the second brightness component; the calculation module is used to calculate the brightness component of the Y channel according to the first brightness component and the second brightness component. a change ratio; and a compensation module for compensating the saturation components of the U channel and the V channel of the YUV image according to the change ratio.
  • the present disclosure provides an electronic device comprising a processor, a memory, and a program or instruction stored on the memory and executable on the processor, the program or instruction being executed by the
  • the processor implements the steps of the image processing method described above when executed.
  • the present disclosure provides a readable storage medium, on which a program or an instruction is stored, and when the program or the instruction is executed by a processor, implements the above-mentioned image processing method.
  • FIG. 1 is a schematic flowchart of steps of an image processing method according to an embodiment of the present disclosure.
  • FIG. 2 is a schematic flowchart of the steps of step S15 shown in FIG. 1 .
  • FIG. 3 is a schematic flowchart of the step S22 shown in FIG. 2 .
  • FIG. 4 is a schematic flowchart of the step S23 shown in FIG. 2 .
  • FIG. 5 is a schematic structural diagram of a luminance mapping curve provided by an embodiment of the present disclosure.
  • FIG. 6 is a schematic structural diagram of a saturation mapping curve provided by an embodiment of the present disclosure.
  • FIG. 7 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • FIG. 9 is a schematic diagram of a specific structure of an electronic device provided by an embodiment of the present disclosure.
  • an embodiment of the present disclosure provides an image processing method, which is applied to an electronic device, and the method includes steps S11 to S15 .
  • Step S11 acquiring an RGB image.
  • Step S12 converting the RGB image into a YUV image.
  • the RGB in the process of converting an RGB image into a YUV image, the RGB is converted to obtain a Y channel of a luminance signal and two saturation signals U and V channels.
  • RGB a Y channel of a luminance signal
  • U and V channels For the specific conversion of RGB to YUV, please refer to the related art .
  • Step S13 pulling the Y channel of the YUV image from the first luminance component to the second luminance component.
  • Step S14 Calculate the change ratio of the luminance component of the Y channel according to the first luminance component and the second luminance component.
  • the calculation formula of the change ratio is: Wherein, Ratio is the change ratio, Y out is the second luminance component, Y in is the first luminance component, and ⁇ is a preset extreme value that is not zero. where ⁇ is a minimum value to prevent the denominator from being zero.
  • Step S15 Compensate the saturation components of the U channel and the V channel of the YUV image according to the change ratio.
  • the saturation component By adjusting the saturation component according to the change ratio of the luminance data, the color of the image after color compensation is maintained, and the image quality is improved.
  • step S15 may further include steps S21 to S24.
  • Step S21 judging whether the change ratio is less than a preset value.
  • the preset value is preferably 1.0, but is not limited thereto. By comparing the change ratio with 1.0, it can be known that the Y channel of the YUV image is darkened or brightened.
  • Step S22 when it is determined that the change ratio is smaller than the preset value, adjust the change ratio to be the first ratio.
  • the change ratio when it is determined that the change ratio is less than the preset value (ie, 1.0), it indicates that the image is darkened. In order to prevent the color of the image from being darkened, the change ratio needs to be adjusted to the first ratio. Adjusts the saturation component.
  • step S22 includes steps S31 to S32.
  • Step S31 acquiring luminance data of the YUV image.
  • the luminance data may be calculated in any color space. Specifically, such as the 709 color gamut of the YUV color space, the calculation method of the luminance data is as follows:
  • Step S32 Obtain a first gain coefficient corresponding to the luminance data.
  • the electronic device is preset with a luminance lookup table (LUT), and a certain number of discrete coordinate points are stored in the luminance lookup table, and these coordinate points are sampling points on the luminance mapping curve.
  • the abscissa of the coordinate point is the luminance data, that is, the input of the luminance mapping curve
  • the ordinate of the coordinate point is the first gain coefficient, that is, the output of the luminance mapping curve.
  • the luminance lookup table represents a simplest luminance mapping curve as shown in FIG. 5 .
  • Step S33 adjusting the change ratio to be a first ratio according to the first gain coefficient.
  • the change ratio is adjusted to the first gain coefficient, so as to prevent the image color from being suppressed when the Y channel is suppressed.
  • Step S23 when it is determined that the change ratio is greater than or equal to the preset value, adjust the change ratio to a second ratio.
  • the change ratio when it is determined that the change ratio is greater than or equal to the preset value (ie, 1.0), it indicates that the image is brightened.
  • the second scale adjusts the saturation component.
  • step S23 includes steps S41 to S43.
  • step S41 the saturation data of the YUV image is acquired.
  • Step S42 acquiring a second gain coefficient corresponding to the saturation data.
  • the electronic device is preset with a saturation lookup table (LUT), and a certain number of discrete coordinate points are stored in the saturation lookup table, and these coordinate points are sampling points on the saturation mapping curve.
  • the abscissa of the coordinate point is the saturation data, that is, the input of the saturation mapping curve
  • the ordinate of the coordinate point is the second gain coefficient, that is, the output of the saturation mapping curve.
  • the saturation lookup table represents a simplest saturation mapping curve as shown in FIG. 6 .
  • Step S43 adjusting the change ratio to a second ratio according to the second gain coefficient.
  • Ratio H Ratio*LUT sat ; wherein, Ratio H is the second ratio, and LUT sat is the second gain coefficient.
  • the change ratio is adjusted to the second gain coefficient, so that when the Y channel is brightened, the color of the image is prevented from being oversaturated.
  • an embodiment of the present disclosure provides an image processing apparatus.
  • the image processing module includes an acquisition module 71 , a conversion module 72 , a pull-up module 73 , a calculation module 74 , and a compensation module 75 .
  • the acquisition module 71 is used to acquire RGB images.
  • the conversion module 72 is used to convert the RGB image into a YUV image.
  • the RGB in the process of converting an RGB image into a YUV image, the RGB is converted to obtain a Y channel of a luminance signal and two saturation signals U and V channels.
  • RGB a Y channel of a luminance signal
  • U and V channels For the specific conversion of RGB to YUV, please refer to the related art .
  • the pulling module 73 is used for pulling the Y channel of the YUV image from the first luminance component to the second luminance component.
  • the calculation module 74 is configured to calculate the change ratio of the luminance component of the Y channel according to the first luminance component and the second luminance component.
  • the calculation formula of the change ratio is: Wherein, Ratio is the change ratio, Y out is the second luminance component, Y in is the first luminance component, and ⁇ is a preset extreme value that is not zero. where ⁇ is a minimum value to prevent the denominator from being zero.
  • the compensation module 75 compensates the saturation components of the U channel and the V channel of the YUV image according to the change ratio.
  • the compensation module 75 includes a determination unit, a first adjustment unit, a second adjustment unit, and a compensation unit.
  • the judging unit is used for judging whether the change ratio is less than a preset value.
  • the preset value is preferably 1.0, but is not limited thereto. By comparing the change ratio with 1.0, it can be known that the Y channel of the YUV image is darkened or brightened.
  • the first adjustment unit is configured to adjust the change ratio to a first ratio when it is determined that the change ratio is smaller than the preset value.
  • the change ratio when it is determined that the change ratio is less than the preset value (ie, 1.0), it indicates that the image is darkened. In order to prevent the color of the image from being darkened, the change ratio needs to be adjusted to the first ratio. Adjusts the saturation component.
  • the first adjustment unit includes a first acquisition subunit, a second acquisition subunit, and a first adjustment subunit.
  • the acquisition subunit is used to acquire the luminance data of the YUV image.
  • the luminance data may be calculated in any color space. Specifically, such as the 709 color gamut of the YUV color space, the calculation method of the luminance data is as follows:
  • the second obtaining subunit is used to obtain the first gain coefficient corresponding to the luminance data.
  • the electronic device is preset with a luminance lookup table (LUT), and a certain number of discrete coordinate points are stored in the luminance lookup table, and these coordinate points are sampling points on the luminance mapping curve.
  • the abscissa of the coordinate point is the luminance data, that is, the input of the luminance mapping curve
  • the ordinate of the coordinate point is the first gain coefficient, that is, the output of the luminance mapping curve.
  • the luminance lookup table represents a simplest luminance mapping curve as shown in FIG. 5 .
  • the first adjustment subunit is configured to adjust the change ratio to a first ratio according to the first gain coefficient.
  • the second adjustment unit is configured to adjust the change ratio to a second ratio when it is determined that the change ratio is greater than or equal to the preset value.
  • the change ratio when it is determined that the change ratio is greater than or equal to the preset value (ie, 1.0), it indicates that the image is brightened.
  • the second scale adjusts the saturation component.
  • the second adjustment unit includes a third acquisition subunit, a fourth acquisition subunit, and a second adjustment subunit.
  • the third acquisition subunit is used to acquire the saturation data of the YUV image.
  • the fourth obtaining subunit is configured to obtain the second gain coefficient corresponding to the saturation data.
  • the electronic device is preset with a saturation lookup table (LUT), and a certain number of discrete coordinate points are stored in the saturation lookup table, and these coordinate points are sampling points on the saturation mapping curve.
  • the abscissa of the coordinate point is the saturation data, that is, the input of the saturation mapping curve
  • the ordinate of the coordinate point is the second gain coefficient, that is, the output of the saturation mapping curve.
  • the saturation lookup table represents a simplest saturation mapping curve as shown in FIG. 6 .
  • the second adjustment subunit is configured to adjust the change ratio to a second ratio according to the second gain coefficient.
  • Ratio H Ratio*LUT sat ; wherein, Ratio H is the second ratio, and LUT sat is the second gain coefficient.
  • an embodiment of the present disclosure further provides an electronic device 800, and the electronic device 800 may be devices such as a mobile phone, a tablet, and a computer.
  • the electronic device 800 includes a processor 801 and a memory 802 .
  • the processor 801 is electrically connected to the memory 802 .
  • the processor 801 is the control center of the electronic device 800, uses various interfaces and lines to connect various parts of the entire electronic device, executes the electronic Various functions of the device and processing data, so as to carry out the overall monitoring of the electronic device.
  • the electronic device 800 is provided with multiple storage partitions, and the multiple storage partitions include a system partition and a target partition.
  • the instructions corresponding to the process of the program are loaded into the memory 802, and the processor 801 runs the application program stored in the memory 802, thereby realizing various functions:
  • the saturation components of the U channel and the V channel of the YUV image are compensated according to the change ratio.
  • FIG. 9 shows a specific structural block diagram of an electronic device 900 provided by an embodiment of the present disclosure, and the electronic device 900 can be used to implement the image processing method provided in the foregoing embodiments.
  • the electronic device 900 may be a mobile phone or a tablet.
  • the electronic device 900 also includes the following components.
  • the RF circuit 910 is used for receiving and sending electromagnetic waves, realizing mutual conversion between electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices.
  • RF circuitry 910 may include various associated circuit elements for performing these functions, eg, antennas, radio frequency transceivers, digital signal processors, encryption/decryption chips, subscriber identity module (SIM) cards, memory, and the like.
  • the RF circuit 910 may communicate with various networks such as the Internet, an intranet, a wireless network, or with other devices over a wireless network.
  • the aforementioned wireless network may include a cellular telephone network, a wireless local area network, or a metropolitan area network.
  • the above-mentioned wireless network can use various communication standards, protocols and technologies, including but not limited to Global System for Mobile Communication (GSM), Enhanced Data GSM Environment (EDGE), wideband code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Code Division Multiple Access (Code Division Access, CDMA), Time Division Multiple Access (TDMA), Wireless Fidelity (Wireless Fidelity, Wi- Fi) (such as IEEE 802.11a, IEEE 802.11b, IEEE802.11g and/or IEEE 802.11n), Voice over Internet Protocol (VoIP), Worldwide Interoperability for Microwave Access, Wi-Max), other protocols for mail, instant messaging, and short messaging, and any other suitable communication protocols, even those that are not currently being developed.
  • GSM Global System for Mobile Communication
  • EDGE Enhanced Data GSM Environment
  • WCDMA Wideband Code Division Multiple Access
  • CDMA Code Division Multiple Access
  • TDMA Time Division Multiple Access
  • Wireless Fidelity Wireless Fidelity
  • Wi- Fi such as IEEE 802.11a, IEEE
  • the memory 920 can be used to store software programs and modules, such as program instructions/modules corresponding to the image processing method in the above-mentioned embodiments, the processor 980 executes various functional applications and data processing by running the software programs and modules stored in the memory 920. , that is, the function of realizing the image processing method.
  • Memory 920 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
  • memory 920 may further include memory located remotely from processor 980, which may be connected to electronic device 900 through a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
  • the input unit 930 may be used to receive input numerical or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
  • the input unit 930 may include a touch-sensitive surface 931 as well as other input devices 932 .
  • Touch-sensitive surface 931 also known as a touch display or trackpad, collects user touch operations on or near it (such as a user using a finger, stylus, etc., any suitable object or accessory on or on touch-sensitive surface 931). operations near the touch-sensitive surface 931), and drive the corresponding connection device according to a preset program.
  • the touch-sensitive surface 931 may include two parts, a touch detection device and a touch controller.
  • the touch detection device detects the user's touch orientation, 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 touch controller.
  • the touch-sensitive surface 931 may be implemented using resistive, capacitive, infrared, and surface acoustic wave types.
  • the input unit 930 may also include other input devices 932 .
  • other input devices 932 may include, but are not limited to, one or more of physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, joysticks, and the like.
  • the display unit 940 may be used to display information input by the user or information provided to the user and various graphical user interfaces of the electronic device 900, which may be composed of graphics, text, icons, videos, and any combination thereof.
  • the display unit 940 may include a display panel 941.
  • the display panel 941 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), and the like.
  • the touch-sensitive surface 931 may cover the display panel 941, and when the touch-sensitive surface 931 detects a touch operation on or near it, it transmits it to the processor 980 to determine the type of the touch event, and then the processor 980 determines the type of the touch event according to the touch event.
  • Type provides corresponding visual output on display panel 941 .
  • the touch-sensitive surface 931 and the display panel 941 are implemented as two separate components to realize the input and output functions, in some embodiments, the touch-sensitive surface 931 and the display panel 941 may be integrated to realize the input and output functions.
  • the electronic device 900 may also include at least one sensor 950, such as a light sensor, a motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 941 according to the brightness of the ambient light, and the proximity sensor may close the display panel 941 when the electronic device 900 is moved to the ear and/or backlight.
  • the gravitational acceleration sensor can detect the magnitude of acceleration in all directions (usually three axes), and can detect the magnitude and direction of gravity when stationary, and can be used for applications that recognize the attitude of mobile phones (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that can be configured in the electronic device 900, here No longer.
  • the audio circuit 960 , the speaker 961 , and the microphone 962 may provide an audio interface between the user and the electronic device 900 .
  • the audio circuit 960 can convert the received audio data into an electrical signal, and transmit it to the speaker 961, and the speaker 961 converts it into a sound signal for output; on the other hand, the microphone 962 converts the collected sound signal into an electrical signal, which is converted by the audio circuit 960 After receiving, it is converted into audio data, and then the audio data is output to the processor 980 for processing, and then sent to, for example, another terminal through the RF circuit 910, or the audio data is output to the memory 920 for further processing.
  • Audio circuitry 960 may also include an ear jack to provide for communication of peripheral headphones with electronic device 900 .
  • the electronic device 900 can help the user to send and receive emails, browse web pages, access streaming media, etc. through the transmission module 970 (such as a Wi-Fi module), which provides the user with wireless broadband Internet access.
  • the transmission module 970 such as a Wi-Fi module
  • FIG. 9 shows the transmission module 970, it can be understood that it does not belong to the essential structure of the electronic device 900, and can be completely omitted as required within the scope of not changing the essence of the invention.
  • the processor 980 is the control center of the electronic device 900, uses various interfaces and lines to connect various parts of the entire mobile phone, runs or executes the software programs and/or modules stored in the memory 920, and calls the data stored in the memory 920. , perform various functions of the electronic device 900 and process data, so as to monitor the mobile phone as a whole.
  • the processor 980 may include one or more processing cores; in some embodiments, the processor 980 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface and Applications, etc., the modem processor mainly deals with wireless communication. It can be understood that, the above-mentioned modulation and demodulation processor may not be integrated into the processor 980 .
  • the electronic device 900 also includes a power supply 990 (such as a battery) for powering the various components.
  • the power supply may be logically connected to the processor 980 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. management and other functions.
  • Power supply 990 may also include one or more DC or AC power sources, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and any other components.
  • the electronic device 900 may further include a camera (eg, a front camera, a rear camera), a Bluetooth module, and the like, which will not be described herein again.
  • the display unit of the electronic device is a touch screen display
  • the electronic device further includes a memory, and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by one or more programs.
  • the above processor executing one or more programs contains instructions for:
  • the saturation components of the U channel and the V channel of the YUV image are compensated according to the change ratio.
  • each of the above modules can be implemented as an independent entity, or can be arbitrarily combined, and implemented as the same or several entities.
  • the specific implementation of each of the above modules can refer to the previous method embodiments, which will not be repeated here.
  • the readable storage medium may include: a read-only memory (ROM, Read Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and the like.
  • ROM Read Only Memory
  • RAM Random Access Memory
  • magnetic disk or an optical disk and the like.
  • the beneficial effect of the present disclosure is that: by acquiring the change ratio of the luminance component of the Y channel, comparing the change ratio with a preset value, and performing corresponding compensation on the saturation component according to the comparison result, it is avoided that after the luminance processing of the image, the When the saturation of the image is compensated, the color clipping phenomenon is caused, the details of the image are protected, and the image display of higher quality is realized.
  • modules, units, sub-modules, sub-units, etc. can be implemented in one or more Application Specific Integrated Circuits (ASIC), Digital Signal Processing (DSP), digital signal processing equipment ( DSP Device, DSPD), Programmable Logic Device (Programmable Logic Device, PLD), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), general-purpose processor, controller, microcontroller, microprocessor, for in other electronic units or combinations thereof that perform the functions described herein.
  • ASIC Application Specific Integrated Circuits
  • DSP Digital Signal Processing
  • DSP Device digital signal processing equipment
  • PLD Programmable Logic Device
  • Field-Programmable Gate Array Field-Programmable Gate Array
  • FPGA Field-Programmable Gate Array

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)
  • Color Image Communication Systems (AREA)

Abstract

An image processing method and apparatus, an electronic device, and a storage medium. The image processing method comprises: acquiring an RGB image (S11); converting the RGB image into a YUV image (S12); pulling a Y channel of the YUV image from a first luminance component to a second luminance component (S13); calculating the change proportion of the luminance components of the Y channel according to the first luminance component and the second luminance component (S14); and compensating for saturation components of a U channel and a V channel of the YUV image according to the change proportion (S15).

Description

图像处理方法、装置、电子设备以及可读存储介质Image processing method, apparatus, electronic device, and readable storage medium
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请主张在2020年11月11日在中国提交的中国专利申请号No.202011253511.6的优先权,其全部内容通过引用包含于此。This application claims priority to Chinese Patent Application No. 202011253511.6 filed in China on Nov. 11, 2020, the entire contents of which are incorporated herein by reference.
技术领域technical field
本公开涉及图像处理技术领域,尤其涉及一种图像处理方法、装置、电子设备以及存储介质。The present disclosure relates to the technical field of image processing, and in particular, to an image processing method, an apparatus, an electronic device, and a storage medium.
背景技术Background technique
YUV色彩空间中的“Y”表示明亮度,也就是灰阶值;而“U”和“V”表示的则是图像色彩饱和度,用于指定像素的颜色。在图像或视频处理过程中,在YUV色彩空间,亮度以及饱和度被很好的分离开,但若只处理亮度或者饱和度,而对分别与亮度或饱和度对应的饱和度、亮度不做任何处理,将产生颜色与亮度不匹配的问题,例如图像中出现颜色洗白或过饱和的现象。"Y" in the YUV color space represents the brightness, which is the grayscale value; while "U" and "V" represent the color saturation of the image, which is used to specify the color of the pixel. In the process of image or video processing, in the YUV color space, brightness and saturation are well separated, but if only brightness or saturation is processed, and saturation and brightness corresponding to brightness or saturation are not done. Processing, it will cause the problem of color and brightness mismatch, such as the phenomenon of color washing or oversaturation in the image.
为了改善上述现象,一般在图像进行亮度处理后,对图像的饱和度做对应的补偿处理,然而补偿处理会引起颜色剪切问题,具体表现为图像中的颜色变暗或细节丢失。In order to improve the above phenomenon, generally, after the brightness processing of the image, the corresponding compensation processing is performed on the saturation of the image. However, the compensation processing will cause the color clipping problem, which is manifested as darkening of the color or loss of details in the image.
发明内容SUMMARY OF THE INVENTION
本公开提供一种图像处理方法、装置、电子设备以及存储介质。The present disclosure provides an image processing method, apparatus, electronic device, and storage medium.
根据本公开的第一方面,本公开提供一种图像处理方法,所述方法包括:获取RGB图像;将所述RGB图像转换为YUV图像;将所述YUV图像的Y通道从第一亮度分量拉升至第二亮度分量;根据所述第一亮度分量和第二亮度分量,计算Y通道的亮度分量的变化比例;以及根据所述变化比例补偿所述YUV图像的U通道以及V通道的饱和度分量。According to a first aspect of the present disclosure, the present disclosure provides an image processing method, the method comprising: acquiring an RGB image; converting the RGB image into a YUV image; pulling a Y channel of the YUV image from a first luminance component rising to the second luminance component; calculating the change ratio of the luminance component of the Y channel according to the first luminance component and the second luminance component; and compensating the saturation of the U channel and the V channel of the YUV image according to the change ratio weight.
在一些实施例中,所述变化比例的计算公式为:
Figure PCTCN2021098613-appb-000001
其中,Ratio为变化比例,Y out为第二亮度分量,Y in为第一亮度分量,δ为一不为零的预设极值。
In some embodiments, the calculation formula of the change ratio is:
Figure PCTCN2021098613-appb-000001
Wherein, Ratio is the change ratio, Y out is the second luminance component, Y in is the first luminance component, and δ is a preset extreme value that is not zero.
在一些实施例中,所述饱和度分量的计算公式为:U out=Ratio*U in;V out=Ratio*V in;其中,U in为U通道的原饱和度分量,U out为U通道补偿后的饱和度分量,V in为V通道的原饱和度分量,V out为V通道补偿后的饱和度分量。 In some embodiments, the calculation formula of the saturation component is: U out =Ratio*U in ; V out =Ratio*V in ; where U in is the original saturation component of the U channel, and U out is the U channel The compensated saturation component, V in is the original saturation component of the V channel, and V out is the compensated saturation component of the V channel.
在一些实施例中,在根据所述变化比例补偿所述YUV图像的U通道以及V通道的饱和度分量的步骤中包括:判断所述变化比例是否小于一预设值;当判断出所述变化比例小于所述预设值,调整所述变化比例为第一比例;当判断出所述变化比例大于或等于所述预设值,调整所述变化比例为第二比例;以及根据所述第一比例或所述第二比例补偿所述YUV图像的U通道以及V通道的饱和度分量。In some embodiments, the step of compensating the saturation components of the U channel and the V channel of the YUV image according to the change ratio includes: judging whether the change ratio is less than a preset value; if the ratio is smaller than the preset value, adjust the change ratio to be the first ratio; when it is determined that the change ratio is greater than or equal to the preset value, adjust the change ratio to the second ratio; and according to the first ratio The scale or the second scale compensates the saturation components of the U channel and the V channel of the YUV image.
在一些实施例中,在调整所述变化比例为第一比例的步骤中,包括:获取YUV图像的亮度数据;获取所述亮度数据对应的第一增益系数;以及根据所述第一增益系数调整所述变化比例为第一比例。In some embodiments, the step of adjusting the change ratio to the first ratio includes: acquiring luminance data of the YUV image; acquiring a first gain coefficient corresponding to the luminance data; and adjusting according to the first gain coefficient The change ratio is the first ratio.
在一些实施例中,所述第一比例的计算公式为:Ratio L=Ratio*LUT y;其中,Ratio L为第一比例,LUT y为第一增益系数。 In some embodiments, the calculation formula of the first ratio is: Ratio L =Ratio*LUT y ; wherein, Ratio L is the first ratio, and LUT y is the first gain coefficient.
在一些实施例中,在调整所述变化比例为第二比例的步骤中,包括:获取YUV图像的饱和度数据;获取所述饱和度数据对应的第二增益系数;以及根据所述第二增益系数调整所述变化比例为第二比例。In some embodiments, the step of adjusting the change ratio to the second ratio includes: acquiring saturation data of the YUV image; acquiring a second gain coefficient corresponding to the saturation data; and according to the second gain The coefficient adjusts the change ratio to be the second ratio.
在一些实施例中,所述第二比例的计算公式为:Ratio H=Ratio*LUT sat;其中,Ratio H为第二比例,LUT sat为第二增益系数。 In some embodiments, the calculation formula of the second ratio is: Ratio H =Ratio*LUT sat ; wherein, Ratio H is the second ratio, and LUT sat is the second gain coefficient.
根据本公开的第二方面,本公开提供一种图像处理装置,所述图像处理装置包括:获取模块,用于获取RGB图像;转换模块,用于将所述RGB图像转换为YUV图像;拉升模块,用于将所述YUV图像的Y通道从第一亮度分量拉升至第二亮度分量;计算模块,用于根据所述第一亮度分量和第二亮度分量,计算Y通道的亮度分量的变化比例;以及补偿模块,用于根据所述变化比例补偿所述YUV图像的U通道以及V通道的饱和度分量。According to a second aspect of the present disclosure, the present disclosure provides an image processing apparatus, the image processing apparatus comprising: an acquisition module for acquiring an RGB image; a conversion module for converting the RGB image into a YUV image; The module is used to pull the Y channel of the YUV image from the first brightness component to the second brightness component; the calculation module is used to calculate the brightness component of the Y channel according to the first brightness component and the second brightness component. a change ratio; and a compensation module for compensating the saturation components of the U channel and the V channel of the YUV image according to the change ratio.
根据本公开的第三方面,本公开提供一种电子设备,包括处理器,存储器及存储在所述存储器上并可在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现如上述的图像处理方法的步骤。According to a third aspect of the present disclosure, the present disclosure provides an electronic device comprising a processor, a memory, and a program or instruction stored on the memory and executable on the processor, the program or instruction being executed by the The processor implements the steps of the image processing method described above when executed.
根据本公开的第四方面,本公开提供一种可读存储介质,所述可读存储介质上存储程序或指令,所述程序或指令被处理器执行时实现如上述的图像处理方法。According to a fourth aspect of the present disclosure, the present disclosure provides a readable storage medium, on which a program or an instruction is stored, and when the program or the instruction is executed by a processor, implements the above-mentioned image processing method.
附图说明Description of drawings
图1为本公开实施例提供的一种图像处理方法的步骤流程示意图。FIG. 1 is a schematic flowchart of steps of an image processing method according to an embodiment of the present disclosure.
图2为图1所示的步骤S15的步骤流程示意图。FIG. 2 is a schematic flowchart of the steps of step S15 shown in FIG. 1 .
图3为图2所示的步骤S22的步骤流程示意图。FIG. 3 is a schematic flowchart of the step S22 shown in FIG. 2 .
图4为图2所示的步骤S23的步骤流程示意图。FIG. 4 is a schematic flowchart of the step S23 shown in FIG. 2 .
图5为本公开实施例提供的一种亮度映射曲线的结构示意图。FIG. 5 is a schematic structural diagram of a luminance mapping curve provided by an embodiment of the present disclosure.
图6为本公开实施例提供的一种饱和度映射曲线的结构示意图。FIG. 6 is a schematic structural diagram of a saturation mapping curve provided by an embodiment of the present disclosure.
图7为本公开实施例提供的一种图像处理装置的结构示意图。FIG. 7 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present disclosure.
图8为本公开实施例提供的电子设备的结构示意图。FIG. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
图9为本公开实施例提供的电子设备的具体结构示意图。FIG. 9 is a schematic diagram of a specific structure of an electronic device provided by an embodiment of the present disclosure.
具体实施方式Detailed ways
下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅仅是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only some, but not all, embodiments of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present disclosure.
如图1所示,本公开实施例提供一种图像处理方法,应用于电子设备,该方法包括步骤S11至步骤S15。As shown in FIG. 1 , an embodiment of the present disclosure provides an image processing method, which is applied to an electronic device, and the method includes steps S11 to S15 .
步骤S11,获取RGB图像。Step S11, acquiring an RGB image.
步骤S12,将所述RGB图像转换为YUV图像。Step S12, converting the RGB image into a YUV image.
在本公开实施例中,在RGB图像转换成YUV图像的过程中,对RGB进行转换得到亮度信号Y通道以及两个饱和度信号U通道和V通道,具体地将RGB转换成YUV可参见相关技术。In the embodiment of the present disclosure, in the process of converting an RGB image into a YUV image, the RGB is converted to obtain a Y channel of a luminance signal and two saturation signals U and V channels. For the specific conversion of RGB to YUV, please refer to the related art .
步骤S13,将所述YUV图像的Y通道从第一亮度分量拉升至第二亮度分量。Step S13, pulling the Y channel of the YUV image from the first luminance component to the second luminance component.
步骤S14,根据所述第一亮度分量和第二亮度分量,计算Y通道的亮度分量的变化比例。Step S14: Calculate the change ratio of the luminance component of the Y channel according to the first luminance component and the second luminance component.
在本公开实施例中,可选的,变化比例的计算公式为:
Figure PCTCN2021098613-appb-000002
其中,Ratio为变化比例,Y out为第二亮度分量,Y in为第一亮度分量,δ为一不为零的预设极值。其中δ为一极小值,用于防止分母为零。
In the embodiment of the present disclosure, optionally, the calculation formula of the change ratio is:
Figure PCTCN2021098613-appb-000002
Wherein, Ratio is the change ratio, Y out is the second luminance component, Y in is the first luminance component, and δ is a preset extreme value that is not zero. where δ is a minimum value to prevent the denominator from being zero.
步骤S15,根据所述变化比例补偿所述YUV图像的U通道以及V通道的饱和度分量。Step S15: Compensate the saturation components of the U channel and the V channel of the YUV image according to the change ratio.
在本公开实施例中,可选的,饱和度分量的计算公式为:U out=Ratio*U in;V out=Ratio*V in;其中,U in为U通道的原饱和度分量,U out为U通道补偿后的饱和度分量,V in为V通道的原饱和度分量,V out为V通道补偿后的饱和度分量。 In the embodiment of the present disclosure, optionally, the calculation formula of the saturation component is: U out =Ratio*U in ; V out =Ratio*V in ; wherein, U in is the original saturation component of the U channel, and U out is the compensated saturation component of the U channel, V in is the original saturation component of the V channel, and V out is the compensated saturation component of the V channel.
通过根据亮度数据的变化比例,对饱和度分量进行相应的调整,保持色彩补偿后的图像颜色,提升图像质量。By adjusting the saturation component according to the change ratio of the luminance data, the color of the image after color compensation is maintained, and the image quality is improved.
参阅图2,步骤S15还可以包括步骤S21至步骤S24。Referring to FIG. 2, step S15 may further include steps S21 to S24.
步骤S21,判断所述变化比例是否小于一预设值。Step S21, judging whether the change ratio is less than a preset value.
在本公开实施例中,预设值优选为1.0,但不限于此。通过判断变化比例与1.0做比较,可获知YUV图像的Y通道被压暗或提亮。In the embodiment of the present disclosure, the preset value is preferably 1.0, but is not limited thereto. By comparing the change ratio with 1.0, it can be known that the Y channel of the YUV image is darkened or brightened.
步骤S22,当判断出所述变化比例小于所述预设值,调整所述变化比例为第一比例。Step S22, when it is determined that the change ratio is smaller than the preset value, adjust the change ratio to be the first ratio.
在本公开实施例中,当判断出变化比例小于预设值(即1.0),则表明该图像被压暗,为了防止图像颜色被压黑,需要调整变化比例为第一比例,通过第一比例调整饱和度分量。In the embodiment of the present disclosure, when it is determined that the change ratio is less than the preset value (ie, 1.0), it indicates that the image is darkened. In order to prevent the color of the image from being darkened, the change ratio needs to be adjusted to the first ratio. Adjusts the saturation component.
参阅图3,步骤S22包括步骤S31至步骤S32。Referring to FIG. 3, step S22 includes steps S31 to S32.
步骤S31,获取YUV图像的亮度数据。Step S31, acquiring luminance data of the YUV image.
在本公开实施例中,亮度数据可以为任意色彩空间的计算方式。具体如YUV色彩空间的709色域,亮度数据的计算方式为:In the embodiment of the present disclosure, the luminance data may be calculated in any color space. Specifically, such as the 709 color gamut of the YUV color space, the calculation method of the luminance data is as follows:
Y=0.213*R in+0.715*G in+0.072*B inY=0.213*R in +0.715*G in +0.072*B in .
步骤S32,获取所述亮度数据对应的第一增益系数。Step S32: Obtain a first gain coefficient corresponding to the luminance data.
电子设备预设有亮度查找表(Look up table,LUT),亮度查找表中存储有一定数量的离散的坐标点,这些坐标点为该亮度映射曲线上的采样点。其 中坐标点的横坐标为亮度数据,即亮度映射曲线的输入,坐标点的纵坐标为第一增益系数,即亮度映射曲线的输出。应当理解,由于亮度查找表中的映射关系是一组离散的点,如果输入的亮度数据没有在这些离散的点中,可以基于已知的亮度数据插值得到输入的亮度数据,从而获取亮度数据对应的第一增益系数。The electronic device is preset with a luminance lookup table (LUT), and a certain number of discrete coordinate points are stored in the luminance lookup table, and these coordinate points are sampling points on the luminance mapping curve. The abscissa of the coordinate point is the luminance data, that is, the input of the luminance mapping curve, and the ordinate of the coordinate point is the first gain coefficient, that is, the output of the luminance mapping curve. It should be understood that since the mapping relationship in the brightness lookup table is a set of discrete points, if the input brightness data is not in these discrete points, the input brightness data can be obtained by interpolation based on the known brightness data, so as to obtain the corresponding brightness data. The first gain factor of .
在本公开实施例中,亮度查找表表示如图5所示的一条最简单的亮度映射曲线。In the embodiment of the present disclosure, the luminance lookup table represents a simplest luminance mapping curve as shown in FIG. 5 .
步骤S33,根据所述第一增益系数调整所述变化比例为第一比例。Step S33, adjusting the change ratio to be a first ratio according to the first gain coefficient.
在本公开实施例中,第一比例的计算公式为:Ratio L=Ratio*LUT y;其中,Ratio L为第一比例,LUT y为第一增益系数。 In the embodiment of the present disclosure, the calculation formula of the first ratio is: Ratio L =Ratio*LUT y ; wherein, Ratio L is the first ratio, and LUT y is the first gain coefficient.
当变化比例小于预设值,将变化比例调整为第一增益系数,实现Y通道被压暗时,防止图像颜色被压黑。When the change ratio is smaller than the preset value, the change ratio is adjusted to the first gain coefficient, so as to prevent the image color from being suppressed when the Y channel is suppressed.
继续参阅图2。Continue to refer to Figure 2.
步骤S23,当判断出所述变化比例大于或等于所述预设值,调整所述变化比例为第二比例。Step S23, when it is determined that the change ratio is greater than or equal to the preset value, adjust the change ratio to a second ratio.
在本公开实施例中,当判断出变化比例大于或等于预设值(即1.0),则表明该图像被提亮,为了防止图像颜色出现过饱和,需要调整变化比例为第二比例,通过第二比例调整饱和度分量。In the embodiment of the present disclosure, when it is determined that the change ratio is greater than or equal to the preset value (ie, 1.0), it indicates that the image is brightened. The second scale adjusts the saturation component.
参阅图4,步骤S23包括步骤S41至步骤S43。Referring to FIG. 4, step S23 includes steps S41 to S43.
步骤S41,获取YUV图像的饱和度数据。In step S41, the saturation data of the YUV image is acquired.
在本公开实施例中,饱和度数据可以为任意色彩空间的计算方式。具体如HSV色彩空间,当MAX(R in,G in,B in)-MIN(R in,G in,B in)≠0时,饱和度数据的计算方式为
Figure PCTCN2021098613-appb-000003
当MAX(R in,G in,B in)-MIN(R in,G in,B in)=0时,饱和度数据的计算方式为sat=0,其中,MAX表示三个数中的最大值,MIN表示三个数中的最小值。
In this embodiment of the present disclosure, the saturation data may be calculated in any color space. Specifically, in the HSV color space, when MAX(R in , G in , B in )-MIN(R in , G in , B in )≠0, the saturation data is calculated as
Figure PCTCN2021098613-appb-000003
When MAX(R in , G in , B in )-MIN(R in , G in , B in )=0, the calculation method of saturation data is sat=0, where MAX represents the maximum value among the three numbers , MIN represents the smallest of the three numbers.
步骤S42,获取所述饱和度数据对应的第二增益系数。Step S42, acquiring a second gain coefficient corresponding to the saturation data.
电子设备预设有饱和度查找表(Look up table,LUT),饱和度查找表中存储有一定数量的离散的坐标点,这些坐标点为该饱和度映射曲线上的采样点。其中坐标点的横坐标为饱和度数据,即饱和度映射曲线的输入,坐标点 的纵坐标为第二增益系数,即饱和度映射曲线的输出。应当理解,由于饱和度查找表中的映射关系是一组离散的点,如果输入的饱和度数据没有在这些离散的点中,可以基于已知的饱和度数据插值得到输入的饱和度数据,从而获取饱和度数据对应的第二增益系数。The electronic device is preset with a saturation lookup table (LUT), and a certain number of discrete coordinate points are stored in the saturation lookup table, and these coordinate points are sampling points on the saturation mapping curve. The abscissa of the coordinate point is the saturation data, that is, the input of the saturation mapping curve, and the ordinate of the coordinate point is the second gain coefficient, that is, the output of the saturation mapping curve. It should be understood that since the mapping relationship in the saturation lookup table is a set of discrete points, if the input saturation data is not in these discrete points, the input saturation data can be obtained by interpolation based on the known saturation data, so that Obtain the second gain coefficient corresponding to the saturation data.
在本公开实施例中,饱和度查找表表示如图6所示的一条最简单的饱和度映射曲线。In the embodiment of the present disclosure, the saturation lookup table represents a simplest saturation mapping curve as shown in FIG. 6 .
步骤S43,根据所述第二增益系数调整所述变化比例为第二比例。Step S43, adjusting the change ratio to a second ratio according to the second gain coefficient.
在本公开实施例中,第二比例的计算公式为:Ratio H=Ratio*LUT sat;其中,Ratio H为第二比例,LUT sat为第二增益系数。 In the embodiment of the present disclosure, the calculation formula of the second ratio is: Ratio H =Ratio*LUT sat ; wherein, Ratio H is the second ratio, and LUT sat is the second gain coefficient.
当变化比例大于预设值,将变化比例调整为第二增益系数,实现Y通道被提亮时,防止图像颜色出现过饱和。When the change ratio is greater than the preset value, the change ratio is adjusted to the second gain coefficient, so that when the Y channel is brightened, the color of the image is prevented from being oversaturated.
如图7所示,本公开实施例提供一种图像处理装置,该图像处理模块包括获取模块71、转换模块72、拉升模块73、计算模块74以及补偿模块75。As shown in FIG. 7 , an embodiment of the present disclosure provides an image processing apparatus. The image processing module includes an acquisition module 71 , a conversion module 72 , a pull-up module 73 , a calculation module 74 , and a compensation module 75 .
获取模块71用于获取RGB图像。The acquisition module 71 is used to acquire RGB images.
转换模块72用于将所述RGB图像转换为YUV图像。The conversion module 72 is used to convert the RGB image into a YUV image.
在本公开实施例中,在RGB图像转换成YUV图像的过程中,对RGB进行转换得到亮度信号Y通道以及两个饱和度信号U通道和V通道,具体地将RGB转换成YUV可参见相关技术。In the embodiment of the present disclosure, in the process of converting an RGB image into a YUV image, the RGB is converted to obtain a Y channel of a luminance signal and two saturation signals U and V channels. For the specific conversion of RGB to YUV, please refer to the related art .
拉升模块73用于将所述YUV图像的Y通道从第一亮度分量拉升至第二亮度分量。The pulling module 73 is used for pulling the Y channel of the YUV image from the first luminance component to the second luminance component.
计算模块74用于根据所述第一亮度分量和第二亮度分量,计算Y通道的亮度分量的变化比例。The calculation module 74 is configured to calculate the change ratio of the luminance component of the Y channel according to the first luminance component and the second luminance component.
在本公开实施例中,变化比例的计算公式为:
Figure PCTCN2021098613-appb-000004
其中,Ratio为变化比例,Y out为第二亮度分量,Y in为第一亮度分量,δ为一不为零的预设极值。其中δ为一极小值,用于防止分母为零。
In the embodiment of the present disclosure, the calculation formula of the change ratio is:
Figure PCTCN2021098613-appb-000004
Wherein, Ratio is the change ratio, Y out is the second luminance component, Y in is the first luminance component, and δ is a preset extreme value that is not zero. where δ is a minimum value to prevent the denominator from being zero.
补偿模块75根据所述变化比例补偿所述YUV图像的U通道以及V通道的饱和度分量。The compensation module 75 compensates the saturation components of the U channel and the V channel of the YUV image according to the change ratio.
在本公开实施例中,饱和度分量的计算公式为:U out=Ratio*U in;V out=Ratio*V in;其中,U in为U通道的原饱和度分量,U out为U通道补偿后的饱和度分量,V in为V通道的原饱和度分量,V out为V通道补偿后的饱和度分量。 In the embodiment of the present disclosure, the calculation formula of the saturation component is: U out =Ratio*U in ; V out =Ratio*V in ; wherein, U in is the original saturation component of the U channel, and U out is the compensation of the U channel After the saturation component, V in is the original saturation component of the V channel, and V out is the compensated saturation component of the V channel.
在本公开的一些实施例中,可选的,补偿模块75包括判断单元、第一调整单元、第二调整单元以及补偿单元。In some embodiments of the present disclosure, optionally, the compensation module 75 includes a determination unit, a first adjustment unit, a second adjustment unit, and a compensation unit.
判断单元用于判断所述变化比例是否小于一预设值。The judging unit is used for judging whether the change ratio is less than a preset value.
在本公开实施例中,预设值优选为1.0,但不限于此。通过判断变化比例与1.0做比较,可获知YUV图像的Y通道被压暗或提亮。In the embodiment of the present disclosure, the preset value is preferably 1.0, but is not limited thereto. By comparing the change ratio with 1.0, it can be known that the Y channel of the YUV image is darkened or brightened.
第一调整单元用于当判断出所述变化比例小于所述预设值,调整所述变化比例为第一比例。The first adjustment unit is configured to adjust the change ratio to a first ratio when it is determined that the change ratio is smaller than the preset value.
在本公开实施例中,当判断出变化比例小于预设值(即1.0),则表明该图像被压暗,为了防止图像颜色被压黑,需要调整变化比例为第一比例,通过第一比例调整饱和度分量。In the embodiment of the present disclosure, when it is determined that the change ratio is less than the preset value (ie, 1.0), it indicates that the image is darkened. In order to prevent the color of the image from being darkened, the change ratio needs to be adjusted to the first ratio. Adjusts the saturation component.
第一调整单元包括第一获取子单元、第二获取子单元以及第一调整子单元。The first adjustment unit includes a first acquisition subunit, a second acquisition subunit, and a first adjustment subunit.
获取子单元用于获取YUV图像的亮度数据。The acquisition subunit is used to acquire the luminance data of the YUV image.
在本公开实施例中,亮度数据可以为任意色彩空间的计算方式。具体如YUV色彩空间的709色域,亮度数据的计算方式为:In the embodiment of the present disclosure, the luminance data may be calculated in any color space. Specifically, such as the 709 color gamut of the YUV color space, the calculation method of the luminance data is as follows:
Y=0.213*R in+0.715*G in+0.072*B inY=0.213*R in +0.715*G in +0.072*B in .
第二获取子单元用于获取所述亮度数据对应的第一增益系数。The second obtaining subunit is used to obtain the first gain coefficient corresponding to the luminance data.
电子设备预设有亮度查找表(Look up table,LUT),亮度查找表中存储有一定数量的离散的坐标点,这些坐标点为该亮度映射曲线上的采样点。其中坐标点的横坐标为亮度数据,即亮度映射曲线的输入,坐标点的纵坐标为第一增益系数,即亮度映射曲线的输出。应当理解,由于亮度查找表中的映射关系是一组离散的点,如果输入的亮度数据没有在这些离散的点中,可以基于已知的亮度数据插值得到输入的亮度数据,从而获取亮度数据对应的第一增益系数。The electronic device is preset with a luminance lookup table (LUT), and a certain number of discrete coordinate points are stored in the luminance lookup table, and these coordinate points are sampling points on the luminance mapping curve. The abscissa of the coordinate point is the luminance data, that is, the input of the luminance mapping curve, and the ordinate of the coordinate point is the first gain coefficient, that is, the output of the luminance mapping curve. It should be understood that since the mapping relationship in the brightness lookup table is a set of discrete points, if the input brightness data is not in these discrete points, the input brightness data can be obtained by interpolation based on the known brightness data, so as to obtain the corresponding brightness data. The first gain factor of .
在本公开实施例中,亮度查找表表示如图5所示的一条最简单的亮度映射曲线。In the embodiment of the present disclosure, the luminance lookup table represents a simplest luminance mapping curve as shown in FIG. 5 .
第一调整子单元用于根据所述第一增益系数调整所述变化比例为第一比例。The first adjustment subunit is configured to adjust the change ratio to a first ratio according to the first gain coefficient.
在本公开实施例中,第一比例的计算公式为:Ratio L=Ratio*LUT y;其 中,Ratio L为第一比例,LUT y为第一增益系数。 In the embodiment of the present disclosure, the calculation formula of the first ratio is: Ratio L =Ratio*LUT y ; wherein, Ratio L is the first ratio, and LUT y is the first gain coefficient.
第二调整单元用于当判断出所述变化比例大于或等于所述预设值,调整所述变化比例为第二比例。The second adjustment unit is configured to adjust the change ratio to a second ratio when it is determined that the change ratio is greater than or equal to the preset value.
在本公开实施例中,当判断出变化比例大于或等于预设值(即1.0),则表明该图像被提亮,为了防止图像颜色出现过饱和,需要调整变化比例为第二比例,通过第二比例调整饱和度分量。In the embodiment of the present disclosure, when it is determined that the change ratio is greater than or equal to the preset value (ie, 1.0), it indicates that the image is brightened. The second scale adjusts the saturation component.
第二调整单元包括第三获取子单元、第四获取子单元以及第二调整子单元。The second adjustment unit includes a third acquisition subunit, a fourth acquisition subunit, and a second adjustment subunit.
第三获取子单元用于获取YUV图像的饱和度数据。The third acquisition subunit is used to acquire the saturation data of the YUV image.
在本公开实施例中,饱和度数据可以为任意色彩空间的计算方式。具体如HSV色彩空间,当MAX(R in,G in,B in)-MIN(R in,G in,B in)≠0时,饱和度数据的计算方式为
Figure PCTCN2021098613-appb-000005
当MAX(R in,G in,B in)-MIN(R in,G in,B in)=0时,饱和度数据的计算方式为sat=0,其中,MAX表示三个数中的最大值,MIN表示三个数中的最小值。
In this embodiment of the present disclosure, the saturation data may be calculated in any color space. Specifically, in the HSV color space, when MAX(R in , G in , B in )-MIN(R in , G in , B in )≠0, the saturation data is calculated as
Figure PCTCN2021098613-appb-000005
When MAX(R in , G in , B in )-MIN(R in , G in , B in )=0, the calculation method of saturation data is sat=0, where MAX represents the maximum value among the three numbers , MIN represents the smallest of the three numbers.
第四获取子单元用于获取所述饱和度数据对应的第二增益系数。The fourth obtaining subunit is configured to obtain the second gain coefficient corresponding to the saturation data.
电子设备预设有饱和度查找表(Look up table,LUT),饱和度查找表中存储有一定数量的离散的坐标点,这些坐标点为该饱和度映射曲线上的采样点。其中坐标点的横坐标为饱和度数据,即饱和度映射曲线的输入,坐标点的纵坐标为第二增益系数,即饱和度映射曲线的输出。应当理解,由于饱和度查找表中的映射关系是一组离散的点,如果输入的饱和度数据没有在这些离散的点中,可以基于已知的饱和度数据插值得到输入的饱和度数据,从而获取饱和度数据对应的第二增益系数。The electronic device is preset with a saturation lookup table (LUT), and a certain number of discrete coordinate points are stored in the saturation lookup table, and these coordinate points are sampling points on the saturation mapping curve. The abscissa of the coordinate point is the saturation data, that is, the input of the saturation mapping curve, and the ordinate of the coordinate point is the second gain coefficient, that is, the output of the saturation mapping curve. It should be understood that since the mapping relationship in the saturation lookup table is a set of discrete points, if the input saturation data is not in these discrete points, the input saturation data can be obtained by interpolation based on the known saturation data, so that Obtain the second gain coefficient corresponding to the saturation data.
在本公开实施例中,饱和度查找表表示如图6所示的一条最简单的饱和度映射曲线。In the embodiment of the present disclosure, the saturation lookup table represents a simplest saturation mapping curve as shown in FIG. 6 .
第二调整子单元用于根据所述第二增益系数调整所述变化比例为第二比例。The second adjustment subunit is configured to adjust the change ratio to a second ratio according to the second gain coefficient.
在本公开实施例中,第二比例的计算公式为:Ratio H=Ratio*LUT sat;其中,Ratio H为第二比例,LUT sat为第二增益系数。 In the embodiment of the present disclosure, the calculation formula of the second ratio is: Ratio H =Ratio*LUT sat ; wherein, Ratio H is the second ratio, and LUT sat is the second gain coefficient.
参阅图8,本公开实施例还提供一种电子设备800,该电子设备800可以 是手机、平板以及电脑等设备。如图8所示,电子设备800包括处理器801、存储器802。其中,处理器801与存储器802电性连接。Referring to Fig. 8, an embodiment of the present disclosure further provides an electronic device 800, and the electronic device 800 may be devices such as a mobile phone, a tablet, and a computer. As shown in FIG. 8 , the electronic device 800 includes a processor 801 and a memory 802 . The processor 801 is electrically connected to the memory 802 .
处理器801是电子设备800的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或加载存储在存储器802内的应用程序,以及调用存储在存储器802内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。The processor 801 is the control center of the electronic device 800, uses various interfaces and lines to connect various parts of the entire electronic device, executes the electronic Various functions of the device and processing data, so as to carry out the overall monitoring of the electronic device.
在本实施例中,该电子设备800设有多个存储分区,该多个存储分区包括系统分区和目标分区,电子设备800中的处理器801会按照如下的步骤,将一个或一个以上的应用程序的进程对应的指令加载到存储器802中,并由处理器801来运行存储在存储器802中的应用程序,从而实现各种功能:In this embodiment, the electronic device 800 is provided with multiple storage partitions, and the multiple storage partitions include a system partition and a target partition. The instructions corresponding to the process of the program are loaded into the memory 802, and the processor 801 runs the application program stored in the memory 802, thereby realizing various functions:
获取RGB图像;get RGB image;
将所述RGB图像转换为YUV图像;converting the RGB image to a YUV image;
将所述YUV图像的Y通道从第一亮度分量拉升至第二亮度分量;Pulling the Y channel of the YUV image from the first luminance component to the second luminance component;
根据所述第一亮度分量和第二亮度分量,计算Y通道的亮度分量的变化比例;以及According to the first luminance component and the second luminance component, calculating the change ratio of the luminance component of the Y channel; and
根据所述变化比例补偿所述YUV图像的U通道以及V通道的饱和度分量。The saturation components of the U channel and the V channel of the YUV image are compensated according to the change ratio.
参阅图9,图9示出了本公开实施例提供的电子设备900的具体结构框图,该电子设备900可以用于实施上述实施例中提供的图像处理方法。该电子设备900可以为手机或平板。电子设备900还包括以下部件。Referring to FIG. 9 , FIG. 9 shows a specific structural block diagram of an electronic device 900 provided by an embodiment of the present disclosure, and the electronic device 900 can be used to implement the image processing method provided in the foregoing embodiments. The electronic device 900 may be a mobile phone or a tablet. The electronic device 900 also includes the following components.
RF电路910用于接收以及发送电磁波,实现电磁波与电信号的相互转换,从而与通讯网络或者其他设备进行通讯。RF电路910可包括各种相关的用于执行这些功能的电路元件,例如,天线、射频收发器、数字信号处理器、加密/解密芯片、用户身份模块(SIM)卡、存储器等等。RF电路910可与各种网络如互联网、企业内部网、无线网络进行通讯或者通过无线网络与其他设备进行通讯。上述的无线网络可包括蜂窝式电话网、无线局域网或者城域网。上述的无线网络可以使用各种通信标准、协议及技术,包括但并不限于全球移动通信系统(Global System for Mobile Communication,GSM)、增强型移动通信技术(Enhanced Data GSM Environment,EDGE),宽带码分多址技术 (Wideband Code Division Multiple Access,WCDMA),码分多址技术(Code Division Access,CDMA)、时分多址技术(Time Division Multiple Access,TDMA),无线保真技术(Wireless Fidelity,Wi-Fi)(如美国电气和电子工程师协会标准IEEE 802.11a,IEEE 802.11b,IEEE802.11g和/或IEEE 802.11n)、网络电话(Voice over Internet Protocol,VoIP)、全球微波互联接入(Worldwide Interoperability for Microwave Access,Wi-Max)、其他用于邮件、即时通讯及短消息的协议,以及任何其他合适的通讯协议,甚至可包括那些当前仍未被开发出来的协议。The RF circuit 910 is used for receiving and sending electromagnetic waves, realizing mutual conversion between electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices. RF circuitry 910 may include various associated circuit elements for performing these functions, eg, antennas, radio frequency transceivers, digital signal processors, encryption/decryption chips, subscriber identity module (SIM) cards, memory, and the like. The RF circuit 910 may communicate with various networks such as the Internet, an intranet, a wireless network, or with other devices over a wireless network. The aforementioned wireless network may include a cellular telephone network, a wireless local area network, or a metropolitan area network. The above-mentioned wireless network can use various communication standards, protocols and technologies, including but not limited to Global System for Mobile Communication (GSM), Enhanced Data GSM Environment (EDGE), wideband code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Code Division Multiple Access (Code Division Access, CDMA), Time Division Multiple Access (TDMA), Wireless Fidelity (Wireless Fidelity, Wi- Fi) (such as IEEE 802.11a, IEEE 802.11b, IEEE802.11g and/or IEEE 802.11n), Voice over Internet Protocol (VoIP), Worldwide Interoperability for Microwave Access, Wi-Max), other protocols for mail, instant messaging, and short messaging, and any other suitable communication protocols, even those that are not currently being developed.
存储器920可用于存储软件程序以及模块,如上述实施例中图像处理方法对应的程序指令/模块,处理器980通过运行存储在存储器920内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现图像处理方法的功能。存储器920可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器920可进一步包括相对于处理器980远程设置的存储器,这些远程存储器可以通过网络连接至电子设备900。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 920 can be used to store software programs and modules, such as program instructions/modules corresponding to the image processing method in the above-mentioned embodiments, the processor 980 executes various functional applications and data processing by running the software programs and modules stored in the memory 920. , that is, the function of realizing the image processing method. Memory 920 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, memory 920 may further include memory located remotely from processor 980, which may be connected to electronic device 900 through a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
输入单元930可用于接收输入的数字或字符信息,以及产生与用户设置以及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。具体地,输入单元930可包括触敏表面931以及其他输入设备932。触敏表面931,也称为触摸显示屏或者触控板,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触敏表面931上或在触敏表面931附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触敏表面931可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器980,并能接收处理器980发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触敏表面931。除了触敏表面931,输入单元930还可以包括其他输入设备932。具体地,其他输入设备932可以包括但不限于物理键盘、功能键(比如音量控制按键、 开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。The input unit 930 may be used to receive input numerical or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, the input unit 930 may include a touch-sensitive surface 931 as well as other input devices 932 . Touch-sensitive surface 931, also known as a touch display or trackpad, collects user touch operations on or near it (such as a user using a finger, stylus, etc., any suitable object or accessory on or on touch-sensitive surface 931). operations near the touch-sensitive surface 931), and drive the corresponding connection device according to a preset program. Optionally, the touch-sensitive surface 931 may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, 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 touch controller. To the processor 980, and can receive the command sent by the processor 980 and execute it. In addition, the touch-sensitive surface 931 may be implemented using resistive, capacitive, infrared, and surface acoustic wave types. In addition to the touch-sensitive surface 931 , the input unit 930 may also include other input devices 932 . Specifically, other input devices 932 may include, but are not limited to, one or more of physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, joysticks, and the like.
显示单元940可用于显示由用户输入的信息或提供给用户的信息以及电子设备900的各种图形用户接口,这些图形用户接口可以由图形、文本、图标、视频和其任意组合来构成。显示单元940可包括显示面板941,可选的,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板941。进一步的,触敏表面931可覆盖显示面板941,当触敏表面931检测到在其上或附近的触摸操作后,传送给处理器980以确定触摸事件的类型,随后处理器980根据触摸事件的类型在显示面板941上提供相应的视觉输出。虽然在图9中,触敏表面931与显示面板941是作为两个独立的部件来实现输入和输出功能,但是在某些实施例中,可以将触敏表面931与显示面板941集成而实现输入和输出功能。The display unit 940 may be used to display information input by the user or information provided to the user and various graphical user interfaces of the electronic device 900, which may be composed of graphics, text, icons, videos, and any combination thereof. The display unit 940 may include a display panel 941. Optionally, the display panel 941 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), and the like. Further, the touch-sensitive surface 931 may cover the display panel 941, and when the touch-sensitive surface 931 detects a touch operation on or near it, it transmits it to the processor 980 to determine the type of the touch event, and then the processor 980 determines the type of the touch event according to the touch event. Type provides corresponding visual output on display panel 941 . Although in FIG. 9, the touch-sensitive surface 931 and the display panel 941 are implemented as two separate components to realize the input and output functions, in some embodiments, the touch-sensitive surface 931 and the display panel 941 may be integrated to realize the input and output functions.
电子设备900还可包括至少一种传感器950,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板941的亮度,接近传感器可在电子设备900移动到耳边时,关闭显示面板941和/或背光。作为运动传感器的一种,重力加速度传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于电子设备900还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。The electronic device 900 may also include at least one sensor 950, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 941 according to the brightness of the ambient light, and the proximity sensor may close the display panel 941 when the electronic device 900 is moved to the ear and/or backlight. As a kind of motion sensor, the gravitational acceleration sensor can detect the magnitude of acceleration in all directions (usually three axes), and can detect the magnitude and direction of gravity when stationary, and can be used for applications that recognize the attitude of mobile phones (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that can be configured in the electronic device 900, here No longer.
音频电路960、扬声器961,传声器962可提供用户与电子设备900之间的音频接口。音频电路960可将接收到的音频数据转换后的电信号,传输到扬声器961,由扬声器961转换为声音信号输出;另一方面,传声器962将收集的声音信号转换为电信号,由音频电路960接收后转换为音频数据,再将音频数据输出处理器980处理后,经RF电路910以发送给比如另一终端,或者将音频数据输出至存储器920以便进一步处理。音频电路960还可能包括耳塞插孔,以提供外设耳机与电子设备900的通信。The audio circuit 960 , the speaker 961 , and the microphone 962 may provide an audio interface between the user and the electronic device 900 . The audio circuit 960 can convert the received audio data into an electrical signal, and transmit it to the speaker 961, and the speaker 961 converts it into a sound signal for output; on the other hand, the microphone 962 converts the collected sound signal into an electrical signal, which is converted by the audio circuit 960 After receiving, it is converted into audio data, and then the audio data is output to the processor 980 for processing, and then sent to, for example, another terminal through the RF circuit 910, or the audio data is output to the memory 920 for further processing. Audio circuitry 960 may also include an ear jack to provide for communication of peripheral headphones with electronic device 900 .
电子设备900通过传输模块970(例如Wi-Fi模块)可以帮助用户收发电 子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图9示出了传输模块970,但是可以理解的是,其并不属于电子设备900的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。The electronic device 900 can help the user to send and receive emails, browse web pages, access streaming media, etc. through the transmission module 970 (such as a Wi-Fi module), which provides the user with wireless broadband Internet access. Although FIG. 9 shows the transmission module 970, it can be understood that it does not belong to the essential structure of the electronic device 900, and can be completely omitted as required within the scope of not changing the essence of the invention.
处理器980是电子设备900的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器920内的软件程序和/或模块,以及调用存储在存储器920内的数据,执行电子设备900的各种功能和处理数据,从而对手机进行整体监控。可选的,处理器980可包括一个或多个处理核心;在一些实施例中,处理器980可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器980中。The processor 980 is the control center of the electronic device 900, uses various interfaces and lines to connect various parts of the entire mobile phone, runs or executes the software programs and/or modules stored in the memory 920, and calls the data stored in the memory 920. , perform various functions of the electronic device 900 and process data, so as to monitor the mobile phone as a whole. Optionally, the processor 980 may include one or more processing cores; in some embodiments, the processor 980 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface and Applications, etc., the modem processor mainly deals with wireless communication. It can be understood that, the above-mentioned modulation and demodulation processor may not be integrated into the processor 980 .
电子设备900还包括给各个部件供电的电源990(比如电池),在一些实施例中,电源可以通过电源管理系统与处理器980逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。电源990还可以包括一个或一个以上的直流或交流电源、再充电系统、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。The electronic device 900 also includes a power supply 990 (such as a battery) for powering the various components. In some embodiments, the power supply may be logically connected to the processor 980 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. management and other functions. Power supply 990 may also include one or more DC or AC power sources, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and any other components.
尽管未示出,电子设备900还可以包括摄像头(如前置摄像头、后置摄像头)、蓝牙模块等,在此不再赘述。具体在本实施例中,电子设备的显示单元是触摸屏显示器,电子设备还包括有存储器,以及一个或者一个以上的程序,其中一个或者一个以上程序存储于存储器中,且经配置以由一个或者一个以上处理器执行一个或者一个以上程序包含用于进行以下操作的指令:Although not shown, the electronic device 900 may further include a camera (eg, a front camera, a rear camera), a Bluetooth module, and the like, which will not be described herein again. Specifically in this embodiment, the display unit of the electronic device is a touch screen display, the electronic device further includes a memory, and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by one or more programs. The above processor executing one or more programs contains instructions for:
获取RGB图像;get RGB image;
将所述RGB图像转换为YUV图像;converting the RGB image to a YUV image;
将所述YUV图像的Y通道从第一亮度分量拉升至第二亮度分量;Pulling the Y channel of the YUV image from the first luminance component to the second luminance component;
根据所述第一亮度分量和第二亮度分量,计算Y通道的亮度分量的变化比例;以及According to the first luminance component and the second luminance component, calculating the change ratio of the luminance component of the Y channel; and
根据所述变化比例补偿所述YUV图像的U通道以及V通道的饱和度分量。The saturation components of the U channel and the V channel of the YUV image are compensated according to the change ratio.
具体实施时,以上各个模块可以作为独立的实体来实现,也可以进行任 意组合,作为同一或若干个实体来实现,以上各个模块的具体实施可参见前面的方法实施例,在此不再赘述。During specific implementation, each of the above modules can be implemented as an independent entity, or can be arbitrarily combined, and implemented as the same or several entities. The specific implementation of each of the above modules can refer to the previous method embodiments, which will not be repeated here.
本领域普通技术人员可以理解,上述实施例的各种方法中的全部或部分步骤可以通过指令来完成,或通过指令控制相关的硬件来完成,该指令可以存储于一计算机可读的可读存储介质中,并由处理器进行加载和执行。为此,本公开实施例提供一种可读存储介质,其中存储有多条指令,该指令能够被处理器进行加载,以执行本公开实施例所提供的任一种图像处理方法中的步骤。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by instructions, or by instructions that control relevant hardware, and the instructions can be stored in a computer-readable readable storage medium, and is loaded and executed by the processor. To this end, the embodiments of the present disclosure provide a readable storage medium in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute steps in any image processing method provided by the embodiments of the present disclosure.
其中,该可读存储介质可以包括:只读存储器(ROM,Read Only Memory)、随机存取记忆体(RAM,Random Access Memory)、磁盘或光盘等。Wherein, the readable storage medium may include: a read-only memory (ROM, Read Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and the like.
由于该可读存储介质中所存储的指令,可以执行本公开实施例所提供的任一种图像处理方法中的步骤,因此,可以实现本公开实施例所提供的任一种图像处理方法所能实现的有益效果,详见前面的实施例,在此不再赘述。以上各个操作的具体实施可参见前面的实施例,在此不再赘述。Since the instructions stored in the readable storage medium can execute the steps in any image processing method provided by the embodiments of the present disclosure, it is possible to realize the functions of any image processing method provided by the embodiments of the present disclosure. For the beneficial effects achieved, see the foregoing embodiments for details, and details are not repeated here. For the specific implementation of the above operations, reference may be made to the foregoing embodiments, and details are not described herein again.
本公开的有益效果在于:通过获取Y通道的亮度分量的变化比例,并将变化比例与预设值作比较,根据比较结果对饱和度分量进行对应的补偿,避免在图像进行亮度处理后,对图像的饱和度做补偿处理时引起颜色剪切现象,保护图像的细节,实现更高质量的图像显示。The beneficial effect of the present disclosure is that: by acquiring the change ratio of the luminance component of the Y channel, comparing the change ratio with a preset value, and performing corresponding compensation on the saturation component according to the comparison result, it is avoided that after the luminance processing of the image, the When the saturation of the image is compensated, the color clipping phenomenon is caused, the details of the image are protected, and the image display of higher quality is realized.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
可以理解的是,本公开描述的这些实施例可以用硬件、软件、固件、中间件、微码或其组合来实现。对于硬件实现,模块、单元、子模块、子单元等可以实现在一个或多个专用集成电路(Application Specific Integrated Circuits,ASIC)、数字信号处理器(Digital Signal Processing,DSP)、数字信号处理设备(DSP Device,DSPD)、可编程逻辑设备(Programmable Logic Device,PLD)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、通用处理器、控制器、微控制器、微处理器、用于执行本申请所述功能的其它电子单元或其组合中。It will be appreciated that the embodiments described in this disclosure may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, modules, units, sub-modules, sub-units, etc. can be implemented in one or more Application Specific Integrated Circuits (ASIC), Digital Signal Processing (DSP), digital signal processing equipment ( DSP Device, DSPD), Programmable Logic Device (Programmable Logic Device, PLD), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), general-purpose processor, controller, microcontroller, microprocessor, for in other electronic units or combinations thereof that perform the functions described herein.
以上对本公开实施例所提供的一种图像处理方法、系统、可读存储介质 及电子设备进行了详细介绍,本文中应用了具体个例对本公开的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本公开的技术方案及其核心思想;本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本公开各实施例的技术方案的范围。The image processing method, system, readable storage medium, and electronic device provided by the embodiments of the present disclosure have been described in detail above. Specific examples are used in this paper to illustrate the principles and implementations of the present disclosure. The description is only used to help understand the technical solutions of the present disclosure and their core ideas; those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements to some of the technical features. However, these modifications or substitutions do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present disclosure.

Claims (11)

  1. 一种图像处理方法,包括:An image processing method, comprising:
    获取RGB图像;get RGB image;
    将所述RGB图像转换为YUV图像;converting the RGB image to a YUV image;
    将所述YUV图像的Y通道从第一亮度分量拉升至第二亮度分量;Pulling the Y channel of the YUV image from the first luminance component to the second luminance component;
    根据所述第一亮度分量和第二亮度分量,计算Y通道的亮度分量的变化比例;以及According to the first luminance component and the second luminance component, calculating the change ratio of the luminance component of the Y channel; and
    根据所述变化比例补偿所述YUV图像的U通道以及V通道的饱和度分量。The saturation components of the U channel and the V channel of the YUV image are compensated according to the change ratio.
  2. 如权利要求1所述的图像处理方法,其中,所述变化比例的计算公式为:The image processing method according to claim 1, wherein the calculation formula of the change ratio is:
    Figure PCTCN2021098613-appb-100001
    Figure PCTCN2021098613-appb-100001
    其中,Ratio为变化比例,Y out为第二亮度分量,Y in为第一亮度分量,δ为一不为零的预设极值。 Wherein, Ratio is the change ratio, Y out is the second luminance component, Y in is the first luminance component, and δ is a preset extreme value that is not zero.
  3. 如权利要求1所述的图像处理方法,其中,所述饱和度分量的计算公式为:The image processing method according to claim 1, wherein the calculation formula of the saturation component is:
    U out=Ratio*U inU out =Ratio*U in ;
    V out=Ratio*V inV out =Ratio*V in ;
    其中,U in为U通道的原饱和度分量,U out为U通道补偿后的饱和度分量,V in为V通道的原饱和度分量,V out为V通道补偿后的饱和度分量。 Wherein, U in is the original saturation component of the U channel, U out is the compensated saturation component of the U channel, Vin is the original saturation component of the V channel, and V out is the compensated saturation component of the V channel.
  4. 如权利要求1所述的图像处理方法,其中,在根据所述变化比例补偿所述YUV图像的U通道以及V通道的饱和度分量的步骤中包括:The image processing method according to claim 1, wherein the step of compensating the saturation components of the U channel and the V channel of the YUV image according to the change ratio comprises:
    判断所述变化比例是否小于一预设值;judging whether the change ratio is less than a preset value;
    当判断出所述变化比例小于所述预设值,调整所述变化比例为第一比例;When it is determined that the change ratio is smaller than the preset value, adjust the change ratio to be the first ratio;
    当判断出所述变化比例大于或等于所述预设值,调整所述变化比例为第二比例;以及When it is determined that the change ratio is greater than or equal to the preset value, adjusting the change ratio to a second ratio; and
    根据所述第一比例或所述第二比例补偿所述YUV图像的U通道以及V通道的饱和度分量。The saturation components of the U channel and the V channel of the YUV image are compensated according to the first scale or the second scale.
  5. 如权利要求4所述的图像处理方法,其中,在调整所述变化比例为第一比例的步骤中,包括:The image processing method according to claim 4, wherein, in the step of adjusting the change ratio to be the first ratio, comprising:
    获取YUV图像的亮度数据;Get the brightness data of the YUV image;
    获取所述亮度数据对应的第一增益系数;以及obtaining a first gain coefficient corresponding to the luminance data; and
    根据所述第一增益系数调整所述变化比例为第一比例。The change ratio is adjusted to be a first ratio according to the first gain coefficient.
  6. 如权利要求5所述的图像处理方法,其中,所述第一比例的计算公式为:The image processing method according to claim 5, wherein the calculation formula of the first ratio is:
    Ratio L=Ratio*LUT yRatio L =Ratio*LUT y ;
    其中,Ratio L为第一比例,LUT y为第一增益系数。 Wherein, Ratio L is the first ratio, and LUT y is the first gain coefficient.
  7. 如权利要求4所述的图像处理方法,其中,在调整所述变化比例为第二比例的步骤中,包括:The image processing method according to claim 4, wherein, in the step of adjusting the change ratio to be the second ratio, comprising:
    获取YUV图像的饱和度数据;Get the saturation data of the YUV image;
    获取所述饱和度数据对应的第二增益系数;以及obtaining a second gain coefficient corresponding to the saturation data; and
    根据所述第二增益系数调整所述变化比例为第二比例。The change ratio is adjusted to be a second ratio according to the second gain coefficient.
  8. 如权利要求7所述的图像处理方法,其中,所述第二比例的计算公式为:The image processing method according to claim 7, wherein the calculation formula of the second ratio is:
    Ratio H=Ratio*LUT satRatio H =Ratio*LUT sat ;
    其中,Ratio H为第二比例,LUT sat为第二增益系数。 Among them, Ratio H is the second ratio, and LUT sat is the second gain coefficient.
  9. 一种图像处理装置,包括:An image processing device, comprising:
    获取模块,用于获取RGB图像;The acquisition module is used to acquire RGB images;
    转换模块,用于将所述RGB图像转换为YUV图像;a conversion module for converting the RGB image into a YUV image;
    拉升模块,用于将所述YUV图像的Y通道从第一亮度分量拉升至第二亮度分量;A pull-up module for pulling the Y channel of the YUV image from the first luminance component to the second luminance component;
    计算模块,用于根据所述第一亮度分量和第二亮度分量,计算Y通道的亮度分量的变化比例;以及a calculation module, configured to calculate the change ratio of the luminance component of the Y channel according to the first luminance component and the second luminance component; and
    补偿模块,用于根据所述变化比例补偿所述YUV图像的U通道以及V通道的饱和度分量。A compensation module, configured to compensate the saturation components of the U channel and the V channel of the YUV image according to the change ratio.
  10. 一种电子设备,包括处理器,存储器及存储在所述存储器上并可在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现如权利要求1至8任一项所述的图像处理方法的步骤。An electronic device, comprising a processor, a memory, and a program or instruction stored on the memory and executable on the processor, the program or instruction being executed by the processor to achieve as claimed in claims 1 to 8 The steps of any one of the image processing methods.
  11. 一种可读存储介质,其中,所述可读存储介质上存储程序或指令,所述程序或指令被处理器执行时实现如权利要求1至8任一项所述的图像处 理方法。A readable storage medium, wherein a program or an instruction is stored on the readable storage medium, and when the program or instruction is executed by a processor, the image processing method according to any one of claims 1 to 8 is implemented.
PCT/CN2021/098613 2020-11-11 2021-06-07 Image processing method and apparatus, electronic device, and readable storage medium WO2022100082A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011253511.6 2020-11-11
CN202011253511.6A CN112330564B (en) 2020-11-11 2020-11-11 Image processing method, device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
WO2022100082A1 true WO2022100082A1 (en) 2022-05-19

Family

ID=74318510

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/098613 WO2022100082A1 (en) 2020-11-11 2021-06-07 Image processing method and apparatus, electronic device, and readable storage medium

Country Status (2)

Country Link
CN (1) CN112330564B (en)
WO (1) WO2022100082A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112330564B (en) * 2020-11-11 2023-08-22 海宁奕斯伟集成电路设计有限公司 Image processing method, device, electronic equipment and readable storage medium
CN113643651B (en) * 2021-07-13 2022-08-09 深圳市洲明科技股份有限公司 Image enhancement method and device, computer equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102231264A (en) * 2011-06-28 2011-11-02 王洪剑 Dynamic contrast enhancement device and method
CN103617792A (en) * 2013-11-14 2014-03-05 天津三星电子有限公司 Method for adjusting image display of display terminal and display terminal
US20150109356A1 (en) * 2013-10-22 2015-04-23 Japan Display Inc. Image processing device, display device, electronic device and method for processing an image
CN106530252A (en) * 2016-11-08 2017-03-22 北京小米移动软件有限公司 Image processing method and device
CN109727216A (en) * 2018-12-28 2019-05-07 Oppo广东移动通信有限公司 Image processing method, device, terminal device and storage medium
CN110264972A (en) * 2019-06-26 2019-09-20 京东方科技集团股份有限公司 Acquisition methods, computer equipment and the computer-readable medium of brightness offset value
CN112330564A (en) * 2020-11-11 2021-02-05 海宁奕斯伟集成电路设计有限公司 Image processing method, image processing device, electronic equipment and readable storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102231264A (en) * 2011-06-28 2011-11-02 王洪剑 Dynamic contrast enhancement device and method
US20150109356A1 (en) * 2013-10-22 2015-04-23 Japan Display Inc. Image processing device, display device, electronic device and method for processing an image
CN103617792A (en) * 2013-11-14 2014-03-05 天津三星电子有限公司 Method for adjusting image display of display terminal and display terminal
CN106530252A (en) * 2016-11-08 2017-03-22 北京小米移动软件有限公司 Image processing method and device
CN109727216A (en) * 2018-12-28 2019-05-07 Oppo广东移动通信有限公司 Image processing method, device, terminal device and storage medium
CN110264972A (en) * 2019-06-26 2019-09-20 京东方科技集团股份有限公司 Acquisition methods, computer equipment and the computer-readable medium of brightness offset value
CN112330564A (en) * 2020-11-11 2021-02-05 海宁奕斯伟集成电路设计有限公司 Image processing method, image processing device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN112330564A (en) 2021-02-05
CN112330564B (en) 2023-08-22

Similar Documents

Publication Publication Date Title
TWI536847B (en) Method and apparatus for adjusting the color gamut of a color image
WO2022100048A1 (en) Image processing method and apparatus, electronic device, and readable storage medium
US10269129B2 (en) Color adjustment method and device
EP3370204B1 (en) Method for detecting skin region and device for detecting skin region
WO2020199878A1 (en) Display brightness adjusting method and related product
WO2022110687A1 (en) Image processing method and apparatus, electronic device, and readable storage medium
WO2022100082A1 (en) Image processing method and apparatus, electronic device, and readable storage medium
WO2019129092A1 (en) Frame rate-lowered photographing method, mobile terminal and storage medium
US11050942B2 (en) Screen fill light photographing method for mobile terminal, system and mobile terminal
CN107705247B (en) Image saturation adjusting method, terminal and storage medium
US11915633B2 (en) Screen color temperature control method, apparatus, storage medium, and mobile terminal
WO2020134789A1 (en) Mobile terminal and method for controlling on and off of screen, and computer storage medium
US20210143856A1 (en) Method for reducing sar value of mobile terminal, storage medium and mobile terminal
US11955098B2 (en) Determining compensation value
WO2024045829A1 (en) Screen brightness adjustment method and apparatus, and storage medium and electronic device
CN112489082A (en) Position detection method, position detection device, electronic equipment and readable storage medium
CN106817324B (en) Frequency response correction method and device
CN111368238A (en) Status bar adjusting method and device, mobile terminal and storage medium
WO2022127790A1 (en) Channel configuration method and apparatus, electronic device, and readable storage medium
CN111124327A (en) Screen control method, multi-screen terminal and computer readable storage medium
US11892723B2 (en) Electronic device and driving method therefor
CN112867171B (en) WIFI connection method and device, storage medium and mobile terminal
WO2021017707A1 (en) Power determining method and terminal device
WO2021212566A1 (en) Method and device for determining gamma value, and display terminal
WO2023138214A1 (en) Screen matching method, screen configuration method, and screen matching 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: 21890613

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: 21890613

Country of ref document: EP

Kind code of ref document: A1