Note: Descriptions are shown in the official language in which they were submitted.
CA 03154893 2022-03-17
IMAGE COLOR TRANSFERRING METHOD, DEVICE, COMPUTER EQUIPMENT
AND STORAGE MEDIUM
BACKGROUND OF THE INVENTION
Technical Field
[0001] The present application relates to the field of image processing
technology, and more
particularly to an image color transferring method, and corresponding device,
computer
equipment and storage medium.
Description of Related Art
[0002] With the rapid development of the e-commerce, e-commerce platforms
often carry out
promotional activities for various commodities, and this enlarges the demand
on graphic
design advertisement. As regards graphic designs of certain types, it might be
required to
transform the color of an advertising picture to a suitable dominant color
according to
different atmospheres and scenarios, so as to provide users with better visual
experience.
[0003] The color transfer technique makes it possible to transform the image
color to other colors.
At present, the directional color transferring method is the main method to
realize the
color transferring function, but a reference image is required for this
method, and this
makes it impossible to adapt to many application scenarios. For instance, most
graphic
designs are applied to such an application scenario that only a hexadecimal
color code of
a target color is given, and the picture is subsequently rendered through
color transfer to
approach this color in visual effect as approximate as possible. Accordingly,
it is
impossible to realize color transfer of images through the directional color
transferring
method.
1
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
SUMMARY OF THE INVENTION
[0004] In view of the above technical problems, there is an urgent need to
provide an image color
transferring method, and corresponding device, computer equipment and storage
medium
capable of realizing color transfer without any reference picture.
[0005] There is provided an image color transferring method that comprises:
[0006] extracting a color value of a dominant color of an image to be
transformed;
[0007] determining a transfer vector used in transferring a target color to
the image to be
transformed according to the color value of the dominant color of the image to
be
transformed and a color value of the target color; and
[0008] transferring the target color to the image to be transformed according
to the transfer vector.
[0009] In one of the embodiments, the step of determining a transfer vector
used in transferring
a target color to the image to be transformed according to the color value of
the dominant
color of the image to be transformed and a color value of the target color
includes:
[0010] obtaining a corresponding first three-dimensional color vector of the
color value of the
dominant color of the image to be transformed in a target color space;
[0011] obtaining a corresponding second three-dimensional color vector of the
color value of the
target color in the target color space; and
[0012] determining the transfer vector according to the first three-
dimensional color vector and
the second three-dimensional color vector.
[0013] In one of the embodiments, the step of determining the transfer vector
according to the
first three-dimensional color vector and the second three-dimensional color
vector
includes:
[0014] obtaining a translation transformation vector used in translating the
first three-
dimensional color vector to the second three-dimensional color, and taking the
translation
transformation vector as the transfer vector.
2
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
[0015] In one of the embodiments, the step of transferring the target color to
the image to be
transformed according to the transfer vector includes:
[0016] extracting a color value of pixels of the image to be transformed; and
[0017] transferring the color value of the pixels of the image to be
transformed according to the
transfer vector, and taking the image to be transformed after transferring as
a target image;
[0018] the target image is an image formed after the target color has been
transferred to the image
to be transformed.
[0019] In one of the embodiments, the step of transferring the color value of
the pixels of the
image to be transformed according to the transfer vector includes:
[0020] transferring the color value of the pixels of the image to be
transformed in accordance
with a luminance dimension, a saturation dimension and a hue dimension,
respectively,
in the target color space according to the transfer vector.
[0021] In one of the embodiments, the step of transferring the color value of
the pixels of the
image to be transformed in accordance with a luminance dimension, a saturation
dimension and a hue dimension, respectively, in the target color space
according to the
transfer vector includes:
[0022] normalizing the luminance data to which the luminance dimension in the
color value of
the pixels of the image to be transformed corresponds according to a first
normalization
function, and obtaining a first numerical value;
[0023] transferring the color value of the pixels of the image to be
transformed in accordance
with the luminance dimension according to the transfer vector and the first
numerical
value;
[0024] normalizing the saturation data to which the saturation dimension in
the color value of
the pixels of the image to be transformed corresponds according to a second
normalization function, and obtaining a second numerical value;
[0025] transferring the color value of the pixels of the image to be
transformed in accordance
3
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
with the saturation dimension according to the transfer vector and the second
numerical
value; and
[0026] obtaining a sum value of the transfer vector and the color value of the
pixels of the image
to be transformed, acquiring the remainder of the sum value divided by 2n, and
transferring the color value of the pixels of the image to be transformed in
accordance
with the hue dimension according to a remainder-acquiring result, wherein it
is the ratio
of the circumference of a circle to its diameter.
[0027] In one of the embodiments, the image color transferring method further
comprises:
[0028] employing a color quantization algorithm to sample the image to be
transformed, and
obtaining a plurality of quantized colors; and
[0029] taking the color with the highest probability of occurrence from the
plurality of colors as
the dominant color of the image to be transformed.
[0030] There is provided an image color transferring device that comprises:
[0031] an extracting module, for extracting a color value of a dominant color
of an image to be
transformed;
[0032] a determining module, for determining a transfer vector used in
transferring a target color
to the image to be transformed according to the color value of the dominant
color of the
image to be transformed and a color value of the target color; and
[0033] a transferring module, for transferring the target color to the image
to be transformed
according to the transfer vector.
[0034] There is provided a computer equipment that comprises a memory, a
processor and a
computer program stored on the memory and operable on the processor, and the
method
steps according to anyone of the aforementioned embodiments are realized when
the
processor executes the computer program.
[0035] There is provided a computer-readable storage medium storing a computer
program
4
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
thereon, and the method steps according to anyone of the aforementioned
embodiments
are realized when the computer program is executed by a processor.
[0036] In the aforementioned image color transferring method, corresponding
device, computer
equipment and storage medium, when the color value of the target color
transferred to the
image to be transformed is determined, the color value of the dominant color
of the image
to be transformed is extracted, a transfer vector for carrying out color
transfer is
determined according to the color value of the dominant color of the image to
be
transformed and the color value of the target color, and the transfer vector
can be finally
based on to transfer the target color to the image to be transformed.
Accordingly, color
transfer of the image to be transformed is realizable without any target
reference picture,
and the restriction of the traditional color transfer technique in which
reference picture is
required is broken, so that the color transfer technique is made to satisfy
many more
application scenarios.
BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Fig. 1 is a view illustrating the application environment for an image
color transferring
method in an embodiment;
[0038] Fig. 2 is a flowchart schematically illustrating an image color
transferring method in an
embodiment;
[0039] Fig. 3 is a flowchart schematically illustrating step S200 in an
embodiment;
[0040] Fig. 4 is a view illustrating interface image displays when two sets of
different
normalization functions are used to perform color transfer in an image color
transferring
method in an embodiment;
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
[0041] Fig. 5 is a view illustrating interface image displays in an image
color transferring method
in another embodiment;
[0042] Fig. 6 is a block diagram illustrating the structure of an image color
transferring device
in an embodiment; and
[0043] Fig. 7 is a view illustrating the internal structure of a computer
equipment in an
embodiment.
DETAILED DESCRIPTION OF THE INVENTION
[0044] To make more lucid and clear the objectives, technical solutions and
advantages of the
present application, the present application is described in greater detail
below with
reference to accompanying drawings and embodiments. As should be understood,
the
specific embodiments as described here are merely meant to explain the present
application, rather than to restrict the present application.
[0045] The image color transferring method provided by the present application
is applicable to
the application environment as shown in Fig. 1, in which server 10
communicates with
storage equipment 20 through network. Storage equipment 20 stores therein a
plurality
of images. Each image is set with color and images, and can further be set
with
corresponding words and digits, etc. Server 10 is employed to read images from
storage
equipment 20 and transfer colors on the images to obtain images that conform
to
requirements. Specifically, server 10 stores therein color values of a
plurality of colors.
In response to a color transferring instruction as received, server 10 reads
an image to be
transformed from storage equipment 20 and determines a color value of a
corresponding
target color from internal memory. Moreover, use of the image color
transferring method
of the present application realizes transfer of the target color to the image
to be
transformed according to the color value of the target color, so as to obtain
a target image
6
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
that satisfies the color transferring instruction. In addition, server 10
communicates with
terminal equipment group 40 through network. Generally, server 10 communicates
with
terminal equipment group 40 through cloud network 30, and dispatches the
target image
obtained after color transfer to various terminals of terminal equipment group
40. The
various terminals of terminal equipment group 40 can be, but are not limited
to be, various
personal computers, notebook computers, smart mobile phones, panel computers
and
desktop computers, and server 10 can be embodied as an independent server or a
server
cluster consisting of a plurality of servers.
[0046] In one embodiment, as shown in Fig. 2, there is provided an image color
transferring
method, and the method is explained with an example of its being applied to
the server in
Fig. 1, to comprise the following steps.
[0047] S100 - extracting a color value of a dominant color of an image to be
transformed.
[0048] In this embodiment, the backstage storage equipment stores therein a
plurality of images
for color transfer. In response to a color transferring instruction as
received, the server
obtains from the backstage storage equipment an image to be transformed. The
image
format of the image to be transformed is JPG, JPEG, TIFF, PNG, RAW or BMP etc.
In
addition, the server further determines a target color to be transferred onto
the image to
be transformed according to the received color transferring instruction. The
target color
can be stored in the server or stored in the backstage storage equipment in
the form of a
color value, and can also be stored in the server or stored in the backstage
storage
equipment in the form of a color image.
[0049] Further, the server obtains the dominant color of the image to be
transformed, and hence
extracts the color value of this dominant color. The color value of the
dominant color can
be a hexadecimal color code, and can also be an RGB value, an HSV value, etc.
7
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
[0050] In one embodiment, the image color transferring method further
comprises: employing a
color quantization algorithm to sample the image to be transformed, and
obtaining a
plurality of quantized colors; and taking the color with the highest
probability of
occurrence from the plurality of colors as the dominant color of the image to
be
transformed.
[0051] Specifically, the server employs an OpenCV library (Open Source
Computer Vision
Library) to read the image to be transformed, and employs a color quantization
algorithm
to sample the image to be transformed, one color is obtained from each
sampling, so that
plural quantized colors are obtained; the color with the highest probability
and maximum
number of occurrence is taken from the plurality of colors obtained after
sampling to
serve as the dominant color of the image to be transformed. Specifically, the
color
quantization algorithm includes modified median cut quantization, K-means
clustering
method, octree method, frequency sequence method, and so on. In one mode of
execution,
the modified median cut quantization (MMCQ) is used as the color quantization
algorithm to process the image to be transformed to obtain plural output
colors, and
selects the color with the highest probability of occurrence from the plural
output colors
to serve as the dominant color of the image to be transformed.
[0052] S200 - determining a transfer vector used in transferring a target
color to the image to be
transformed according to the color value of the dominant color of the image to
be
transformed and a color value of the target color.
[0053] In this embodiment, after having determined the target color, the
server reads the color
value of this target color. Further, the transfer vector when image color
transfer is
executed is determined according to the color value of the dominant color of
the image
to be transformed and the color value of the target color. The transfer vector
is the moving
vector to be referred when the target color is transferred to the image to be
transformed.
The color value of the dominant color of the image to be transformed and the
color value
8
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
of the target color are corresponding color values within the same color
space, so that the
feasibility of obtaining the transfer vector is ensured.
[0054] In one embodiment, as shown in Fig. 3, step S200 includes:
[0055] S210 - obtaining a corresponding first three-dimensional color vector
of the color value
of the dominant color of the image to be transformed in a target color space;
[0056] S230 - obtaining a corresponding second three-dimensional color vector
of the color
value of the target color in the target color space; and
[0057] S250 - determining the transfer vector according to the first three-
dimensional color
vector and the second three-dimensional color vector.
[0058] In this embodiment, the server places the color value of the dominant
color of the image
to be transformed and the color value of the target color both in the same
color space, and
thereafter calculates to obtain the transfer vector. Specifically, the server
determines the
target color space. The target color space is a three-dimensional color space,
in which the
three dimensions are employed respectively to characterize the luminance
channel, the
saturation channel and the hue channel in the color. The target color space
used in this
embodiment is a CIE-LCH color model space, and it is of course also possible
to use any
other color space to perform transformation calculation of numerical values.
[0059] The server obtains a corresponding first three-dimensional color vector
of the color value
of the dominant color of the image to be transformed in the target color space
and a
corresponding second three-dimensional color vector of the color value of the
target color
in the target color space, and determines the transfer vector according to the
first three-
dimensional color vector and the second three-dimensional color vector in the
target color
space. The transfer vector here is also a corresponding three-dimensional
vector in the
target color space.
[0060] Specifically, the dominant color of the image to be transformed and the
target color for
9
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
color transfer are transformed to the CIE-LCH color model space. A third party
library
of python can be used for the transformation mode, and a corresponding
function in a
scikit-image image processing package is used to perform image processing. In
addition,
if there is a transparent channel in the image to be transformed, the
transparent channel
is drawn out before transformation is made, and the transparent channel is
separately
stored. Accordingly, the color value of the dominant color of the image to be
transformed
and the color value of the target color are processed under the CIE-LCH color
model
space to determine the transfer vector, in which process the property of the
CIE-LCH
color model space that possesses interval uniformity with respect to responses
to the same
transformation is made use of to thereby make it possible to guarantee
controllability of
color transfer.
[0061] As for such color model spaces as HSV, HSL, and RGB etc. frequently
used in the
traditional digital image color processing, these color spaces differ
relatively greatly in
visual effects for the degrees of responses to the same transformation in the
processing of
differently colored pixels. Taking for example the HSV space, with respect to
two pixels
whose hues are respectively located in yellow and blue regions, when their
saturations
are likewise increased by 5, the visual perception of the yellow pixel changes
abruptly,
while the visual perception of the blue pixel does not change much.
Accordingly, when
consistent color transformation is applied, changes in the visual perceptions
of differently
colored pixels are uncontrollable, so that the image generated is deprived of
readability.
However, use of the CIE-LCH color model space in the embodiments of the
present
application solves quite well the problem concerning uncontrollability in the
traditional
color transfer.
[0062] In one embodiment, step S250 includes: obtaining a translation
transformation vector
used in translating the first three-dimensional color vector to the second
three-
dimensional color, and taking the translation transformation vector as the
transfer vector.
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
[0063] In this embodiment, after the first three-dimensional color vector to
which the color value
of the dominant color of the image to be transformed corresponds and the
second three-
dimensional color vector to which the color value of the target color
corresponds have
been determined in the target color space, the first three-dimensional color
vector is
translated to the second three-dimensional color vector to obtain the
translation
transformation vector used in the translating process, and this translation
transformation
vector is taken as the transfer vector. Specifically, in the CIE-LCH color
model space,
the translation transformation vector is d1)*, then the calculation expression
of the
translation transformation vector is as follows:
stkh
kb
where
'17.1' represents the second three-dimensional color vector, and icklai
stkk
represents the first three-dimensional color vector. is
the translation
transformation vector. Each dimension represents the distance of the
corresponding
dimension moving at the corresponding coordinate axis in the CIE-LCH color
model
space. The modulus of di stkb is the Euclidean distance between the second
three-
dimensional color vector and the first three-dimensional color vector under
the CIE-LCH
color space.
[0064] Therefore, when the translation transformation vector used in
translating the first three-
dimensional color vector to the second three-dimensional color is taken to
serve as the
transfer vector, and the transfer vector is subsequently used to transfer the
target color to
the image to be transformed, the color contrast relation between different
color regions is
basically maintained, the color matching rule of the image to be transformed
will not be
damaged, and the image generated after such transfer is made more visually
appealing.
[0065] S300 - transferring the target color to the image to be transformed
according to the
transfer vector.
11
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
[0066] In this embodiment, the server bases on the transfer vector to transfer
the target color to
the image to be transformed so as to realize image color transfer. In the
specific mode of
execution, it can be to move all color values of the image to be transformed
according to
the transfer vector, and the color exhibited in the image obtained after such
movement is
precisely the color effect after the target color has been transferred to the
image to be
transformed. It can also be to move partial color values of the image to be
transformed
according to the transfer vector, and the color exhibited in the image
obtained after such
movement is precisely the color effect after the target color has been
transferred to the
image to be transformed. Therefore, the restriction of the traditional color
transfer
technique in which reference picture is required is overcome.
[0067] In one embodiment, the transfer vector is a three-dimensional vector
determined
according to the first three-dimensional color vector to which the color value
of the
dominant color of the image to be transformed corresponds in the target color
space and
the second three-dimensional color vector to which the color value of the
target color
corresponds in the target color space. At this time, step S300 includes:
extracting a color
value of pixels of the image to be transformed, transferring the color value
of the pixels
of the image to be transformed according to the transfer vector, and taking
the image to
be transformed after transferring as a target image, in which the target image
is an image
formed after the target color has been transferred to the image to be
transformed.
[0068] Specifically, the color value of the pixels of the image to be
transformed is extracted
while color transfer is being performed, the color value of the pixels is
transferred
according to the transfer vector, and the color exhibited in the target image
obtained after
transferring is precisely the color exhibition result of the target color in
the image to be
transformed, so that it is realized to transfer the target color to the image
to be transformed.
It is possible to transfer the color value of all pixels of the image to be
transformed
according to the transfer vector, and take the image to be transformed after
transferring
12
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
as a target image. It is also possible to transfer the color value of partial
pixels of the
image to be transformed according to the transfer vector, and take the image
to be
transformed after transferring as a target image.
[0069] In one embodiment, the step of transferring the color value of the
pixels of the image to
be transformed according to the transfer vector includes: transferring the
color value of
the pixels of the image to be transformed in accordance with a luminance
dimension, a
saturation dimension and a hue dimension, respectively, according to the
transfer vector,
in which the target color space includes the luminance dimension, the
saturation
dimension and the hue dimension.
[0070] Specifically, the target color space is a three-dimensional space, and
the corresponding
three dimensions in the three-dimensional space are, respectively, the
luminance
dimension, the saturation dimension and the hue dimension. In other words, the
color
value of the pixels of the image to be transformed is embodied in the target
color space
as the numerical values characterized by three dimension values, and the three
dimension
values respectively characterize the luminance, saturation and hue of the
pixels. In
addition, the transfer vector is a three-dimensional vector, and the three
dimensions
respectively characterize the corresponding luminance, saturation and hue of
the color.
In the target color space, the color value of the pixels of the image to be
transformed is
transferred according to the transfer vector, and the image after transferring
is precisely
the image to be transformed to which the target color is transferred. It is
possible during
the color transferring process to transfer the color value of all pixels of
the image to be
transformed according to the transfer vector, and it is also possible to
transfer the color
value of partial pixels of the image to be transformed according to the
transfer vector.
[0071] In one mode of execution in this embodiment, the step of transferring
the color value of
the pixels of the image to be transformed in accordance with a luminance
dimension, a
saturation dimension and a hue dimension, respectively, according to the
transfer vector
13
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
includes: normalizing the luminance data to which the luminance dimension in
the color
value of the pixels of the image to be transformed corresponds according to a
first
normalization function, and obtaining a first numerical value; transferring
the color value
of the pixels of the image to be transformed in accordance with the luminance
dimension
according to the transfer vector and the first numerical value; normalizing
the saturation
data to which the saturation dimension in the color value of the pixels of the
image to be
transformed corresponds according to a second normalization function, and
obtaining a
second numerical value; transferring the color value of the pixels of the
image to be
transformed in accordance with the saturation dimension according to the
transfer vector
and the second numerical value; and obtaining a sum value of the transfer
vector and the
color value of the pixels of the image to be transformed, acquiring the
remainder of the
sum value divided by 2n, and transferring the color value of the pixels of the
image to be
transformed in accordance with the hue dimension according to a remainder-
acquiring
result, wherein it is the ratio of the circumference of a circle to its
diameter.
[0072] Specifically, the color value of all pixels of the image to be
transformed is transferred
according to the transfer vector. When the pixels of the image to be
transformed are
transferred in the target color space according to the transfer vector, the
following
expressions are abided by:
j[Lf = p,)[ ]-4-f1(põ)[L])*(li stk.õ[L]
pi.)[ [ ]-f-fjpia IC P*di stor Cl
j[Iii = (pti[ H -.1ust,,,,,(E1) MOD2ff
where i, j are respectively two-dimensional coordinates in the image, L
represents
luminance dimension, C represents saturation dimension, and H represents hue
dimension.
pLi[L]
represents the value of the image to be transformed on the luminance
dimension,
ki[C] represents the value of the image to be transformed on the saturation
dimension,
and represents the value of the image to be transformed on
the hue dimension.
14
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
f
ft(PLACP [1.1) represents the first normalization function,
represents the
second normalization function, and AVICO represents the remainder-acquiring
disto[L]
operation.
represents the value of the transfer vector on the luminance
stkk [C]
dimension
represents the value of the transfer vector on the saturation
dimension, and di st.k H I represents the value of the transfer vector on the
hue
dimension. PWIL] represents the value of the image to be transformed obtained
after
p.
luminance dimension transfer,
represents the value of the image to be
transformed obtained after saturation dimension transfer, and P Lj[
represents the
value of the image to be transformed obtained after hue dimension transfer.
to. ,[L]-501
f IUD õ[LP¨tanill( )
+1
[0073] The first normalization functioa is: 27
[ CD
[0074] the second normalization function
is:
1 C1-551 A
fcl(pij[0])=-2( tarLh(IPL'r41 )+
pi, j[L]
where the domain of definition of and is
[0,100], and the domain of
f(p
definition of ifis [0,27c]. The codornain of and is
[0,1], fifspALP
and the codomain of Pajil is [0 27t]
f(r. [Lp
[0075] In addition, the first normalization function "
can further be:
(p. -[L]¨ 50)2
f j(p Lp =1 - _______________
2500 õ and
fc(Pif[CP
[0076] the second normalization function
can further be:
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
f
jr' ij[C]-551 anh ______________ ¨) 1-1)
[0077] Normalization functions are used in this embodiment to define the image
to be
transformed, so as to ensure as far as possible that the color value of the
pixels still falls
within the domain of definition even after transformation. In addition, the
definitive
normalization functions are continuous within the entire domain of definition,
thusly
guaranteeing that there is no tearing sensation to generate at various border
regions of the
image after color transfer, and strengthening readability.
[0078] Selection of the first normalization function and the second
normalization function is
variegated, and abides by the following constraint in the physical meaning.
[0079] As for the luminance channel, the codomain of the normalization
function is [0,1], the
axis is symmetrical in the domain of definition relevant to x=50, the function
is
monotonously increased when x<50, the function is monotonously decreased when
x>50,
and the maximum value 1 is obtained when x=50. This is so because black and
white
regions are usually not desired for participation in color transformation,
such as black and
white text formats. The transfer vector is weighted through the normalization
functions
to ensure that the black and white text formats in the original image
essentially remain
unchanged.
[0080] As for the saturation channel, the normalization function is
monotonously increased in
the domain of definition, and the codomain is [0,1]. Thusly, it is ensured
that, when the
saturation of the original color value is relatively low, the amplitude of
change in its
saturation should also be relatively low to prevent the color value from being
imprecise
after color transformation.
[0081] Two sets of different normalization functions are taken for example
below, to have
16
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
achieved different effects for the same input:
[0082] First set:
[L]-501
)
fipi4[2:1) . V=tanh( ______ +1
7 .
[0083] the first normalization function is:
f, [CI)
[0084] the second normalization function
is:
________________________ ( t anh( IPiJ[CI-551) +1)
2 41
[0085] Second set:
(;) 50)2
LI) fs(pv[L94-
[0086] the first normalization function is:
f,(P,,,P1)
[0087] the second normalization function
is:
f (?, 1[CD 1= ¨ (t ( [ C] -551
c '2 iv?
2 20
[0088] The results after performing color transfer by using the two sets of
functions are as shown
in Fig. 4. With reference to Fig. 4, after the color view 11 of the target
color has been
performed with color transfer by using the first set of functions, the new
image obtained
is image 22, after color transfer by using the second set of functions, the
new image
obtained is image 33. As can be known by a comparison of image 22 with image
33, after
transferring of the target color, the image and text format in image 22 differ
apparently
from the image and text format in image 33 in terms of display effects.
[0089] In the picture generated by using the first set of functions, the
contrast of the text format
is slightly lowered, whereas in the picture generated by using the second set
of functions,
the contrast of the text format is clear, but color saturation and luminance
are slightly
lowered.
17
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
[0090] Selection of the normalization functions is subjective, the two sets of
normalization
functions given in the present application are considered through
experimentation to be
better ones in representation effect, as they respectively focus on bright and
relatively
solemn scenarios under the precondition of guaranteeing the basic effect of
the picture as
generated. As a matter of fact, any function that abides by the aforementioned
constraining conditions is usable as a normalization function, but it will
also affect the
picture as generated in a different way.
[0091] In one embodiment, after step S300, the image color transferring method
further
comprises: transforming the image obtained after the target color has been
transferred to
the image to be transformed to an image of a corresponding target format.
[0092] Specifically, during the process of transferring the target color to
the image to be
transformed, it is required to transform the target color and the image to be
transformed
in the target color space to be processed there, and the image obtained after
transferring
is also an image under the target color space. Therefore, it is needed to
transform the
image obtained after transferring to an image of a target format corresponding
to
requirement, and to finally output the image of the target format. It is also
possible to
subject the image obtained after the target color has been transferred to the
image to be
transformed to image format transformation according to various requirements.
For
instance, in the case the image to be transformed and the target color are
both
characterized under the RGB color space, after the two have been transformed
in the CIE-
LCH color model space to have been performed color transfer processing, the
image
obtained after transferring is transformed back again in the RGB color space,
and the
image under the RGB color space is finally output.
[0093] In the aforementioned image color transferring method, when the color
value of the target
color transferred to the image to be transformed is determined, the color
value of the
18
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
dominant color of the image to be transformed is extracted, a transfer vector
for carrying
out color transfer is determined according to the color value of the dominant
color of the
image to be transformed and the color value of the target color, and the
transfer vector
can be finally based on to transfer the target color to the image to be
transformed.
Accordingly, color transfer of the image to be transformed is realizable
without any target
reference picture, and the restriction of the traditional color transfer
technique in which
reference picture is required is broken, so that the color transfer technique
is made to
satisfy many more application scenarios.
[0094] In order to better enunciate the image color transferring method of the
aforementioned
embodiment, a concrete embodiment is given below.
[0095] 1. The OpenCV library is employed to read a picture to be processed,
namely the image
to be transformed.
[0096] 2. The modified median cut quantization (MMCQ) method is employed to
process the
picture to be processed, 10 output colors are obtained, and the color with the
highest
probability of occurrence is selected as the dominant color of the picture to
be processed.
[0097] 3. The dominant color as obtained and the target color needed for color
transfer are
transformed in the CIE-LCH color model space, a third party library of python
can be
employed, and corresponding functions in scikit-image are used to carry out
image
processing to obtain the color value of the dominant color and the color value
of the target
color. If there is a transparent channel in the picture to be processed, the
transparent
channel is drawn out before transformation is made, and the transparent
channel is
separately stored.
[0098] 4. The color value of the dominant color and the color value of the
target color as obtained
are made use of, and vector subtraction of a Numpy multi-dimensional array is
employed
19
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
to calculate the translation transformation vector from under the color value
of the
dominant color to the color value of the target color in the CIE-LCH color
model space.
[0099] 5. Vector addition of the Numpy multi-dimensional array is employed to
make
corresponding transformation on each pixel in the picture to be processed
according to
the translation transformation vector to obtain a picture after
transformation.
[0100] 6. The picture after transformation is transformed back from the CIE-
LCH color model
space to the RGB color space, the third party library of python can
specifically be
employed, and the corresponding functions in scikit-image are used to perform
image
processing. By the same token, if there is a transparent channel in the
picture after
transformation, a Numpy.concatenate function in the Numpy multi-dimensional
array is
used to obtain a target picture from the picture after transformation plus the
transparent
channel stored in step 3.
[0101] 7. The process is completed, and the target picture after
transformation is output.
[0102] The implementation result of this mode of execution is as shown in Fig.
5, in which target
color 44 is transferred to picture to be processed 55, and target picture 66
is finally
obtained after transferring.
[0103] Accordingly, when there is new color matching requirement of an
existing design picture,
it is merely required according to the technical solution of the present
application to input
the existing template bitmap and the target color value designated as
required, whereby a
color-transferred picture can be obtained according to the original template
in several
seconds, and only manual check or slight adjustment is needed thereafter.
Repeated
manual work of the designer is greatly reduced, moreover, only a PSD file (an
image file
format specific to Photoshop) is required to be maintained in the system
before the
required picture can be generated in real time after a color matching
requirement has been
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
received, and storage resource is greatly saved.
[0104] As should be understood, although the various steps in the flowcharts
are sequentially
displayed as indicated by arrows, these steps are not necessarily executed in
the sequences
indicated by arrows. Unless otherwise explicitly noted in this paper,
execution of these
steps is not restricted by any sequence, as these steps can also be executed
in other
sequences (than those indicated in the drawings). Moreover, at least partial
steps in the
flowcharts may include plural sub-steps or multi-phases, these sub-steps or
phases are not
necessarily completed at the same timing, but can be executed at different
timings, and
these sub-steps or phases are also not necessarily sequentially performed, but
can be
performed in turns or alternately with other steps or with at least some of
sub-steps or
phases of other steps.
[0105] In one embodiment, as shown in Fig. 6, there is provided an image color
transferring
device that comprises: an extracting module 100, a determining module 200 and
a
transferring module 300, of which:
[0106] the extracting module 100 is employed for extracting a color value of a
dominant color
of an image to be transformed;
[0107] the determining module 200 is employed for determining a transfer
vector used in
transferring a target color to the image to be transformed according to the
color value of
the dominant color of the image to be transformed and a color value of the
target color;
and
[0108] the transferring module 300 is employed for transferring the target
color to the image to
be transformed according to the transfer vector.
[0109] In one of the embodiments, the determining module 200 can include (not
shown in Fig.
6):
[0110] a first obtaining unit, for obtaining a corresponding first three-
dimensional color vector
of the color value of the dominant color of the image to be transformed in a
target color
21
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
space;
[0111] a second obtaining unit, for obtaining a corresponding second three-
dimensional color
vector of the color value of the target color in the target color space; and
[0112] a determining unit, for determining the transfer vector according to
the first three-
dimensional color vector and the second three-dimensional color vector.
[0113] In one of the embodiments, the determining unit can include:
[0114] a determining subunit, for obtaining a translation transformation
vector used in translating
the first three-dimensional color vector to the second three-dimensional
color, and taking
the translation transformation vector as the transfer vector.
[0115] In one of the embodiments, the transferring module 300 can include (not
shown in Fig.
6):
[0116] an extracting unit, for extracting a color value of pixels of the image
to be transformed;
and
[0117] a transferring unit, for transferring the color value of the pixels of
the image to be
transformed according to the transfer vector, and taking the image to be
transformed after
transferring as a target image;
[0118] the target image is an image formed after the target color has been
transferred to the image
to be transformed.
[0119] In one of the embodiments, the transferring unit further includes:
[0120] a transferring subunit, for transferring the color value of the pixels
of the image to be
transformed in accordance with a luminance dimension, a saturation dimension
and a hue
dimension, respectively, in the target color space according to the transfer
vector.
[0121] In one of the embodiments, the transferring subunit further includes
(not shown in Fig.
6):
[0122] a first processing unit, for normalizing the luminance data to which
the luminance
22
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
dimension in the color value of the pixels of the image to be transformed
corresponds
according to a first normalization function, and obtaining a first numerical
value;
transferring the color value of the pixels of the image to be transformed in
accordance
with the luminance dimension according to the transfer vector and the first
numerical
value;
[0123] a second processing unit, for normalizing the saturation data to which
the saturation
dimension in the color value of the pixels of the image to be transformed
corresponds
according to a second normalization function, and obtaining a second numerical
value;
transferring the color value of the pixels of the image to be transformed in
accordance
with the saturation dimension according to the transfer vector and the second
numerical
value; and
[0124] a third processing unit, for obtaining a sum value of the transfer
vector and the color value
of the pixels of the image to be transformed, acquiring the remainder of the
sum value
divided by 2n, and transferring the color value of the pixels of the image to
be transformed
in accordance with the hue dimension according to a remainder-acquiring
result, wherein
it is the ratio of the circumference of a circle to its diameter.
[0125] In one of the embodiments, the image color transferring device further
comprises (not
shown in Fig. 6):
[0126] a segmenting module, for employing a color quantization algorithm to
sample the image
to be transformed, and obtaining a plurality of quantized colors; and taking
the color with
the highest probability of occurrence from the plurality of colors as the
dominant color
of the image to be transformed.
[0127] Specific definitions relevant to the image color transferring device
may be inferred from
the aforementioned definitions to the image color transferring method, while
no repetition
is made in this context. The various modules in the aforementioned image color
transferring device can be wholly or partly realized via software, hardware,
and a
combination of software with hardware. The various modules can be embedded in
the
23
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
form of hardware in a processor in a computer equipment or independent of any
computer
equipment, and can also be stored in the form of software in a memory in a
computer
equipment, so as to facilitate the processor to invoke and perform operations
corresponding to the aforementioned various modules.
[0128] In one embodiment, a computer equipment is provided, the computer
equipment can be
an image processing server, and its internal structure can be as shown in Fig.
7. The
computer equipment comprises a processor, a memory, a network interface and a
database connected to each other via a system bus. The processor of the
computer
equipment is employed to provide computing and controlling capabilities. The
memory
of the computer equipment includes a nonvolatile storage medium, and an
internal
memory. The nonvolatile storage medium stores therein an operating system, a
computer
program and a database. The internal memory provides environment for the
running of
the operating system and the computer program in the nonvolatile storage
medium. The
database of the computer equipment is employed to store such data as color
values of
target colors, etc. The network interface of the computer equipment is
employed to
connect to an external terminal via network for communication. The computer
program
realizes an image color transferring method when it is executed by a
processor.
[0129] As understandable to persons skilled in the art, the structure
illustrated in Fig. 7 is merely
a block diagram of partial structure relevant to the solution of the present
application, and
does not constitute any restriction to the computer equipment on which the
solution of
the present application is applied, as the specific computer equipment may
comprise
component parts that are more than or less than those illustrated in Fig. 7,
or may combine
certain component parts, or may have different layout of component parts.
[0130] In one embodiment, there is provided a computer equipment that
comprises a memory, a
processor and a computer program stored on the memory and operable on the
processor,
and the following steps are realized when the processor executes the computer
program:
24
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
[0131] extracting a color value of a dominant color of an image to be
transformed; determining
a transfer vector used in transferring a target color to the image to be
transformed
according to the color value of the dominant color of the image to be
transformed and a
color value of the target color; and transferring the target color to the
image to be
transformed according to the transfer vector.
[0132] In one embodiment, when the processor executes the computer program to
realize the
step of determining a transfer vector used in transferring a target color to
the image to be
transformed according to the color value of the dominant color of the image to
be
transformed and a color value of the target color, the following steps are
further realized:
[0133] obtaining a corresponding first three-dimensional color vector of the
color value of the
dominant color of the image to be transformed in a target color space;
obtaining a
corresponding second three-dimensional color vector of the color value of the
target color
in the target color space; and determining the transfer vector according to
the first three-
dimensional color vector and the second three-dimensional color vector.
[0134] In one embodiment, when the processor executes the computer program to
realize the
step of determining the transfer vector according to the first three-
dimensional color
vector and the second three-dimensional color vector, the following steps are
further
realized:
[0135] obtaining a translation transformation vector used in translating the
first three-
dimensional color vector to the second three-dimensional color, and taking the
translation
transformation vector as the transfer vector.
[0136] In one embodiment, when the processor executes the computer program to
realize the
step of transferring the target color to the image to be transformed according
to the
transfer vector, the following steps are further realized:
[0137] extracting a color value of pixels of the image to be transformed; and
transferring the
color value of the pixels of the image to be transformed according to the
transfer vector,
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
and taking the image to be transformed after transferring as a target image;
the target
image is an image formed after the target color has been transferred to the
image to be
transformed.
[0138] In one embodiment, when the processor executes the computer program to
realize the
step of transferring the color value of the pixels of the image to be
transformed according
to the transfer vector, the following step is further realized:
[0139] transferring the color value of the pixels of the image to be
transformed in accordance
with a luminance dimension, a saturation dimension and a hue dimension,
respectively,
in the target color space according to the transfer vector.
[0140] In one embodiment, when the processor executes the computer program to
realize the
step of transferring the color value of the pixels of the image to be
transformed in
accordance with a luminance dimension, a saturation dimension and a hue
dimension,
respectively, in the target color space according to the transfer vector, the
following steps
are further realized:
[0141] normalizing the luminance data to which the luminance dimension in the
color value of
the pixels of the image to be transformed corresponds according to a first
normalization
function, and obtaining a first numerical value; transferring the color value
of the pixels
of the image to be transformed in accordance with the luminance dimension
according to
the transfer vector and the first numerical value; normalizing the saturation
data to which
the saturation dimension in the color value of the pixels of the image to be
transformed
corresponds according to a second normalization function, and obtaining a
second
numerical value; transferring the color value of the pixels of the image to be
transformed
in accordance with the saturation dimension according to the transfer vector
and the
second numerical value; and obtaining a sum value of the transfer vector and
the color
value of the pixels of the image to be transformed, acquiring the remainder of
the sum
value divided by 2n, and transferring the color value of the pixels of the
image to be
transformed in accordance with the hue dimension according to a remainder-
acquiring
26
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
result, wherein it is the ratio of the circumference of a circle to its
diameter.
[0142] In one embodiment, when the processor executes the computer program,
the following
steps are further realized:
[0143] employing a color quantization algorithm to sample the image to be
transformed, and
obtaining a plurality of quantized colors; and taking the color with the
highest probability
of occurrence from the plurality of colors as the dominant color of the image
to be
transformed.
[0144] In one embodiment, there is provided a computer-readable storage medium
storing
thereon a computer program, and the following steps are realized when the
computer
program is executed by a processor:
[0145] extracting a color value of a dominant color of an image to be
transformed; determining
a transfer vector used in transferring a target color to the image to be
transformed
according to the color value of the dominant color of the image to be
transformed and a
color value of the target color; and transferring the target color to the
image to be
transformed according to the transfer vector.
[0146] In one embodiment, when the computer program is executed by a processor
to realize the
step of determining a transfer vector used in transferring a target color to
the image to be
transformed according to the color value of the dominant color of the image to
be
transformed and a color value of the target color, the following steps are
further realized:
[0147] obtaining a corresponding first three-dimensional color vector of the
color value of the
dominant color of the image to be transformed in a target color space;
obtaining a
corresponding second three-dimensional color vector of the color value of the
target color
in the target color space; and determining the transfer vector according to
the first three-
dimensional color vector and the second three-dimensional color vector.
[0148] In one embodiment, when the computer program is executed by a processor
to realize the
27
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
step of determining the transfer vector according to the first three-
dimensional color
vector and the second three-dimensional color vector, the following steps are
further
realized:
[0149] obtaining a translation transformation vector used in translating the
first three-
dimensional color vector to the second three-dimensional color, and taking the
translation
transformation vector as the transfer vector.
[0150] In one embodiment, when the computer program is executed by a processor
to realize the
step of transferring the target color to the image to be transformed according
to the
transfer vector, the following steps are further realized:
[0151] extracting a color value of pixels of the image to be transformed; and
transferring the
color value of the pixels of the image to be transformed according to the
transfer vector,
and taking the image to be transformed after transferring as a target image;
the target
image is an image formed after the target color has been transferred to the
image to be
transformed.
[0152] In one embodiment, when the computer program is executed by a processor
to realize the
step of transferring the color value of the pixels of the image to be
transformed according
to the transfer vector, the following step is further realized:
[0153] transferring the color value of the pixels of the image to be
transformed in accordance
with a luminance dimension, a saturation dimension and a hue dimension,
respectively,
in the target color space according to the transfer vector.
[0154] In one embodiment, when the computer program is executed by a processor
to realize the
step of transferring the color value of the pixels of the image to be
transformed in
accordance with a luminance dimension, a saturation dimension and a hue
dimension,
respectively, in the target color space according to the transfer vector, the
following steps
are further realized:
[0155] normalizing the luminance data to which the luminance dimension in the
color value of
28
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
the pixels of the image to be transformed corresponds according to a first
normalization
function, and obtaining a first numerical value; transferring the color value
of the pixels
of the image to be transformed in accordance with the luminance dimension
according to
the transfer vector and the first numerical value; normalizing the saturation
data to which
the saturation dimension in the color value of the pixels of the image to be
transformed
corresponds according to a second normalization function, and obtaining a
second
numerical value; transferring the color value of the pixels of the image to be
transformed
in accordance with the saturation dimension according to the transfer vector
and the
second numerical value; and obtaining a sum value of the transfer vector and
the color
value of the pixels of the image to be transformed, acquiring the remainder of
the sum
value divided by 2n, and transferring the color value of the pixels of the
image to be
transformed in accordance with the hue dimension according to a remainder-
acquiring
result, wherein it is the ratio of the circumference of a circle to its
diameter.
[0156] In one embodiment, when the computer program is executed by a
processor, the following
steps are further realized:
[0157] employing a color quantization algorithm to sample the image to be
transformed, and
obtaining a plurality of quantized colors; and taking the color with the
highest probability
of occurrence from the plurality of colors as the dominant color of the image
to be
transformed.
[0158] As comprehensible to persons ordinarily skilled in the art, the entire
or partial flows in
the methods according to the aforementioned embodiments can be completed via a
computer program instructing relevant hardware, the computer program can be
stored in
a nonvolatile computer-readable storage medium, and the computer program can
include
the flows as embodied in the aforementioned various methods when executed. Any
reference to the memory, storage, database or other media used in the various
embodiments provided by the present application can all include nonvolatile
and/or
volatile memory/memories. The nonvolatile memory can include a read-only
memory
29
Date Recue/Date Received 2022-03-17
CA 03154893 2022-03-17
(ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM),
an electrically erasable and programmable ROM (EEPROM) or a flash memory. The
volatile memory can include a random access memory (RAM) or an external cache
memory. To serve as explanation rather than restriction, the RAM is obtainable
in many
forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM
(SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM),
synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM
(RDRAM), direct Rambus dynamic RAM (DRDRAM), and Rambus dynamic RAM
(RDRAM), etc.
[0159] Technical features of the aforementioned embodiments are randomly
combinable, while
all possible combinations of the technical features in the aforementioned
embodiments
are not exhausted for the sake of brevity, but all these should be considered
to fall within
the scope recorded in the Description as long as such combinations of the
technical
features are not mutually contradictory.
[0160] The foregoing embodiments are merely directed to several modes of
execution of the
present application, and their descriptions are relatively specific and
detailed, but they
should not be hence misunderstood as restrictions to the inventive patent
scope. As should
be pointed out, persons with ordinary skill in the art may further make
various
modifications and improvements without departing from the conception of the
present
application, and all these should pertain to the protection scope of the
present application.
Accordingly, the patent protection scope of the present application shall be
based on the
attached Claims.
Date Recue/Date Received 2022-03-17