CN115619628B - Image processing method and terminal equipment - Google Patents

Image processing method and terminal equipment Download PDF

Info

Publication number
CN115619628B
CN115619628B CN202211545743.8A CN202211545743A CN115619628B CN 115619628 B CN115619628 B CN 115619628B CN 202211545743 A CN202211545743 A CN 202211545743A CN 115619628 B CN115619628 B CN 115619628B
Authority
CN
China
Prior art keywords
image data
preset
data
processed
terminal device
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202211545743.8A
Other languages
Chinese (zh)
Other versions
CN115619628A (en
Inventor
罗钢
钱彦霖
邹卓良
彭嘉琦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202211545743.8A priority Critical patent/CN115619628B/en
Publication of CN115619628A publication Critical patent/CN115619628A/en
Application granted granted Critical
Publication of CN115619628B publication Critical patent/CN115619628B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map

Landscapes

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

Abstract

The image processing method and the terminal equipment are beneficial to improving the stability of color space conversion in the image processing process, so that the user experience is improved. The method comprises the following steps: acquiring image data to be processed; determining a target conversion matrix from a plurality of candidate conversion matrices based on image data to be processed and a preset data set, wherein the preset data set comprises preset RAW domain image data and preset CIExy space image data, the preset RAW domain image data and the preset CIExy space image data are in one-to-one correspondence, the preset RAW domain image data are divided into a plurality of subsets based on a target preset threshold, the subsets correspond to a plurality of color temperature intervals and the plurality of candidate conversion matrices, the plurality of candidate conversion matrices are obtained based on fitting of the plurality of subsets and the plurality of color temperature intervals, and the target preset threshold is determined based on condition numbers of the plurality of candidate conversion matrices; and processing the image data to be processed based on the target conversion matrix.

Description

Image processing method and terminal equipment
Technical Field
The present disclosure relates to the field of terminal technologies, and in particular, to an image processing method and a terminal device.
Background
The RAW (RAW) domain and the international commission on illumination (the international commission on illumination, CIE) xy space are two color spaces. For the RAW field, the same color may be represented by different coordinate values, i.e., there is no uniform color standard, while for the CIExy space, a set of coordinate values represents only one color, there is a uniform color standard. In general, the image data acquired by the terminal device is image data in the RAW domain, and the terminal device needs to convert the image data in the RAW domain into image data in the CIExy space. Taking a terminal device as a mobile phone as an example, a user uses the mobile phone to photograph a target object, the mobile phone acquires image data on a RAW domain of the target object through a camera, then the image data on the RAW domain is converted into image data on a CIExy space, and an image is displayed to the user based on the image data on the CIExy space.
Currently, converting image data from the RAW domain to the CIExy space requires passing through an intermediate color space, i.e., XYZ space. The terminal device may convert the image data from the RAW domain to the XYZ space, and then perform normalization processing on the image data in the XYZ space to obtain image data in the CIExy space. The usual image processing methods are: from the standpoint of accuracy and precision, a 3×3 conversion matrix is obtained, by which the image data is converted from the RAW domain to the XYZ space, and then normalized (i.e., normalized in the XYZ space) to the CIExy space.
However, the above method may cause unstable conversion of the image data from the RAW domain to the CIExy space, that is, for the same target object, the colors of the images after the two conversions are different (for example, the colors of the images obtained after the two photographing are different due to the angle conversion of the camera or the shake of the lens), thereby affecting the user experience.
Disclosure of Invention
The image processing method and the terminal equipment are beneficial to improving the stability of color space conversion in the image processing process, so that the user experience is improved.
In a first aspect, an image processing method is provided, applied to a terminal device, and the method includes: acquiring image data to be processed, wherein the image data to be processed is original RAW domain image data; determining a target conversion matrix from a plurality of candidate conversion matrices based on image data to be processed and a preset data set, wherein the preset data set comprises preset RAW domain image data and preset CIExy space image data, the preset RAW domain image data and the preset CIExy space image data are in one-to-one correspondence, the preset RAW domain image data are divided into a plurality of subsets based on a target preset threshold, the subsets correspond to a plurality of color temperature intervals and the plurality of candidate conversion matrices, the plurality of candidate conversion matrices are obtained based on fitting of the plurality of subsets and the plurality of color temperature intervals, and the target preset threshold is determined based on the condition number of the plurality of candidate conversion matrices; and processing the image data to be processed based on the target conversion matrix.
It should be understood that the image data to be processed may include image data of one color, or may include image data of a plurality of colors, which is not limited in this embodiment of the present application.
It should also be appreciated that the preset RAW domain image data is divided into a plurality of subsets corresponding to a plurality of color temperature intervals and a plurality of candidate conversion matrices based on a target preset threshold value, which is determined based on a condition number of the plurality of candidate conversion matrices, based on fitting the plurality of subsets and the plurality of color temperature intervals.
According to the image processing method, the preset data are divided into the subsets, the candidate conversion matrixes are determined based on the image data of each subset and the color temperature interval corresponding to each subset and combined with the factor of the condition number, the target conversion matrix is determined from the candidate conversion matrixes, and the target conversion matrix is used for processing the image data to be processed.
With reference to the first aspect, in certain implementation manners of the first aspect, the method further includes: acquiring a preset data set; obtaining a plurality of color temperatures based on preset CIExy spatial image data; dividing the RAW domain image data into a plurality of subsets based on a preset threshold, wherein the subsets correspond to a plurality of color temperature intervals; determining a plurality of conversion matrices based on the plurality of subsets and the plurality of color temperature intervals; determining a condition number for each of the plurality of conversion matrices; updating the preset threshold value for a plurality of times, dividing the preset RAW domain image data into a plurality of subsets based on the updated preset threshold value, and redefining a plurality of conversion matrixes; and stopping updating the preset threshold value when the preset condition is met, and determining a plurality of candidate conversion matrixes based on the condition number of the obtained conversion matrixes.
Illustratively, determining the plurality of candidate transformation matrices based on the condition number of the plurality of transformation matrices may specifically include: the sum of the condition numbers of the plurality of conversion matrices obtained by each division is calculated, and a plurality of conversion matrices with the minimum sum of the condition numbers are selected from the plurality of conversion matrices obtained by each division as a plurality of candidate conversion matrices.
In one possible implementation, the terminal device may store the sum of the preset threshold value, the plurality of conversion matrices, and the condition numbers corresponding to the plurality of conversion matrices after each update. And under the condition that the preset condition is met, the terminal equipment selects a minimum from the sum of the stored condition numbers, and a plurality of conversion matrixes corresponding to the sum of the minimum condition numbers are the candidate conversion matrixes.
According to the method for determining the multiple candidate conversion matrixes, the terminal equipment stores the sum of the multiple conversion matrixes updated each time and the condition numbers corresponding to the multiple conversion matrixes. When the preset condition is met, the terminal equipment selects the sum of the minimum condition numbers from the stored sum of the condition numbers, and a plurality of candidate conversion matrixes can be determined by comparing the sum of the condition numbers once, wherein the comparison times are only once, thereby being beneficial to reducing the processing complexity of the terminal equipment.
In another possible implementation manner, after each preset threshold value update, the terminal device may compare the sum of the condition numbers obtained by the calculation and the sum of the condition numbers obtained by the previous calculation, and reserve a plurality of conversion matrices corresponding to the sum of the condition numbers with smaller one of the sum of the condition numbers obtained by the two calculations. And under the condition that the preset condition is met, the terminal equipment determines the reserved plurality of conversion matrixes as the plurality of candidate conversion matrixes.
According to the method for determining the plurality of candidate conversion matrixes, after each preset threshold value is updated, the terminal equipment can compare the sum of the condition numbers obtained through calculation at this time with the sum of the condition numbers obtained through calculation at last time, and a plurality of conversion matrixes corresponding to the sum of the smaller condition numbers in the sum of the condition numbers obtained through calculation at two times are reserved. And after the preset condition is met, the terminal equipment determines the reserved plurality of conversion matrixes as the candidate conversion matrixes. Because the terminal equipment only reserves a plurality of conversion matrixes with smaller sum of condition numbers in the updating process, the memory occupation of the terminal equipment is smaller, and the memory saving of the terminal equipment is facilitated.
It should be understood that different preset CIExy spatial image data correspond to different color temperatures, and the preset RAW domain image data correspond to the preset CIExy spatial image data one by one, so that the different preset RAW domain image data correspond to different color temperatures. Thus, the terminal device may divide the preset RAW domain image data into a plurality of subsets by a preset threshold of color temperature, wherein each subset corresponds to one color temperature interval.
It should also be understood that the number of the preset thresholds may be one or more, which is not limited in the embodiment of the present application.
With reference to the first aspect, in certain implementation manners of the first aspect, the preset condition is any one of the following: the update times of the preset threshold value are equal to the preset times; or, the update time of the preset threshold value is equal to the preset duration.
It should be understood that the update time of the preset threshold is a period from the start of update to the end of update.
It should also be appreciated that there is a correspondence between the preset number of times and the preset duration. In general, the longer the preset time period, the more the preset threshold is updated.
If the preset time length is longer or the preset times are more, the terminal equipment is more in updating times of the preset threshold value, so that a plurality of better candidate conversion matrixes can be determined, and the accuracy of the plurality of candidate conversion matrixes is improved. If the preset time is shorter or the preset times are smaller, the number of times of updating the preset threshold value by the terminal equipment is smaller, so that the terminal equipment can determine a plurality of candidate conversion matrixes in a shorter time, and the determination efficiency of the plurality of candidate conversion matrixes is improved.
With reference to the first aspect, in certain implementations of the first aspect, determining a plurality of conversion matrices based on the plurality of subsets and the plurality of color temperature intervals includes: based on the plurality of subsets and the plurality of color temperature intervals, a plurality of conversion matrices are determined by least squares regression fit.
With reference to the first aspect, in some implementations of the first aspect, the preset RAW domain image data is image data corresponding to a color of a standard color card under different color temperatures, and the preset CIExy space image data is image data corresponding to a wavelength of reflected light of the standard color card under the same light source.
With reference to the first aspect, in certain implementations of the first aspect, the image data to be processed includes one data point, and the number of target transformation matrices is one; determining a target transformation matrix from a plurality of candidate transformation matrices based on the image data to be processed and a preset data set, comprising: respectively calculating the distance between a data point of the image data to be processed and each data point of a plurality of data points in the preset RAW domain image data; and determining a candidate conversion matrix corresponding to the subset of the data points of the image data of the preset RAW domain, which are closest to the data points of the image data to be processed, as a target conversion matrix.
With reference to the first aspect, in certain implementations of the first aspect, the image data to be processed includes a plurality of data points, and the number of target transformation matrices is a plurality; determining a target transformation matrix from a plurality of candidate transformation matrices based on the image data to be processed and a preset data set, further comprising: respectively calculating the distance between a plurality of data points of the image data to be processed and each data point in a plurality of data points in the preset RAW domain image data; a plurality of target transformation matrices are determined based on distances between a plurality of data points of the image data to be processed and each of a plurality of data points in the preset RAW domain image data.
With reference to the first aspect, in certain implementation manners of the first aspect, calculating distances between a plurality of data points of the image data to be processed and each of the plurality of data points in the preset RAW domain image data, respectively, includes: calculating a distance between a first data point of a plurality of data points of the image data to be processed and each data point of the plurality of data points of the preset RAW domain image data; determining a plurality of target transformation matrices, comprising: and determining a candidate conversion matrix corresponding to the subset of the data points of the preset RAW domain image data, which is closest to the first data point, as a target conversion matrix corresponding to the first data point.
With reference to the first aspect, in certain implementation manners of the first aspect, processing image data to be processed based on the target transformation matrix includes: based on the plurality of target transformation matrices, data points corresponding to the plurality of target transformation matrices are processed, respectively.
With reference to the first aspect, in certain implementation manners of the first aspect, processing image data to be processed based on the target transformation matrix includes: obtaining image data in XYZ space based on the target conversion matrix and the image data to be processed; based on the image data in the XYZ space, the processed image data is obtained.
When the data point of the image data to be processed is one, the target conversion matrix is one, and the terminal equipment can calculate the product of the target conversion matrix and the image data to be processed to obtain the image data in the XYZ space. And the terminal equipment performs standardization processing on the image data in the XYZ space to obtain the processed image data.
When the number of the data points of the image data to be processed is plural, the terminal device uses the plural target conversion matrices to process the data points of the image data to be processed corresponding to the plural target conversion matrices, and the processing method is similar to that when the number of the data points of the image data to be processed is one, so that repetition is avoided and redundant description is omitted.
In a second aspect, a terminal device is provided for performing the method in any of the possible implementations of the first aspect. In particular, the terminal device comprises means for performing the method in any of the possible implementations of the first aspect described above.
In one design, the terminal device may include modules corresponding to the methods/operations/steps/actions described in the first aspect, where the modules may be hardware circuits, software, or a combination of hardware circuits and software.
In a third aspect, there is provided a terminal device comprising: a processor and a memory, the processor being configured to read instructions stored in the memory to perform the method of any one of the possible implementations of the first aspect.
Optionally, the processor is one or more and the memory is one or more.
Alternatively, the memory may be integrated with the processor or the memory may be separate from the processor.
In a specific implementation process, the memory may be a non-transient (non-transitory) memory, for example, a Read Only Memory (ROM), which may be integrated on the same chip as the processor, or may be separately disposed on different chips.
The terminal device in the above third aspect may be a chip, and the processor may be implemented by hardware or by software, and when implemented by hardware, the processor may be a logic circuit, an integrated circuit, or the like; when implemented in software, the processor may be a general-purpose processor, implemented by reading software code stored in a memory, which may be integrated in the processor, or may reside outside the processor, and exist separately.
In a fourth aspect, there is provided a computer program product comprising: a computer program (which may also be referred to as code, or instructions) which, when executed, causes a computer to perform the method of any one of the possible implementations of the first aspect described above.
In a fifth aspect, a computer readable storage medium is provided, which stores a computer program (which may also be referred to as code, or instructions) which, when run on a computer, causes the computer to perform the method of any one of the possible implementations of the first aspect.
Drawings
Fig. 1 is a schematic structural diagram of a terminal device provided in an embodiment of the present application;
fig. 2 is a software architecture block diagram of a terminal device provided in an embodiment of the present application;
FIG. 3 is a diagram of an image processing method according to an embodiment of the present application;
fig. 4 is a schematic block diagram of a terminal device provided in an embodiment of the present application;
fig. 5 is a schematic block diagram of another terminal device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the present application will be described below with reference to the accompanying drawings.
In order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second", etc. are used to distinguish the same item or similar items having substantially the same function and effect. It will be appreciated by those of skill in the art that the words "first," "second," and the like do not limit the amount and order of execution, and that the words "first," "second," and the like do not necessarily differ.
In this application, the terms "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
Furthermore, "at least one" means one or more, and "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a alone, a and B together, and B alone, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b, and c may represent: a, b, or c, or a and b, or a and c, or b and c, or a, b and c, wherein a, b and c can be single or multiple.
In order to better understand the embodiments of the present application, the following describes a hardware structure of the terminal device of the embodiments of the present application.
Fig. 1 shows a schematic structure of a terminal device 100.
The terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, keys 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identity module (subscriber identification module, SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, terminal device 100 may include more or less components than illustrated, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processing units, such as: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors.
The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a universal serial bus (universal serial bus, USB) interface, among others.
The I2C interface is a bi-directional synchronous serial bus comprising a serial data line (SDA) and a serial clock line (derail clock line, SCL). In some embodiments, the processor 110 may contain multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, charger, flash, camera 193, etc., respectively, through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through an I2C bus interface to implement a touch function of the terminal device 100.
The I2S interface may be used for audio communication. In some embodiments, the processor 110 may contain multiple sets of I2S buses. The processor 110 may be coupled to the audio module 170 via an I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 may transmit an audio signal to the wireless communication module 160 through the I2S interface, to implement a function of answering a call through the bluetooth headset.
PCM interfaces may also be used for audio communication to sample, quantize and encode analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface. In some embodiments, the audio module 170 may also transmit audio signals to the wireless communication module 160 through the PCM interface to implement a function of answering a call through the bluetooth headset. Both the I2S interface and the PCM interface may be used for audio communication.
The UART interface is a universal serial data bus for asynchronous communications. The bus may be a bi-directional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is typically used to connect the processor 110 with the wireless communication module 160. For example: the processor 110 communicates with a bluetooth module in the wireless communication module 160 through a UART interface to implement a bluetooth function. In some embodiments, the audio module 170 may transmit an audio signal to the wireless communication module 160 through a UART interface, to implement a function of playing music through a bluetooth headset.
The MIPI interface may be used to connect the processor 110 to peripheral devices such as a display 194, a camera 193, and the like. The MIPI interfaces include camera serial interfaces (camera serial interface, CSI), display serial interfaces (display serial interface, DSI), and the like. In some embodiments, processor 110 and camera 193 communicate through a CSI interface to implement the photographing function of terminal device 100. The processor 110 and the display 194 communicate via a DSI interface to implement the display function of the terminal device 100.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal or as a data signal. In some embodiments, a GPIO interface may be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like. The GPIO interface may also be configured as an I2C interface, an I2S interface, a UART interface, an MIPI interface, etc.
The USB interface 130 is an interface conforming to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, or the like. The USB interface 130 may be used to connect a charger to charge the terminal device 100, or may be used to transfer data between the terminal device 100 and a peripheral device. And can also be used for connecting with a headset, and playing audio through the headset. The interface may also be used to connect other terminal devices, such as AR devices, etc.
It should be understood that the interfacing relationship between the modules illustrated in the embodiments of the present application is only illustrative, and does not constitute a structural limitation of the terminal device 100. In other embodiments of the present application, the terminal device 100 may also use different interfacing manners, or a combination of multiple interfacing manners in the foregoing embodiments.
The charge management module 140 is configured to receive a charge input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charge management module 140 may receive a charging input of a wired charger through the USB interface 130. In some wireless charging embodiments, the charge management module 140 may receive wireless charging input through a wireless charging coil of the terminal device 100. The charging management module 140 may also supply power to the terminal device through the power management module 141 while charging the battery 142.
The power management module 141 is used for connecting the battery 142, and the charge management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charge management module 140 to power the processor 110, the internal memory 121, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 may also be configured to monitor battery capacity, battery cycle number, battery health (leakage, impedance) and other parameters. In other embodiments, the power management module 141 may also be provided in the processor 110. In other embodiments, the power management module 141 and the charge management module 140 may be disposed in the same device.
The wireless communication function of the terminal device 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the terminal device 100 may be used to cover a single or multiple communication bands. Different antennas may also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed into a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution including 2G/3G/4G/5G wireless communication applied to the terminal device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA), etc. The mobile communication module 150 may receive electromagnetic waves from the antenna 1, perform processes such as filtering, amplifying, and the like on the received electromagnetic waves, and transmit the processed electromagnetic waves to the modem processor for demodulation. The mobile communication module 150 can amplify the signal modulated by the modem processor, and convert the signal into electromagnetic waves through the antenna 1 to radiate. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be provided in the same device as at least some of the modules of the processor 110.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs sound signals through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or video through the display screen 194. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be provided in the same device as the mobile communication module 150 or other functional module, independent of the processor 110.
The wireless communication module 160 may provide solutions for wireless communication including wireless local area network (wireless local area networks, WLAN) (e.g., wireless fidelity (wireless fidelity, wi-Fi) network), bluetooth (BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field wireless communication technology (near field communication, NFC), infrared technology (IR), etc., applied to the terminal device 100. The wireless communication module 160 may be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signals, filters the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, frequency modulate it, amplify it, and convert it to electromagnetic waves for radiation via the antenna 2.
In some embodiments, antenna 1 and mobile communication module 150 of terminal device 100 are coupled, and antenna 2 and wireless communication module 160 are coupled, such that terminal device 100 may communicate with a network and other devices via wireless communication techniques. The wireless communication techniques may include the Global System for Mobile communications (global system for mobile communications, GSM), general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), wideband code division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC, FM, and/or IR techniques, among others. The GNSS may include a global satellite positioning system (global positioning system, GPS), a global navigation satellite system (global navigation satellite system, GLONASS), a beidou satellite navigation system (beidou navigation satellite system, BDS), a quasi zenith satellite system (quasi-zenith satellite system, QZSS) and/or a satellite based augmentation system (satellite based augmentation systems, SBAS).
The terminal device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
The display screen 194 is used to display images, videos, and the like. The display 194 includes a display panel. The display panel may employ a liquid crystal display (liquid crystal display, LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (flex), a mini, a Micro-OLED, a quantum dot light-emitting diode (quantum dot light emitting diodes, QLED), or the like. In some embodiments, the terminal device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
The terminal device 100 may implement a photographing function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
The ISP is used to process data fed back by the camera 193. For example, when photographing, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing and is converted into an image visible to naked eyes. ISP can also optimize the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in the camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (charge coupled device, CCD) or a Complementary Metal Oxide Semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then transferred to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or the like format. In some embodiments, the terminal device 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
The digital signal processor is used for processing digital signals, and can process other digital signals besides digital image signals. For example, when the terminal device 100 selects a frequency bin, the digital signal processor is used to fourier transform the frequency bin energy, or the like.
Video codecs are used to compress or decompress digital video. The terminal device 100 may support one or more video codecs. In this way, the terminal device 100 can play or record video in various encoding formats, for example: dynamic picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
The NPU is a neural-network (NN) computing processor, and can rapidly process input information by referencing a biological neural network structure, for example, referencing a transmission mode between human brain neurons, and can also continuously perform self-learning. Applications such as intelligent awareness of the terminal device 100 may be implemented by the NPU, for example: image recognition, face recognition, speech recognition, text understanding, etc.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to realize expansion of the memory capability of the terminal device 100. The external memory card communicates with the processor 110 through an external memory interface 120 to implement data storage functions. For example, files such as music, video, etc. are stored in an external memory card.
The internal memory 121 may be used to store computer executable program code including instructions. The internal memory 121 may include a storage program area and a storage data area. The storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for at least one function of the operating system, etc. The storage data area may store data (such as audio data, phonebook, etc.) created during use of the terminal device 100, and the like. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (universal flash storage, UFS), and the like. The processor 110 performs various functional applications of the terminal device 100 and data processing by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
The terminal device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or a portion of the functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also referred to as a "horn," is used to convert audio electrical signals into sound signals. The terminal device 100 can listen to music or to handsfree talk through the speaker 170A.
A receiver 170B, also referred to as a "earpiece", is used to convert the audio electrical signal into a sound signal. When the terminal device 100 receives a call or voice message, it is possible to receive voice by approaching the receiver 170B to the human ear.
Microphone 170C, also referred to as a "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can sound near the microphone 170C through the mouth, inputting a sound signal to the microphone 170C. The terminal device 100 may be provided with at least one microphone 170C. In other embodiments, the terminal device 100 may be provided with two microphones 170C, and may implement a noise reduction function in addition to collecting sound signals. In other embodiments, the terminal device 100 may be further provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the source of sound, implement directional recording functions, etc.
The earphone interface 170D is used to connect a wired earphone. The earphone interface 170D may be a USB interface 130 or a 3.5mm open mobile terminal platform (open mobile terminal platform, OMTP) standard interface, a american cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
The pressure sensor 180A is used to sense a pressure signal, and may convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. The pressure sensor 180A is of various types, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a capacitive pressure sensor comprising at least two parallel plates with conductive material. The capacitance between the electrodes changes when a force is applied to the pressure sensor 180A. The terminal device 100 determines the intensity of the pressure according to the change of the capacitance. When a touch operation is applied to the display 194, the terminal device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The terminal device 100 may also calculate the position of the touch from the detection signal of the pressure sensor 180A. In some embodiments, touch operations that act on the same touch location, but at different touch operation strengths, may correspond to different operation instructions. For example: and executing an instruction for checking the short message when the touch operation with the touch operation intensity smaller than the first pressure threshold acts on the short message application icon. And executing an instruction for newly creating the short message when the touch operation with the touch operation intensity being greater than or equal to the first pressure threshold acts on the short message application icon.
The gyro sensor 180B may be used to determine a motion gesture of the terminal device 100. In some embodiments, the angular velocity of the terminal device 100 about three axes (i.e., x, y, and z axes) may be determined by the gyro sensor 180B. The gyro sensor 180B may be used for photographing anti-shake. Illustratively, when the shutter is pressed, the gyro sensor 180B detects the angle of the shake of the terminal device 100, calculates the distance to be compensated by the lens module according to the angle, and allows the lens to counteract the shake of the terminal device 100 by the reverse motion, thereby realizing anti-shake. The gyro sensor 180B may also be used for navigating, somatosensory game scenes.
The air pressure sensor 180C is used to measure air pressure. In some embodiments, the terminal device 100 calculates altitude from barometric pressure values measured by the barometric pressure sensor 180C, aiding in positioning and navigation.
The magnetic sensor 180D includes a hall sensor. The terminal device 100 can detect the opening and closing of the flip cover using the magnetic sensor 180D. In some embodiments, when the terminal device 100 is a folder, the terminal device 100 may detect opening and closing of the folder according to the magnetic sensor 180D. And then according to the detected opening and closing state of the leather sheath or the opening and closing state of the flip, the characteristics of automatic unlocking of the flip and the like are set.
The acceleration sensor 180E can detect the magnitude of acceleration of the terminal device 100 in various directions (typically three axes). The magnitude and direction of gravity may be detected when the terminal device 100 is stationary. The method can also be used for identifying the gesture of the terminal equipment, and is applied to the applications such as horizontal and vertical screen switching, pedometers and the like.
A distance sensor 180F for measuring a distance. The terminal device 100 may measure the distance by infrared or laser. In some embodiments, the terminal device 100 may range using the distance sensor 180F to achieve fast focusing.
The proximity light sensor 180G may include, for example, a Light Emitting Diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The terminal device 100 emits infrared light outward through the light emitting diode. The terminal device 100 detects infrared reflected light from a nearby object using a photodiode. When sufficient reflected light is detected, it can be determined that there is an object in the vicinity of the terminal device 100. When insufficient reflected light is detected, the terminal device 100 may determine that there is no object in the vicinity of the terminal device 100. The terminal device 100 can detect that the user holds the terminal device 100 close to the ear to talk by using the proximity light sensor 180G, so as to automatically extinguish the screen for the purpose of saving power. The proximity light sensor 180G may also be used in holster mode, pocket mode to automatically unlock and lock the screen.
The ambient light sensor 180L is used to sense ambient light level. The terminal device 100 may adaptively adjust the brightness of the display 194 based on the perceived ambient light level. The ambient light sensor 180L may also be used to automatically adjust white balance when taking a photograph. The ambient light sensor 180L may also cooperate with the proximity light sensor 180G to detect whether the terminal device 100 is in a pocket to prevent false touches.
The fingerprint sensor 180H is used to collect a fingerprint. The terminal device 100 can utilize the collected fingerprint characteristics to realize fingerprint unlocking, access an application lock, fingerprint photographing, fingerprint incoming call answering and the like.
The temperature sensor 180J is for detecting temperature. In some embodiments, the terminal device 100 performs a temperature processing strategy using the temperature detected by the temperature sensor 180J. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the terminal device 100 performs a reduction in the performance of a processor located near the temperature sensor 180J in order to reduce power consumption to implement thermal protection. In other embodiments, when the temperature is below another threshold, the terminal device 100 heats the battery 142 to avoid the low temperature causing the terminal device 100 to shut down abnormally. In other embodiments, when the temperature is below a further threshold, the terminal device 100 performs boosting of the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperatures.
The touch sensor 180K, also referred to as a "touch device". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is for detecting a touch operation acting thereon or thereabout. The touch sensor may communicate the detected touch operation to the application processor to determine the touch event type. Visual output related to touch operations may be provided through the display 194. In other embodiments, the touch sensor 180K may also be disposed on the surface of the terminal device 100 at a different location than the display 194.
The bone conduction sensor 180M may acquire a vibration signal. In some embodiments, bone conduction sensor 180M may acquire a vibration signal of a human vocal tract vibrating bone pieces. The bone conduction sensor 180M may also contact the pulse of the human body to receive the blood pressure pulsation signal. In some embodiments, bone conduction sensor 180M may also be provided in a headset, in combination with an osteoinductive headset. The audio module 170 may analyze the voice signal based on the vibration signal of the sound portion vibration bone block obtained by the bone conduction sensor 180M, so as to implement a voice function. The application processor may analyze the heart rate information based on the blood pressure beat signal acquired by the bone conduction sensor 180M, so as to implement a heart rate detection function.
The keys 190 include a power-on key, a volume key, etc. The keys 190 may be mechanical keys. Or may be a touch key. The terminal device 100 may receive key inputs, generating key signal inputs related to user settings and function controls of the terminal device 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration alerting as well as for touch vibration feedback. For example, touch operations acting on different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 191 may also correspond to different vibration feedback effects by touching different areas of the display screen 194. Different application scenarios (such as time reminding, receiving information, alarm clock, game, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
The indicator 192 may be an indicator light, may be used to indicate a state of charge, a change in charge, a message indicating a missed call, a notification, etc.
The SIM card interface 195 is used to connect a SIM card. The SIM card may be contacted and separated from the terminal apparatus 100 by being inserted into the SIM card interface 195 or by being withdrawn from the SIM card interface 195. The terminal device 100 may support 1 or N SIM card interfaces, N being a positive integer greater than 1. The SIM card interface 195 may support Nano SIM cards, micro SIM cards, and the like. The same SIM card interface 195 may be used to insert multiple cards simultaneously. The types of the plurality of cards may be the same or different. The SIM card interface 195 may also be compatible with different types of SIM cards. The SIM card interface 195 may also be compatible with external memory cards. The terminal device 100 interacts with the network through the SIM card to realize functions such as call and data communication. In some embodiments, the terminal device 100 employs esims, namely: an embedded SIM card. The eSIM card can be embedded in the terminal device 100 and cannot be separated from the terminal device 100. The software system of the terminal device 100 may employ a layered architecture, an event driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. In this embodiment, taking an Android system with a layered architecture as an example, a software structure of the terminal device 100 is illustrated.
Fig. 2 is a software configuration block diagram of the terminal device 100 of the embodiment of the present application.
The layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, from top to bottom, an application layer, an application framework layer, an Zhuoyun row (Android run) and system libraries, and a kernel layer, respectively.
The application layer may include a series of application packages. As shown in fig. 2, the application package may include applications for cameras, gallery, calendar, phone calls, maps, navigation, WLAN, bluetooth, music, video, short messages, etc.
The application framework layer provides an application programming interface (application programming interface, API) and programming framework for application programs of the application layer. The application framework layer includes a number of predefined functions. As shown in FIG. 2, the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.
The window manager is used for managing window programs. The window manager can acquire the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider is used to store and retrieve data and make such data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phonebooks, etc.
The view system includes visual controls, such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, a display interface including a text message notification icon may include a view displaying text and a view displaying a picture.
The telephony manager is used to provide the communication functions of the terminal device 100. Such as the management of call status (including on, hung-up, etc.).
The resource manager provides various resources for the application program, such as localization strings, icons, pictures, layout files, video files, and the like.
The notification manager allows the application to display notification information in a status bar, can be used to communicate notification type messages, can automatically disappear after a short dwell, and does not require user interaction. Such as notification manager is used to inform that the download is complete, message alerts, etc. The notification manager may also be a notification in the form of a chart or scroll bar text that appears on the system top status bar, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in a status bar, a prompt tone is emitted, the terminal equipment vibrates, and an indicator light blinks.
Android run time includes a core library and virtual machines. Android run time is responsible for scheduling and management of the Android system.
The core library consists of two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in a virtual machine. The virtual machine executes java files of the application program layer and the application program framework layer as binary files. The virtual machine is used for executing the functions of object life cycle management, stack management, thread management, security and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: surface manager (surface manager), media Libraries (Media Libraries), three-dimensional graphics processing Libraries (e.g., openGL ES), 2D graphics engines (e.g., SGL), etc.
The surface manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
Media libraries support a variety of commonly used audio, video format playback and recording, still image files, and the like. The media library may support a variety of audio and video encoding formats, such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, etc.
The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
The 2D graphics engine is a drawing engine for 2D drawing.
The kernel layer is a layer between hardware and software. The kernel layer is used for driving the hardware so that the hardware works. The kernel layer at least includes a display driver, a screen driver, an image processor (graphics processing unit, GPU) driver, a camera, and a sensor driver, which is not limited in this embodiment. For example, the screen driver may drive a screen bright or off screen.
The terminal device related to the embodiment of the application may be a mobile phone, a tablet computer, a personal computer (personal computer, PC), an intelligent screen, a car machine device, various teaching auxiliary tools (such as a learning machine and an early education machine), an augmented reality technology (augmented reality, AR) device, a Virtual Reality (VR) device, or the like, or may be a device with a mobile office function, a device with an intelligent home function, a device with an audio-visual entertainment function, a device supporting intelligent travel, or the like. It should be understood that the embodiments of the present application do not limit the specific technology and specific device configuration adopted by the terminal device.
The RAW domain and CIExy space are two color spaces. For the RAW field, the same color may be represented by different coordinate values, i.e., there is no uniform color standard, while for the CIExy space, a set of coordinate values represents only one color, there is a uniform color standard. In general, the image data acquired by the terminal device is image data in the RAW domain, and the terminal device needs to convert the image data in the RAW domain into image data in the CIExy space. Taking a terminal device as a mobile phone as an example, a user uses the mobile phone to photograph a target object, the mobile phone acquires image data on a RAW domain of the target object through a camera, then the image data on the RAW domain is converted into image data on a CIExy space, and an image is displayed to the user based on the image data on the CIExy space.
Currently, converting image data from the RAW domain to the CIExy space requires passing through an intermediate color space, i.e., XYZ space. The terminal device may convert the image data from the RAW domain to the XYZ space, and then perform normalization processing on the image data in the XYZ space to obtain image data in the CIExy space. The usual image processing methods are: from the standpoint of accuracy and precision, a 3×3 conversion matrix is obtained, by which the image data is converted from the RAW domain to the XYZ space, and then normalized (i.e., normalized in the XYZ space) to the CIExy space.
However, the conversion matrix obtained by the method does not consider stability, which may cause unstable conversion of the image data from the RAW domain to the CIExy space, that is, for the same target object, the colors of the images after the two conversions are different (for example, the colors of the images obtained after the two photographing are different due to angle conversion of the camera or shake of the lens), thereby affecting the user experience.
In order to solve the above problems, the present application provides an image processing method and a terminal device, by dividing preset data into a plurality of subsets, determining a plurality of candidate conversion matrices based on image data of each subset and a color temperature interval corresponding to each subset in combination with a condition number, determining a target conversion matrix from the plurality of candidate conversion matrices, and processing image data to be processed by using the target conversion matrix, which is beneficial to improving stability of color space conversion in an image processing process, thereby improving user experience.
Next, an image processing method 300 according to an embodiment of the present application will be described with reference to fig. 3. The method 300 may be applied to image processing scenes or to other scenes that require conversion to a color space. The method 300 may be performed by a terminal device, the hardware structure of which may be as shown in fig. 1, and the software structure of which may be as shown in fig. 2. The method 300 includes the steps of:
S301, RAW domain image data requiring image processing by the terminal device is acquired.
For ease of understanding, the RAW domain image data that requires the terminal device to perform image processing is hereinafter referred to as "image data to be processed", and the image data converted from the RAW domain to the CIExy space through the terminal device processing is hereinafter referred to as "processed image data".
It should be understood that the image data to be processed may include image data of one color, or may include image data of a plurality of colors, which is not limited in this embodiment of the present application.
It should also be appreciated that if the image data to be processed includes image data of one color, i.e., the image data to be processed corresponds to one data point, the image data to be processed corresponds to one color temperature. If the image data to be processed includes image data of a plurality of colors, that is, the image data to be processed corresponds to a plurality of data points, the image data to be processed corresponds to a plurality of color temperatures.
For example, if the image data to be processed includes white image data, the image data to be processed corresponds to a color temperature of white, that is, a color temperature of white may be obtained according to 1 data point corresponding to the image data to be processed. If the image data to be processed includes white image data, yellow image data and red image data, the image data to be processed corresponds to white, yellow and red color temperatures, that is, the white color temperature, the yellow color temperature and the red color temperature can be obtained respectively according to the 3 data points corresponding to the image data to be processed.
S302, determining a target conversion matrix from a plurality of candidate conversion matrices based on image data to be processed and a preset data set.
Specifically, the preset data set includes RAW domain image data and image data of CIExy space, which are in one-to-one correspondence. For convenience of description and distinction, the RAW domain image data in the preset data set is hereinafter referred to as "preset RAW domain image data", and the image data in the CIExy space in the preset data set is hereinafter referred to as "preset CIExy space image data".
In this embodiment of the present application, the preset RAW domain image data is divided into a plurality of subsets based on a target preset threshold, where the plurality of subsets correspond to a plurality of color temperature intervals and a plurality of candidate conversion matrices, the plurality of candidate conversion matrices are obtained based on fitting of the plurality of subsets and the plurality of color temperature intervals, and the target preset threshold is determined based on a condition number of the plurality of candidate conversion matrices.
It should be appreciated that the above-described determination of a plurality of candidate transformation matrices is a process that continually iterates for finding an optimal solution. In the initial state, a preset threshold value can be selected at random or based on a preset threshold value set by default, the preset RAW domain image data is divided to obtain a plurality of subsets, a plurality of conversion matrixes are further obtained, then the preset threshold value is updated for a plurality of times, and the preset RAW domain image data is divided again for a plurality of times to obtain the plurality of conversion matrixes. And selecting a plurality of candidate conversion matrixes from the plurality of conversion matrixes obtained each time based on the condition number of the plurality of conversion matrixes obtained each time, wherein the preset threshold value used by the partition corresponding to the plurality of candidate conversion matrixes is the target preset threshold value.
It should be further understood that the above process of determining the plurality of candidate conversion matrices may be that the determined plurality of candidate conversion matrices are stored after the terminal device executes the process, or may be that the determined plurality of candidate conversion matrices are sent to the terminal device after another device different from the terminal device executes the process, and the terminal device directly stores the candidate conversion matrices.
S303, processing the image data to be processed based on the target conversion matrix.
According to the image processing method, the preset data are divided into the subsets, the candidate conversion matrixes are determined based on the image data of each subset and the color temperature interval corresponding to each subset and combined with the factor of the condition number, the target conversion matrix is determined from the candidate conversion matrixes, and the target conversion matrix is used for processing the image data to be processed.
In the above S302, the process of determining the target conversion matrix is described in detail below in consideration of the fact that image data of one color may be included in the image data to be processed, or image data of a plurality of colors may be included.
In case 1, when the image data to be processed includes image data of one color, that is, the image data to be processed corresponds to one data point, and the preset RAW domain image data corresponds to a plurality of data points, the terminal device may perform the following operations:
the terminal device may calculate a distance between a data point of the image data to be processed and each of a plurality of data points in the preset RAW domain image data, and determine a candidate conversion matrix corresponding to a subset to which a data point of one preset RAW domain image data closest to the data point of the image data to be processed belongs as a target conversion matrix corresponding to the image data to be processed.
The image data to be processed has a data point, and the coordinates of the data point arer t b t ) Presetting the number of data points of RAW domain image data to be K, wherein the number of data points in the K data points is the firstsThe coordinates of the data points are [ ]r s b s ) The first data point of the image data to be processed and the data point of the preset RAW domain image datasDistance between data pointsd s The method comprises the following steps:
Figure 47738DEST_PATH_IMAGE001
wherein, the liquid crystal display device comprises a liquid crystal display device,sfor presetting the index of the data points in the RAW domain image data,sis a positive integer, andsand taken through 1~K. Based on the above formula, the terminal device can calculate K distances, namely d 1 ~d K . The terminal device cand 1 ~d K And determining a candidate conversion matrix corresponding to a subset of the data points of the preset RAW domain image data corresponding to the minimum value as a target conversion matrix corresponding to the image data to be processed.
In case 2, when the image data to be processed includes image data of a plurality of colors, that is, the image data to be processed corresponds to a plurality of data points, and the preset RAW domain image data corresponds to a plurality of data points, the terminal device may perform the following operations:
the terminal device may calculate distances between a plurality of data points of the image data to be processed and each of a plurality of data points in the preset RAW domain image data, respectively, and determine a plurality of target transformation matrices based on the distances between the plurality of data points of the image data to be processed and each of the plurality of data points in the preset RAW domain image data.
Optionally, the terminal device may calculate distances between a plurality of data points of the image data to be processed and each of the plurality of data points in the preset RAW domain image data, respectively, including: the terminal device may calculate a distance between a first data point of the plurality of data points of the image data to be processed and each data point of the plurality of data points of the preset RAW domain image data. Determining a plurality of target transformation matrices, comprising: and determining a candidate conversion matrix corresponding to the subset of the data points of the preset RAW domain image data, which is closest to the first data point, as a target conversion matrix corresponding to the first data point.
The number of data points of the image data to be processed is Q, and the number of data points of the preset RAW domain image data is K. The terminal device may calculate distances between a first data point of the Q data points of the image data to be processed and each data point of the K data points of the preset RAW domain image data, respectively, to obtain K distances. And the terminal equipment determines a candidate conversion matrix corresponding to a subset of the data points of the preset RAW domain image data corresponding to the minimum value in the K distances as a target conversion matrix corresponding to the first data point in the image data to be processed. The distance calculating method is the same as that of the above example, and in order to avoid repetition, a description thereof will be omitted. Wherein Q is a positive integer greater than or equal to 2.
It should be understood that, the method for determining the target conversion matrix corresponding to the rest of the plurality of data points except the first data point is similar to the method for determining the target conversion matrix corresponding to the first data point in the plurality of data points of the image data to be processed, and is not repeated here.
In S303, the terminal device processes the image data to be processed based on the target conversion matrix, and may obtain processed image data, where the processed image data is image data converted into the CIExy space.
Optionally, processing the image data to be processed based on the target transformation matrix includes: obtaining image data in XYZ space based on the target conversion matrix and the image data to be processed; based on the image data in the XYZ space, the processed image data is obtained.
In one possible implementation, the number of the target conversion matrices is one, and the terminal device processes the image based on the target conversion matrices, and may calculate the product of the target conversion matrices and the image data to be processed, to obtain image data in XYZ space. The terminal device obtains processed image data based on the image data in the XYZ space.
It should be understood that, in the imaging principle, the terminal device needs to coordinate the RAW domain #rb) Adding one dimension to become%r,1,b) For convenience of description, the following will be mader,1,b) Referred to as "RAW domain augmentation coordinates". The terminal device uses the product of the target transformation matrix and the RAW domain augmentation coordinate as the coordinate of the XYZ space. In other words, the terminal device may add one dimension to the image data to be processed to become the augmented image data to be processed. The terminal device uses the product of the target conversion matrix and the amplified image data to be processed as the image data in XYZ space.
It should also be understood that coordinates in XYZ space are three rows and one column, and that the augmented coordinates of the image data to be processed are three rows and one column, and that to obtain coordinates in XYZ space, the transformation matrix is 3 rows and 3 columns.
Illustratively, the target transformation matrix M is
Figure 783220DEST_PATH_IMAGE002
The image data to be processed has N data points, the N data points are the firstjThe data points of the amplified image data to be processed arer j ,1,b j ) First, thejTransposed augmented image data for data points to be processed
Figure 649544DEST_PATH_IMAGE003
The terminal equipment converts the target conversion matrix and the transposed firstjMultiplying the data points of the amplified image data to be processed to obtain the firstjThe image data of the data points in XYZ space are:
Figure 237521DEST_PATH_IMAGE004
first, thejThe data points are transposed into XYZ space image dataX j Y j Z j ) The terminal device normalizes it to CIExy space as:
Figure 254018DEST_PATH_IMAGE005
,/>
Figure 440411DEST_PATH_IMAGE006
the obtained processed image datax j y j ) The method comprises the following steps:
Figure 477637DEST_PATH_IMAGE007
Figure 365959DEST_PATH_IMAGE008
wherein, the liquid crystal display device comprises a liquid crystal display device,jas an index to data points in the image data to be processed,jis a positive integer, andjand taking 1-N times.
In another possible implementation manner, the number of the target conversion matrices is a plurality, and the terminal device processes the corresponding image data to be processed based on the plurality of the target conversion matrices.
Exemplary, if there are 3 image data to be processed, and there are @ in the image data to be processed r a b a ) Corresponding to the target conversion matrix 1, the image data to be processed is processedr b b b ) Corresponding to the target conversion matrix 2, the image data to be processed is processedr c b c ) Corresponding to the target conversion matrix 3, the terminal equipment processes the image data to be processed based on the target conversion matrix 1r a b a ) Processing the image data to be processed based on the target conversion matrix 2r b b b ) Processing the image data to be processed based on the target conversion matrix 3r c b c ). When the target conversion matrix is multiple, the specific method for processing the multiple image data to be processed by the terminal device is similar to that when the target conversion matrix is one, and in order to avoid repetition, a description is omitted here.
As an alternative embodiment, the method further comprises: acquiring the preset data set; obtaining a plurality of color temperatures based on the preset CIExy spatial image data; dividing the preset RAW domain image data into a plurality of subsets based on a preset threshold, wherein the subsets correspond to a plurality of color temperature intervals; determining a plurality of conversion matrices based on the plurality of subsets and the plurality of color temperature intervals; determining a condition number for each of the plurality of conversion matrices; updating the preset threshold value for a plurality of times, and re-dividing the preset RAW domain image data into a plurality of subsets based on the updated preset threshold value, and re-determining a plurality of conversion matrixes; and stopping updating the preset threshold value under the condition that the preset condition is met, and determining a plurality of candidate conversion matrixes based on the condition number of the obtained conversion matrixes.
It should be understood that the terminal device may divide the preset RAW domain image data into a plurality of subsets based on the preset threshold, and may obtain a plurality of conversion matrices according to the plurality of subsets and color temperature intervals corresponding to the plurality of subsets, thereby obtaining the condition numbers of the plurality of conversion matrices. The terminal device may update the preset threshold multiple times, and re-divide the preset RAW domain image data into multiple subsets based on the updated preset threshold, and re-determine the multiple conversion matrices and the condition numbers of the multiple conversion matrices. And under the condition that the preset condition is met, stopping updating, and determining a target preset threshold value and a plurality of candidate conversion matrixes based on the condition number obtained by each division. The target preset threshold is one of preset thresholds adopted in each division.
Illustratively, determining the plurality of candidate transformation matrices based on the condition number of the plurality of transformation matrices may specifically include: the sum of the condition numbers of the plurality of conversion matrices obtained by each division is calculated, and a plurality of conversion matrices with the minimum sum of the condition numbers are selected from the plurality of conversion matrices obtained by each division as a plurality of candidate conversion matrices.
As an alternative embodiment, the preset conditions are: the update times of the preset threshold value are equal to the preset times, or the update time of the preset threshold value is equal to the preset duration.
It should be understood that the update time of the preset threshold is a period of time between when the update starts from the preset threshold and when the update stops. For example, the terminal device may start a timer or a counter at the start of the update to count the update time or the number of updates of the preset threshold.
It should also be appreciated that there is a correspondence between the preset number of times and the preset duration. In general, the longer the preset time period, the more the preset threshold is updated.
If the preset time length is longer or the preset times are more, the terminal equipment is more in updating times of the preset threshold value, so that a plurality of better candidate conversion matrixes can be determined, and the accuracy of the plurality of candidate conversion matrixes is improved. If the preset time is shorter or the preset times are smaller, the number of times of updating the preset threshold value by the terminal equipment is smaller, so that the terminal equipment can determine a plurality of candidate conversion matrixes in a shorter time, and the determination efficiency of the plurality of candidate conversion matrixes is improved.
Optionally, the preset RAW domain image data is image data corresponding to colors of standard color cards under different color temperatures, and the preset CIExy space image data is image data corresponding to wavelengths of reflected light of the standard color cards under the same light source.
Next, a method for determining a plurality of candidate transformation matrices according to an embodiment of the present application will be described in detail. The method comprises the following steps:
step one, acquiring a preset data set. The preset data set comprises preset RAW domain image data and preset CIExy space image data, and the preset RAW domain image data and the preset CIExy space image data are in one-to-one correspondence.
Alternatively, the data in the preset data set may be obtained by: and stably irradiating the light source on one color of the standard color card, and photographing the color on the standard color card by using the equipment to obtain the preset RAW domain image data of the image corresponding to the color. And under the same color temperature, collecting reflected light of the same color on the standard color card through a second device to obtain spectrum information, and obtaining preset CIExy space image data of the image corresponding to the color based on the wavelength in the spectrum information. And establishing a corresponding relation between the acquired preset RAW domain image data and preset CIExy space image data under the color temperature. And obtaining preset RAW domain image data and preset CIExy space image data of different colors by repeatedly changing the color temperature of the light source for a plurality of times and repeating the steps for a plurality of times.
Illustratively, taking white as an example, a light source is irradiated on a white area of a standard color card, and a camera is used to photograph the white area of the standard color card, so that preset RAW domain image data corresponding to a white image can be obtained. And collecting the reflected light of the white area of the standard color card through a spectrometer under the same color temperature, so that spectrum information can be obtained. Based on the wavelength in the spectral information, preset CIExy spatial image data of the white image can be obtained. The preset RAW domain image data and the preset CIExy space image data with different colors can be obtained by changing the color temperature of the light source for a plurality of times and repeating the steps for a plurality of times.
And step two, obtaining a plurality of color temperatures based on preset CIExy spatial image data.
It will be appreciated that different preset CIExy spatial image data correspond to different color temperatures.
In one possible implementation, the color temperature can be calculated by the following formula:
Figure 904256DEST_PATH_IMAGE009
in another possible implementation, the color temperature can also be calculated by the following formula:
Figure 460003DEST_PATH_IMAGE010
wherein, the liquid crystal display device comprises a liquid crystal display device,CCTcolor temperature indicationxy) And representing coordinates of the CIExy space, namely preset CIExy space image data.
And thirdly, dividing the preset RAW domain image data into a plurality of subsets based on a preset threshold value of the color temperature, wherein each subset corresponds to one color temperature interval.
Specifically, different preset CIExy spatial image data correspond to different color temperatures, and the preset RAW domain image data correspond to the preset CIExy spatial image data one by one, so that the different preset RAW domain image data correspond to different color temperatures. Thus, the terminal device may divide the preset RAW domain image data into a plurality of subsets by a preset threshold of color temperature, wherein each subset corresponds to one color temperature interval.
The number of the preset thresholds may be one or more, which is not limited in the embodiment of the present application. Assuming that the number of preset thresholds is N, the terminal device may divide the color temperature into n+1 intervals, thereby dividing the preset RAW domain image data into n+1 subsets. N is an integer greater than or equal to 1.
Illustratively, n=2, the preset threshold includes T h And T l The terminal device can divide the color temperature into three sections, the color temperature is less than or equal to T l For color temperature interval 1, the color temperature is greater than T l And is less than T h For the color temperature interval 2, the color temperature is greater than or equal to T h Is color temperature interval 3. The terminal device may divide the data with the color temperature belonging to the color temperature interval 1 in the preset RAW domain image data into the subset 1, and divide the preset RAW domain image data into the subset 1Data of which the color temperature belongs to a color temperature interval 2 in the data are divided into a subset 2, and data of which the color temperature belongs to a color temperature interval 3 in the preset RAW domain image data are divided into a subset 3.
And step four, fitting a plurality of conversion matrixes based on the subsets and color temperature intervals corresponding to the subsets.
Alternatively, the preset CIExy space image data may be expressed as coordinates of CIExy space @xy) The preset RAW domain image data may be expressed as coordinates of the RAW domain #rb). Coordinates of CIExy spacexy) And the coordinates of RAW domainrb) The following relationship is satisfied:
xy)=hrb),
wherein, the liquid crystal display device comprises a liquid crystal display device,hrepresenting a preset transformation operation of converting the coordinates of the CIExy spacexy) Conversion to RAW domain coordinatesrb) Is performed according to the operation of (a).
Therefore, a coordinate about the RAW domain can be obtainedrb) Conversion matrix M and color temperature to be fittedCCTThe relation between:
Figure 668130DEST_PATH_IMAGE011
wherein, the liquid crystal display device comprises a liquid crystal display device,frepresentation of
Figure 260392DEST_PATH_IMAGE012
And color temperatureCCTMapping relation between the two.
Alternatively, based on a subset, the terminal device may fit a transformation matrix using the principle of least squares regression fit.
It should be understood that, for a subset, the terminal device may fit the transformation matrix corresponding to the subset by using the preset RAW domain image data in the subset, the color temperature corresponding to the preset RAW domain image data, and the above-mentioned relational expression.
For a plurality of subsets, the terminal device may fit the conversion matrix corresponding to each of the plurality of subsets separately, and thus, may fit a plurality of conversion matrices.
In the above example, based on subset 1, the terminal device can fit M 1 . Based on subset 2, the terminal device can fit M 2 . Based on subset 3, the terminal device can fit M 3 。M 1 、M 2 、M 3 Namely the plurality of conversion matrices.
And fifthly, determining the condition number of each conversion matrix in the plurality of conversion matrices based on the plurality of conversion matrices, and summing the condition numbers. Wherein the condition number is the ratio between the maximum eigenvalue and the minimum eigenvalue of the matrix.
In the above example, the calculation
Figure 884271DEST_PATH_IMAGE013
,/>
Figure 543792DEST_PATH_IMAGE014
Representation matrix M i I=1, 2 or 3.
Step six, changing the preset threshold value in the step three, repeating the step three to the step five, determining a plurality of different conversion matrixes, calculating the sum of condition numbers of the conversion matrixes, and determining the conversion matrixes with smaller condition numbers as a plurality of candidate conversion matrixes.
In the above example, T is changed h And T l Repeating the third to fifth steps, when
Figure 922820DEST_PATH_IMAGE015
Relatively small, corresponding M 1 、M 2 M and M 3 Is determined as a candidate transition matrix.
It will be appreciated that a preset threshold value for the color temperature may be determined before each execution of step three. The preset threshold may be determined randomly in a section formed by a plurality of color temperatures obtained by the terminal device based on preset CIExy spatial image data, or may be determined according to a preset step length in the section, which is not limited in the embodiment of the present application. Illustratively, the plurality of color temperatures obtained by the terminal device based on the preset CIExy spatial image data are respectively: 10. 20, 30, 40 and 50, the interval formed by the plurality of color temperatures is [ 10-50 ], and assuming that the number of preset thresholds is 1, the preset threshold may be 25 in the 1 st division, 30 in the 2 nd division, and 35 in the 3 rd division, or the preset threshold is randomly valued in [ 10-50 ] in each division.
In one possible implementation manner, the terminal device may execute the third to fifth steps within a preset time or a preset number of times, and store the sum of the preset threshold value, the calculated plurality of conversion matrices, and the condition numbers corresponding to the plurality of conversion matrices for each time. After the preset time is over or the update times are equal to the preset times, the terminal equipment selects a minimum from the sum of the stored condition numbers, and a plurality of conversion matrixes corresponding to the sum of the minimum condition numbers are the candidate conversion matrixes.
According to the method for determining the multiple candidate conversion matrixes, the terminal equipment stores the sum of the multiple conversion matrixes updated each time and the condition numbers corresponding to the multiple conversion matrixes. When the preset condition is met, the terminal equipment selects the sum of the minimum condition numbers from the stored sum of the condition numbers, and a plurality of candidate conversion matrixes can be determined by comparing the sum of the condition numbers once, wherein the comparison times are only once, thereby being beneficial to reducing the processing complexity of the terminal equipment.
In another possible implementation manner, the terminal device may execute the third to fifth steps within a preset time or a preset number of times, and compare the sum of the condition numbers obtained by the current calculation with the sum of the condition numbers obtained by the previous calculation each time the fifth step is executed, and reserve a preset threshold value and a plurality of conversion matrices corresponding to the sum of the condition numbers with a smaller one of the sum of the condition numbers obtained by the two calculations. After the preset time is over or the number of updates is equal to the preset number, the terminal device determines the plurality of reserved conversion matrices as the plurality of candidate conversion matrices.
According to the method for determining the plurality of candidate conversion matrixes, after each preset threshold value is updated, the terminal equipment can compare the sum of the condition numbers obtained through calculation at this time with the sum of the condition numbers obtained through calculation at last time, and a plurality of conversion matrixes corresponding to the sum of the smaller condition numbers in the sum of the condition numbers obtained through calculation at two times are reserved. And after the preset condition is met, the terminal equipment determines the reserved plurality of conversion matrixes as the candidate conversion matrixes. Because the terminal equipment only reserves a plurality of conversion matrixes with smaller sum of condition numbers in the updating process, the memory occupation of the terminal equipment is smaller, and the memory saving of the terminal equipment is facilitated.
The process of determining the plurality of candidate conversion matrices may be that the determined plurality of candidate conversion matrices are stored after the terminal device executes the process, so that the plurality of candidate conversion matrices are used for performing color space conversion subsequently, or may be that after another device different from the terminal device executes the process, the determined plurality of candidate conversion matrices are sent to the terminal device, and the terminal device directly stores the determined plurality of candidate conversion matrices, which is not limited in the embodiment of the present application.
It should be understood that the sequence numbers of the above processes do not mean the order of execution, and the execution order of the processes should be determined by the functions and internal logic of the processes, and should not constitute any limitation on the implementation process of the embodiments of the present application.
The image processing method according to the embodiment of the present application is described in detail above with reference to fig. 3, and the terminal device according to the embodiment of the present application is described in detail below with reference to fig. 4 and 5.
Fig. 4 is a terminal device 400 provided in an embodiment of the present application. The terminal device 400 comprises an acquisition module 401 and a processing module 402.
The fetching module 401 is configured to: acquiring image data to be processed, wherein the image data to be processed is RAW domain image data; processing module 402: determining a target conversion matrix from a plurality of candidate conversion matrices based on image data to be processed and a preset data set, wherein the preset data set comprises preset RAW domain image data and CIExy space image data, the preset RAW domain image data and the preset CIExy space image data are in one-to-one correspondence, the preset RAW domain image data are divided into a plurality of subsets based on a target preset threshold, the plurality of subsets correspond to a plurality of color temperature intervals and the plurality of candidate conversion matrices, the plurality of candidate conversion matrices are obtained based on fitting of the plurality of subsets and the plurality of color temperature intervals, and the target preset threshold is determined based on the condition number of the plurality of candidate conversion matrices; and processing the image data to be processed based on the target conversion matrix.
Optionally, the obtaining module 401 is further configured to: acquiring a preset data set; the processing module 402 is further configured to: obtaining a plurality of color temperatures based on preset CIExy spatial image data; dividing the preset RAW domain image data into a plurality of subsets based on a preset threshold, wherein the subsets correspond to a plurality of color temperature intervals; determining a plurality of conversion matrices based on the plurality of subsets and the plurality of color temperature intervals; determining a condition number for each of a plurality of conversion matrices; updating the preset threshold value for a plurality of times, dividing the preset RAW domain image data into a plurality of subsets based on the updated preset threshold value, and redefining a plurality of conversion matrixes; and stopping updating the preset threshold value when the preset condition is met, and determining a plurality of candidate conversion matrixes based on the condition number of the obtained conversion matrixes.
Optionally, the preset condition is any one of the following: the update times of the preset threshold value are equal to the preset times; or, the update time of the preset threshold value is equal to the preset duration.
Optionally, the processing module 402 is further configured to: based on the plurality of subsets and the plurality of color temperature intervals, a plurality of conversion matrices are determined by least squares regression fit.
Optionally, the preset RAW domain image data is image data corresponding to colors of standard color cards under different color temperatures, and the preset CIExy space image data is image data corresponding to wavelengths of reflected light of the standard color cards under the same light source.
Optionally, the image data to be processed includes one data point, and the number of the target transformation matrices is one; the processing module 402 is further configured to: respectively calculating the distance between a data point of the image data to be processed and each data point of a plurality of data points in the preset RAW domain image data; and determining a candidate conversion matrix corresponding to the subset of the data points of the image data of the preset RAW domain, which are closest to the data points of the image data to be processed, as a target conversion matrix.
Optionally, the image data to be processed includes a plurality of data points, and the number of the target conversion matrices is a plurality; the processing module 402 is further configured to: respectively calculating the distance between a plurality of data points of the image data to be processed and each data point in a plurality of data points in the preset RAW domain image data; a plurality of target transformation matrices are determined based on distances between a plurality of data points of the image data to be processed and each of a plurality of data points in the preset RAW domain image data.
Optionally, the processing module 402 is further configured to: calculating a distance between a first data point of a plurality of data points of the image data to be processed and each data point of the plurality of data points of the preset RAW domain image data; and determining a candidate conversion matrix corresponding to the subset of the data points of the preset RAW domain image data, which is closest to the first data point, as a target conversion matrix corresponding to the first data point.
Optionally, the processing module 402 is further configured to: based on the plurality of target transformation matrices, data points corresponding to the plurality of target transformation matrices are processed, respectively.
Optionally, the processing module 402 is further configured to: obtaining image data in XYZ space based on the target conversion matrix and the image data to be processed; based on the image data in the XYZ space, the processed image data is obtained.
It should be understood that the terminal device 400 herein is embodied in the form of functional modules. The term module herein may refer to an application specific integrated circuit (application specific integrated circuit, ASIC), an electronic circuit, a processor (e.g., a shared, dedicated, or group processor, etc.) and memory that execute one or more software or firmware programs, a combinational logic circuit, and/or other suitable components that support the described functionality. In an alternative example, it will be understood by those skilled in the art that the terminal device 400 may be specifically a terminal device in the foregoing embodiment, and the terminal device 400 may be configured to perform each flow and/or step corresponding to the terminal device in the foregoing method embodiment, which is not described herein for avoiding repetition.
Fig. 5 is another terminal device 500 provided in an embodiment of the present application. The terminal device 500 includes: a processor 501 and a memory 502. Wherein the processor 501 and the memory 502 are in communication with each other via an internal connection path, the memory 502 is configured to store instructions, and the processor 501 is configured to execute the instructions stored in the memory 502.
It should be understood that the terminal device 500 may be specifically a terminal device in the foregoing embodiment, and may be configured to perform the steps and/or flows corresponding to the terminal device in the foregoing method embodiment. Alternatively, the memory 502 may include read-only memory and random access memory, and provide instructions and data to the processor. A portion of the memory may also include non-volatile random access memory. For example, the memory may also store information of the device type. The processor 501 may be configured to execute instructions stored in a memory, and when the processor 501 executes instructions stored in the memory 502, the processor 501 is configured to perform the steps and/or processes of the method embodiments described above corresponding to the terminal device.
It should be appreciated that in embodiments of the present application, the processor may be a central processing unit (central processing unit, CPU), the processor may also be other general purpose processors, digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or by instructions in the form of software. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in the processor for execution. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory, and the processor executes instructions in the memory to perform the steps of the method described above in conjunction with its hardware. To avoid repetition, a detailed description is not provided herein.
The present application also provides a computer-readable storage medium for storing a computer program for implementing the method corresponding to the terminal device in the above embodiment.
The present application also provides a computer program product comprising a computer program (which may also be referred to as code, or instructions) which, when run on a computer, is capable of executing the method corresponding to the terminal device shown in the above embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative modules and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system, apparatus and module may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, i.e., may be located in one place, or may be distributed over a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely specific embodiments of the present application, but the scope of the embodiments of the present application is not limited thereto, and any person skilled in the art may easily think about changes or substitutions within the technical scope of the embodiments of the present application, and the changes or substitutions are intended to be covered by the scope of the embodiments of the present application. Therefore, the protection scope of the embodiments of the present application shall be subject to the protection scope of the claims.

Claims (18)

1. An image processing method, applied to a terminal device, comprising:
acquiring a preset data set; the preset data set comprises preset RAW domain image data and preset CIExy space image data, and the preset RAW domain image data and the preset CIExy space image data are in one-to-one correspondence;
obtaining a plurality of color temperatures based on the preset CIExy spatial image data;
dividing the preset RAW domain image data into a plurality of subsets based on a preset threshold, wherein the subsets correspond to a plurality of color temperature intervals;
determining a plurality of conversion matrices based on the plurality of subsets and the plurality of color temperature intervals;
determining a condition number for each of the plurality of conversion matrices;
updating the preset threshold value for a plurality of times, and re-dividing the preset RAW domain image data into a plurality of subsets based on the updated preset threshold value, and re-determining a plurality of conversion matrixes;
Stopping updating the preset threshold value under the condition that the preset condition is met, and determining a plurality of candidate conversion matrixes based on the condition number of the obtained conversion matrixes;
acquiring image data to be processed, wherein the image data to be processed is original RAW domain image data; determining a target conversion matrix from the plurality of candidate conversion matrices based on the image data to be processed and the preset data set;
obtaining image data in XYZ space based on the target conversion matrix and the image data to be processed;
and obtaining processed image data based on the image data in the XYZ space.
2. The method according to claim 1, wherein the preset condition is any one of the following:
the update times of the preset threshold value are equal to the preset times; or alternatively, the process may be performed,
and the updating time of the preset threshold value is equal to the preset duration.
3. The method of claim 1, wherein the determining a plurality of conversion matrices based on the plurality of subsets and the plurality of color temperature intervals comprises:
the plurality of transformation matrices are determined by least squares regression fit based on the plurality of subsets and the plurality of color temperature intervals.
4. The method according to claim 1, wherein the preset RAW domain image data is image data corresponding to colors of standard color cards under different color temperatures, and the preset CIExy space image data is image data corresponding to wavelengths of reflected light of the standard color cards under the same light source.
5. The method of claim 1, wherein the image data to be processed comprises one data point, and the number of target transformation matrices is one;
the determining a target transformation matrix from a plurality of candidate transformation matrices based on the image data to be processed and a preset data set includes:
respectively calculating the distance between the data point of the image data to be processed and each data point of a plurality of data points in the preset RAW domain image data;
and determining a candidate conversion matrix corresponding to a subset of the data points of the preset RAW domain image data, which are closest to the data points of the image data to be processed, as the target conversion matrix.
6. The method of claim 1, wherein the image data to be processed comprises a plurality of data points, the number of target transformation matrices being a plurality;
The determining a target transformation matrix from the candidate transformation matrices based on the image data to be processed and the preset data set, further includes:
respectively calculating the distance between a plurality of data points of the image data to be processed and each data point in a plurality of data points in the preset RAW domain image data;
a plurality of target transformation matrices are determined based on distances between a plurality of data points of the image data to be processed and each of a plurality of data points in the preset RAW domain image data.
7. The method of claim 6, wherein the separately calculating distances between the plurality of data points of the image data to be processed and each of the plurality of data points in the preset RAW domain image data comprises:
calculating a distance between a first data point of a plurality of data points of the image data to be processed and each data point of the plurality of data points of the preset RAW domain image data;
the determining a plurality of target transformation matrices includes:
and determining a candidate conversion matrix corresponding to a subset of the data points of the preset RAW domain image data, which are closest to the first data point, as a target conversion matrix corresponding to the first data point.
8. The method of claim 6, wherein the processing the image data to be processed based on the target transformation matrix comprises:
and processing data points corresponding to the target conversion matrixes based on the target conversion matrixes.
9. A terminal device, comprising:
the acquisition module is used for acquiring image data to be processed, wherein the image data to be processed is original RAW domain image data;
the acquisition module is further configured to: acquiring a preset data set; the preset data set comprises preset RAW domain image data and preset CIExy space image data, and the preset RAW domain image data and the preset CIExy space image data are in one-to-one correspondence;
the processing module is used for obtaining a plurality of color temperatures based on the preset CIExy space image data; obtaining a plurality of color temperatures based on the preset CIExy spatial image data; dividing the preset RAW domain image data into a plurality of subsets based on a preset threshold, wherein the subsets correspond to a plurality of color temperature intervals; determining a plurality of conversion matrices based on the plurality of subsets and the plurality of color temperature intervals; determining a condition number for each of the plurality of conversion matrices; updating the preset threshold value for a plurality of times, and re-dividing the preset RAW domain image data into a plurality of subsets based on the updated preset threshold value, and re-determining a plurality of conversion matrixes; stopping updating the preset threshold value under the condition that the preset condition is met, and determining a plurality of candidate conversion matrixes based on the condition number of the obtained conversion matrixes; determining a target conversion matrix from the plurality of candidate conversion matrices based on the image data to be processed and the preset data set; obtaining image data in XYZ space based on the target conversion matrix and the image data to be processed; and obtaining processed image data based on the image data in the XYZ space.
10. The terminal device according to claim 9, wherein the preset condition is any one of the following:
the update times of the preset threshold value are equal to the preset times; or alternatively, the process may be performed,
and the updating time of the preset threshold value is equal to the preset duration.
11. The terminal device of claim 10, wherein the processing module is further configured to:
the plurality of transformation matrices are determined by least squares regression fit based on the plurality of subsets and the plurality of color temperature intervals.
12. The terminal device according to claim 9, wherein the preset RAW domain image data is image data corresponding to colors of standard color cards under different color temperatures, and the preset CIExy space image data is image data corresponding to wavelengths of reflected light of the standard color cards under the same light source.
13. The terminal device according to claim 9, wherein the image data to be processed includes one data point, and the number of the target conversion matrices is one;
the processing module is further configured to:
respectively calculating the distance between the data point of the image data to be processed and each data point of a plurality of data points in the preset RAW domain image data;
And determining a candidate conversion matrix corresponding to a subset of the data points of the preset RAW domain image data, which are closest to the data points of the image data to be processed, as the target conversion matrix.
14. The terminal device of claim 9, wherein the image data to be processed includes a plurality of data points, the number of target transformation matrices being a plurality;
the processing module is further configured to:
respectively calculating the distance between a plurality of data points of the image data to be processed and each data point in a plurality of data points in the preset RAW domain image data;
a plurality of target transformation matrices are determined based on distances between a plurality of data points of the image data to be processed and each of a plurality of data points in the preset RAW domain image data.
15. The terminal device of claim 14, wherein the processing module is further configured to:
calculating a distance between a first data point of a plurality of data points of the image data to be processed and each data point of the plurality of data points of the preset RAW domain image data;
and determining a candidate conversion matrix corresponding to a subset of the data points of the preset RAW domain image data, which are closest to the first data point, as a target conversion matrix corresponding to the first data point.
16. The terminal device of claim 14, wherein the processing module is further configured to:
and processing data points corresponding to the target conversion matrixes based on the target conversion matrixes.
17. A terminal device, comprising: a processor coupled to a memory for storing a computer program which, when invoked by the processor, causes the terminal device to perform the method of any one of claims 1 to 8.
18. A computer readable storage medium storing a computer program comprising instructions for implementing the method of any one of claims 1 to 8.
CN202211545743.8A 2022-12-05 2022-12-05 Image processing method and terminal equipment Active CN115619628B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211545743.8A CN115619628B (en) 2022-12-05 2022-12-05 Image processing method and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211545743.8A CN115619628B (en) 2022-12-05 2022-12-05 Image processing method and terminal equipment

Publications (2)

Publication Number Publication Date
CN115619628A CN115619628A (en) 2023-01-17
CN115619628B true CN115619628B (en) 2023-05-23

Family

ID=84880603

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211545743.8A Active CN115619628B (en) 2022-12-05 2022-12-05 Image processing method and terminal equipment

Country Status (1)

Country Link
CN (1) CN115619628B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008227951A (en) * 2007-03-13 2008-09-25 Ichikawa Soft Laboratory:Kk Image processing device
CN113766204A (en) * 2021-07-28 2021-12-07 荣耀终端有限公司 Method for adjusting light source color of image, electronic device and storage medium
CN113810601A (en) * 2021-08-12 2021-12-17 荣耀终端有限公司 Terminal image processing method and device and terminal equipment
CN114827565A (en) * 2021-01-27 2022-07-29 浙江宇视科技有限公司 Color correction matrix determining method, color correction device and storage medium
CN115239550A (en) * 2022-07-21 2022-10-25 Oppo广东移动通信有限公司 Image processing method, image processing apparatus, storage medium, and electronic device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008227951A (en) * 2007-03-13 2008-09-25 Ichikawa Soft Laboratory:Kk Image processing device
CN114827565A (en) * 2021-01-27 2022-07-29 浙江宇视科技有限公司 Color correction matrix determining method, color correction device and storage medium
CN113766204A (en) * 2021-07-28 2021-12-07 荣耀终端有限公司 Method for adjusting light source color of image, electronic device and storage medium
CN113810601A (en) * 2021-08-12 2021-12-17 荣耀终端有限公司 Terminal image processing method and device and terminal equipment
CN115239550A (en) * 2022-07-21 2022-10-25 Oppo广东移动通信有限公司 Image processing method, image processing apparatus, storage medium, and electronic device

Also Published As

Publication number Publication date
CN115619628A (en) 2023-01-17

Similar Documents

Publication Publication Date Title
CN113542580B (en) Method and device for removing light spots of glasses and electronic equipment
CN115798390B (en) Screen display method and terminal equipment
CN114880251B (en) Memory cell access method, memory cell access device and terminal equipment
CN113973398A (en) Wireless network connection method, electronic equipment and chip system
CN116070035A (en) Data processing method and electronic equipment
CN112527220B (en) Electronic equipment display method and electronic equipment
CN116389884B (en) Thumbnail display method and terminal equipment
CN115641867B (en) Voice processing method and terminal equipment
CN116048831B (en) Target signal processing method and electronic equipment
CN115482143B (en) Image data calling method and system for application, electronic equipment and storage medium
CN113573045B (en) Stray light detection method and stray light detection device
CN113380240B (en) Voice interaction method and electronic equipment
WO2022007757A1 (en) Cross-device voiceprint registration method, electronic device and storage medium
CN115619628B (en) Image processing method and terminal equipment
CN117009005A (en) Display method, automobile and electronic equipment
CN116703741B (en) Image contrast generation method and device and electronic equipment
CN116382728B (en) Propagation name display method and terminal equipment
CN116738033B (en) Method and device for recommending service
CN115513571B (en) Control method of battery temperature and terminal equipment
CN116095224B (en) Notification display method and terminal device
CN116320880B (en) Audio processing method and device
CN116232959B (en) Network quality detection method and device
CN116450026B (en) Method and system for identifying touch operation
CN116709023B (en) Video processing method and device
CN116095223B (en) Notification display method and terminal device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant