WO2020224459A1 - 图像处理方法、装置、终端及存储介质 - Google Patents

图像处理方法、装置、终端及存储介质 Download PDF

Info

Publication number
WO2020224459A1
WO2020224459A1 PCT/CN2020/086934 CN2020086934W WO2020224459A1 WO 2020224459 A1 WO2020224459 A1 WO 2020224459A1 CN 2020086934 W CN2020086934 W CN 2020086934W WO 2020224459 A1 WO2020224459 A1 WO 2020224459A1
Authority
WO
WIPO (PCT)
Prior art keywords
value
color
pixel
inverted
target
Prior art date
Application number
PCT/CN2020/086934
Other languages
English (en)
French (fr)
Inventor
汪义明
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Priority to EP20802792.0A priority Critical patent/EP3968269A4/en
Publication of WO2020224459A1 publication Critical patent/WO2020224459A1/zh
Priority to US17/380,937 priority patent/US20210352253A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/64Circuits for processing colour signals
    • H04N9/67Circuits for processing colour signals for matrixing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/46Colour picture communication systems
    • H04N1/56Processing of colour picture signals
    • H04N1/60Colour correction or control
    • H04N1/6002Corrections within particular colour systems
    • H04N1/6008Corrections within particular colour systems with primary colour signals, e.g. RGB or CMY(K)
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/40Image enhancement or restoration using histogram techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • G06T5/92Dynamic range modification of images or parts thereof based on global image properties
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/46Colour picture communication systems
    • H04N1/56Processing of colour picture signals
    • H04N1/60Colour correction or control
    • H04N1/6077Colour balance, e.g. colour cast correction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/253Picture signal generating by scanning motion picture films or slide opaques, e.g. for telecine
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/64Circuits for processing colour signals
    • H04N9/73Colour balance circuits, e.g. white balance circuits or colour temperature control

Definitions

  • This application relates to the field of image processing technology, and in particular to an image processing method, device, terminal and storage medium.
  • Film also called negative
  • the most common type of film is negative film.
  • the so-called negative film is a film that records colors that are opposite to the true color of the subject during imaging.
  • the method of converting negative film into digital image mainly includes the following two schemes: the first is to use darkroom processing technology to develop the negative film to obtain paper photos, and then scan the paper photos with a scanner to obtain digital images.
  • the second is to use machine learning algorithms to train the neural network model, and call the trained neural network model to perform color restoration on the negative image to be processed to obtain a digital image.
  • the embodiment of the application provides an image processing method, including:
  • the inverted color value of each pixel in the inverted image data is determined according to the initial color value of each pixel in the negative image;
  • the digital image data of the negative image is obtained according to the digital color value of each pixel.
  • An embodiment of the present application also provides an image processing device, including:
  • An acquiring unit for acquiring the negative image to be processed and the initial color value of each pixel in the negative image in the first color space
  • a processing unit configured to perform inversion processing on the negative image to obtain inverted image data, the inverted color value of each pixel in the inverted image data is determined according to the initial color value of each pixel in the negative image;
  • the processing unit is configured to perform value equalization processing on the intermediate color value of each pixel in the value range corresponding to the second color space according to the inverted image data to obtain the digital color value of each pixel;
  • the processing unit is configured to obtain the digital image data of the negative image according to the digital color value of each pixel.
  • An embodiment of the present application also provides an intelligent terminal, including a processor, an input device, an output device, and a memory, the processor, input device, output device, and memory are connected to each other, wherein the memory is used to store a computer program,
  • the computer program includes program instructions, and the processor is configured to call the program instructions to execute any one of the above-mentioned image processing methods.
  • An embodiment of the present application also provides a computer storage medium, where the computer storage medium stores computer program instructions, and the computer program instructions are suitable for being loaded by a processor and executing any one of the foregoing image processing methods.
  • FIG. 1A is an application scenario diagram of an image processing function provided by an embodiment of the present application.
  • FIG. 1B is an application scenario diagram of an image processing function provided by an embodiment of the present application.
  • FIG. 1C is an application scenario diagram of an image processing function provided by an embodiment of the present application.
  • FIG. 1D is a schematic diagram of an image processing flow provided by an embodiment of the present application.
  • FIG. 1E is an application scenario diagram of an image processing function provided by an embodiment of the present application.
  • FIG. 2A is a schematic flowchart of an image processing method provided by an embodiment of the present application.
  • FIG. 2B is a schematic flowchart of an image processing method provided by an embodiment of the present application.
  • 3A is a schematic diagram of a color histogram provided by an embodiment of the present application.
  • 3B is a schematic diagram of another color histogram provided by an embodiment of the present application.
  • FIG. 4A is a schematic flowchart of an image processing method according to another embodiment of the present application.
  • 4B is a specific flow chart of performing inversion processing on a negative image to obtain inverted image data in an embodiment of the application;
  • FIG. 4C is a specific flowchart of step S404 in the embodiment of this application.
  • FIG. 5A is a schematic diagram of determining the value of the first inverted component according to an embodiment of the present application.
  • FIG. 5B is a schematic diagram of determining a second inverse component value according to an embodiment of the present application.
  • FIG. 6 is a schematic flowchart of an image processing method provided by another embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of an image processing apparatus provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of an image processing device provided by another embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of a smart terminal provided by an embodiment of the present application.
  • the inventor found that the entire process of using the darkroom washing technology is relatively complicated, and it requires professional technicians to realize the washing of the negative film; and the neural network model after training is used for processing For color restoration of negative film images, a large number of negative film images are required as sample images. Since negative films are rarely produced, it is difficult to collect sample images.
  • the embodiment of the application provides an image processing method, which can convert a negative image into a digital image, which not only saves the user the time when the user takes the negative film to the image processing shop and waits for the professional technicians to use the darkroom processing technology to develop the negative film, but also Improve the convenience of converting negative images into digital images.
  • the embodiment of the application provides an image processing method that can be executed by a terminal.
  • the terminal 11 provides an image processing function for the user to execute the image processing method provided in the embodiment of the application. To convert negative images to digital images.
  • the aforementioned terminal 11 may include, but is not limited to, portable mobile terminals such as smart phones, tablet computers, laptop computers, and desktop computers.
  • the image processing function provided by the terminal 11 can be added as an independent function module to any application in the terminal; for example, the image processing function can be added as an independent function module to a camera application, Then the user can turn on the image processing function in the setting interface (or shooting interface) of the camera application; for another example, the image processing function can be added to the instant messaging application as an independent functional module, and the user can enter the instant messaging application. Turn on the image processing function in the setting interface (or conversation interface) of the application.
  • the image processing function can also be added to the system function option bar in the terminal as an independent system function in the terminal, that is, the user can turn on the image processing function in the system function option bar of the terminal.
  • the image processing function can also be added to the terminal as an independent application APP, that is, the user opens the image processing function by opening the application APP.
  • the mobile terminal After the mobile terminal collects the negative image, it can perform a series of image processing on the negative image to restore the digital image data of the negative image, thereby converting the negative image into a digital image.
  • the specific process can be shown in Figure 1D.
  • the mobile terminal may first perform inversion processing on the negative image to obtain inverted image data; the inverted image data may include the inverted color value of each pixel, and the inverted color value of each pixel includes the pixel in the RGB( (Optical three primary colors) the inverse component value of each color channel in the color space.
  • color equalization can be performed on the inverted image data to obtain the digital color value of each pixel in each color channel in the RGB color space; specifically, according to the inverted image data in the RGB color space
  • the pixel distribution map under each color channel performs value equalization processing on the color value of each pixel to obtain the digital color value of each pixel under each color channel in the RGB color space.
  • a color look-up table can be generated according to the digital color value of each pixel in each color channel in the RGB color space.
  • the color look-up table includes the corresponding relationship between the inverted color value of each pixel and the digital color; finally, it can be based on the color look-up table Perform image rendering to obtain a digital image corresponding to the negative image.
  • the mobile terminal can also output the digital image on the user interface for the user to view, as shown in FIG. 1E.
  • the image processing function provided by the embodiments of the present application enables the user to realize the digitization of the negative film in the terminal, and can avoid the complicated process of developing the negative film using the darkroom processing technology.
  • any negative film such as the negative film left by parents or other elders, or the negative film taken by film lovers now, etc.; even users who have no basic darkroom processing technology can use this image processing function easily and conveniently
  • the negative film can be converted into a digital image, and the digital image can be displayed, stored and transmitted through the terminal, eliminating the need to take the image processing shop to wait for processing, so that the image memory stored in the negative film can be restored portable.
  • FIG. 2A shows a schematic flowchart of an image processing method provided by an embodiment of the present application; the image processing method can be implemented by the aforementioned terminal, as shown in FIG. 2A As shown, the image processing method includes the following steps S21 to S24:
  • step S21 the negative image to be processed and the initial color value of each pixel in the negative image in the first color space are acquired.
  • step S22 inverting processing is performed on the negative image to obtain inverted image data, and the inverted color value of each pixel in the inverted image data is determined according to the initial color value of each pixel in the negative image.
  • steps S21-S22 can refer to steps S201-S202 or steps S401-S402 in the embodiment of the present application, which will not be repeated here.
  • step S23 according to the inverted image data, a value equalization process is performed on the intermediate color value of each pixel in the value range corresponding to the second color space to obtain the digital color value of each pixel.
  • step S23 can refer to step S203 in the embodiment of the present application, which will not be repeated here.
  • step S24 the digital image data of the negative image is obtained according to the digital color value of each pixel.
  • step S24 can be referred to step S204 in the embodiment of the present application, which will not be repeated here.
  • the intermediate color value when the first color space is the same as the second color space and is a target color space, the intermediate color value includes the inverted color value.
  • the intermediate color value when the first color space is different from the second color space, includes a converted color value obtained by converting the inverted color value.
  • converting the inverted color value includes: converting the inverted color value of each pixel in the inverted image data from the first color space to the second color space to obtain The converted color value of each pixel.
  • the performing value equalization processing on the intermediate color value of each pixel in the value range corresponding to the second color space to obtain the digital color value of each pixel includes: Perform value equalization processing on the converted color value of each pixel in the value range corresponding to the space to obtain the equalized color value of each pixel; convert the equalized color value of each pixel from the second color space to the first color space , To obtain the digital color value of each pixel.
  • FIG. 2B shows a schematic flowchart of an image processing method provided by an embodiment of the application; the image processing method can be implemented by the aforementioned terminal, as shown in FIG. 2B, the image processing method includes The following steps S201 to S204:
  • step S201 the negative image to be processed and the initial color value of each pixel in the negative image in the target color space are acquired.
  • the terminal when it detects the user's image shooting instruction for the negative film, it may respond to the image shooting instruction and call the camera component to shoot the negative film, so as to obtain the negative film image to be processed. After obtaining the negative image, the terminal can identify each pixel in the negative image to obtain the initial color value of each pixel in the target color space.
  • the target color space may include the RGB color space
  • the initial color value may be the initial RGB value
  • the initial color value may include the initial component value of the pixel in each color channel in the target color space, that is, the initial RGB of the pixel
  • the value may include an initial R value, an initial G value, and an initial B value.
  • step S202 according to the initial color value of each pixel in the negative image, inversion processing is performed on the negative image to obtain inverted image data.
  • the negative film is a film that records the color opposite to the true color of the subject during imaging. Then the initial color value of each pixel in the negative film image obtained by shooting the negative film is used to reflect the true color of each pixel Opposite colors. Therefore, after the inverted image is obtained, the negative image can be inverted to obtain inverted image data, so that the inverted color value of each pixel in the inverted image data can be used to reflect the true color of each pixel, and the inverted color value Can be inverted RGB values.
  • the inverted color value of each pixel is determined according to the initial color value of each pixel in the negative image; inversion processing refers to calculating the complementary value of the initial color value of each pixel in the negative image, and taking the complementary value of each pixel as The processing of the inverted color value of each pixel. Since the initial color value includes the initial component value of the pixel under each color channel in the target color space, in the specific implementation process of step S202, the terminal can separately calculate the initial component value of each pixel in the negative image under each channel in the target color space. The value is inverted to obtain the inverted component value of each pixel in each color channel in the target color space, and the inverted component value of each pixel is used to form the inverted color value of each pixel to obtain inverted image data.
  • step S203 according to the inverted image data, the inverted color value of each pixel is subjected to value equalization processing in the value range corresponding to the target color space to obtain the digital color value of each pixel.
  • the base of the negative film is usually coated with a certain chemical substance (such as a color mask) to prevent light from entering the photosensitive layer to reach the base and then reflecting back bad light; however, the chemical substance can interfere with the color, resulting in
  • the inverted image corresponding to the inverted image data obtained after the inverted processing may have obvious color shift visually.
  • the color histogram distribution of the inverted image data in the RGB color space shown in Figure 3A the color deviation phenomenon can be seen more intuitively, that is, the R channel (red channel), G channel (green channel), and B channel (blue Channel)
  • the color histograms corresponding to these three channels are almost staggered.
  • the embodiment of the present application may reverse the inverted image data corresponding to the Phase image undergoes color equalization processing.
  • the terminal may perform value equalization processing on the inverted color value of each pixel in the value range corresponding to the target color space according to the inverted image data to obtain the digital color value of each pixel.
  • the value range corresponding to the target color space may include the value range of each color channel in the target color space, and the value range of the color channel refers to the value range of the color value of the pixel in the color channel.
  • the value range corresponding to the target color space includes the value range of the R channel, the value range of the G channel, and the value range of the B channel; taking the R channel as an example, the color value of the pixel is in The value range under the R channel is 0-255, so the value range of the R channel is [0, 255].
  • step S203 may be: first determine the area range set formed by the maximum inverted color value and the minimum inverted color value in the inverted image data, and the area range set includes the target color space
  • the target area range formed by the minimum inversion component value and the maximum inversion component value under the target color channel can be collected from the area range, and the target color channel is any channel in the target color space.
  • x represents the inverted component value of the target pixel under the target color channel
  • a 1 represents the minimum inverted component value under the target channel
  • Q represents the proportional mapping parameter value
  • F(x) represents the target pixel under the target color channel Digital component value.
  • step S203 may also be: first obtain a pixel distribution map of the inverted image data in the target color space.
  • the pixel distribution map may include, but is not limited to: a color histogram and a color curve diagram. and many more. Then, according to the pixel distribution map, the inverted color value of each pixel is equalized in the value range corresponding to the target color space to obtain the digital color value of each pixel; the digital color value of each pixel can be a digital RGB value.
  • step S204 the digital image data of the negative image is obtained according to the digital color value of each pixel.
  • the terminal can obtain the digital image data of the negative image according to the digital color value of each pixel in step S204.
  • the terminal may directly use the digital color value of each pixel as the digital image data of the negative image, so that subsequent rendering can be directly performed according to the digital color value of each pixel to obtain a digital image corresponding to the negative image.
  • the terminal can establish a color lookup table of the inverted image data according to the digital color value of each pixel, and use the inverted image data and the color lookup table as the digital image data of the negative image, so that the The color look-up table finds the color corresponding to the inverted color value of each pixel in the inverted image data, and then performs rendering to obtain a digital image corresponding to the negative image.
  • the negative film image can be inverted first to obtain the reverse Image data including the inverted color value of each pixel. Then the inverted color value of each pixel can be equalized according to the inverted image data in the value range corresponding to the target color space, so that the digital color value of each pixel obtained by the equalized processing can more accurately reflect the true color Therefore, the accuracy of the digital image data of the negative image obtained from the digital color value can be improved.
  • FIG. 4A is a schematic flowchart of an image processing method according to another embodiment of the application. As shown in FIG. 4A, the image processing method includes the following steps S401 to S409:
  • the embodiments of the present application mainly take the target color space as an RGB color space as an example for illustration.
  • the target color space is other color spaces, please refer to the embodiments of the present application.
  • step S401 the negative image to be processed and the initial color value of each pixel in the negative image in the target color space are acquired.
  • step S402 inverting processing is performed on the negative image to obtain inverted image data, and the inverted color value of each pixel in the inverted image data is determined according to the initial color value of each pixel in the negative image.
  • the initial color value includes the initial component value of the pixel in each color channel in the target color space; correspondingly, the specific implementation of step S402 may be as shown in FIG. 4B, which is a negative image in the embodiment of the application.
  • the specific flowchart of performing inversion processing to obtain inverted image data includes the following steps S421 to S423:
  • step S421 the terminal obtains the value range of the target color channel, and the target color channel is any channel in the target color space.
  • step S423 the terminal obtains the inverted image data according to the inverted component value of each pixel in the target color channel.
  • the above method can be used to calculate the inverted component value of each pixel in each color channel in the target color space, so as to obtain the inverted color value of each pixel in the target color space.
  • the inverted color value includes the inverted color value of each pixel in the target color space.
  • the inverted component value of each color channel in the target color space; the inverted color value of each pixel in the target color space is added to the inverted image data.
  • step S403 a pixel distribution map of the inverted image data in the target color space is obtained, the pixel distribution map includes a pixel distribution map of the inverted image data in each color channel in the target color space, and the target color space includes an RGB color space .
  • any color channel from the target color space can be selected as the target color channel to obtain the inverted component value of each pixel in the inverted image data under the target color channel;
  • the inverted component value under the target color channel is in descending order, and the pixels are arranged to obtain the pixel distribution map of the inverted image data under the target color channel.
  • step S404 after obtaining the pixel distribution map of the inverted image data in the target color space, according to the pixel distribution map, perform value equalization processing on the inverted color value of each pixel in the value range corresponding to the target color space to obtain each The digital color value of the pixel.
  • Fig. 4C is a specific flowchart of step S404 in an embodiment of the application. As shown in Fig. 4C, it includes the following steps S11-S13:
  • S11 Determine the value of the numerical mapping parameter according to the pixel distribution map of the inverted image data under the target color channel and the value range of the target color channel.
  • the target color channel is any of the following channels: R channel, G channel or B channel;
  • the pixel distribution map of the target color channel can be a color histogram, the horizontal axis of the color histogram represents the inverted component value, and the vertical axis represents the inverted component value
  • the frequency of ie the number of pixels corresponding to the inverted component value.
  • the terminal can first determine the total area of the color histogram of the inverted image data under the target color channel; specifically, a rectangular area calculation formula can be used to determine the area of each column in the color histogram.
  • the first inverted component value and the second inverted component value can be determined from the inverted component values of each pixel in the target color channel. In one embodiment, based on the total area, the specific implementation of determining the first inverted component value from the inverted component value of each pixel in the target color channel can be seen in FIG.
  • Figure 5b the specific implementation of determining the second inverted component value from the inverted component value of each pixel in the target color channel can be seen in Figure 5b: Set a vertical line on the right side of the color histogram corresponding to the channel (that is, at the maximum inverted component value b), and gradually slide the vertical line from right to left; if the current position of the vertical line corresponds to the maximum inverted component value If the ratio of the partial area to the total area determined by the inverted component value satisfies the proportionality condition, stop sliding, and use the inverted component value corresponding to the current position of the vertical line as the second inverted component value b 1 , that is, the second inverted component value b 1 The ratio of the partial area (the black area shown in Figure 5b) to the total area determined by the phase component value and the maximum antiphase component value meets the proportionality condition.
  • the aforementioned ratio condition may include a condition that the ratio of the partial area to the total area is equal to a ratio threshold.
  • the ratio threshold can be set to 1% according to experience or business requirements. It should be noted that if the ratio of the area of the bar graph corresponding to the minimum inversion component value (that is, the first bar graph from left to right) to the total area is greater than or equal to the ratio threshold, the minimum inversion can be The component value is determined as the first inverted component value; if the ratio of the area of the histogram corresponding to the maximum inverted component value (that is, the first histogram from right to left) to the total area is greater than or equal to the ratio threshold, Then the maximum inversion component value can be determined as the second inversion component value.
  • the numerical mapping parameter can be calculated according to the value range formed by the first inverted component value and the second inverted component value, and the value range of the target color channel value.
  • S12 Calculate the inverted component value of the target pixel in the target color channel in the inverted image data according to the numerical mapping parameter value to obtain the digital component value of the target pixel in the target color channel.
  • the target pixel includes pixels whose inverted component value in the target color channel is not less than the first inverted component value and not greater than the second inverted component value, that is, the inverted component value of the target pixel is not less than the first inverted component value And not greater than the second inverted component value.
  • the numerical mapping algorithm is a mapping algorithm based on interpolation calculation, the specific algorithm can be seen in formula 1.2:
  • x represents the inverted component value of the target pixel under the target color channel
  • a 1 represents the first inverted component value
  • q represents the value of the numerical mapping parameter
  • a represents the minimum value of the target color channel
  • f(x) Represents the digital component value of the target pixel in the target color channel.
  • the digital component value of the first pixel under the target color channel is set as the value range of the target color channel If there is a second pixel whose inverted component value under the target color channel is greater than the second inverted component value, set the digital component value of the second pixel under the target color channel to the value range of the target color channel Maximum value.
  • the value range of the target color channel is [0, 255]; if the inverted component value of pixel 1 in the target color channel is 4, which is less than the first inverted component value of 5, then the pixel 1 is the first Pixel, the digital component value of the pixel 1 under the target color channel can be set to 0; if the inverted component value of the pixel 2 under the target color channel is 95, which is greater than the second inverted component value of 92, then the pixel 2 As the second pixel, the digital component value of the pixel 2 in the target color channel can be set to 255.
  • S13 Determine the digital color value of the target pixel according to the digital component value of the target pixel in the target color channel.
  • the terminal can add the digital component value of the target pixel under the target color channel to the digital color value of the target pixel.
  • the above steps S11-S12 can also be used to calculate the digital component value of the target pixel under each color channel in the target color space, and the digital component value of the target pixel under each color channel is used to form the digital color value of the target pixel.
  • step S405 after obtaining the digital color value of each pixel, the terminal obtains the digital color corresponding to the digital color value of each pixel.
  • step S406 according to the numerical mapping relationship between the inverted color value of each pixel and the digital color value, a color lookup table of the inverted image data is obtained, and the color lookup table includes the inverted color value of each pixel in the inverted image data. Correspondence with digital color.
  • the terminal may first obtain the numerical mapping relationship between the inverted color value and the digital color value of each pixel, and the pixel corresponding to the inverted color value having the numerical mapping relationship and the pixel corresponding to the digital color value are the same pixel . Secondly, according to the numerical mapping relationship between the inverted color value of each pixel and the digital color value, the corresponding relationship between the inverted color value of each pixel and the digital color corresponding to the digital color value with the mapping relationship can be determined.
  • the inverted color value of pixel a is (128, 128, 128) and the digital color value is (255, 255, 255)
  • the value mapping relationship of pixel a is (128, 128, 128) ⁇ (255) ,255,255); and the digital color corresponding to (255,255,255) is white
  • the inverted color value of pixel a has a corresponding relationship with the white digital color, and the corresponding relationship is (255,255,255) ⁇ white .
  • the corresponding relationship between the inverted color value of each pixel and the digital color can be used to construct a color lookup table;
  • the color lookup table can be expressed in the form of a table, and It can be represented in the form of a two-dimensional image.
  • the two-dimensional image can be a LUT (Look Up Table);
  • the LUT is a 512 ⁇ 512 image, and the LUT can be 8 ⁇ 8 It is composed of large square grids, and each large square grid can be composed of 64 ⁇ 64 small squares.
  • the embodiment of the application may use 64 ⁇ 64 small squares to store the R inverted component value and G inverted component value of pixels; wherein, the horizontal axis of each large square grid may be represented by the R channel value, and the vertical axis may be represented by the G channel Value representation; or the horizontal axis of each large square grid can be represented by the G channel value, and the vertical axis can be represented by the R channel value; for ease of explanation, the following embodiments of this application are represented by the horizontal axis using the R channel value and the vertical axis
  • the G channel value representation is explained as an example.
  • the embodiment of the present application can use 8 ⁇ 8 large squares to store the B inverted component value; since the value range of the B channel is also [0, 255], each large square stores 4 B inversion component value, that is, the B inversion component value stored in the first large square is [0, 4), the B inversion component value stored in the second large square is [4, 8)... and so on.
  • the B inverted component value can be stored using the principle of row first or column first;
  • the principle of row first means that the large square of the same row is preferentially used to store the B inverted component value
  • the principle of column priority refers to the principle that the large squares in the same column are used to store the B inverted component value, that is, the first large square and the second Two large squares are in the same column.
  • step S407 after the color look-up table is obtained, the inverted image data and the color look-up table are used as the digital image data of the negative image.
  • step S408 if an image display request is received, in response to the image display request, the color lookup table and the inverted image data are input to the rendering engine for rendering to obtain a digital image.
  • a rendering engine can be selected arbitrarily from GPUImage (an image rendering framework), such as GPUImageLookupFilter (a color lookup filter); the color lookup table and inverted image data are input into the GPUImageLookupFilter for rendering, and the digital image.
  • GPUImage an image rendering framework
  • GPUImageLookupFilter a color lookup filter
  • the color look-up table and the inverted image data are input to the rendering engine for rendering, so that the rendering engine can search for and render each pixel in parallel, and how to improve rendering efficiency.
  • step S409 after obtaining the digital image, the terminal displays the rendered digital image.
  • the negative film image can be inverted first to obtain the reverse Image data including the inverted color value of each pixel. Then, according to the pixel distribution map of the inverted image data in the target color space, the inverted color value of each pixel can be equalized in the value range corresponding to the target color space, so that the digital value of each pixel obtained by the equalized value is processed.
  • the color value can more accurately reflect the true color, so that the accuracy of the digital image data of the negative image obtained according to the digital color value can be improved.
  • the embodiment of the present application may also use a more refined partial color equalization processing method to perform color equalization processing on the reverse image, so as to achieve a better equalization effect.
  • the H channel (hue channel) can be stripped, and only the S channel (saturation channel) and V channel (luminance channel) can be equalized, so that the image can be obtained in continuous saturation and continuous brightness Better satisfaction.
  • FIG. 6 is a schematic flowchart of an image processing method according to another embodiment of the application. As shown in FIG. 6, the image processing method includes the following steps S601 to S606:
  • step S601 the negative image to be processed and the initial color value of each pixel in the negative image in the first color space are acquired.
  • step S602 inverting processing is performed on the negative image to obtain inverted image data.
  • the inverted color value of each pixel in the inverted image data is determined according to the initial color value of each pixel in the negative image.
  • steps S601-S602 can refer to steps S201-S202 or steps S401-S402 in the foregoing embodiment, and details are not described herein again.
  • step S603 after the inverted image data is obtained, the inverted color value of each pixel in the inverted image data is converted from the first color space to the second color space to obtain the converted color value of each pixel.
  • the first color space is an RGB color space
  • the second color space is an HSV color space.
  • step S604 the converted color value of each pixel is subjected to value equalization processing in the value range corresponding to the second color space to obtain the balanced color value of each pixel; the value range corresponding to the second color space may include those in the second color space The value range of each color channel.
  • step S604 may be: first determine the area range set formed by the maximum converted color value and the minimum converted color value from the converted color values of each pixel, and the area range set includes the second color
  • the area range formed by the minimum conversion component value and the maximum conversion component value under each color channel in the space secondly, according to the area range set, the converted color value of each pixel can be valued in the value range corresponding to the second color space
  • the equalization process obtains the equalized color value of each pixel.
  • the target area range formed by the minimum conversion component value and the maximum conversion component value of the target color channel may be collected from the area range, and the target color channel is the S channel or the V channel in the second color space.
  • the specific implementation manner of step S604 may also be: first determine the pixel distribution map of the inverted image data in the second color space according to the converted color value of each pixel; specifically, for the second color space Obtain the conversion component value of each pixel in the color channel; according to the conversion component value of each pixel in the color channel from small to large, arrange the pixels to obtain the inverted image data in the color channel. Pixel distribution map under the channel.
  • the pixel distribution diagram of the inverted image data in the second color space can be obtained, that is, the pixel distribution diagram of the inverted image data in the second color space may include the colors of the inverted image data in the second color space. Pixel distribution map under the channel.
  • the terminal may first determine the numerical mapping parameter value according to the pixel distribution map of the inverted image data under the target color channel and the value range of the target color channel, where the target color channel is the S channel or the V channel in the second color space . Then according to the numerical mapping parameter value, the conversion component value of the target pixel under the target color channel is calculated to obtain the equalization component value of the target pixel under the target color channel; the target pixel is determined according to the equalization component value of the target pixel under the target color channel The balanced color value.
  • the value range of the target color channel mentioned in the embodiment of this application is [0,1].
  • the specific implementation process in this embodiment please refer to the relevant description of step S203 or step S404 in the above-mentioned invention embodiment. , I won’t repeat it here.
  • step S605 after obtaining the balanced color value of each pixel, the balanced color value of each pixel is converted from the second color space to the first color space to obtain the digital color value of each pixel.
  • step S606 the digital image data of the negative image is obtained according to the digital color value of each pixel.
  • the negative film image can be inverted first to obtain the inverted image data.
  • the inverted image data includes the information of each pixel. Invert the color value. Then, the inverted color value of each pixel can be converted from the first color space to the second color space to obtain the converted color value of each pixel.
  • the embodiment of the present application provides a schematic structural diagram of an image processing apparatus as shown in FIG. 7.
  • the image processing device can be run in a smart terminal, and the image processing device can be a computer program (including program code) running in the smart terminal.
  • the image processing device in the embodiment of the present application may include:
  • the acquiring unit 101 is configured to acquire a negative image to be processed and the initial color value of each pixel in the negative image in the first color space;
  • the processing unit 102 is configured to perform inversion processing on the negative image to obtain inverted image data, and the inverted color value of each pixel in the inverted image data is determined according to the initial color value of each pixel in the negative image ;
  • the processing unit 102 is configured to perform value equalization processing on the intermediate color value of each pixel in the value range corresponding to the second color space according to the inverted image data to obtain the digital color value of each pixel;
  • the processing unit 102 is configured to obtain digital image data of the negative image according to the digital color value of each pixel.
  • the intermediate color value when the first color space is the same as the second color space and is a target color space, the intermediate color value includes the inverted color value.
  • the intermediate color value when the first color space is different from the second color space, includes a converted color value obtained by converting the inverted color value.
  • the processing unit 102 is further configured to convert the inverted color value of each pixel in the inverted image data from the first color space to the second color space to obtain the converted color value of each pixel.
  • the processing unit 102 is further configured to perform value equalization processing on the converted color value of each pixel in the value range corresponding to the second color space to obtain the balanced color value of each pixel;
  • the balanced color value of is converted from the second color space to the first color space to obtain the digital color value of each pixel.
  • each module unit in the image processing apparatus shown in FIG. 7 may also have the following functions:
  • the acquiring unit 101 is configured to acquire a negative image to be processed and the initial color value of each pixel in the negative image in the target color space;
  • the processing unit 102 is configured to perform inversion processing on the negative image to obtain inverted image data, and the inverted color value of each pixel in the inverted image data is determined according to the initial color value of each pixel in the negative image ;
  • the processing unit 102 is configured to perform value equalization processing on the inverted color value of each pixel in the value range corresponding to the target color space according to the inverted image data to obtain the digital color of each pixel value;
  • the processing unit 102 is configured to obtain digital image data of the negative image according to the digital color value of each pixel.
  • the initial color value includes the initial component value of the pixel in each color channel in the target color space; correspondingly, when the negative image is inverted to obtain the inverted image data, the processing unit 102 can be specifically used to: obtain the value range of a target color channel, where the target color channel is any color channel in the target color space; and combine the initial components of each pixel in the negative image under the target color channel Value and the maximum value of the value range of the target color channel to obtain the inverted component value of each pixel in the target color channel; according to the inverse component value of each pixel in the target color channel The phase component value obtains inverted image data.
  • the processing unit 102 may be specifically configured to: obtain the pixel distribution map of the inverted image data in the target color space; according to the pixel distribution map, compare all the pixels in the value range corresponding to the target color space.
  • the inverted color value of each pixel is subjected to value equalization processing to obtain the digital color value of each pixel.
  • the pixel distribution map includes a pixel distribution map of the inverted image data in each color channel in the target color space, and the target color space includes an RGB color space; correspondingly, according to The pixel distribution map performs value equalization processing on the inverted color value of each pixel in the value range corresponding to the target color space, and when the digital color value of each pixel is obtained, the processing unit 102 may be specifically configured to : Determine a numerical mapping parameter value according to the pixel distribution map of the inverted image data under the target color channel and the value range of the target color channel, and the target color channel is any of the following channels: R channel, G Channel or B channel; according to the numerical mapping parameter value, the inverted component value of the target pixel in the inverted image data under the target color channel is calculated to obtain that the target pixel is in the target color channel The digital component value of the target pixel; the digital color value of the target pixel is determined according to the digital component value of the target pixel in the target color channel.
  • the pixel distribution map is a color histogram; correspondingly, it is determined according to the pixel distribution map of the inverted image data under the target color channel and the value range of the target color channel
  • the processing unit 102 may be specifically configured to: determine the total area of the color histogram of the inverted image data under the target color channel; based on the total area, from the pixels in the The first inverted component value and the second inverted component value are determined from the inverted component values under the target color channel, and the partial area determined by the first inverted component value and the minimum inverted component value is equal to the total area
  • the ratio satisfies the ratio condition, and the ratio of the partial area determined by the second antiphase component value and the maximum antiphase component value to the total area satisfies the ratio condition; according to the first antiphase component value and the first antiphase component value
  • the numerical range formed by the two inverted component values and the value range of the target color channel are calculated to obtain the numerical mapping parameter value.
  • the inverted component value of the target pixel is not less than the first inverted component value and not greater than the second inverted component value; according to the pixel distribution map, the inverted component value of the target pixel Perform value equalization processing on the inverted color value of each pixel in the value range corresponding to the color space, and when the digital color value of each pixel is obtained, the processing unit 102 may also be used to: if there is an inverted color value in the target color channel A first pixel whose phase component value is less than the first inverted component value, then the digital component value of the first pixel in the target color channel is set to the minimum value of the target color channel; if If there is a second pixel whose inverted component value under the target color channel is greater than the second inverted component value, then the digital component value of the second pixel under the target color channel is set as the target color The maximum value of the range of the channel.
  • the processing unit 102 when obtaining the digital image data of the negative image according to the digital color value of each pixel, the processing unit 102 may be specifically configured to: obtain the digital color corresponding to the digital color value of each pixel; According to the numerical mapping relationship between the inverted color value of each pixel and the digital color value, a color look-up table of the inverted image data is obtained, and the color look-up table includes the inverse of each pixel in the inverted image data. Correspondence between phase color value and digital color; using the inverted image data and the color look-up table as the digital image data of the negative image.
  • processing unit 102 may be further configured to: in response to an image display request, input the color look-up table and the inverted image data to a rendering engine for rendering to obtain a digital image; and display the rendered digital image .
  • the negative film image can be inverted first to obtain the reverse Image data including the inverted color value of each pixel. Then the inverted color value of each pixel can be equalized according to the inverted image data in the value range corresponding to the target color space, so that the digital color value of each pixel obtained by the equalized processing can more accurately reflect the true color Therefore, the accuracy of the digital image data of the negative image obtained from the digital color value can be improved.
  • the embodiment of the present application also provides a schematic structural diagram of an image processing device as shown in FIG. 8.
  • the image processing device can be run in a smart terminal, and the image processing device can be a computer program (including program code) running in the smart terminal.
  • the image processing device in the embodiment of the present application may include:
  • the acquiring unit 201 is configured to acquire the negative image to be processed and the initial color value of each pixel in the negative image in the first color space;
  • the processing unit 202 is configured to perform inversion processing on the negative image to obtain inverted image data, and the inverted color value of each pixel in the inverted image data is determined according to the initial color value of each pixel in the negative image ;
  • a conversion unit 203 configured to convert the inverted color value of each pixel in the inverted image data from the first color space to the second color space to obtain the converted color value of each pixel;
  • the processing unit 202 is configured to perform value equalization processing on the converted color value of each pixel in the value range corresponding to the second color space to obtain the balanced color value of each pixel;
  • the conversion unit 203 is configured to convert the balanced color value of each pixel from the second color space to the first color space to obtain the digital color value of each pixel;
  • the processing unit 202 is configured to obtain the digital image data of the negative image according to the digital color value of each pixel.
  • the first color space is an RGB color space
  • the second color space is an HSV color space
  • the converted color value of each pixel is subjected to value equalization processing in the value range corresponding to the second color space, and when the equalized color value of each pixel is obtained, the processing unit 202 can specifically use Yu: Determine the pixel distribution map of the inverted image data in the second color space according to the converted color value of each pixel; according to the pixel distribution map, in the value range corresponding to the second color space Perform value equalization processing on the converted color value of each pixel to obtain the balanced color value of each pixel.
  • the pixel distribution map includes a pixel distribution map of the inverted image data in each color channel in the second color space, and the second color space is an HSV color space; correspondingly,
  • the processing unit 202 may specifically Used for: determining a numerical mapping parameter value according to the pixel distribution map of the inverted image data in the target color channel and the value range of the target color channel, where the target color channel is in the second color space Calculate the conversion component value of the target pixel in the target color channel according to the value of the numerical mapping parameter to obtain the equalized component value of the target pixel in the target color channel ; Determine the balanced color value of the target pixel according to the balanced component value of the target pixel in the target color channel.
  • the negative film image can be inverted first to obtain the inverted image data.
  • the inverted image data includes the information of each pixel. Invert the color value. Then, the inverted color value of each pixel can be converted from the first color space to the second color space to obtain the converted color value of each pixel.
  • the embodiment of the present application also proposes a schematic structural diagram of a smart terminal in FIG. 9; as shown in FIG. 9, the smart terminal may include one or more processors 301; one or more input devices 302, one or Multiple output devices 303 and storage 304.
  • the aforementioned processor 301, input device 302, output device 303, and memory 304 are connected via a bus 305.
  • the memory 304 is configured to store a computer program, the computer program includes program instructions, and the processor 301 is configured to execute the program instructions stored in the memory 304 to execute the image processing method shown in FIG. 2A, FIG. 2B, FIG. 4, or FIG. .
  • the processor 301 may be a central processing unit (Central Processing Unit, CPU), and the processor may also be another general-purpose processor, that is, a microprocessor or any conventional processor.
  • the memory 304 may include a read-only memory and a random access memory, and provides instructions and data to the processor 301. Therefore, the processor 301 and the memory 304 are not limited here.
  • the embodiment of the present application also provides a computer storage medium, the computer storage medium stores computer program instructions, and the processor 301 loads and executes one or more computer program instructions stored in the computer storage medium to implement the foregoing FIG. 2A and FIG. The corresponding steps of the method in the corresponding embodiment shown in 2B, FIG. 4 or FIG. 6.
  • a computer storage medium stores computer program instructions, which can be loaded by the processor 301 and execute the following steps:
  • the inverted color value of each pixel in the inverted image data is determined according to the initial color value of each pixel in the negative image;
  • the digital image data of the negative image is obtained according to the digital color value of each pixel.
  • the initial color value includes the initial component value of the pixel in each color channel in the target color space; correspondingly, when the negative image is inverted to obtain the inverted image data, the first A computer program instruction can be loaded and specifically executed by the processor 301: obtain the value range of the target color channel, the target color channel being any color channel in the target color space; and place each pixel in the negative image in the The difference between the initial component value under the target color channel and the maximum value of the value range of the target color channel is calculated to obtain the inverted component value of each pixel under the target color channel; The inverted component values under the target color channel obtain inverted image data.
  • the inverted color value of each pixel is equalized in the value range corresponding to the target color space to obtain the digital color of each pixel Value
  • the first computer program instruction can be loaded and specifically executed by the processor 301: obtain the pixel distribution map of the inverted image data in the target color space; according to the pixel distribution map, in the target color space Perform value equalization processing on the inverted color value of each pixel in the corresponding value range to obtain the digital color value of each pixel.
  • the pixel distribution map includes a pixel distribution map of the inverted image data in each color channel in the target color space, and the target color space includes an RGB color space; correspondingly, according to The pixel distribution map performs value equalization processing on the inverted color value of each pixel in the value range corresponding to the target color space, and when the digital color value of each pixel is obtained, the first computer program instruction can be
  • the processor 301 loads and specifically executes: determining a numerical mapping parameter value according to the pixel distribution map of the inverted image data under the target color channel and the value range of the target color channel, and the target color channel is any of the following One channel: R channel, G channel or B channel; according to the numerical mapping parameter value, the inverted component value of the target pixel in the inverted image data under the target color channel is calculated to obtain the target pixel
  • the digital component value under the target color channel; the digital color value of the target pixel is determined according to the digital component value of the target pixel under the target color channel.
  • the pixel distribution map is a color histogram; correspondingly, it is determined according to the pixel distribution map of the inverted image data under the target color channel and the value range of the target color channel
  • the first computer program instruction can be loaded and specifically executed by the processor 301: determine the total area of the color histogram of the inverted image data under the target color channel; based on the total area, Each pixel determines a first inverted component value and a second inverted component value from the inverted component values in the target color channel, and the first inverted component value and the minimum inverted component value determine the local
  • the ratio of the area to the total area satisfies the ratio condition, and the ratio of the partial area and the total area determined by the second inversion component value and the maximum inversion component value satisfies the ratio condition;
  • the numerical value range formed by the phase component value and the second inverted component value and the value range of the target color channel are calculated to obtain the numerical mapping parameter value.
  • the inverted component value of the target pixel is not less than the first inverted component value and not greater than the second inverted component value; correspondingly, according to the pixel distribution map,
  • the first computer program instruction may also be loaded and executed by the processor 301 : If there is a first pixel whose inverted component value under the target color channel is less than the first inverted component value, set the digital component value of the first pixel under the target color channel to The minimum value of the value range of the target color channel; if there is a second pixel whose inverted component value under the target color channel is greater than the second inverted component value, place the second pixel in the target color channel The value of the digital component below is set to the maximum value of the value range of the target color channel.
  • the first computer program instruction can be loaded by the processor 301 and specifically executed: Obtain the digital color value of each pixel The digital color corresponding to the color value; according to the numerical mapping relationship between the inverted color value of each pixel and the digital color value, a color lookup table of the inverted image data is obtained, and the color lookup table includes the inverted The corresponding relationship between the inverted color value of each pixel in the image data and the digital color; the inverted image data and the color look-up table are used as the digital image data of the negative image.
  • the first computer program instruction may also be loaded and executed by the processor 301: in response to an image display request, input the color look-up table and the inverted image data to the rendering engine for rendering to obtain digital Image; displays the rendered digital image.
  • the first color space is an RGB color space
  • the second color space is an HSV color space
  • the second computer program instructs The processor 301 can be loaded and specifically executed: determine the pixel distribution map of the inverted image data in the second color space according to the converted color value of each pixel; according to the pixel distribution map, in the second color space Perform value equalization processing on the converted color value of each pixel in the value range corresponding to the color space to obtain the equalized color value of each pixel.
  • the pixel distribution map includes a pixel distribution map of the inverted image data in each color channel in the second color space, and the second color space is an HSV color space; correspondingly,
  • the second computer program The instructions can be loaded and specifically executed by the processor 301: according to the pixel distribution map of the inverted image data under the target color channel and the value range of the target color channel, determine the value of the numerical mapping parameter, and the target color channel is The S channel or the V channel in the second color space; according to the numerical mapping parameter value, the conversion component value of the target pixel in the target color channel is calculated to obtain the target pixel in the target The equalized component value under the color channel; the equalized color value of the target pixel is determined according to the equalized component value of the target pixel under the target color channel.
  • the negative film image can be inverted first to obtain the reverse Image data including the inverted color value of each pixel. Then the inverted color value of each pixel can be equalized according to the inverted image data in the value range corresponding to the target color space, so that the digital color value of each pixel obtained by the equalized processing can more accurately reflect the true color Therefore, the accuracy of the digital image data of the negative image obtained from the digital color value can be improved.
  • the program can be stored in a computer readable storage medium. During execution, it may include the procedures of the above-mentioned method embodiments.
  • the storage medium may be a magnetic disk, an optical disc, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

本申请实施例公开了一种图像处理方法、装置、终端及存储介质,其中方法包括:获取待处理的负片图像及所述负片图像中各像素在第一颜色空间中的初始颜色值;对所述负片图像进行反相处理得到反相图像数据,所述反相图像数据中各像素的反相颜色值是根据所述负片图像中各像素的初始颜色值确定的;根据所述反相图像数据,在第二颜色空间所对应的值域内对所述各像素的中间颜色值进行值均衡处理,得到所述各像素的数码颜色值;根据所述各像素的数码颜色值得到所述负片图像的数码图像数据。

Description

图像处理方法、装置、终端及存储介质
本申请要求于2019年5月9日提交中国专利局、申请号为201910386977.4、名称为“图像处理方法、装置、终端及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及图像处理技术领域,尤其涉及一种图像处理方法、装置、终端及存储介质。
背景
胶片,又可称为底片,是一种成像器材。而胶片中最为常见的是负片,所谓负片是一种成像时记录与被摄物的真实色彩相反的颜色的胶片。目前,将负片转换为数码图像的方法主要包括以下两种方案:第一种是采用暗房冲洗技术对负片进行冲洗得到纸质照片,然后通过扫描仪对纸质照片进行扫描从而得到数码图像。第二种是采用机器学习算法对神经网络模型进行训练,调用训练后的神经网络模型对待处理的负片图像进行色彩复原,得到数码图像。
技术内容
本申请实施例提供了一种图像处理方法,包括:
获取待处理的负片图像及所述负片图像中各像素在第一颜色空间中的初始颜色值;
对所述负片图像进行反相处理得到反相图像数据,所述反相图像数据中各像素的反相颜色值是根据所述负片图像中各像素的初始颜色值确定的;
根据所述反相图像数据,在第二颜色空间所对应的值域内对所述各像素的中间颜色值进行值均衡处理,得到所述各像素的数码颜色值;
根据所述各像素的数码颜色值得到所述负片图像的数码图像数据。
本申请实施例还提供了一种图像处理装置,包括:
获取单元,用于获取待处理的负片图像及所述负片图像中各像素在第一颜色空间中的初始颜色值;
处理单元,用于对所述负片图像进行反相处理得到反相图像数据,所述反相图像数据中各像素的反相颜色值是根据所述负片图像中各像素的初始颜色值确定的;
所述处理单元,用于根据所述反相图像数据,在第二颜色空间所对应的值域内对所述各像素的中间颜色值进行值均衡处理,得到所述各像素的数码颜色值;
所述处理单元,用于根据所述各像素的数码颜色值得到所述负片图像的数码图像数据。
本申请实施例还提供一种智能终端,包括处理器、输入设备、输出设备和存储器,所述处理器、输入设备、输出设备和存储器相互连接,其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行上述任意一种图像处理方法。
本申请实施例还提供一种计算机存储介质,该计算机存储介质存储有计算机程序指令,该计算机程序指令适于由处理器加载并执行上述任意一种图像处理方法。
附图说明
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1A是本申请实施例提供的一种图像处理功能的应用场景图;
图1B是本申请实施例提供的一种图像处理功能的应用场景图;
图1C是本申请实施例提供的一种图像处理功能的应用场景图;
图1D是本申请实施例提供的一种图像处理的流程示意图;
图1E是本申请实施例提供的一种图像处理功能的应用场景图;
图2A是本申请实施例提供的一种图像处理方法的流程示意图;
图2B是本申请实施例提供的一种图像处理方法的流程示意图;
图3A是本申请实施例提供的一种颜色直方图的示意图;
图3B是本申请实施例提供的另一种颜色直方图的示意图;
图4A是本申请另一实施例提供的一种图像处理方法的流程示意图;
图4B为本申请实施例中对负片图像进行反相处理得到反相图像数据的具体流程图;
图4C本申请实施例中步骤S404的具体流程图;
图5A是本申请实施例提供的一种确定第一反相分量值的示意图;
图5B是本申请实施例提供的一种确定第二反相分量值的示意图;
图6是本申请另一实施例提供的一种图像处理方法的流程示意图;
图7是本申请实施例提供的一种图像处理装置的结构示意图;
图8是本申请另一实施例提供的一种图像处理装置的结构示意图;
图9是本申请实施例提供的一种智能终端的结构示意图。
实施方式
在将待处理的负片转换为数码图像的过程中,发明人发现采用暗房冲洗技术的整个流程较为复杂,需要专业的技术人员才可实现对负片的冲洗;而采用训练后的神经网络模型对待处理的负片图像进行色彩复原,需要大量的负片图像作为样本图像,由于负片已极少被生产,因此导致了样本图像的收集难度较大。
本申请实施例提供一种图像处理方法,该图像处理方法可以将负片图像转换为数码图像,不仅可以节省用户将负片拿到图像冲洗店等待专业技术人员采用暗房冲洗技术冲洗负片的时间,还可以提高将负片图像转换为数码图像的便利性。
在本申请实施例中,本申请实施例提供一种图像处理方法可以由终端执行,如图1A所示,该终端11为用户提供一个图像处理功能,可以执行本申请实施例提供的图像处理方法,将负片图像转换为数码图像。
其中,上述终端11可以包括但不限于:智能手机、平板电脑、膝上计算机等便携式移动终端,以及台式计算机等等。
在一种实施方式中,上述终端11提供的图像处理功能可以作为独立的功能模块添加到终端内的任一应用中;例如,可以将该图像处理功能作为独立的功能模块添加至相机应用中,则用户可以在该相机应用的设置界面(或者拍摄界面)中打开该图像处理功能;又如,可以将该图像处理功能作为独立的功能模块添加至即时通讯应用中,则用户可以在该即时通讯应用的设置界面(或者会话界面)中打开该图像处理功能。再一种实施方式中,该图像处理功能也可以作为终端内独立的系统功能添加至终端内的系统功能选项栏中,即用户可以在终端的系统功能选项栏中打开该图像处理功能。再一种实施方式中,该图像处理功能还可以作为一个独立的应用APP添加至终端中,即用户通过打开该应用APP以开启该图像处理功能。
下面以图像处理功能作为一个独立的应用APP添加至移动终端中为例,对该图像处理功能进行阐述:用户想要将某负片转换为数码图像时,可以打开移动终端中的图像处理功能。移动终端检测到用户针对图像处理功能的打开操作后,可以启动运行该图像处理功能,并在用户界面中输出提示信息,以提示用户对负片进行图像拍摄,如图1B所示。用户可根据该提示信息对负片进行拍摄,移动终端检测到用户的拍摄操作后,可调用移动终端的摄像组件对负片进行图像采集,并将采集到的图像作为负片图像,如图1C所示。
移动终端在采集到负片图像之后,可以对负片图像进行一系列的图像处理,还原出负片图像的数码图像数据,从而将负片图像转换为数码图像,其具体流程可以一并参见图1D所示。具体的,移动终端可以先对负片图像进行反相处理,得到反相图像数据;该反相图像数据可包括各像素的反相颜色值,每个像素的反相颜色值均包括像素在RGB(光学三原色)颜色空间中各颜色通道下的反相分量值。在得到反相图像数据之后,可以对反相图像数据进行颜色均衡处理,得到各像素在RGB颜色空间中各颜色通道下的数码颜色值;具体的,可以根据反相图像数据在RGB颜色空间中各颜色通道下的像素分布图,对各像素的颜色值进行值均衡处理,得到各像素在RGB颜色空间中各颜色通道下的数码颜色值。然后,可以根据各像素在RGB颜色空间中各颜色通道下的数码颜色值生成颜色查找表,该颜色查找表包括各像素的反相颜色值和数码颜色的对应关系;最后可基 于该颜色查找表进行图像渲染,得到负片图像对应的数码图像。移动终端在得到负片图像的数码图像之后,还可在用户界面输出该数码图像以供用户查看,如图1E所示。
由此可见,本申请实施例所提供的图像处理功能使得用户在终端中即可实现负片的数码化,可以避免复杂的采用暗房冲洗技术对负片进行冲洗的工艺流程。针对任一负片,例如父母或者其他长辈旧时留存下来的负片,或者胶片爱好者现在所拍摄出来的负片,等等;即使是毫无暗房冲洗工艺基础的用户也可通过该图像处理功能轻松且便利地将该负片转换为数码图像,并可通过终端显示、存储以及传播该数码图像,省去了拿去图像冲洗店等待冲洗的过程,使得负片所存储的图像记忆可以便携地被还原。
基于上述图像处理功能的相关描述,图2A中示出了本申请实施例提供的一种图像处理方法的示意流程图;该图像处理方法可以由上述所提及的终端来实现,如图2A所示,该图像处理方法包括以下步骤S21~S24:
步骤S21中,获取待处理的负片图像及所述负片图像中各像素在第一颜色空间中的初始颜色值。
步骤S22中,对所述负片图像进行反相处理得到反相图像数据,所述反相图像数据中各像素的反相颜色值是根据所述负片图像中各像素的初始颜色值确定的。
在一些实施例中,步骤S21-S22的具体实施方式可以参见本申请实施例中的步骤S201-S202或者步骤S401-S402,在此不再赘述。
步骤S23中,根据所述反相图像数据,在第二颜色空间所对应的值域内对所述各像素的中间颜色值进行值均衡处理,得到所述各像素的数码颜色值。
在一些实施例中,步骤S23的具体实施方式可以参见本申请实施例中的步骤S203,在此不再赘述。
步骤S24中,根据所述各像素的数码颜色值得到所述负片图像的数码图像数据。
在一些实施例中,步骤S24的具体实施方式可以参见本申请实施例中的步骤S204,在此不再赘述。
在一些实施例中,当所述第一颜色空间与所述第二颜色空间相同且为目标颜色空间时,所述中间颜色值包括所述反相颜色值。
在一些实施例中,当所述第一颜色空间与所述第二颜色空间不同时,所述中间颜色值包括将所述反相颜色值进行转换后得到的转换颜色值。
在一些实施例中,将所述反相颜色值进行转换,包括:将所述反相图像数据中各像素的反相颜色值从所述第一颜色空间转换至所述第二颜色空间,得到所述各像素的转换颜色值。
在一些实施例中,所述在第二颜色空间所对应的值域内对所述各像素的中间颜色值进行值均衡处理,得到所述各像素的数码颜色值,包括:在所述第二颜色空间所对应的值域内对所述各像素的转换颜色值进行值均衡处理,得到所述各像素的均衡颜色值;将所述各像素的均衡颜色值从第二颜色空间转换至第一颜色空间,得到所述各像素的数码颜色值。
如前所述,当所述第一颜色空间与所述第二颜色空间相同且为目标颜色空间时,所述中间颜色值包括所述反相颜色值,本申请实施例提供了一种图像处理方法,图2B中示出了本申请实施例提供的一种图像处理方法的示意流程图;该图像处理方法可以由上述所提及的终端来实现,如图2B所示,该图像处理方法包括以下步骤S201~S204:
步骤S201中,获取待处理的负片图像及负片图像中各像素在目标颜色空间中的初始颜色值。
具体的,终端在检测到用户针对负片的图像拍摄指令时,可响应于该图像拍摄指令,调用摄像组件对负片进行拍摄,从而得到待处理的负片图像。在得到负片图像之后,终端可对负片图像中各像素进行识别,得到各像素在目标颜色空间中的初始颜色值。在一种实施方式中,目标颜色空间可包括RGB颜色空间,初始颜色值可为初始RGB值;初始颜色值可包括像素在目标颜色空间中各颜色通道下的初始分量值,即像素的初始RGB值可包括初始R值、初始G值以及初始B值。
步骤S202中,根据所述负片图像中各像素的初始颜色值,对所述负片图像进行反相处理得到反相图像数据。
由前述可知,负片是一种成像时记录与被摄物的真实色彩相反的颜色的胶片,那么对负片进行拍摄所得到的负片图像中各像素的初始颜色值用于反映与各像素的真实颜色相反的颜色。因此,在得到反相图像之后,可以对负片图像进行反相处理得到反相图像数据,以使得反相图像数据中各像素的反相颜色值可用于反映各像素的真实颜色,反相颜色值可为反相RGB值。其中,各像素的反相颜色值是根据负片图像中各像素的初始颜色值确定的;反相处理是指计算负片图像中各像素的初始颜色值的补值,并将各像素的补值作为各像素的反相颜色值的处理。由于初始颜色值包括像素在目标颜色空间中各颜色通道下的初始分量值,因此在步骤S202的具体实施过程中,终端可分别对负片图像中各像素在目标颜色空间中各通道下的初始分量值进行反相处理,得到各像素在目标颜色空间中各颜色通道下的反相分量值,采用各像素的反相分量值构成各像素的反相颜色值,从而得到反相图像数据。
步骤S203中,根据所述反相图像数据,在所述目标颜色空间所对应的值域内对所述各像素的反相颜色值进行值均衡处理,得到所述各像素的数码颜色值。
研究表明,负片的片基上通常会涂有某种化学物质(例如色罩),以防止光线进入感光层到达片基后再反射回不良光线;但是该化学物质会对颜色造成干扰,从而导致反相处理后所得到的反相图像数据所对应的反相图像在视觉上可能发生明显的色偏现象。根据图3A所示的反相图像数据在RGB颜色空间中的颜色直方图分布,可以较为直观地看出色偏现象,即R通道(红色通道)、G通道(绿色通道)以及B通道(蓝色通道)这三个通道所对应的颜色直方图几乎相互错开。因此,为了使R通道、G通道以及B通道这三个通道对应的颜色直方图协调分布(如图3B所示)以解决色偏问题,本申请实施例可对反相图像数据所对应的反相图像进行颜色均衡处理。
具体的,终端可以根据反相图像数据,在目标颜色空间中所对应的值域内对各像素的反相颜色值进行值均衡处理,得到各像素的数码颜色值。其中,目标颜色空间所对应的值域可以包括目标颜色空间中各颜色通道的值域,颜色通道的值域是指像素的颜色值在该颜色通道下的取值范围。例如,如果目标颜色空间为RGB颜色空间,那么目标颜色空间所对应的值域包括R通道的值域、G通道的 值域以及B通道的值域;以R通道为例,像素的颜色值在R通道下的取值范围为0-255,因此R通道的值域为[0,255]。
在一种实施方式中,步骤S203的具体实施方式可以是:先确定反相图像数据中的最大反相颜色值和最小反相颜色值所构成的区域范围集,该区域范围集包括目标颜色空间中各颜色通道下的最小反相分量值和最大反相分量值所构成的区域范围;其次,可根据该区域范围集,在目标颜色空间所对应的值域内对各像素的反相颜色值进行值均衡处理,得到各像素的数码颜色值。具体的,可以从区域范围集中获取目标颜色通道下的最小反相分量值和最大反相分量值所构成的目标区域范围,目标颜色通道为目标颜色空间中的任一通道。计算目标颜色通道的值域和该目标区域范围的比值,得到比例映射参数;例如,设目标颜色通道的值域为[0,255],目标颜色通道下的最小反相分量值和最大第二反相分量值构成的数值范围为[5,56],则比例映射参数等于:(255-0)/(56-5)=5。采用该比例映射参数对各像素在目标颜色通道下的反相分量值进行计算,得到各像素在目标颜色通道下的数码分量值;具体的,可以将各像素在目标颜色通道下的反相分量值代入式1.1中进行计算,得到各像素在目标颜色通道下的数码分量值。
F(x)=(x-A 1)×Q    式1.1
其中,x表示目标像素在目标颜色通道下的反相分量值,A 1表示目标通道下的最小反相分量值,Q表示比例映射参数值,F(x)表示目标像素在目标颜色通道下的数码分量值。得到各像素在目标颜色通道下的数码分量值之后,可以根据各像素在目标颜色通道下的数码分量值得到各像素的数码颜色值。
再一种实施方式中,步骤S203的具体实施方式还可以是:先获取反相图像数据在目标颜色空间中的像素分布图,该像素分布图可以包括但不限于:颜色直方图、颜色曲线图等等。然后根据像素分布图,在目标颜色空间所对应的值域内对各像素的反相颜色值进行值均衡处理,得到各像素的数码颜色值;各像素的数码颜色值可为数码RGB值。
步骤S204中,根据所述各像素的数码颜色值得到所述负片图像的数码图像数据。
在得到各像素的数码颜色值之后,终端可以在步骤S204中根据各像素的数 码颜色值得到负片图像的数码图像数据。在一种实施方式中,终端可以直接将各像素的数码颜色值作为负片图像的数码图像数据,以使得后续可直接根据各像素的数码颜色值进行渲染,得到负片图像对应的数码图像。再一种实施方式中,终端可以根据各像素的数码颜色值建立反相图像数据的颜色查找表,并将反相图像数据和颜色查找表作为负片图像的数码图像数据,以使得后续可根据在颜色查找表查找到反相图像数据中各像素的反相颜色值所对应的颜色,从而进行渲染得到负片图像对应的数码图像。
本申请实施例中,由于负片记录的是与真实色彩相反的颜色,因此在获取到负片图像中各像素在目标颜色空间中的初始颜色值之后,可以先对负片图像进行反相处理得到反相图像数据,该反相图像数据包括各像素的反相颜色值。然后可根据反相图像数据在目标颜色空间所对应的值域内对各像素的反相颜色值进行值均衡处理,使得值均衡处理所得到的各像素的数码颜色值可以较为准确地反映出真实色彩,从而可以提高根据数码颜色值所得到的负片图像的数码图像数据的准确度。由上述图像处理流程可知,本申请实施例无需采用复杂的暗房冲洗技术对负片进行冲洗,也无需采用大量的负片图像进行模型训练,可以在一定程度上降低图像处理的复杂度,并提高图像处理的可实现性。
本申请实施例还提出了另一种图像处理方法,该图像处理方法可以由上述所提及的终端来实现。图4A为本申请另一实施例提供的一种图像处理方法的流程示意图,如图4A所示,该图像处理方法包括以下步骤S401~S409:
本申请实施例主要以目标颜色空间为RGB颜色空间为例进行阐述,当目标颜色空间为其他颜色空间时的具体实施方式可以参见本申请实施例。
步骤S401中,获取待处理的负片图像及负片图像中各像素在目标颜色空间中的初始颜色值。
步骤S402中,对负片图像进行反相处理得到反相图像数据,该反相图像数据中各像素的反相颜色值是根据负片图像中各像素的初始颜色值确定的。
由前述可知,初始颜色值包括像素在目标颜色空间中各颜色通道下的初始分量值;相应的,步骤S402的具体实施方式可以如图4B所示,图4B为本申请实施例中对负片图像进行反相处理得到反相图像数据的具体流程图,如图4B所示, 包括以下步骤S421~S423:
步骤S421,终端获取目标颜色通道的值域,该目标颜色通道为目标颜色空间中的任一通道。
步骤S422,终端将负片图像中各像素在目标颜色通道下的初始分量值与目标颜色通道的值域的最大值进行差值计算,得到各像素在目标颜色通道下的反相分量值;例如,设目标颜色通道的值域的最大值为255,那么反相分量值=255-初始分量值。
步骤S423,终端根据各像素在目标颜色通道下的反相分量值得到反相图像数据。
具体的,可以采用上述方法计算得到各像素在目标颜色空间中各颜色通道下的反相分量值,从而得到各像素在目标颜色空间中的反相颜色值,该反相颜色值包括各像素在目标颜色空间中各颜色通道下的反相分量值;将各像素在目标颜色空间中的反相颜色值添加至反相图像数据中。
步骤S403中,获取反相图像数据在目标颜色空间中的像素分布图,该像素分布图包括反相图像数据在目标颜色空间中各颜色通道下的像素分布图,该目标颜色空间包括RGB颜色空间。
具体的,在得到反相图像数据之后,可以从目标颜色空间中选取任一颜色通道作为目标颜色通道,获取反相图像数据中各像素在目标颜色通道下的反相分量值;按照各像素在目标颜色通道下的反相分量值从小到大的顺序,对各像素进行排列得到反相图像数据在目标颜色通道下的像素分布图。
步骤S404中,在得到反相图像数据在目标颜色空间中的像素分布图之后,根据像素分布图,在目标颜色空间所对应的值域内对各像素的反相颜色值进行值均衡处理,得到各像素的数码颜色值。
图4C为本申请实施例中步骤S404的具体流程图,如图4C所示,包括以下步骤S11-S13:
S11,根据反相图像数据在目标颜色通道下的像素分布图以及目标颜色通道的值域,确定数值映射参数值。
目标颜色通道为以下任一通道:R通道、G通道或者B通道;目标颜色通道 的像素分布图可以为颜色直方图,颜色直方图的横轴表示反相分量值,纵轴表示反相分量值的频次(即反相分量值所对应的像素的数量)。在具体实施过程中,终端可以先确定反相图像数据在目标颜色通道下的颜色直方图的总面积;具体的,可以采用矩形的面积计算公式确定颜色直方图中各柱形图的面积,求取各柱形图的面积的总和作为颜色直方图的总面积;也可以根据颜色直方图的最小反相分量值和最大反相分量值进行积分运算,得到颜色直方图的总面积。其次,可以基于该总面积,从各像素在目标颜色通道下的反相分量值中确定第一反相分量值和第二反相分量值。在一种实施方式中,基于总面积,从各像素在目标颜色通道下的反相分量值中确定第一反相分量值的具体实施方式可参见图5a所示:可以在目标颜色通道对应的颜色直方图的左侧(即最小反相分量值a处)设置一条垂直线,将该垂直线从左向右逐渐滑动;若垂直线的当前位置所对应的反相分量值与最小反相分量值所确定的局部面积与总面积的比值满足比例条件,则停止滑动,并将垂直线的当前位置所对应的反相分量值作为第一反相分量值a 1,即第一反相分量值与最小反相分量值所确定的局部面积(如图5a所示的黑色面积)与总面积的比值满足比例条件。
同理,再一种实施方式中,基于总面积,从各像素在目标颜色通道下的反相分量值中确定第二反相分量值的具体实施方式可参见图5b所示:可以在目标颜色通道对应的颜色直方图的右侧(即最大反相分量值b处)设置一条垂直线,将该垂直线从右向左逐渐滑动;若垂直线的当前位置所对应的反相分量值与最大反相分量值所确定的局部面积与总面积的比值满足比例条件,则停止滑动,并将垂直线的当前位置所对应的反相分量值作为第二反相分量值b 1,即第二反相分量值与最大反相分量值所确定的局部面积(如图5b所示的黑色面积)与总面积的比值满足比例条件。上述所提及的比例条件可包括局部面积和总面积的比值等于比例阈值的条件,该比例阈值可根据经验值或者业务需求,例如可设置为1%。需要说明的是,若最小反相分量值所对应的柱形图(即从左往右的第一个柱形图)的面积与总面积的比值大于或等于比例阈值,则可将最小反相分量值确定为第一反相分量值;若最大反相分量值所对应的柱形图(即从右往左的第一个柱形图)的面积与总面积的比值大于或等于比例阈值,则可将最大反相分量值确定为第二 反相分量值。
在确定第一反相分量值和第二反相分量值之后,可以根据第一反相分量值与第二反相分量值构成的数值范围,以及目标颜色通道的值域,计算得到数值映射参数值。具体的,终端可以计算目标颜色通道的值域和该数值范围之间的比例,将计算得到的比例作为数值映射参数值。举例来说,设目标颜色通道的值域为[0,255],第一反相分量值和第二反相分量值构成的数值范围为[5,92];那么数值映射参数值等于:(255-0)/(92-5)=3。
S12,根据数值映射参数值,对反相图像数据中目标像素在目标颜色通道下的反相分量值进行计算,得到目标像素在目标颜色通道下的数码分量值。
其中,目标像素包括在目标颜色通道下反相分量值不小于第一反相分量值且不大于第二反相分量值的像素,即目标像素的反相分量值不小于第一反相分量值且不大于第二反相分量值。在具体实施过程中,可以调用数值映射算法根据该数值映射参数值,对反相图像数据中目标像素在目标颜色通道下的反相分量值进行计算,得到目标像素在目标颜色通道下的数码分量值。其中,该数值映射算法是一种基于插值计算的映射算法,具体算法可参见式1.2所示:
f(x)=(x-a 1)×q+a     式1.2
其中,x表示目标像素在目标颜色通道下的反相分量值,a 1表示第一反相分量值,q表示数值映射参数值,a表示目标颜色通道的值域的最小值,f(x)表示目标像素在目标颜色通道下的数码分量值。参照步骤s11中的举例,目标颜色通道的值域为[0,255],第一反相分量值和第二反相分量值构成的数值范围为[5,92],那么数值映射参数值q等于3;设目标像素在目标颜色通道下的反相分量值为6,那么采用式1.1可计算得到目标像素在目标颜色通道下的数码分量值为:(6-5)×3+0=3。
需要说明的是:若存在目标颜色通道下的反相分量值小于第一反相分量值的第一像素,则将第一像素在目标颜色通道下的数码分量值设置为目标颜色通道的值域的最小值;若存在目标颜色通道下的反相分量值大于第二反相分量值的第二像素,则将第二像素在目标颜色通道下的数码分量值设置为目标颜色通道的值域的最大值。承前述例子,目标颜色通道的值域为[0,255];若存在像素1在目标 颜色通道下的反相分量值为4,小于第一反相分量值5,则该像素1为第一像素,可将该像素1在目标颜色通道下的数码分量值设置为0;若存在像素2在目标颜色通道下的反相分量值为95,大于第二反相分量值92,则该像素2为第二像素,可将该像素2在目标颜色通道下的数码分量值设置为255。
S13,根据目标像素在目标颜色通道下的数码分量值确定目标像素的数码颜色值。
终端可以将目标像素在目标颜色通道下的数码分量值添加至目标像素的数码颜色值中。还可以采用上述步骤S11-S12计算得到目标像素在目标颜色空间中各颜色通道下的数码分量值,采用目标像素在各颜色通道下的数码分量值构成目标像素的数码颜色值。
步骤S405中,在得到各像素的数码颜色值之后,终端获取各像素的数码颜色值对应的数码颜色。
步骤S406中,根据各像素的反相颜色值和数码颜色值之间的数值映射关系,得到反相图像数据的颜色查找表,该颜色查找表包括反相图像数据中各像素的反相颜色值和数码颜色的对应关系。
具体的,终端可以先获取各像素的反相颜色值和数码颜色值之间的数值映射关系,具有数值映射关系的反相颜色值所对应的像素和数码颜色值所对应的像素为同一个像素。其次,可以根据各像素的反相颜色值和数码颜色值之间的数值映射关系,确定各像素的反相颜色值与具有映射关系的数码颜色值所对应的数码颜色之间的对应关系。举例来说,像素a的反相颜色值为(128,128,128),数码颜色值为(255,255,255),那么像素a的数值映射关系为(128,128,128)→(255,255,255);而(255,255,255)对应的数码颜色为白色,那么像素a的反相颜色值与白色数码颜色具有对应关系,其对应关系为(255,255,255)→白色。
在得到各像素的反相颜色值和数码颜色的对应关系后,可以采用各像素的反相颜色值与数码颜色的对应关系构建颜色查找表;该颜色查找表可以以表格的形式进行表示,也可以二维图像的形式进行表示。当颜色查找表以二维图像的形式进行表示时,该二维图像可以是LUT(Look Up Table,显示查找表);该LUT是 一张512×512大小的图像,该LUT可由8×8个大正方形格子组成,每个大正方形格子可由64×64个小正方形组成。本申请实施例可采用64×64个小正方形存储像素的R反相分量值和G反相分量值;其中,每个大正方形格子的横轴可采用R通道值表示,纵轴可采用G通道值表示;或者每个大正方形格子的横轴可采用G通道值表示,纵轴可采用R通道值表示;为便于阐述,本申请实施例后续均以横轴采用R通道值表示,纵轴采用G通道值表示为例进行阐述。由于R通道的值域为[0,255],共256个数值,因此每个小正方形的宽度值为256/64=4,R通道值的集合为[0,4,8,12,16,...,255];同理,每个小正方形的高度值也为256/64=4,G通道值的集合也为[0,4,8,12,16,...,255]。
而不同于R值和G值,本申请实施例可采用8×8个大正方形存储B反相分量值;由于B通道的值域也为[0,255],因此每个大正方形存储4个B反相分量值,即第一个大正方形存储的B反相分量值为[0,4),第二个大正方形存储的B反相分量值为[4,8)…以此类推。需要说明的是,B反相分量值可以采用行优先的原则进行存储,也可以采用列优先的原则进行存储;其中,行优先的原则是指优先采用同一行的大正方形存储B反相分量值的原则,即第一个大正方形和第二个大正方形位于同一行;列优先的原则是指优先采用同一列的大正方形存储B反相分量值的原则,即第一个大正方形和第二个大正方形位于同一列。以行优先的原则存储B反相分量值为例,对如何采用各像素的反相颜色值与数码颜色的对应关系构建颜色查找表(如LUT)进行详细阐述:设像素b的反相颜色值为(5,5,1),数码颜色值为(0,0,0),那么像素b的反相颜色值与数码颜色的对应关系为(5,5,1)→黑色。首先,可根据像素b的B反相分量值1定位至第一个大正方形;其次,可将第一个大正方形中(5,5)所指示的位置作为像素b的颜色绘制位置,并在该颜色绘制位置处绘制黑色。
步骤S407中,在得到颜色查找表之后,将反相图像数据和颜色查找表作为负片图像的数码图像数据。
步骤S408中,若接收到图像显示请求,则响应于该图像显示请求,将颜色查找表和反相图像数据输入至渲染引擎进行渲染,得到数码图像。
具体的,可以从GPUImage(一种图像渲染框架)中任意选取一个渲染引擎, 例如GPUImageLookupFilter(一种颜色查找滤镜);将颜色查找表和反相图像数据输入至该GPUImageLookupFilter中进行渲染,得到数码图像。本申请实施将颜色查找表和反相图像数据一并输入至渲染引擎进行渲染,使得渲染引擎可以并行查找并渲染各个像素,从何提升渲染效率。
步骤S409中,终端在得到数码图像之后,显示渲染得到的数码图像。
本申请实施例中,由于负片记录的是与真实色彩相反的颜色,因此在获取到负片图像中各像素在目标颜色空间中的初始颜色值之后,可以先对负片图像进行反相处理得到反相图像数据,该反相图像数据包括各像素的反相颜色值。然后可根据反相图像数据在目标颜色空间中的像素分布图,在目标颜色空间所对应的值域内对各像素的反相颜色值进行值均衡处理,使得值均衡处理所得到的各像素的数码颜色值可以较为准确地反映出真实色彩,从而可以提高根据数码颜色值所得到的负片图像的数码图像数据的准确度。由上述图像处理流程可知,本申请实施例无需采用复杂的暗房冲洗技术对负片进行冲洗,也无需采用大量的负片图像进行模型训练,可以在一定程度上降低图像处理的复杂度,并提高图像处理的可实现性。
再一个实施例中,本申请实施例还可采用更加精细的局部颜色均衡处理方法对反相图像进行颜色均衡处理,从而达到更好的均衡效果。例如,可以在HSV颜色空间中,将H通道(色相通道)剥离,只对S通道(饱和度通道)以及V通道(亮度通道)进行均衡化,使得图像可以在饱和度连续和亮度连续上得到更好的满足。
基于此,本申请实施例还提出了另一种图像处理方法的示意流程图;该图像处理方法可以由上述所提及的终端来实现。图6为本申请另一实施例提供的一种图像处理方法的流程示意图,如图6所示,该图像处理方法包括以下步骤S601~S606:
步骤S601中,获取待处理的负片图像及负片图像中各像素在第一颜色空间中的初始颜色值。
步骤S602中,对负片图像进行反相处理得到反相图像数据,该反相图像数据中各像素的反相颜色值是根据负片图像中各像素的初始颜色值确定的。
需要说明的是,步骤S601-S602的具体实施方式可以参见前述实施例中的步骤S201-S202或者步骤S401-S402,在此不再赘述。
步骤S603中,在得到反相图像数据之后,将反相图像数据中各像素的反相颜色值从第一颜色空间转换至第二颜色空间,得到各像素的转换颜色值。其中,第一颜色空间为RGB颜色空间,第二颜色空间为HSV颜色空间。
步骤S604中,在第二颜色空间所对应的值域内对各像素的转换颜色值进行值均衡处理,得到各像素的均衡颜色值;第二颜色空间所对应的值域可以包括第二颜色空间中各颜色通道的值域。
在一种实施方式中,步骤S604的具体实施方式可以是:先从各像素的转换颜色值中确定最大转换颜色值和最小转换颜色值所构成的区域范围集,该区域范围集包括第二颜色空间中各颜色通道下的最小转换分量值和最大转换分量值所构成的区域范围;其次,可根据该区域范围集,在第二颜色空间所对应的值域内对各像素的转换颜色值进行值均衡处理,得到各像素的均衡颜色值。具体的,可以从区域范围集中获取目标颜色通道下的最小转换分量值和最大转换分量值所构成的目标区域范围,目标颜色通道为第二颜色空间中的S通道或者V通道。计算目标颜色通道的值域和该目标区域范围的比值,得到比例映射参数;采用该比例映射参数对各像素在目标颜色通道下的转换分量值进行计算,得到各像素在目标颜色通道下的均衡分量值;根据各像素在目标颜色通道下的均衡分量值得到各像素的均衡颜色值。需要说明的是,本申请实施例所提及的目标颜色通道的值域为[0,1],此实施方式下的具体实施过程可以参见上述发明实施例中的步骤S203的相关描述,在此不再赘述。
再一种实施方式中,步骤S604的具体实施方式还可以是:先根据各像素的转换颜色值确定反相图像数据在第二颜色空间中的像素分布图;具体的,针对第二颜色空间中的任一颜色通道,获取各像素在该颜色通道下的转换分量值;按照各像素在该颜色通道下的转换分量值从小到大的顺序,对各像素进行排列得到反相图像数据在该颜色通道下的像素分布图。重复上述步骤,可以得到反相图像数据在第二颜色空间中的像素分布图,即反相图像数据在第二颜色空间中的像素分布图可包括反相图像数据在第二颜色空间中各颜色通道下的像素分布图。其次, 根据像素分布图,在第二颜色空间所对应的值域内对各像素的反相颜色值进行值均衡处理,得到各像素的均衡颜色值。具体的,终端可先根据反相图像数据在目标颜色通道下的像素分布图以及目标颜色通道的值域,确定数值映射参数值,该目标颜色通道为第二颜色空间中的S通道或者V通道。然后根据数值映射参数值,对目标像素在目标颜色通道下的转换分量值进行计算,得到目标像素在目标颜色通道下的均衡分量值;根据目标像素在目标颜色通道下的均衡分量值确定目标像素的均衡颜色值。需要说明的是,本申请实施例所提及的目标颜色通道的值域为[0,1],此实施方式下的具体实施过程可以参见上述发明实施例中的步骤S203或者步骤S404的相关描述,在此不再赘述。
步骤S605中,在得到各像素的均衡颜色值之后,将各像素的均衡颜色值从第二颜色空间转换至第一颜色空间,得到各像素的数码颜色值。
步骤S606中,根据各像素的数码颜色值得到负片图像的数码图像数据。
本申请实施例中,由于负片记录的是与真实色彩相反的颜色,因此在获取到负片图像之后,可以先对负片图像进行反相处理得到反相图像数据,该反相图像数据包括各像素的反相颜色值。然后可将各像素的反相颜色值从第一颜色空间转换至第二颜色空间,得到各像素的转换颜色值。在第二颜色空间所对应的值域内对各像素的转换颜色值进行值均衡处理,得到各像素的均衡颜色值;并将各像素的均衡颜色值从第二颜色空间转换至第一颜色空间,得到各像素的数码颜色值,该数码颜色值可以较为准确地反映出真实色彩,从而可以提高根据数码颜色值所得到的负片图像的数码图像数据的准确度。由上述图像处理流程可知,本申请实施例无需采用复杂的暗房冲洗技术对负片进行冲洗,也无需采用大量的负片图像进行模型训练,可以在一定程度上降低图像处理的复杂度,并提高图像处理的可实现性。
基于上述方法实施例的描述,在一个实施例中,本申请实施例提供了一种如图7所示的图像处理装置的结构示意图。该图像处理装置可运行于智能终端中,该图像处理装置可以是运行于智能终端中的一个计算机程序(包括程序代码)。如图7所示,本申请实施例中的图像处理装置可包括:
获取单元101,用于获取待处理的负片图像及所述负片图像中各像素在第一 颜色空间中的初始颜色值;
处理单元102,用于对所述负片图像进行反相处理得到反相图像数据,所述反相图像数据中各像素的反相颜色值是根据所述负片图像中各像素的初始颜色值确定的;
所述处理单元102,用于根据所述反相图像数据,在第二颜色空间所对应的值域内对所述各像素的中间颜色值进行值均衡处理,得到所述各像素的数码颜色值;
所述处理单元102,用于根据所述各像素的数码颜色值得到所述负片图像的数码图像数据。
在一些实施例中,当所述第一颜色空间与所述第二颜色空间相同且为目标颜色空间时,所述中间颜色值包括所述反相颜色值。
在一些实施例中,当所述第一颜色空间与所述第二颜色空间不同时,所述中间颜色值包括将所述反相颜色值进行转换后得到的转换颜色值。
所述处理单元102,进一步用于将所述反相图像数据中各像素的反相颜色值从所述第一颜色空间转换至所述第二颜色空间,得到所述各像素的转换颜色值。
所述处理单元102,进一步用于在所述第二颜色空间所对应的值域内对所述各像素的转换颜色值进行值均衡处理,得到所述各像素的均衡颜色值;将所述各像素的均衡颜色值从第二颜色空间转换至第一颜色空间,得到所述各像素的数码颜色值。
基于上述方法实施例的描述,在一个实施例中,本申请实施例提供的如图7所示的图像处理装置中的各模块单元还可以具有如下功能:
获取单元101,用于获取待处理的负片图像及所述负片图像中各像素在目标颜色空间中的初始颜色值;
处理单元102,用于对所述负片图像进行反相处理得到反相图像数据,所述反相图像数据中各像素的反相颜色值是根据所述负片图像中各像素的初始颜色值确定的;
所述处理单元102,用于根据所述反相图像数据,在所述目标颜色空间所对应的值域内对所述各像素的反相颜色值进行值均衡处理,得到所述各像素的数码 颜色值;
所述处理单元102,用于根据所述各像素的数码颜色值得到所述负片图像的数码图像数据。
在一种实施方式中,所述初始颜色值包括像素在目标颜色空间中各颜色通道下的初始分量值;相应的,在对所述负片图像进行反相处理得到反相图像数据时,处理单元102可具体用于:获取目标颜色通道的值域,所述目标颜色通道为所述目标颜色空间中的任一颜色通道;将所述负片图像中各像素在所述目标颜色通道下的初始分量值与所述目标颜色通道的值域的最大值进行差值计算,得到所述各像素在所述目标颜色通道下的反相分量值;根据所述各像素在所述目标颜色通道下的反相分量值得到反相图像数据。
再一种实施方式中,在根据所述反相图像数据,在所述目标颜色空间所对应的值域内对所述各像素的反相颜色值进行值均衡处理,得到所述各像素的数码颜色值时,处理单元102可具体用于:获取所述反相图像数据在所述目标颜色空间中的像素分布图;根据所述像素分布图,在所述目标颜色空间所对应的值域内对所述各像素的反相颜色值进行值均衡处理,得到所述各像素的数码颜色值。
再一种实施方式中,所述像素分布图包括所述反相图像数据在所述目标颜色空间中各颜色通道下的像素分布图,所述目标颜色空间包括RGB颜色空间;相应的,在根据所述像素分布图,在所述目标颜色空间所对应的值域内对所述各像素的反相颜色值进行值均衡处理,得到所述各像素的数码颜色值时,处理单元102可具体用于:根据所述反相图像数据在所述目标颜色通道下的像素分布图以及所述目标颜色通道的值域,确定数值映射参数值,所述目标颜色通道为以下任一通道:R通道、G通道或者B通道;根据所述数值映射参数值,对所述反相图像数据中目标像素在所述目标颜色通道下的反相分量值进行计算,得到所述目标像素在所述目标颜色通道下的数码分量值;根据所述目标像素在所述目标颜色通道下的数码分量值确定所述目标像素的数码颜色值。
再一种实施方式中,所述像素分布图为颜色直方图;相应的,在根据所述反相图像数据在所述目标颜色通道下的像素分布图以及所述目标颜色通道的值域,确定数值映射参数值时,处理单元102可具体用于:确定所述反相图像数据在所 述目标颜色通道下的颜色直方图的总面积;基于所述总面积,从所述各像素在所述目标颜色通道下的反相分量值中确定第一反相分量值和第二反相分量值,所述第一反相分量值与最小反相分量值所确定的局部面积与所述总面积的比值满足比例条件,所述第二反相分量值和最大反相分量值所确定的局部面积与所述总面积的比值满足所述比例条件;根据所述第一反相分量值与所述第二反相分量值构成的数值范围,以及所述目标颜色通道的值域,计算得到数值映射参数值。
再一种实施方式中,所述目标像素的反相分量值不小于所述第一反相分量值且不大于所述第二反相分量值;在根据所述像素分布图,在所述目标颜色空间所对应的值域内对所述各像素的反相颜色值进行值均衡处理,得到所述各像素的数码颜色值时,处理单元102还可用于:若存在所述目标颜色通道下的反相分量值小于所述第一反相分量值的第一像素,则将所述第一像素在所述目标颜色通道下的数码分量值设置为所述目标颜色通道的值域的最小值;若存在所述目标颜色通道下的反相分量值大于所述第二反相分量值的第二像素,则将所述第二像素在所述目标颜色通道下的数码分量值设置为所述目标颜色通道的值域的最大值。
再一种实施方式中,在根据所述各像素的数码颜色值得到所述负片图像的数码图像数据时,处理单元102可具体用于:获取所述各像素的数码颜色值对应的数码颜色;根据所述各像素的反相颜色值和数码颜色值之间的数值映射关系,得到所述反相图像数据的颜色查找表,所述颜色查找表包括所述反相图像数据中各像素的反相颜色值和数码颜色的对应关系;将所述反相图像数据和所述颜色查找表作为所述负片图像的数码图像数据。
再一种实施方式中,处理单元102还可用于:响应于图像显示请求,将所述颜色查找表和所述反相图像数据输入至渲染引擎进行渲染,得到数码图像;显示渲染得到的数码图像。
本申请实施例中,由于负片记录的是与真实色彩相反的颜色,因此在获取到负片图像中各像素在目标颜色空间中的初始颜色值之后,可以先对负片图像进行反相处理得到反相图像数据,该反相图像数据包括各像素的反相颜色值。然后可根据反相图像数据在目标颜色空间所对应的值域内对各像素的反相颜色值进行值均衡处理,使得值均衡处理所得到的各像素的数码颜色值可以较为准确地反映 出真实色彩,从而可以提高根据数码颜色值所得到的负片图像的数码图像数据的准确度。由上述图像处理流程可知,本申请实施例无需采用复杂的暗房冲洗技术对负片进行冲洗,也无需采用大量的负片图像进行模型训练,可以在一定程度上降低图像处理的复杂度,并提高图像处理的可实现性。
再一个实施例中,本申请实施例还提供了一种如图8所示的图像处理装置的结构示意图。该图像处理装置可运行于智能终端中,该图像处理装置可以是运行于智能终端中的一个计算机程序(包括程序代码)。如图8所示,本申请实施例中的图像处理装置可包括:
获取单元201,用于获取待处理的负片图像及所述负片图像中各像素在第一颜色空间中的初始颜色值;
处理单元202,用于对所述负片图像进行反相处理得到反相图像数据,所述反相图像数据中各像素的反相颜色值是根据所述负片图像中各像素的初始颜色值确定的;
转换单元203,用于将所述反相图像数据中各像素的反相颜色值从所述第一颜色空间转换至所述第二颜色空间,得到所述各像素的转换颜色值;
所述处理单元202,用于在所述第二颜色空间所对应的值域内对所述各像素的转换颜色值进行值均衡处理,得到所述各像素的均衡颜色值;
所述转换单元203,用于将所述各像素的均衡颜色值从第二颜色空间转换至第一颜色空间,得到所述各像素的数码颜色值;
所述处理单元202,用于根据所述各像素的数码颜色值得到所述负片图像的数码图像数据。
在一种实施方式中,所述第一颜色空间为RGB颜色空间,所述第二颜色空间为HSV颜色空间。
再一种实施方式中,在所述第二颜色空间所对应的值域内对所述各像素的转换颜色值进行值均衡处理,得到所述各像素的均衡颜色值时,处理单元202可具体用于:根据所述各像素的转换颜色值确定所述反相图像数据在所述第二颜色空间中的像素分布图;根据所述像素分布图,在所述第二颜色空间所对应的值域内对所述各像素的转换颜色值进行值均衡处理,得到所述各像素的均衡颜色值。
再一种实施方式中,所述像素分布图包括所述反相图像数据在所述第二颜色空间中各颜色通道下的像素分布图,所述第二颜色空间为HSV颜色空间;相应的,在根据所述像素分布图,在所述第二颜色空间所对应的值域内对所述各像素的转换颜色值进行值均衡处理,得到所述各像素的均衡颜色值时,处理单元202可具体用于:根据所述反相图像数据在所述目标颜色通道下的像素分布图以及所述目标颜色通道的值域,确定数值映射参数值,所述目标颜色通道为所述第二颜色空间中的S通道或者V通道;根据所述数值映射参数值,对所述目标像素在所述目标颜色通道下的转换分量值进行计算,得到所述目标像素在所述目标颜色通道下的均衡分量值;根据所述目标像素在所述目标颜色通道下的均衡分量值确定所述目标像素的均衡颜色值。
本申请实施例中,由于负片记录的是与真实色彩相反的颜色,因此在获取到负片图像之后,可以先对负片图像进行反相处理得到反相图像数据,该反相图像数据包括各像素的反相颜色值。然后可将各像素的反相颜色值从第一颜色空间转换至第二颜色空间,得到各像素的转换颜色值。在第二颜色空间所对应的值域内对各像素的转换颜色值进行值均衡处理,得到各像素的均衡颜色值;并将各像素的均衡颜色值从第二颜色空间转换至第一颜色空间,得到各像素的数码颜色值,该数码颜色值可以较为准确地反映出真实色彩,从而可以提高根据数码颜色值所得到的负片图像的数码图像数据的准确度。由上述图像处理流程可知,本申请实施例无需采用复杂的暗房冲洗技术对负片进行冲洗,也无需采用大量的负片图像进行模型训练,可以在一定程度上降低图像处理的复杂度,并提高图像处理的可实现性。
基于上述描述,本申请实施例还在图9中提出一种智能终端的结构示意图;如图9所示,智能终端可包括一个或多个处理器301;一个或多个输入设备302,一个或多个输出设备303和存储器304。上述处理器301、输入设备302、输出设备303和存储器304通过总线305连接。存储器304用于存储计算机程序,所述计算机程序包括程序指令,处理器301用于执行所述存储器304存储的程序指令以执行上述图2A、图2B、图4或图6所示的图像处理方法。
在一个实施例中,该处理器301可以是中央处理单元(Central Processing  Unit,CPU),该处理器还可以是其他通用处理器,即微处理器或者任何常规的处理器。该存储器304可以包括只读存储器和随机存取存储器,并向处理器301提供指令和数据。因此,在此对于处理器301和存储器304不作限定。
本申请实施例还提供一种计算机存储介质,所述计算机存储介质存储有计算机程序指令,由处理器301加载并执行计算机存储介质中存放的一条或多条计算机程序指令以实现上述图2A、图2B、图4或图6所示的相应实施例中的方法的相应步骤。在一个实施例中,计算机存储介质存储有计算机程序指令,该计算机程序指令可由处理器301加载并执行如下步骤:
获取待处理的负片图像及所述负片图像中各像素在第一颜色空间中的初始颜色值;
对所述负片图像进行反相处理得到反相图像数据,所述反相图像数据中各像素的反相颜色值是根据所述负片图像中各像素的初始颜色值确定的;
根据所述反相图像数据,在第二颜色空间所对应的值域内对所述各像素的中间颜色值进行值均衡处理,得到所述各像素的数码颜色值;
根据所述各像素的数码颜色值得到所述负片图像的数码图像数据。
在一种实施方式中,所述初始颜色值包括像素在目标颜色空间中各颜色通道下的初始分量值;相应的,在对所述负片图像进行反相处理得到反相图像数据时,该第一计算机程序指令可由处理器301加载并具体执行:获取目标颜色通道的值域,所述目标颜色通道为所述目标颜色空间中的任一颜色通道;将所述负片图像中各像素在所述目标颜色通道下的初始分量值与所述目标颜色通道的值域的最大值进行差值计算,得到所述各像素在所述目标颜色通道下的反相分量值;根据所述各像素在所述目标颜色通道下的反相分量值得到反相图像数据。
再一种实施方式中,在根据所述反相图像数据,在所述目标颜色空间所对应的值域内对所述各像素的反相颜色值进行值均衡处理,得到所述各像素的数码颜色值时,该第一计算机程序指令可由处理器301加载并具体执行:获取所述反相图像数据在所述目标颜色空间中的像素分布图;根据所述像素分布图,在所述目标颜色空间所对应的值域内对所述各像素的反相颜色值进行值均衡处理,得到所述各像素的数码颜色值。
再一种实施方式中,所述像素分布图包括所述反相图像数据在所述目标颜色空间中各颜色通道下的像素分布图,所述目标颜色空间包括RGB颜色空间;相应的,在根据所述像素分布图,在所述目标颜色空间所对应的值域内对所述各像素的反相颜色值进行值均衡处理,得到所述各像素的数码颜色值时,该第一计算机程序指令可由处理器301加载并具体执行:根据所述反相图像数据在所述目标颜色通道下的像素分布图以及所述目标颜色通道的值域,确定数值映射参数值,所述目标颜色通道为以下任一通道:R通道、G通道或者B通道;根据所述数值映射参数值,对所述反相图像数据中目标像素在所述目标颜色通道下的反相分量值进行计算,得到所述目标像素在所述目标颜色通道下的数码分量值;根据所述目标像素在所述目标颜色通道下的数码分量值确定所述目标像素的数码颜色值。
再一种实施方式中,所述像素分布图为颜色直方图;相应的,在根据所述反相图像数据在所述目标颜色通道下的像素分布图以及所述目标颜色通道的值域,确定数值映射参数值时,该第一计算机程序指令可由处理器301加载并具体执行:确定所述反相图像数据在所述目标颜色通道下的颜色直方图的总面积;基于所述总面积,从所述各像素在所述目标颜色通道下的反相分量值中确定第一反相分量值和第二反相分量值,所述第一反相分量值与最小反相分量值所确定的局部面积与所述总面积的比值满足比例条件,所述第二反相分量值和最大反相分量值所确定的局部面积与所述总面积的比值满足所述比例条件;根据所述第一反相分量值与所述第二反相分量值构成的数值范围,以及所述目标颜色通道的值域,计算得到数值映射参数值。
再一种实施方式中,所述目标像素的反相分量值不小于所述第一反相分量值且不大于所述第二反相分量值;相应的,在根据所述像素分布图,在所述目标颜色空间所对应的值域内对所述各像素的反相颜色值进行值均衡处理,得到所述各像素的数码颜色值时,该第一计算机程序指令还可由处理器301加载并执行:若存在所述目标颜色通道下的反相分量值小于所述第一反相分量值的第一像素,则将所述第一像素在所述目标颜色通道下的数码分量值设置为所述目标颜色通道的值域的最小值;若存在所述目标颜色通道下的反相分量值大于所述第二反相分量值的第二像素,则将所述第二像素在所述目标颜色通道下的数码分量值设置为 所述目标颜色通道的值域的最大值。
再一种实施方式中,在根据所述各像素的数码颜色值得到所述负片图像的数码图像数据时,该第一计算机程序指令可由处理器301加载并具体执行:获取所述各像素的数码颜色值对应的数码颜色;根据所述各像素的反相颜色值和数码颜色值之间的数值映射关系,得到所述反相图像数据的颜色查找表,所述颜色查找表包括所述反相图像数据中各像素的反相颜色值和数码颜色的对应关系;将所述反相图像数据和所述颜色查找表作为所述负片图像的数码图像数据。
再一种实施方式中,该第一计算机程序指令还可由处理器301加载并执行:响应于图像显示请求,将所述颜色查找表和所述反相图像数据输入至渲染引擎进行渲染,得到数码图像;显示渲染得到的数码图像。
在一种实施方式中,所述第一颜色空间为RGB颜色空间,所述第二颜色空间为HSV颜色空间。
再一种实施方式中,在所述第二颜色空间所对应的值域内对所述各像素的转换颜色值进行值均衡处理,得到所述各像素的均衡颜色值时,该第二计算机程序指令可由处理器301加载并具体执行:根据所述各像素的转换颜色值确定所述反相图像数据在所述第二颜色空间中的像素分布图;根据所述像素分布图,在所述第二颜色空间所对应的值域内对所述各像素的转换颜色值进行值均衡处理,得到所述各像素的均衡颜色值。
再一种实施方式中,所述像素分布图包括所述反相图像数据在所述第二颜色空间中各颜色通道下的像素分布图,所述第二颜色空间为HSV颜色空间;相应的,在根据所述像素分布图,在所述第二颜色空间所对应的值域内对所述各像素的转换颜色值进行值均衡处理,得到所述各像素的均衡颜色值时,该第二计算机程序指令可由处理器301加载并具体执行:根据所述反相图像数据在所述目标颜色通道下的像素分布图以及所述目标颜色通道的值域,确定数值映射参数值,所述目标颜色通道为所述第二颜色空间中的S通道或者V通道;根据所述数值映射参数值,对所述目标像素在所述目标颜色通道下的转换分量值进行计算,得到所述目标像素在所述目标颜色通道下的均衡分量值;根据所述目标像素在所述目标颜色通道下的均衡分量值确定所述目标像素的均衡颜色值。
本申请实施例中,由于负片记录的是与真实色彩相反的颜色,因此在获取到负片图像中各像素在目标颜色空间中的初始颜色值之后,可以先对负片图像进行反相处理得到反相图像数据,该反相图像数据包括各像素的反相颜色值。然后可根据反相图像数据在目标颜色空间所对应的值域内对各像素的反相颜色值进行值均衡处理,使得值均衡处理所得到的各像素的数码颜色值可以较为准确地反映出真实色彩,从而可以提高根据数码颜色值所得到的负片图像的数码图像数据的准确度。由上述图像处理流程可知,本申请实施例无需采用复杂的暗房冲洗技术对负片进行冲洗,也无需采用大量的负片图像进行模型训练,可以在一定程度上降低图像处理的复杂度,并提高图像处理的可实现性。
需要说明的是,上述描述的终端和单元的具体工作过程,可以参考前述各个实施例中的相关描述,在此不再赘述。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
以上所揭露的仅为本申请的部分实施例而已,当然不能以此来限定本申请之权利范围,本领域普通技术人员可以理解实现上述实施例的全部或部分流程,并依本申请权利要求所作的等同变化,仍属于发明所涵盖的范围。

Claims (19)

  1. 一种图像处理方法,由终端执行,包括:
    获取待处理的负片图像及所述负片图像中各像素在第一颜色空间中的初始颜色值;
    对所述负片图像进行反相处理得到反相图像数据,所述反相图像数据中各像素的反相颜色值是根据所述负片图像中各像素的初始颜色值确定的;
    根据所述反相图像数据,在第二颜色空间所对应的值域内对所述各像素的中间颜色值进行值均衡处理,得到所述各像素的数码颜色值;
    根据所述各像素的数码颜色值得到所述负片图像的数码图像数据。
  2. 如权利要求1所述的方法,其中,当所述第一颜色空间与所述第二颜色空间相同且为目标颜色空间时,所述中间颜色值包括所述反相颜色值。
  3. 如权利要求2所述的方法,其中,所述初始颜色值包括像素在所述目标颜色空间中各颜色通道下的初始分量值;
    其中,所述对所述负片图像进行反相处理得到反相图像数据,包括:
    获取目标颜色通道的值域,所述目标颜色通道为所述目标颜色空间中的任一颜色通道;
    将所述负片图像中各像素在所述目标颜色通道下的初始分量值与所述目标颜色通道的值域的最大值进行差值计算,得到所述各像素在所述目标颜色通道下的反相分量值;
    根据所述各像素在所述目标颜色通道下的反相分量值得到反相图像数据。
  4. 如权利要求3所述的方法,其中,所述根据所述各像素在所述目标颜色通道下的反相分量值得到反相图像数据,包括:根据所述各像素在所述目标颜色通道下的反相分量值,得到各像素在所述目标颜色空间中的反相颜色值,所述反相颜色值包括各像素在所述目标颜色空间中各颜色通道下的反相分量值;
    根据所述各像素在所述目标颜色空间中的反相颜色值,得到所述反相图像数据。
  5. 如权利要求2所述的方法,其中,所述根据所述反相图像数据,在所述目标颜色空间所对应的值域内对所述各像素的反相颜色值进行值均衡处理,得到 所述各像素的数码颜色值,包括:
    获取所述反相图像数据在所述目标颜色空间中的像素分布图;
    根据所述像素分布图,在所述目标颜色空间所对应的值域内对所述各像素的反相颜色值进行值均衡处理,得到所述各像素的数码颜色值。
  6. 如权利要求5所述的方法,其中,所述像素分布图包括所述反相图像数据在所述目标颜色空间中各颜色通道下的像素分布图,所述目标颜色空间包括RGB颜色空间;
    所述根据所述像素分布图,在所述目标颜色空间所对应的值域内对所述各像素的反相颜色值进行值均衡处理,得到所述各像素的数码颜色值,包括:
    根据所述反相图像数据在所述目标颜色通道下的像素分布图以及所述目标颜色通道的值域,确定数值映射参数值,所述目标颜色通道为以下任一通道:R通道、G通道或者B通道;
    根据所述数值映射参数值,对所述反相图像数据中目标像素在所述目标颜色通道下的反相分量值进行计算,得到所述目标像素在所述目标颜色通道下的数码分量值;
    根据所述目标像素在所述目标颜色通道下的数码分量值确定所述目标像素的数码颜色值。
  7. 如权利要求6所述的方法,其中,所述像素分布图为颜色直方图;所述根据所述反相图像数据在所述目标颜色通道下的像素分布图以及所述目标颜色通道的值域,确定数值映射参数值,包括:
    确定所述反相图像数据在所述目标颜色通道下的颜色直方图的总面积;
    基于所述总面积,从所述各像素在所述目标颜色通道下的反相分量值中确定第一反相分量值和第二反相分量值,所述第一反相分量值与最小反相分量值所确定的局部面积与所述总面积的比值满足比例条件,所述第二反相分量值和最大反相分量值所确定的局部面积与所述总面积的比值满足所述比例条件;
    根据所述第一反相分量值与所述第二反相分量值构成的数值范围,以及所述目标颜色通道的值域,计算得到数值映射参数值。
  8. 如权利要求7所述的方法,其中,所述目标像素的反相分量值不小于所 述第一反相分量值且不大于所述第二反相分量值;
    所述根据所述像素分布图,在所述目标颜色空间所对应的值域内对所述各像素的反相颜色值进行值均衡处理,得到所述各像素的数码颜色值,还包括:
    若存在所述目标颜色通道下的反相分量值小于所述第一反相分量值的第一像素,则将所述第一像素在所述目标颜色通道下的数码分量值设置为所述目标颜色通道的值域的最小值;
    若存在所述目标颜色通道下的反相分量值大于所述第二反相分量值的第二像素,则将所述第二像素在所述目标颜色通道下的数码分量值设置为所述目标颜色通道的值域的最大值。
  9. 如权利要求1所述的方法,其中,所述根据所述各像素的数码颜色值得到所述负片图像的数码图像数据,包括:
    获取所述各像素的数码颜色值对应的数码颜色;
    根据所述各像素的反相颜色值和数码颜色值之间的数值映射关系,得到所述反相图像数据的颜色查找表,所述颜色查找表包括所述反相图像数据中各像素的反相颜色值和数码颜色的对应关系;
    将所述反相图像数据和所述颜色查找表作为所述负片图像的数码图像数据。
  10. 如权利要求9所述的方法,其中,所述方法还包括:
    响应于图像显示请求,将所述颜色查找表和所述反相图像数据输入至渲染引擎进行渲染,得到数码图像;
    显示渲染得到的数码图像。
  11. 如权利要求1所述的方法,其中,当所述第一颜色空间与所述第二颜色空间不同时,所述中间颜色值包括将所述反相颜色值进行转换后得到的转换颜色值。
  12. 如权利要求11所述的方法,其中,所述第一颜色空间为RGB颜色空间,所述第二颜色空间为HSV颜色空间。
  13. 如权利要求11所述的方法,其中,所述将所述反相颜色值进行转换,包括:将所述反相图像数据中各像素的反相颜色值从所述第一颜色空间转换至所述第二颜色空间,得到所述各像素的转换颜色值。
  14. 如权利要求13所述的方法,所述在第二颜色空间所对应的值域内对所述各像素的中间颜色值进行值均衡处理,得到所述各像素的数码颜色值,包括:
    在所述第二颜色空间所对应的值域内对所述各像素的转换颜色值进行值均衡处理,得到所述各像素的均衡颜色值;
    将所述各像素的均衡颜色值从第二颜色空间转换至第一颜色空间,得到所述各像素的数码颜色值。
  15. 如权利要求14所述的方法,其中,所述在所述第二颜色空间所对应的值域内对所述各像素的转换颜色值进行值均衡处理,得到所述各像素的均衡颜色值,包括:
    根据所述各像素的转换颜色值确定所述反相图像数据在所述第二颜色空间中的像素分布图;
    根据所述像素分布图,在所述第二颜色空间所对应的值域内对所述各像素的转换颜色值进行值均衡处理,得到所述各像素的均衡颜色值。
  16. 如权利要求15所述的方法,其中,所述像素分布图包括所述反相图像数据在所述第二颜色空间中各颜色通道下的像素分布图,所述第二颜色空间为HSV颜色空间;
    所述根据所述像素分布图,在所述第二颜色空间所对应的值域内对所述各像素的转换颜色值进行值均衡处理,得到所述各像素的均衡颜色值,包括:
    根据所述反相图像数据在所述目标颜色通道下的像素分布图以及所述目标颜色通道的值域,确定数值映射参数值,所述目标颜色通道为所述第二颜色空间中的S通道或者V通道;
    根据所述数值映射参数值,对所述目标像素在所述目标颜色通道下的转换分量值进行计算,得到所述目标像素在所述目标颜色通道下的均衡分量值;
    根据所述目标像素在所述目标颜色通道下的均衡分量值确定所述目标像素的均衡颜色值。
  17. 一种图像处理装置,包括:
    获取单元,用于获取待处理的负片图像及所述负片图像中各像素在第一颜色空间中的初始颜色值;
    处理单元,用于对所述负片图像进行反相处理得到反相图像数据,所述反相图像数据中各像素的反相颜色值是根据所述负片图像中各像素的初始颜色值确定的;
    所述处理单元,用于根据所述反相图像数据,在第二颜色空间所对应的值域内对所述各像素的中间颜色值进行值均衡处理,得到所述各像素的数码颜色值;
    所述处理单元,用于根据所述各像素的数码颜色值得到所述负片图像的数码图像数据。
  18. 一种智能终端,包括处理器、输入设备、输出设备和存储器,所述处理器、输入设备、输出设备和存储器相互连接,其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行如权利要求1-16任一项所述的图像处理方法。
  19. 一种计算机存储介质,所述计算机存储介质存储有计算机程序指令,所述计算机程序指令适于由处理器加载并执行如权利要求1-16任一项所述的图像处理方法。
PCT/CN2020/086934 2019-05-09 2020-04-26 图像处理方法、装置、终端及存储介质 WO2020224459A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP20802792.0A EP3968269A4 (en) 2019-05-09 2020-04-26 IMAGE PROCESSING METHOD AND DEVICE, TERMINAL AND STORAGE MEDIUM
US17/380,937 US20210352253A1 (en) 2019-05-09 2021-07-20 Image processing method and apparatus, terminal and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910386977.4 2019-05-09
CN201910386977.4A CN110084767A (zh) 2019-05-09 2019-05-09 图像处理方法、装置、终端及存储介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/380,937 Continuation US20210352253A1 (en) 2019-05-09 2021-07-20 Image processing method and apparatus, terminal and storage medium

Publications (1)

Publication Number Publication Date
WO2020224459A1 true WO2020224459A1 (zh) 2020-11-12

Family

ID=67419588

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/086934 WO2020224459A1 (zh) 2019-05-09 2020-04-26 图像处理方法、装置、终端及存储介质

Country Status (4)

Country Link
US (1) US20210352253A1 (zh)
EP (1) EP3968269A4 (zh)
CN (1) CN110084767A (zh)
WO (1) WO2020224459A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113450440A (zh) * 2021-06-22 2021-09-28 网易(杭州)网络有限公司 渲染图像的方法、装置、计算机可读存储介质和电子设备

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110084767A (zh) * 2019-05-09 2019-08-02 腾讯科技(深圳)有限公司 图像处理方法、装置、终端及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103200389A (zh) * 2013-03-15 2013-07-10 广州市海珠区亮瞳眼视光研究所 一种双焦距分体式电子助视器
US8654192B2 (en) * 2007-08-21 2014-02-18 Adobe Systems Incorporated Inter-image effect array for previewing digital motion picture content
CN107613277A (zh) * 2017-09-29 2018-01-19 维沃移动通信有限公司 一种底片的数字化处理方法及终端
CN108764345A (zh) * 2018-05-30 2018-11-06 河海大学常州校区 一种基于局部与全局聚类的水下大坝裂缝检测方法
CN110084767A (zh) * 2019-05-09 2019-08-02 腾讯科技(深圳)有限公司 图像处理方法、装置、终端及存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3456032B2 (ja) * 1994-05-09 2003-10-14 富士写真フイルム株式会社 画像処理方法
US6204940B1 (en) * 1998-05-15 2001-03-20 Hewlett-Packard Company Digital processing of scanned negative films
US6295115B1 (en) * 1999-03-01 2001-09-25 Hewlett-Packard Company Producing an optimized color image from a negative image and its developed print image

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8654192B2 (en) * 2007-08-21 2014-02-18 Adobe Systems Incorporated Inter-image effect array for previewing digital motion picture content
CN103200389A (zh) * 2013-03-15 2013-07-10 广州市海珠区亮瞳眼视光研究所 一种双焦距分体式电子助视器
CN107613277A (zh) * 2017-09-29 2018-01-19 维沃移动通信有限公司 一种底片的数字化处理方法及终端
CN108764345A (zh) * 2018-05-30 2018-11-06 河海大学常州校区 一种基于局部与全局聚类的水下大坝裂缝检测方法
CN110084767A (zh) * 2019-05-09 2019-08-02 腾讯科技(深圳)有限公司 图像处理方法、装置、终端及存储介质

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3968269A4 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113450440A (zh) * 2021-06-22 2021-09-28 网易(杭州)网络有限公司 渲染图像的方法、装置、计算机可读存储介质和电子设备

Also Published As

Publication number Publication date
EP3968269A4 (en) 2022-04-06
US20210352253A1 (en) 2021-11-11
EP3968269A1 (en) 2022-03-16
CN110084767A (zh) 2019-08-02

Similar Documents

Publication Publication Date Title
Jiang et al. Learning the image processing pipeline
US20150363912A1 (en) Rgbw demosaic method by combining rgb chrominance with w luminance
US9672414B2 (en) Enhancement of skin, including faces, in photographs
US20150097985A1 (en) Compensating for sensor saturation and microlens modulation during light-field image processing
WO2022183902A1 (zh) 图像清晰度确定方法、装置、设备及存储介质
CN103347152A (zh) 一种图像处理方法、装置及终端
WO2020224459A1 (zh) 图像处理方法、装置、终端及存储介质
CN112241933A (zh) 人脸图像处理方法、装置、存储介质及电子设备
KR20140045370A (ko) 이미지의 자동 노출 보정 기법
WO2022121893A1 (zh) 图像处理方法、装置、计算机设备和存储介质
JP2017187994A (ja) 画像処理装置、画像処理方法、画像処理システムおよびプログラム
US11962917B2 (en) Color adjustment method, color adjustment device, electronic device and computer-readable storage medium
WO2022142219A1 (zh) 图像背景处理方法、装置、电子设备及存储介质
CN113658085B (zh) 图像处理方法及装置
TW201537982A (zh) 影像感測裝置及色彩校正矩陣修正方法與查找表建立方法
EP4261784A1 (en) Image processing method and apparatus based on artificial intelligence, and electronic device, computer-readable storage medium and computer program product
CN111462158A (zh) 一种图像处理方法、装置及智能设备、存储介质
WO2023151210A1 (zh) 图像处理方法、电子设备及计算机可读存储介质
JP2014192859A (ja) 色補正方法、プログラム及び装置
WO2023123601A1 (zh) 图像色彩处理方法、装置和电子设备
WO2022111269A1 (zh) 视频的细节增强方法、装置、移动终端和存储介质
CN111354058B (zh) 一种图像着色方法、装置、图像采集设备及可读存储介质
CN114266803A (zh) 图像处理方法、装置、电子设备及存储介质
CN110874816B (zh) 一种图像处理方法、装置、移动终端及存储介质
CN108282643B (zh) 图像处理方法、图像处理装置及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20802792

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2020802792

Country of ref document: EP

Effective date: 20211209