CN112907459A - Image processing method and device - Google Patents
Image processing method and device Download PDFInfo
- Publication number
- CN112907459A CN112907459A CN202110099368.8A CN202110099368A CN112907459A CN 112907459 A CN112907459 A CN 112907459A CN 202110099368 A CN202110099368 A CN 202110099368A CN 112907459 A CN112907459 A CN 112907459A
- Authority
- CN
- China
- Prior art keywords
- tone
- image
- data
- mapping table
- hue
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 35
- 238000013507 mapping Methods 0.000 claims abstract description 182
- 238000012545 processing Methods 0.000 claims abstract description 44
- 230000004044 response Effects 0.000 claims abstract description 11
- 238000004590 computer program Methods 0.000 claims description 14
- 238000010586 diagram Methods 0.000 description 10
- 238000000034 method Methods 0.000 description 9
- 238000001514 detection method Methods 0.000 description 8
- 230000000694 effects Effects 0.000 description 8
- 238000006243 chemical reaction Methods 0.000 description 4
- 238000013500 data storage Methods 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 3
- 238000012423 maintenance Methods 0.000 description 3
- 230000011218 segmentation Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 210000000746 body region Anatomy 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000014509 gene expression Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012805 post-processing Methods 0.000 description 2
- 241000287196 Asthenes Species 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 239000012634 fragment Substances 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 239000000758 substrate Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/90—Dynamic range modification of images or parts thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
Abstract
An image processing method and apparatus are provided. The image processing method comprises the following steps: in response to receiving a hue offset value, acquiring an initial hue mapping table of an image in a Hue Saturation Value (HSV) color space, wherein the initial hue mapping table reflects hue data of the image when the hue offset is not carried out; establishing a tone offset mapping table based on the tone offset value and an initial tone mapping table, wherein the tone offset mapping table reflects tone data of an image subjected to tone offset; mapping hue data of the image based on a hue shift mapping table in an HSV color space to obtain an HSV image with hue shift; the hue-shifted HSV image is converted to an RGB color space to obtain a hue-shifted image. According to the image processing method and the image processing device, the whole tone offset function of the single-frame picture can be efficiently completed.
Description
Technical Field
The present disclosure relates to the field of video technology. More particularly, the present disclosure relates to an image processing method and apparatus.
Background
In the related art, all areas in a picture or video are subjected to color gradual change, and the color changes are cyclically repeated and different hues are monotonically circulated. In addition, when a person is present in the picture, all the human body regions in the picture can be protected only, so that the color of the whole human body region is maintained unchanged, and the color change is performed only on other scenes in the picture, which results in poor special effect of the picture or the video.
Disclosure of Invention
An exemplary embodiment of the present disclosure is to provide an image processing method and apparatus to solve at least the problems of image processing in the related art, and may not solve any of the above problems.
According to an exemplary embodiment of the present disclosure, there is provided an image processing method including: in response to receiving a hue offset value, acquiring an initial hue mapping table of an image in a Hue Saturation Value (HSV) color space, wherein the initial hue mapping table reflects hue data of the image when the hue offset is not carried out; establishing a tone offset mapping table based on the tone offset value and an initial tone mapping table, wherein the tone offset mapping table reflects tone data of an image subjected to tone offset; mapping hue data of the image based on a hue shift mapping table in an HSV color space to obtain an HSV image with hue shift; the hue-shifted HSV image is converted to an RGB color space to obtain a hue-shifted image.
Optionally, before receiving the tone offset value, the image processing method may further include: acquiring HSV color space data of an image, wherein the HSV color space data comprises hue data; an initial tone mapping table is established for tone data in HSV color space data for an image.
Optionally, the step of building a tone offset mapping table based on the tone offset value and the initial tone mapping table may comprise: and dividing the initial tone mapping table into a first part and a second part based on the position of the tone offset value in the initial tone mapping table, and offsetting the data of the first part and the data of the second part respectively to obtain the tone offset mapping table.
Optionally, the step of shifting the data of the first part and the data of the second part respectively may include: and exchanging the data of the first part and the data of the second part, and taking the exchanged tone mapping table as a tone offset mapping table.
Alternatively, the step of mapping the tone data of the image based on the tone shift mapping table may comprise: and modifying the tone data of the image into tone-shifted tone data based on the index value in the tone shift mapping table.
Optionally, after converting the hue-shifted HSV image into the RGB color space, the image processing method may further include: detecting a preset part in the image; and maintaining the color of the preset part in the image converted into the RGB color space unchanged before image processing, and taking the image with the color of the preset part unchanged before image processing as the image with tone shift.
Optionally, the step of building a tone offset mapping table based on the tone offset value and the initial tone mapping table may comprise: detecting a preset part in the image; dividing the initial tone mapping table into a first portion and a second portion based on a position of the tone offset value in the initial tone mapping table; and under the condition of maintaining the part corresponding to the preset part in the initial tone mapping table unchanged, respectively shifting the data of the first part and the data of the second part to obtain a tone shift mapping table.
Alternatively, in the case of maintaining the portion of the initial tone mapping table corresponding to the preset portion unchanged, the step of shifting the data of the first portion and the data of the second portion respectively may include: and exchanging the data which does not belong to the preset part in the first part of data and the data which does not belong to the preset part in the second part of data, and using the exchanged tone mapping table as a tone offset mapping table.
Optionally, the preset portion may comprise a skin portion.
According to an exemplary embodiment of the present disclosure, there is provided an image processing apparatus including: an initial mapping table obtaining unit configured to obtain an initial tone mapping table of an image in a Hue Saturation Value (HSV) color space in response to receiving a tone offset value, wherein the initial tone mapping table reflects tone data of the image without tone offset; a data shift unit configured to establish a tone shift mapping table based on a tone shift value and an initial tone mapping table, wherein the tone shift mapping table reflects tone data of an image after tone shift; the hue mapping unit is configured to map hue data of the image based on a hue shift mapping table in an HSV color space to obtain an HSV image with hue shift; and a space converting unit configured to convert the hue-shifted HSV image to an RGB color space to obtain a hue-shifted image.
Optionally, the image processing apparatus may further include an initial mapping table establishing unit configured to: acquiring HSV color space data of an image, wherein the HSV color space data comprises hue data; an initial tone mapping table is established for tone data in HSV color space data for an image.
Optionally, the data offset unit may be configured to: and dividing the initial tone mapping table into a first part and a second part based on the position of the tone offset value in the initial tone mapping table, and offsetting the data of the first part and the data of the second part respectively to obtain the tone offset mapping table.
Optionally, the data offset unit may be configured to: and exchanging the data of the first part and the data of the second part, and taking the exchanged tone mapping table as a tone offset mapping table.
Optionally, the tone mapping unit may be configured to: and modifying the tone data of the image into tone-shifted tone data based on the index value in the tone shift mapping table.
Optionally, the image processing apparatus may further include: an area detection unit configured to detect a preset portion in an image; and a color maintenance unit configured to maintain a preset portion in the image converted into the RGB color space unchanged in color before image processing, and maintain the preset portion as an image with the unchanged color before image processing as a tone shifted image.
Alternatively, the data offset unit may include: an area detection unit configured to detect a preset portion in an image; a map dividing unit configured to divide the initial tone map into a first part and a second part based on a position of the tone offset value in the initial tone map; and the data part shifting unit is configured to shift the data of the first part and the data of the second part respectively under the condition of keeping the part corresponding to the preset part in the initial tone mapping table unchanged to obtain the tone shift mapping table.
Optionally, the data part shifting unit may be configured to: and exchanging the data which does not belong to the preset part in the first part of data and the data which does not belong to the preset part in the second part of data, and using the exchanged tone mapping table as a tone offset mapping table.
Optionally, the preset portion may comprise a skin portion.
According to an exemplary embodiment of the present disclosure, there is provided an electronic apparatus including: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement an image processing method according to an exemplary embodiment of the present disclosure.
According to an exemplary embodiment of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor of an electronic device, causes the electronic device to execute an image processing method according to an exemplary embodiment of the present disclosure.
According to an exemplary embodiment of the present disclosure, a computer program product is provided, comprising computer programs/instructions which, when executed by a processor, implement an image processing method according to an exemplary embodiment of the present disclosure.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
the efficiency of overall tone shift of a single-frame picture is improved;
the flexibility and variability of hue shift is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
Fig. 1 illustrates a flowchart of an image processing method according to an exemplary embodiment of the present disclosure.
Fig. 2 shows a schematic diagram of exchanging data of a first portion and data of a second portion according to an exemplary embodiment of the present disclosure.
Fig. 3 illustrates a flowchart of an image processing method according to another exemplary embodiment of the present disclosure.
Fig. 4 illustrates a flowchart of an image processing method according to another exemplary embodiment of the present disclosure.
Fig. 5 illustrates a block diagram of an image processing apparatus according to an exemplary embodiment of the present disclosure.
Fig. 6 illustrates a block diagram of an image processing apparatus according to another exemplary embodiment of the present disclosure.
Fig. 7 illustrates a block diagram of an image processing apparatus according to another exemplary embodiment of the present disclosure.
Fig. 8 is a block diagram of an electronic device 800 according to an example embodiment of the present disclosure.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The embodiments described in the following examples do not represent all embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
In this case, the expression "at least one of the items" in the present disclosure means a case where three types of parallel expressions "any one of the items", "a combination of any plural ones of the items", and "the entirety of the items" are included. For example, "include at least one of a and B" includes the following three cases in parallel: (1) comprises A; (2) comprises B; (3) including a and B. For another example, "at least one of the first step and the second step is performed", which means that the following three cases are juxtaposed: (1) executing the step one; (2) executing the step two; (3) and executing the step one and the step two.
Hereinafter, an image processing method and apparatus according to an exemplary embodiment of the present disclosure will be described in detail with reference to fig. 1 to 8.
Fig. 1 illustrates a flowchart of an image processing method according to an exemplary embodiment of the present disclosure. Here, the image may be, for example, but not limited to, a picture and a video. And if the processing object is a video, extracting a single-frame picture in the video, and processing the video one frame by one frame.
Referring to fig. 1, in step S101, in response to receiving a hue offset value, an initial hue mapping table of an image in a hue saturation value, HSV, color space is obtained. Here, the initial tone map reflects tone data when the image is not subjected to tone shift. The hue offset value may be input by a user and represents the hue value to be offset.
In an exemplary embodiment of the present disclosure, before receiving the hue offset value, HSV color space data of the image may be first obtained, and then an initial hue mapping table may be established for hue data in the HSV color space data of the image, thereby optimizing calculation of the hue data. Here, the HSV color space data may include hue data. Furthermore, the HSV color space data may also include saturation data and brightness data for the image.
Specifically, for a frame of picture I in the processing object, the picture may first be transferred to HSV color space, denoted as I ═ pij}i=1...h,j=1...wIn this case, the first and second substrates,pijrecording a pixel point in the HSV space picture, h represents Hue (Hue) value, 0<=h<180; s represents a Saturation (Saturation) value, 0<=s<255, v stands for Value (Value) Value, 0<=v<=255。
The initial tone mapping table is only for Hue space (i.e., tone space) in the picture, i.e., H in HSV. In one example, when building the initial tone mapping table, a one-dimensional array of length 181 may be first built, which is denoted asThen, the initial value of the array is sequentially initialized to the index value index of the array, namely m [ index ]]And forming an initial tone mapping table by the array and the index value. Here, index represents the value of h in the original picture, m [ index ]]For representation m [ index [ ]]Replacing the h value with the value; therefore, the initial tone mapping table does not make any shift to the H space. Table 1 shows an example of an initial tone mapping table.
TABLE 1
In step S102, a tone offset mapping table is established based on the tone offset value and the initial tone mapping table. Here, the tone shift map reflects tone data of an image subjected to tone shift.
In an exemplary embodiment of the present disclosure, when the tone shift mapping table is established, the initial tone mapping table may be divided into a first part and a second part based on a position of a tone shift value in the initial tone mapping table, and data of the first part and data of the second part may be shifted, respectively, to obtain the tone shift mapping table.
In the exemplary embodiment of the present disclosure, when the data of the first portion and the data of the second portion are respectively shifted, the data of the first portion and the data of the second portion may be exchanged, and the exchanged tone mapping table is used as the tone shift mapping table, thereby improving the efficiency and effect of tone shift.
Fig. 2 shows a schematic diagram of exchanging data of a first portion and data of a second portion according to an exemplary embodiment of the present disclosure. In FIG. 2, the hue offset value is H, 0<=H<=181。Representing a tone shift mapping table.
As shown in FIG. 2, values in m indexed from H to 181 are adjusted toIn the segment with the middle index of 0 to 181-H-1, and then the value in m with the index of 0 to H-1 is adjusted toThe middle indices are 181-H through 181 of the fragment.
In step S103, mapping the tone data of the image based on the tone shift mapping table in the HSV color space to obtain a tone-shifted HSV image.
In an exemplary embodiment of the present disclosure, when mapping the tone data of the image based on the tone shift mapping table, the tone data of the image may be modified into tone-shifted tone data based on the index value in the tone shift mapping table, thereby improving the efficiency and effect of the tone shift.
For example, mapping tables according to hue shiftMapping the Hue space (i.e. tone space) of the original image I to obtain a Hue-shifted HSV imageNamely:pij[1],pij,
in step S104, the hue-shifted HSV image is converted into an RGB color space, and a hue-shifted image is obtained.
In the exemplary embodiments of the present disclosure, for one picture, there may be different tone shift results given different tone shift values H.
Fig. 3 illustrates a flowchart of an image processing method according to another exemplary embodiment of the present disclosure. Here, the image may be, for example, but not limited to, a picture and a video. And if the processing object is a video, extracting a single-frame picture in the video, and processing the video one frame by one frame.
Referring to fig. 3, in step S301, in response to receiving a hue offset value, an initial hue mapping table of an image in a hue saturation value HSV color space is acquired. Here, the initial tone map reflects tone data when the image is not subjected to tone shift. The hue offset value may be input by a user and represents the hue value to be offset.
In an exemplary embodiment of the present disclosure, before receiving the hue offset value, HSV color space data of the image may be first obtained, and then an initial hue mapping table may be established for hue data in the HSV color space data of the image, thereby optimizing calculation of the hue data. Here, the HSV color space data may include hue data. Furthermore, the HSV color space data may also include saturation data and brightness data for the image.
In step S302, a tone offset mapping table is established based on the tone offset value and the initial tone mapping table. Here, the tone shift map reflects tone data of an image subjected to tone shift.
In an exemplary embodiment of the present disclosure, when the tone shift mapping table is established, the initial tone mapping table may be divided into a first part and a second part based on a position of a tone shift value in the initial tone mapping table, and data of the first part and data of the second part may be shifted, respectively, to obtain the tone shift mapping table.
In the exemplary embodiment of the present disclosure, when the data of the first portion and the data of the second portion are respectively shifted, the data of the first portion and the data of the second portion may be exchanged, and the exchanged tone mapping table is used as the tone shift mapping table, thereby improving the efficiency and effect of tone shift.
In step S303, in the HSV color space, mapping is performed on tone data of the image based on the tone shift mapping table, so as to obtain a tone-shifted HSV image.
In an exemplary embodiment of the present disclosure, when mapping the tone data of the image based on the tone shift mapping table, the tone data of the image may be modified into tone-shifted tone data based on the index value in the tone shift mapping table, thereby improving the efficiency and effect of the tone shift.
In step S304, the hue-shifted HSV image is converted into an RGB color space.
In step S305, a preset portion in the image is detected.
In step S306, the preset portion of the image converted into the RGB color space is kept unchanged in color before image processing, and the image with the preset portion kept unchanged in color before image processing is taken as an image with a shifted hue.
In an exemplary embodiment of the present disclosure, the preset portion may include, for example, but not limited to, a skin portion.
Specifically, after obtaining the hue-shifted HSV image, the HSV image may be first subjected toConverting the color space into an RGB color space, and then carrying out post-processing; the post-processing aims to protect some special areas and retain original pixel values, such as human skin color parts and the like. In order to increase playability, in the case of a human being, only the skin-color part may be protected. As an exampleThe skin color portion may be determined by a skin color detection method. The skin color detection method may be, for example, but not limited to, a skin segmentation method based on an elliptical color space, or a skin segmentation algorithm based on deep learning, etc.
With regard to the method in the above-described embodiment, the detailed manner of each step has been described in detail in the embodiment related to fig. 1, and will not be elaborated here.
Fig. 4 illustrates a flowchart of an image processing method according to another exemplary embodiment of the present disclosure. Here, the image may be, for example, but not limited to, a picture and a video. And if the processing object is a video, extracting a single-frame picture in the video, and processing the video one frame by one frame.
Referring to fig. 4, in step S401, in response to receiving a hue offset value, an initial hue mapping table of an image in a hue saturation value HSV color space is acquired. Here, the initial tone map reflects tone data when the image is not subjected to tone shift. The hue offset value may be input by a user and represents the hue value to be offset.
In an exemplary embodiment of the present disclosure, before receiving the hue offset value, HSV color space data of the image may be first obtained, and then an initial hue mapping table may be established for hue data in the HSV color space data of the image, thereby optimizing calculation of the hue data. Here, the HSV color space data may include hue data. Furthermore, the HSV color space data may also include saturation data and brightness data for the image.
In step S402, a preset portion in an image is detected.
In an exemplary embodiment of the present disclosure, the preset portion may include, for example, but not limited to, a skin portion.
In step S403, the initial tone map is divided into a first part and a second part based on the position of the tone offset value in the initial tone map.
In step S404, under the condition that the portion corresponding to the preset portion in the initial tone mapping table is maintained unchanged, the data of the first portion and the data of the second portion are respectively shifted to obtain a tone shift mapping table. Here, the tone shift map reflects tone data of an image subjected to tone shift.
In an exemplary embodiment of the present disclosure, in a case that a portion corresponding to the preset portion in the initial tone mapping table is maintained unchanged, when shifting the data of the first portion and the data of the second portion, respectively, the data of the first portion that does not belong to the preset portion and the data of the second portion that does not belong to the preset portion may be exchanged, and the exchanged tone mapping table is used as a tone shift mapping table, so that efficiency and effect of tone shift are improved.
In step S405, mapping the tone data of the image based on the tone shift mapping table in the HSV color space to obtain a tone-shifted HSV image.
In an exemplary embodiment of the present disclosure, when mapping the tone data of the image based on the tone shift mapping table, the tone data of the image may be modified into tone-shifted tone data based on the index value in the tone shift mapping table, thereby improving the efficiency and effect of the tone shift.
In step S406, the hue-shifted HSV image is converted into an RGB color space, and a hue-shifted image is obtained.
With regard to the method in the above-described embodiment, the detailed manner of each step has been described in detail in the embodiment related to fig. 1, and will not be elaborated here.
The image processing method according to the exemplary embodiment of the present disclosure has been described above in conjunction with fig. 1 to 4. Hereinafter, an image processing apparatus and units thereof according to an exemplary embodiment of the present disclosure will be described with reference to fig. 5 to 7.
Fig. 5 illustrates a block diagram of an image processing apparatus according to an exemplary embodiment of the present disclosure.
Referring to fig. 5, the image processing apparatus includes an initial mapping table acquisition unit 51, a data shift unit 52, a tone mapping unit 53, and a spatial conversion unit 54.
The initial mapping table obtaining unit 51 is configured to obtain an initial tone mapping table of an image in a tone saturation value HSV color space in response to receiving a tone offset value. Here, the initial tone map reflects tone data when the image is not subjected to tone shift.
In an exemplary embodiment of the present disclosure, the image processing apparatus may further include an initial mapping table establishing unit (not shown) configured to: acquiring HSV color space data of an image; an initial tone mapping table is established for tone data in HSV color space data for an image. Here, the HSV color space data includes hue data.
The data shift unit 52 is configured to build a tone shift map based on the tone shift value and the initial tone map. Here, the tone shift map reflects tone data of an image subjected to tone shift.
In an exemplary embodiment of the present disclosure, the data shifting unit 52 may be configured to: and dividing the initial tone mapping table into a first part and a second part based on the position of the tone offset value in the initial tone mapping table, and offsetting the data of the first part and the data of the second part respectively to obtain the tone offset mapping table.
In an exemplary embodiment of the present disclosure, the data shifting unit 52 may be configured to: and exchanging the data of the first part and the data of the second part, and taking the exchanged tone mapping table as a tone offset mapping table.
The tone mapping unit 53 is configured to map tone data of the image based on the tone shift mapping table in the HSV color space, obtaining a tone-shifted HSV image.
In an exemplary embodiment of the present disclosure, the tone mapping unit 53 may be configured to: and modifying the tone data of the image into tone-shifted tone data based on the index value in the tone shift mapping table.
The space converting unit 54 is configured to convert the hue-shifted HSV image to an RGB color space to obtain a hue-shifted image.
Fig. 6 illustrates a block diagram of an image processing apparatus according to another exemplary embodiment of the present disclosure.
Referring to fig. 6, the image processing apparatus includes an initial mapping table acquisition unit 61, a data shift unit 62, a tone mapping unit 63, a spatial conversion unit 64, an area detection unit 65, and a color maintenance unit 66.
The initial mapping table obtaining unit 61 is configured to obtain an initial tone mapping table of an image in a tone saturation value HSV color space in response to receiving a tone offset value. Here, the initial tone map reflects tone data when the image is not subjected to tone shift.
In an exemplary embodiment of the present disclosure, the image processing apparatus may further include an initial mapping table establishing unit (not shown) configured to: acquiring HSV color space data of an image; an initial tone mapping table is established for tone data in HSV color space data for an image. Here, the HSV color space data includes hue data.
The data shift unit 62 is configured to build a tone shift map based on the tone shift value and the initial tone map. Here, the tone shift map reflects tone data of an image subjected to tone shift.
In an exemplary embodiment of the present disclosure, the data shifting unit 62 may be configured to: and dividing the initial tone mapping table into a first part and a second part based on the position of the tone offset value in the initial tone mapping table, and offsetting the data of the first part and the data of the second part respectively to obtain the tone offset mapping table.
In an exemplary embodiment of the present disclosure, the data shifting unit 62 may be configured to: and exchanging the data of the first part and the data of the second part, and taking the exchanged tone mapping table as a tone offset mapping table.
The tone mapping unit 63 is configured to map tone data of the image based on a tone shift mapping table in an HSV color space, obtaining a tone-shifted HSV image.
In an exemplary embodiment of the present disclosure, the tone mapping unit 63 may be configured to: and modifying the tone data of the image into tone-shifted tone data based on the index value in the tone shift mapping table.
The space converting unit 64 is configured to convert the hue-shifted HSV image to an RGB color space to obtain a hue-shifted image.
The area detection unit 65 is configured to detect a preset portion in the image.
The color maintenance unit 66 is configured to maintain a preset portion of the image converted into the RGB color space unchanged in color before image processing, and maintain the preset portion unchanged in color before image processing as an image with a shifted hue.
In an exemplary embodiment of the present disclosure, the preset portion may include, for example, but not limited to, a skin portion.
Fig. 7 illustrates a block diagram of an image processing apparatus according to another exemplary embodiment of the present disclosure.
Referring to fig. 7, the image processing apparatus includes an initial map acquisition unit 71, a region detection unit 72, a map segmentation unit 73, a data portion shift unit 74, a tone mapping unit 75, and a spatial conversion unit 76.
The initial mapping table obtaining unit 71 is configured to obtain an initial tone mapping table of the image in the hue saturation value HSV color space in response to receiving the hue offset value. Here, the initial tone map reflects tone data when the image is not subjected to tone shift.
In an exemplary embodiment of the present disclosure, the image processing apparatus may further include an initial mapping table establishing unit (not shown) configured to: acquiring HSV color space data of an image; an initial tone mapping table is established for tone data in HSV color space data for an image. Here, the HSV color space data includes hue data
The area detection unit 72 is configured to detect a preset portion in the image.
In an exemplary embodiment of the present disclosure, the preset portion may include, for example, but not limited to, a skin portion.
The map dividing unit 73 is configured to divide the initial tone map into a first part and a second part based on the position of the tone offset value in the initial tone map.
The data part shifting unit 74 is configured to shift the data of the first part and the data of the second part, respectively, while maintaining the part of the initial tone mapping table corresponding to the preset part unchanged, to obtain a tone shift mapping table.
In an exemplary embodiment of the present disclosure, the data portion shifting unit 74 may be configured to: and exchanging the data which does not belong to the preset part in the first part of data and the data which does not belong to the preset part in the second part of data, and using the exchanged tone mapping table as a tone offset mapping table.
In an exemplary embodiment of the present disclosure, the area detecting unit 72, the mapping table dividing unit 73, and the data part shifting unit 74 may or may not be included in one unit or module (e.g., a data shifting unit).
The tone mapping unit 75 is configured to map tone data of the image based on the tone shift mapping table in the HSV color space, obtaining a tone-shifted HSV image.
In an exemplary embodiment of the present disclosure, the tone mapping unit 75 may be configured to: and modifying the tone data of the image into tone-shifted tone data based on the index value in the tone shift mapping table.
The space conversion unit 76 is configured to convert the hue-shifted HSV image to an RGB color space, obtaining a hue-shifted image.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
The image processing apparatus according to the exemplary embodiment of the present disclosure has been described above with reference to fig. 5 to 7. Next, an electronic apparatus according to an exemplary embodiment of the present disclosure is described with reference to fig. 8.
Fig. 8 is a block diagram of an electronic device 800 according to an example embodiment of the present disclosure.
Referring to fig. 8, an electronic device 800 includes at least one memory 801 and at least one processor 802, the at least one memory 801 having stored therein a set of computer-executable instructions that, when executed by the at least one processor 802, perform a method of image processing according to an exemplary embodiment of the present disclosure.
By way of example, the electronic device 800 may be a PC computer, tablet device, personal digital assistant, smart phone, or other device capable of executing the set of instructions described above. Here, the electronic device 800 need not be a single electronic device, but can be any collection of devices or circuits that can execute the above instructions (or sets of instructions) either individually or in combination. The electronic device 800 may also be part of an integrated control system or system manager, or may be configured as a portable electronic device that interfaces with local or remote (e.g., via wireless transmission).
In the electronic device 800, the processor 802 may include a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a programmable logic device, a special purpose processor system, a microcontroller, or a microprocessor. By way of example, and not limitation, processors may also include analog processors, digital processors, microprocessors, multi-core processors, processor arrays, network processors, and the like.
The processor 802 may execute instructions or code stored in the memory 801, wherein the memory 801 may also store data. The instructions and data may also be transmitted or received over a network via a network interface device, which may employ any known transmission protocol.
The memory 801 may be integrated with the processor 802, for example, with RAM or flash memory disposed within an integrated circuit microprocessor or the like. Further, memory 801 may include a stand-alone device, such as an external disk drive, storage array, or any other storage device usable by a database system. The memory 801 and the processor 802 may be operatively coupled or may communicate with each other, such as through I/O ports, network connections, etc., so that the processor 802 can read files stored in the memory.
Further, the electronic device 800 may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, mouse, touch input device, etc.). All components of the electronic device 800 may be connected to each other via a bus and/or a network.
According to an exemplary embodiment of the present disclosure, there may also be provided a computer-readable storage medium storing instructions, which when executed by at least one processor, cause the at least one processor to perform a method of image processing according to the present disclosure. Examples of the computer-readable storage medium herein include: read-only memory (ROM), random-access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random-access memory (RAM), dynamic random-access memory (DRAM), static random-access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD + R, CD-RW, CD + RW, DVD-ROM, DVD-R, DVD + R, DVD-RW, DVD + RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, Blu-ray or compact disc memory, Hard Disk Drive (HDD), solid-state drive (SSD), card-type memory (such as a multimedia card, a Secure Digital (SD) card or a extreme digital (XD) card), magnetic tape, a floppy disk, a magneto-optical data storage device, an optical data storage device, a magnetic tape, a floppy disk, a magneto-optical data storage device, a, Hard disk, solid state disk, and any other device configured to store and provide a computer program and any associated data, data files, and data structures to a processor or computer in a non-transitory manner such that the processor or computer can execute the computer program. The computer program in the computer-readable storage medium described above can be run in an environment deployed in a computer apparatus, such as a client, a host, a proxy device, a server, and the like, and further, in one example, the computer program and any associated data, data files, and data structures are distributed across a networked computer system such that the computer program and any associated data, data files, and data structures are stored, accessed, and executed in a distributed fashion by one or more processors or computers.
There is also provided, in accordance with an example embodiment of the present disclosure, a computer-readable storage medium, such as a memory 801, including instructions executable by a processor 802 of a device 800 to perform the above-described method. Alternatively, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
According to an exemplary embodiment of the present disclosure, a computer program product may also be provided, which comprises computer programs/instructions, which when executed by a processor, implement the method of image processing according to an exemplary embodiment of the present disclosure.
The image processing method and apparatus according to the exemplary embodiment of the present disclosure have been described above with reference to fig. 1 to 8. However, it should be understood that: the image processing apparatus and units thereof shown in fig. 5 to 7 may be respectively configured as software, hardware, firmware, or any combination thereof to perform a specific function, the electronic device shown in fig. 8 is not limited to include the above-shown components, but some components may be added or deleted as needed, and the above components may also be combined.
According to the image processing method and the device, an initial tone mapping table of an image in a tone saturation value (HSV) color space is obtained by responding to a received tone offset value, wherein the initial tone mapping table reflects tone data of the image without tone offset; establishing a tone offset mapping table based on the tone offset value and an initial tone mapping table, wherein the tone offset mapping table reflects tone data of an image subjected to tone offset; mapping hue data of the image based on a hue shift mapping table in an HSV color space to obtain an HSV image with hue shift; and converting the hue-shifted HSV image into an RGB color space to obtain a hue-shifted image, thereby efficiently completing the overall hue shift function of the single-frame picture.
In addition, according to the image processing method and the image processing device disclosed by the invention, different playing designs of pictures or videos can be supported, the flexibility and the changeability are realized, and meanwhile, the algorithm only protects the skin of a human body (only the skin part retains the original image effect), so that the color tone of clothes, backpacks and the like can be changed.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (10)
1. An image processing method, comprising:
in response to receiving a hue offset value, acquiring an initial hue mapping table of an image in a Hue Saturation Value (HSV) color space, wherein the initial hue mapping table reflects hue data of the image when the hue offset is not carried out;
establishing a tone offset mapping table based on the tone offset value and an initial tone mapping table, wherein the tone offset mapping table reflects tone data of an image subjected to tone offset;
mapping hue data of the image based on a hue shift mapping table in an HSV color space to obtain an HSV image with hue shift;
the hue-shifted HSV image is converted to an RGB color space to obtain a hue-shifted image.
2. The image processing method according to claim 1, wherein before receiving the tone offset value, the image processing method further comprises:
acquiring HSV color space data of an image, wherein the HSV color space data comprises hue data;
an initial tone mapping table is established for tone data in HSV color space data for an image.
3. The image processing method of claim 1, wherein the step of building a tone shift mapping table based on the tone shift value and the initial tone mapping table comprises:
and dividing the initial tone mapping table into a first part and a second part based on the position of the tone offset value in the initial tone mapping table, and offsetting the data of the first part and the data of the second part respectively to obtain the tone offset mapping table.
4. The image processing method according to claim 3, wherein the step of shifting the data of the first part and the data of the second part respectively comprises:
and exchanging the data of the first part and the data of the second part, and taking the exchanged tone mapping table as a tone offset mapping table.
5. The image processing method of claim 1, wherein the step of mapping the tone data of the image based on the tone shift mapping table comprises:
and modifying the tone data of the image into tone-shifted tone data based on the index value in the tone shift mapping table.
6. The image processing method according to claim 3, wherein after converting the hue-shifted HSV image to the RGB color space, the image processing method further comprises:
detecting a preset part in the image;
and maintaining the color of the preset part in the image converted into the RGB color space unchanged before image processing, and taking the image with the color of the preset part unchanged before image processing as the image with tone shift.
7. An image processing apparatus characterized by comprising:
an initial mapping table obtaining unit configured to obtain an initial tone mapping table of an image in a Hue Saturation Value (HSV) color space in response to receiving a tone offset value, wherein the initial tone mapping table reflects tone data of the image without tone offset;
a data shift unit configured to establish a tone shift mapping table based on a tone shift value and an initial tone mapping table, wherein the tone shift mapping table reflects tone data of an image after tone shift;
the hue mapping unit is configured to map hue data of the image based on a hue shift mapping table in an HSV color space to obtain an HSV image with hue shift; and
a space converting unit configured to convert the hue-shifted HSV image to an RGB color space to obtain a hue-shifted image.
8. An electronic device/server, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the image processing method of any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, which, when executed by a processor of an electronic device, causes the electronic device to perform the image processing method according to any one of claims 1 to 6.
10. A computer program product comprising computer programs/instructions, characterized in that when the computer programs/instructions are executed by a processor, the image processing method of any of claims 1 to 6 is implemented.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110099368.8A CN112907459B (en) | 2021-01-25 | 2021-01-25 | Image processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110099368.8A CN112907459B (en) | 2021-01-25 | 2021-01-25 | Image processing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112907459A true CN112907459A (en) | 2021-06-04 |
CN112907459B CN112907459B (en) | 2024-04-09 |
Family
ID=76120257
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110099368.8A Active CN112907459B (en) | 2021-01-25 | 2021-01-25 | Image processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112907459B (en) |
Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080079968A1 (en) * | 2006-09-25 | 2008-04-03 | Industrial Technology Research Institute | Color adjustment circuit, digital color adjustment device and multimedia apparatus using the same |
CN106981277A (en) * | 2016-01-19 | 2017-07-25 | 上海和辉光电有限公司 | Method of adjustment, apparatus and system for the tone of display |
CN107657594A (en) * | 2017-09-22 | 2018-02-02 | 武汉大学 | The quick tone mapping method and system of a kind of high quality |
CN108171648A (en) * | 2017-11-27 | 2018-06-15 | 北京美摄网络科技有限公司 | A kind of method and apparatus of U.S.'s face skin color transition |
CN108198152A (en) * | 2018-02-07 | 2018-06-22 | 广东欧珀移动通信有限公司 | Image processing method and device, electronic equipment, computer readable storage medium |
CN108198250A (en) * | 2018-01-23 | 2018-06-22 | 网易(杭州)网络有限公司 | Virtual objects model colouring method and device, storage medium, electronic equipment |
CN109299299A (en) * | 2018-07-18 | 2019-02-01 | 奇酷互联网络科技(深圳)有限公司 | Adjust the method, apparatus and mobile terminal of color |
CN109754375A (en) * | 2018-12-25 | 2019-05-14 | 广州华多网络科技有限公司 | Image processing method, system, computer equipment, storage medium and terminal |
CN110009588A (en) * | 2019-04-09 | 2019-07-12 | 成都品果科技有限公司 | A kind of portrait image color enhancement method and device |
CN110211030A (en) * | 2019-06-04 | 2019-09-06 | 北京字节跳动网络技术有限公司 | Image generating method and device |
CN110830778A (en) * | 2018-08-14 | 2020-02-21 | 杭州海康威视数字技术股份有限公司 | Imaging device color correction method, imaging device color correction device, electronic device and storage medium |
CN111080725A (en) * | 2019-12-19 | 2020-04-28 | 新立讯科技股份有限公司 | Image processing method, system and equipment based on color space conversion |
CN112215760A (en) * | 2019-07-11 | 2021-01-12 | 华为技术有限公司 | Image processing method and device |
-
2021
- 2021-01-25 CN CN202110099368.8A patent/CN112907459B/en active Active
Patent Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080079968A1 (en) * | 2006-09-25 | 2008-04-03 | Industrial Technology Research Institute | Color adjustment circuit, digital color adjustment device and multimedia apparatus using the same |
CN106981277A (en) * | 2016-01-19 | 2017-07-25 | 上海和辉光电有限公司 | Method of adjustment, apparatus and system for the tone of display |
CN107657594A (en) * | 2017-09-22 | 2018-02-02 | 武汉大学 | The quick tone mapping method and system of a kind of high quality |
CN108171648A (en) * | 2017-11-27 | 2018-06-15 | 北京美摄网络科技有限公司 | A kind of method and apparatus of U.S.'s face skin color transition |
CN108198250A (en) * | 2018-01-23 | 2018-06-22 | 网易(杭州)网络有限公司 | Virtual objects model colouring method and device, storage medium, electronic equipment |
CN108198152A (en) * | 2018-02-07 | 2018-06-22 | 广东欧珀移动通信有限公司 | Image processing method and device, electronic equipment, computer readable storage medium |
CN109299299A (en) * | 2018-07-18 | 2019-02-01 | 奇酷互联网络科技(深圳)有限公司 | Adjust the method, apparatus and mobile terminal of color |
CN110830778A (en) * | 2018-08-14 | 2020-02-21 | 杭州海康威视数字技术股份有限公司 | Imaging device color correction method, imaging device color correction device, electronic device and storage medium |
CN109754375A (en) * | 2018-12-25 | 2019-05-14 | 广州华多网络科技有限公司 | Image processing method, system, computer equipment, storage medium and terminal |
CN110009588A (en) * | 2019-04-09 | 2019-07-12 | 成都品果科技有限公司 | A kind of portrait image color enhancement method and device |
CN110211030A (en) * | 2019-06-04 | 2019-09-06 | 北京字节跳动网络技术有限公司 | Image generating method and device |
CN112215760A (en) * | 2019-07-11 | 2021-01-12 | 华为技术有限公司 | Image processing method and device |
CN111080725A (en) * | 2019-12-19 | 2020-04-28 | 新立讯科技股份有限公司 | Image processing method, system and equipment based on color space conversion |
Also Published As
Publication number | Publication date |
---|---|
CN112907459B (en) | 2024-04-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP7181437B2 (en) | A technique for identifying skin tones in images under uncontrolled lighting conditions | |
US20180211107A1 (en) | System and Method for Detecting Objects in an Image | |
WO2018028583A1 (en) | Subtitle extraction method and device, and storage medium | |
Almeer | Cloud hadoop map reduce for remote sensing image analysis | |
US9082160B2 (en) | Image processing method, image compression device and mobile terminal | |
WO2020005650A1 (en) | Image colorization based on reference information | |
US11080553B2 (en) | Image search method and apparatus | |
US10089332B2 (en) | Method and electronic device for classifying contents | |
WO2017070841A1 (en) | Image processing method and apparatus | |
CN112150347A (en) | Image modification patterns learned from a limited set of modified images | |
US8824778B2 (en) | Systems and methods for depth map generation | |
CN111402117B (en) | Picture processing method and device, storage medium and client device | |
CN113329261A (en) | Video processing method and device | |
US11526961B2 (en) | Information processing method, image processing apparatus, and storage medium that selectively perform upsampling to increase resolution to image data included in album data | |
WO2019085235A1 (en) | Picture processing method, and user interface display method and device | |
CN113012031A (en) | Image processing method and image processing apparatus | |
JP6440604B2 (en) | Subject evaluation system, subject evaluation method, subject evaluation program, and recording medium storing the program | |
CN112907459A (en) | Image processing method and device | |
CN113470124B (en) | Training method and device for special effect model, and special effect generation method and device | |
CN114937072A (en) | Image processing method and device, electronic equipment and computer readable storage medium | |
CN114299198A (en) | Animation generation method, animation generation device, electronic equipment, media and computer program product | |
JP6750094B2 (en) | Image evaluation apparatus, image evaluation method, and image evaluation program | |
CN113411521B (en) | Video processing method and device, electronic equipment and storage medium | |
EP3454538A1 (en) | Method for determining a transfer function adapted to be used for color grading a visual content and corresponding electronic device, system, computer readable program product and computer readable storage medium | |
CN116977154B (en) | Visible light image and infrared image fusion storage method, device, equipment and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |