Image processing method and apparatus, terminal and storage medium
AssigneeTencent Technology (Shenzhen) Company Limited
InventorYiming Wang
Life of this patent
Estimating the term…
Abstract
Embodiments of this disclosure disclose an image processing method and apparatus, a terminal, and a storage medium. The method includes: obtaining a to-be-processed negative image and initial color values of pixels in the negative image in a first color space; inverting the negative image to obtain inverted image data, inverted color values of pixels in the inverted image data being determined according to the initial color values of the pixels in the negative image; performing value equalization on intermediate color values of the pixels in a range corresponding to a second color space according to the inverted image data, to obtain digital color values of the pixels; and obtaining digital image data of the negative image according to the digital color values of the pixels.
Claims15
An image processing method, performed by a terminal, the method comprising:
- obtaining a to-be-processed negative image, which comprises a plurality of pixels and initial color values of the plurality of pixels in a first color space;
- inverting the negative image to obtain inverted image data, the inverted image data comprising inverted color values of the plurality of pixels and the inverted color values being determined according to the initial color values of the plurality of pixels;
- performing value equalization on intermediate color values of the plurality of pixels in a range corresponding to a second color space according to the inverted image data to obtain digital color values of the plurality of pixels by:
- obtaining a pixel distribution map set of the inverted image data in a target color space;
- and
- performing the value equalization on the inverted color values of the plurality of pixels in a range corresponding to the target color space according to the pixel distribution map set to obtain the digital color values of the plurality of pixels, wherein:
- the pixel distribution map set comprises pixel distribution maps of the inverted image data in color channels in the target color space;
- the target color space comprises an RGB color space;
- and performing the value equalization on the inverted color values of the plurality of pixels in the range corresponding to the target color space according to the pixel distribution map set to obtain the digital color values of the plurality of pixels comprises:
- determining a value mapping parameter according to one of the pixel distribution maps of the inverted image data in a target color channel and a range of the target color channel, the target color channel being any one of the following channels:
- an R channel, a G channel, or a B channel;
- calculating an inverted component value of a target pixel in the inverted image data in the target color channel according to the value mapping parameter to obtain a digital component value of the target pixel in the target color channel;
- and
- determining a digital color value of the target pixel according to the digital component value of the target pixel in the target color channel;
- and
- obtaining digital image data of the negative image according to the digital color values of the plurality of pixels.
A terminal device, comprising:
- at least one processor;
- and
- a memory, the at least one processor and the memory being electrically coupled to each other, the memory storing at least one computer program, and the at least one processor being configured to execute the computer program to cause the terminal device to:
- obtain a to-be-processed negative image, which comprises a plurality of pixels and initial color values of the plurality of pixels in a first color space;
- invert the negative image to obtain inverted image data, the inverted image data comprising inverted color values of the plurality of pixels and the inverted color values being determined according to the initial color values of the plurality of pixels;
- perform value equalization on intermediate color values of the plurality of pixels in a range corresponding to a second color space according to the inverted image data to obtain digital color values of the plurality of pixels,
- wherein the first color space is the same as the second color space and is the target color space, and the intermediate color values comprise the inverted color values, and the intermediate color values comprise the inverted color values,
- wherein the initial color values comprise initial component values of the plurality of pixels in color channels in the target color space, and
- wherein the at least one processor is configured to to invert the negative image to obtain the inverted image data by:
- obtaining a range of a target color channel, the target color channel being any color channel in the target color space;
- calculating differences between the initial component values of the plurality of pixels in the target color channel and a maximum value of the range of the target color channel to obtain inverted component values of the plurality of pixels in the target color channel;
- and
- obtaining the inverted image data according to the inverted component values of the plurality of pixels in the target color channel;
- and
- obtaining digital image data of the negative image according to the digital color values of the plurality of pixels.
A non-transitory computer-readable storage medium, storing computer program instructions, the computer program instructions being adapted to be loaded by a processor to cause a device to:
- obtain a to-be-processed negative image, which comprises a plurality of pixels and initial color values of the plurality of pixels in a first color space;
- invert the negative image to obtain inverted image data, the inverted image data comprising inverted color values of the plurality of pixels and the inverted color values being determined according to the initial color values of the plurality of pixels;
- perform value equalization on intermediate color values of the plurality of pixels in a range corresponding to a second color space according to the inverted image data to obtain digital color values of the plurality of pixels by:
- determining a pixel distribution map of the inverted image data in the second color space according to converted color values of the plurality of pixels, wherein the pixel distribution map comprises pixel distribution maps of the inverted image data in color channels in the second color space, and the second color space is an HSV color space;
- performing the value equalization on the converted color values of the plurality of pixels in the range corresponding to the second color space according to the pixel distribution map to obtain equalized color values of the plurality of pixels by:
- determining a value mapping parameter according to a pixel distribution map of the inverted image data in a target color channel and a range of the target color channel, the target color channel being an S channel or a V channel in the second color space;
- calculating a converted component value of a target pixel of the plurality of pixels in the target color channel according to the value mapping parameter to obtain an equalized component value of the target pixel in the target color channel;
- and
- determining an equalized color value of the target pixel according to the equalized component value of the target pixel in the target color channel;
- and
- converting the equalized color values of the plurality of pixels from the second color space to the first color space to obtain the digital color values of the plurality of pixels;
- and
- obtaining digital image data of the negative image according to the digital color values of the plurality of pixels.
Dependencies are inferred from the claim text.