CN106204690B - Image processing method and device - Google Patents

Image processing method and device Download PDF

Info

Publication number
CN106204690B
CN106204690B CN201510222313.6A CN201510222313A CN106204690B CN 106204690 B CN106204690 B CN 106204690B CN 201510222313 A CN201510222313 A CN 201510222313A CN 106204690 B CN106204690 B CN 106204690B
Authority
CN
China
Prior art keywords
color
range
saturation
preset
chroma
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510222313.6A
Other languages
Chinese (zh)
Other versions
CN106204690A (en
Inventor
刘奎龙
李波
黄凯明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Singapore Holdings Pte Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201510222313.6A priority Critical patent/CN106204690B/en
Publication of CN106204690A publication Critical patent/CN106204690A/en
Application granted granted Critical
Publication of CN106204690B publication Critical patent/CN106204690B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Color Image Communication Systems (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses an image processing method and device, which are used for combining the color contrast of a foreground image and a background image to carry out color matching so as to improve the color matching effect. The invention provides an image processing method, which comprises the following steps: determining a foreground image in an original image and a main body color of the foreground image; obtaining a background color according to the main body color and a preset color matching rule for realizing the comparative display of the foreground image and the background image, and obtaining a background image by using the background color; and synthesizing the foreground image and the obtained background image into a target image. The invention combines the color contrast of the foreground image and the background image to carry out color matching, thereby improving the color matching effect.

Description

Image processing method and device
Technical Field
The present invention relates to the field of image technologies, and in particular, to an image processing method and apparatus.
Background
Display ads (displays ads) on internet media are classified into text ads and image ads (banner). Data analysis shows that the flow introduced by the image advertisement is higher in click rate (CTR, ratio of number of clicks to number of exposures) than the flow introduced by the text advertisement, and is easier to attract the attention of users.
In the prior art, a scheme for making an image advertisement can be used, for example, by means of the prior art, a product image is scratched, and making of the image advertisement is completed. This scheme is widely used in actual production.
However, the color matching is poor.
Disclosure of Invention
The embodiment of the invention provides an image processing method and device, which are used for combining the color contrast of a foreground image and a background image to carry out color matching, so that the color matching effect is improved.
The image processing method provided by the embodiment of the invention comprises the following steps:
determining a foreground image in an original image and a main body color of the foreground image;
obtaining a background color according to the main body color and a preset color matching rule for realizing the comparative display of the foreground image and the background image, and obtaining a background image by using the background color;
and synthesizing the foreground image and the obtained background image into a target image.
By the method, the main color of the foreground image in the original image and the preset color matching rule for realizing the comparative display of the foreground image and the background image can be utilized to obtain the background color, and the background color is utilized to obtain the background image; and synthesizing the foreground image and the obtained background image into a target image. Therefore, color matching is carried out by combining the color contrast of the foreground image and the background image, the color matching effect is improved, the user experience effect is improved, and the click rate of image related contents such as image advertisements can be further improved.
Optionally, determining a foreground image in the original image and a main color of the foreground image specifically includes:
determining the gray value of each pixel point of the original image;
determining a foreground image in the original image according to the gray value of each pixel point of the original image;
and determining a histogram of gray values of a foreground image in the original image, and determining a main body color of the foreground image by using the histogram.
Optionally, obtaining a background color according to the main color and a preset color matching rule for realizing comparative display of the foreground image and the background image, specifically including:
determining the lightness range of the background color by using the lightness of the main color and a plurality of preset lightness ranges, and selecting lightness from the lightness range to which the background color belongs as the lightness of the background color; and/or the presence of a gas in the gas,
determining the saturation range of the background color by utilizing the saturation of the main body color and a plurality of preset saturation ranges, and selecting a saturation from the saturation range of the background color as the saturation of the background color; and/or the presence of a gas in the gas,
determining the chroma of the background color by using the chroma of the main body color and a preset chroma included angle;
and determining the background color by using the lightness, the saturation and the chroma of the background color.
Optionally, determining the brightness range of the background color by using the brightness of the subject color and a preset plurality of brightness ranges, including:
when the lightness of the main body color belongs to a preset first lightness range, determining that the lightness range of the background color belongs to a preset second lightness range; when the lightness of the main body color belongs to a preset second lightness range, determining that the lightness range of the background color belongs to a preset first lightness range; wherein the first range of brightness is higher than or equal to the second range of brightness.
Optionally, determining the saturation range of the background color by using the saturation of the subject color and a plurality of preset saturation ranges includes:
when the saturation of the main color belongs to a preset first saturation range, determining that the saturation range of the background color belongs to a preset second saturation range; when the saturation of the main color belongs to a preset second saturation range, determining that the saturation range of the background color belongs to a preset first saturation range; wherein the first saturation range is higher than or equal to the second saturation range.
Optionally, determining the chroma of the background color by using the chroma of the main body color and a preset chroma included angle includes:
when the chroma of the main body color belongs to a preset first chroma range, determining the chroma of the background color by adopting a preset first chroma included angle and the chroma of the main body color; when the chroma of the main body color belongs to a preset second chroma range, determining the chroma of the background color by adopting a preset second chroma included angle and the chroma of the main body color; wherein the first chroma included angle is smaller than the second chroma included angle.
Optionally, the method further comprises:
determining a mark to be added in the target image, and determining the color of the mark, wherein the mark is added in the target image by adopting the color.
Optionally, the marker comprises: text, graphics and/or symbols.
Optionally, the determining the color of the mark specifically includes: and determining the color with the highest saturation in the foreground image, and taking the color as the color of the mark.
An image processing apparatus provided in an embodiment of the present invention includes:
a first unit, configured to determine a foreground image in an original image and a subject color of the foreground image;
the second unit is used for obtaining a background color according to the main body color and a preset color matching rule for realizing the comparative display of the foreground image and the background image, and obtaining a background image by using the background color;
and a third unit, configured to combine the foreground image and the obtained background image into a target image.
Optionally, the first unit is specifically configured to:
determining the gray value of each pixel point of the original image;
determining a foreground image in the original image according to the gray value of each pixel point of the original image;
and determining a histogram of gray values of a foreground image in the original image, and determining a main body color of the foreground image by using the histogram.
Optionally, the second unit is specifically configured to, when obtaining the background color according to the main color and a preset color matching rule for implementing comparative display of the foreground image and the background image,:
determining the lightness range of the background color by using the lightness of the main color and a plurality of preset lightness ranges, and selecting lightness from the lightness range to which the background color belongs as the lightness of the background color; and/or the presence of a gas in the gas,
determining the saturation range of the background color by utilizing the saturation of the main body color and a plurality of preset saturation ranges, and selecting a saturation from the saturation range of the background color as the saturation of the background color; and/or the presence of a gas in the gas,
determining the chroma of the background color by using the chroma of the main body color and a preset chroma included angle;
and determining the background color by using the lightness, the saturation and the chroma of the background color.
Optionally, when determining the lightness range of the background color by using the lightness of the main color and a plurality of preset lightness ranges, the second unit is specifically configured to:
when the lightness of the main body color belongs to a preset first lightness range, determining that the lightness range of the background color belongs to a preset second lightness range; when the lightness of the main body color belongs to a preset second lightness range, determining that the lightness range of the background color belongs to a preset first lightness range; wherein the first range of brightness is higher than or equal to the second range of brightness.
Optionally, when the second unit determines the saturation range of the background color by using the saturation of the main color and a plurality of preset saturation ranges, the second unit is specifically configured to:
when the saturation of the main color belongs to a preset first saturation range, determining that the saturation range of the background color belongs to a preset second saturation range; when the saturation of the main color belongs to a preset second saturation range, determining that the saturation range of the background color belongs to a preset first saturation range; wherein the first saturation range is higher than or equal to the second saturation range.
Optionally, when determining the chroma of the background color, the second unit is specifically configured to:
when the chroma of the main body color belongs to a preset first chroma range, determining the chroma of the background color by adopting a preset first chroma included angle and the chroma of the main body color; when the chroma of the main body color belongs to a preset second chroma range, determining the chroma of the background color by adopting a preset second chroma included angle and the chroma of the main body color; wherein the first chroma included angle is smaller than the second chroma included angle.
Optionally, the third unit is further configured to:
determining a mark to be added in the target image, and determining the color of the mark, wherein the mark is added in the target image by adopting the color.
Optionally, the marker comprises: text, graphics and/or symbols.
Optionally, the first unit is further configured to determine a color with the highest saturation in the foreground image, use the color as the color of the mark, and send the color to the third unit.
Drawings
Fig. 1 is a schematic flowchart of an image processing method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a method for determining a main color of a foreground image according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a gray level histogram of a main color of a foreground image according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of an HSV space provided in accordance with an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides an image processing method and device, which are used for combining the color contrast of a foreground image and a background image to carry out color matching, so that the color matching effect is improved.
The embodiment of the invention provides a scheme capable of automatically matching colors for an object image, which is characterized in that an original image of an object is input, the main body color distribution of the object is obtained through statistics, and schemes such as background color matching, character color matching and the like are given according to the main body color.
Referring to fig. 1, an image processing method provided in an embodiment of the present invention includes:
s101, determining a foreground image in an original image and a main body color of the foreground image;
the foreground image is the image of the object itself without the background in the original image.
The main color of the foreground image, i.e. the dominant color of the object.
S102, obtaining a background color according to the main body color and a preset color matching rule for realizing the comparative display of the foreground image and the background image, and obtaining a background image by using the background color;
the preset color matching rules for implementing the comparative display of the foreground image and the background image are that some rules such as value ranges of corresponding feature values of color matching are preset according to specific values of various feature values of a main body color in consideration of contrast of color matching, and will be described in detail later with reference to specific embodiments.
S103, synthesizing the foreground image and the obtained background image into a target image.
By the method, the main color of the foreground image in the original image and the preset color matching rule for realizing the comparative display of the foreground image and the background image can be utilized to obtain the background color, and the background color is utilized to obtain the background image; and synthesizing the foreground image and the obtained background image into a target image. Therefore, color matching is carried out by combining the color contrast of the foreground image and the background image, the color matching effect is improved, the user experience effect is improved, and the click rate of image related contents such as image advertisements can be further improved.
Optionally, determining a foreground image in the original image and a main color of the foreground image specifically includes:
and determining the gray value of each pixel point of the original image. Specifically, the RGB value of each pixel point may be calculated first, and the gray value of the pixel point is further calculated according to the RGB value.
And determining a foreground image in the original image according to the gray value of each pixel point of the original image. Specifically, the background color in the original image may be removed according to the gray value of each pixel in the prior art, so as to obtain the foreground image.
And determining a histogram of gray values of a foreground image in the original image, and determining a main body color of the foreground image by using the histogram. Specifically, the main body color of the foreground image may be obtained through histogram distribution of the gray values of the foreground image.
For example, referring to fig. 2, step S101 specifically includes the following steps:
s201, acquiring an original image, and opening the original image.
S202, converting the original image into an RGB format to facilitate point operation, namely determining the RGB value of each pixel point in the original image.
S203, calculating the gray value of each pixel point according to the RGB values of the pixel points.
The prior art is used for calculating the gray value of the pixel point, for example, for each pixel point, according to a formula: the gray-level value is (3 × R +6 × G + B)/10, where R, G, B represents the red (R), green (G), and blue (B) values of the pixel point, respectively.
Grayscales represent objects using black tones. Each gray object has a brightness value from 0% (white) to 100% (black). Images generated using black and white or grayscale scanners are typically displayed in grayscale. The use of grayscale can also convert color drawings to high quality black and white drawings. The edges of an image are the most basic features of an image.
Since the human eye does not perceive the RGB colors differently, different weights need to be given at the time of conversion. From the physiological and psychological perspectives, the human eye is more sensitive to green, which leads to a fluorescent effect on the human eye, and thus the green weight is greater when calculating the gray value. For example, the weight 6 of G in the above formula is relatively large.
And S204, removing the background color of the original image according to the gray values of all the pixel points in the original image to obtain a foreground image in the original image, namely the image of the object.
In the embodiment of the invention, the background color of the image is removed according to the gray value. Referring to fig. 3, the gray histogram of the original image shows that there is a peak between 0 and 100, the color of the peak is darker and is mostly the color of the foreground image, and there is a peak between 200 and 225, the color of the peak is lighter and is mostly the background color of the original image. The color of the foreground image in the original image can be distinguished from the color of the background image through the histogram, so that the background color is taken out, and the foreground image is determined.
The window change of the gray level in the prior art is a common point operation. Referring to fig. 3, the valley between the two peaks is T, when the original image is subjected to window transformation, the upper limit of the window may be T, the lower limit is 0, and the background color may be eliminated as a result of the transformation.
And S205, obtaining the histogram distribution of the gray values of the foreground image, so that the main color in the foreground image, namely the main color of the foreground image can be obtained.
Alternatively, when a mark such as a letter is to be provided for an image, the color of the mark is also determined.
Specifically, the color value with the highest saturation in the foreground image can be obtained, the main color of the foreground image refers to the most colors owned by the product, and the color value with the highest saturation is obtained by converting the color value represented by RGB of each pixel point of the foreground image into the color value represented by HSV (H: hue, S: saturation, V: lightness) (the conversion method is the prior art), traversing all the pixel points of the foreground image, and searching for the point with the highest S value. For example, the following steps are carried out: a black product has a small piece of red, the main color of the product is black, and the color value with the highest saturation is red.
The interconversion between RGB and HSV is described as follows:
HSV models are commonly used in computer image processing applications. HSV color wheels are often used in a variety of application environments where a user must select a color to apply to a particular image element. Where the hue is represented as a circle, a separate triangle may be used to represent saturation and lightness. Typically, the vertical axis of this triangle indicates saturation, while the horizontal axis represents brightness. In this way, selecting a color may first select a hue in the circle and then select the desired saturation and lightness from the triangle.
Referring to FIG. 4, another visual approach to the HSV model is a cone. In this representation, hue is represented as an angle around the central axis of the cone, saturation is represented as the distance from the center of the cross-section of the cone to this point, and lightness is represented as the distance from the center of the cross-section of the cone to the apex.
In addition to the above representation, the prior art uses hexagonal pyramids for representation. This approach is more suitable for displaying the HSV color space in a single object; but due to its three-dimensional nature it is not suitable for selecting colors in a two-dimensional computer interface.
The HSV color space more closely resembles the way humans perceive colors, and the color scheme is more intuitive. And RGB is an additive primary color model, which is more convenient for computer processing.
Converting RGB value into HSV value
For the RGB value (r, g, b) of each pixel, let (r, g, b) be the red, green and blue coordinates of the color of a pixel, respectively, whose values are real numbers between 0 and 1. Let max be equal to the maximum of r, g, and b. Let min be equal to the minimum of these values. To find the corresponding (h, s, v) value in HSV space, where h e [0,360) is the hue angle of the angle and s, v e [0,1] is the saturation and lightness, the following formula is used:
Figure GDA0002285007450000081
where the value of h is typically normalized to lie between 0 and 360 deg.. And h-0 is used when max-min (i.e., gray) instead of leaving h undefined.
Figure GDA0002285007450000082
v=max
Thereby obtaining the HSV value of the pixel point.
And secondly, converting HSV value to RGB value.
Given a pixel point represented by HSV for a color defined by a value of (h, s, v) in HSV space, with h as above, and s and v varying between 0 and 1 for saturation and lightness, respectively, the corresponding (r, g, b) primaries in RGB space can be calculated as:
Figure GDA0002285007450000091
Figure GDA0002285007450000092
p=v×(1-s)
q=v×(1-f×s)
t=v×(1-(1-f)×s)
wherein p, q and t respectively represent intermediate variables in the calculation process.
RGB values (r, g, b) of pixel points for each color:
Figure GDA0002285007450000093
therefore, the RGB value corresponding to the HSV value of any pixel point can be obtained.
Optionally, obtaining a background color according to the main color and a preset color matching rule for realizing comparative display of the foreground image and the background image, specifically including:
determining a brightness range of the background color by using the brightness (which can be called as brightness) of the main color and a plurality of preset brightness ranges, and selecting brightness from the brightness range to which the background color belongs as the brightness of the background color; and/or the presence of a gas in the gas,
determining the saturation range of the background color by utilizing the saturation of the main body color and a plurality of preset saturation ranges, and selecting a saturation from the saturation range of the background color as the saturation of the background color; and/or the presence of a gas in the gas,
determining the chroma of the background color by using the chroma (which can be called as hue) of the main color and a preset chroma included angle;
and determining the background color by using the lightness, the saturation and the chroma of the background color.
The method comprises the steps of converting the main color of a foreground image from an RGB space to an HSV space, namely converting the RGB value of each pixel point into an HSV value. In the HSV space, the lightness, saturation, and chroma of the subject color can be obtained.
Optionally, determining the brightness range of the background color by using the brightness of the subject color and a preset plurality of brightness ranges, including:
determining that a lightness range of a background color belongs to a preset second lightness range (e.g., [0,0.5]), when the lightness of the subject color belongs to a preset first lightness range (e.g., [0.5,1 ]); when the lightness of the main body color belongs to a preset second lightness range, determining that the lightness range of the background color belongs to a preset first lightness range; wherein the first range of brightness is higher than or equal to the second range of brightness. The meaning is as follows: colors with high lightness are matched with colors with low lightness, and colors with low lightness are matched with colors with high lightness.
Optionally, determining the saturation range of the background color by using the saturation of the subject color and a plurality of preset saturation ranges includes:
determining that the saturation range of the background color belongs to a preset second saturation range (e.g., [0,0.5]) when the saturation of the body color belongs to a preset first saturation range (e.g., [0.5,1 ]); when the saturation of the main color belongs to a preset second saturation range, determining that the saturation range of the background color belongs to a preset first saturation range; wherein the first saturation range is higher than or equal to the second saturation range. The meaning is as follows: colors with high saturation are matched with colors with low saturation, and colors with low saturation are matched with colors with high saturation.
Optionally, determining the chroma of the background color by using the chroma of the main body color and a preset chroma included angle includes:
when the chroma of the main body color belongs to a preset first chroma range, determining the chroma of the background color by adopting a preset first chroma included angle and the chroma of the main body color; when the chroma of the main body color belongs to a preset second chroma range, determining the chroma of the background color by adopting a preset second chroma included angle and the chroma of the main body color; wherein the first chroma included angle is smaller than the second chroma included angle.
Wherein, first chroma scope and second chroma scope can carry out corresponding setting according to actual need, for example can obtain corresponding scope through the simulation, confirms the chroma in which scope through the simulation, is fit for adopting close chroma to match colors, and the chroma in which chroma scope is fit for adopting the chroma that the contrast is high to match colors. The first chroma range and the second chroma range are not limited in the embodiments of the present invention. Of course, color matching can also be achieved without using the first chroma range and the second chroma range, for example, a preset fixed chroma angle is added to the chroma of the main body color, and the obtained sum value is used as the chroma of the background color.
The value range of the hue (i.e. H) is [0,360 ], and in practical application, different hue color matching can be selected according to products in different industries, for example: selecting 30 degrees as a similar color matching, namely adding the chroma of the theme color to a first chroma included angle of 30 degrees to obtain the chroma of the background color; and selecting 180 degrees as contrast color matching, namely adding the chroma of the theme color to a second chroma included angle of 180 degrees to obtain the chroma of the background color and the like.
In addition, the color with the highest saturation in the main body colors can be used as the character color matching. The color with higher saturation is easy to be contrasted with the background color, and the color with high saturation appears in the foreground image, so that the character color can correspond to the foreground image, and the purpose of processing is to easily enable marks such as characters and the foreground image to attract attention of a user.
Thus, optionally, the method further comprises:
determining a mark to be added in the target image, and determining the color of the mark, wherein the mark is added in the target image by adopting the color.
Optionally, the marker comprises: text, graphics and/or symbols.
Optionally, the determining the color of the mark specifically includes: and determining the color with the highest saturation in the foreground image, and taking the color as the color of the mark.
In the embodiment of the invention, in the linux operating system, the scheme realized by the python language can achieve the best implementation effect.
In correspondence with the above method, referring to fig. 5, an image processing apparatus according to an embodiment of the present invention includes:
a first unit 11, configured to determine a foreground image in an original image and a subject color of the foreground image;
the second unit 12 is configured to obtain a background color according to the main body color and a preset color matching rule for realizing comparative display of the foreground image and the background image, and obtain a background image by using the background color;
a third unit 13, configured to combine the foreground image and the obtained background image into a target image.
Optionally, the first unit is specifically configured to:
determining the gray value of each pixel point of the original image;
determining a foreground image in the original image according to the gray value of each pixel point of the original image;
and determining a histogram of gray values of a foreground image in the original image, and determining a main body color of the foreground image by using the histogram.
Optionally, the second unit is specifically configured to, when obtaining the background color according to the main color and a preset color matching rule for implementing comparative display of the foreground image and the background image,:
determining the lightness range of the background color by using the lightness of the main color and a plurality of preset lightness ranges, and selecting lightness from the lightness range to which the background color belongs as the lightness of the background color; and/or the presence of a gas in the gas,
determining the saturation range of the background color by utilizing the saturation of the main body color and a plurality of preset saturation ranges, and selecting a saturation from the saturation range of the background color as the saturation of the background color; and/or the presence of a gas in the gas,
determining the chroma of the background color by using the chroma of the main body color and a preset chroma included angle;
and determining the background color by using the lightness, the saturation and the chroma of the background color.
Optionally, when determining the lightness range of the background color by using the lightness of the main color and a plurality of preset lightness ranges, the second unit is specifically configured to:
when the lightness of the main body color belongs to a preset first lightness range, determining that the lightness range of the background color belongs to a preset second lightness range; when the lightness of the main body color belongs to a preset second lightness range, determining that the lightness range of the background color belongs to a preset first lightness range; wherein the first range of brightness is higher than or equal to the second range of brightness.
Optionally, when the second unit determines the saturation range of the background color by using the saturation of the main color and a plurality of preset saturation ranges, the second unit is specifically configured to:
when the saturation of the main color belongs to a preset first saturation range, determining that the saturation range of the background color belongs to a preset second saturation range; when the saturation of the main color belongs to a preset second saturation range, determining that the saturation range of the background color belongs to a preset first saturation range; wherein the first saturation range is higher than or equal to the second saturation range.
Optionally, when determining the chroma of the background color, the second unit is specifically configured to:
when the chroma of the main body color belongs to a preset first chroma range, determining the chroma of the background color by adopting a preset first chroma included angle and the chroma of the main body color; when the chroma of the main body color belongs to a preset second chroma range, determining the chroma of the background color by adopting a preset second chroma included angle and the chroma of the main body color; wherein the first chroma included angle is smaller than the second chroma included angle.
Optionally, the third unit is further configured to:
determining a mark to be added in the target image, and determining the color of the mark, wherein the mark is added in the target image by adopting the color.
Optionally, the marker comprises: text, graphics and/or symbols.
Optionally, the first unit is further configured to determine a color with the highest saturation in the foreground image, use the color as the color of the mark, and send the color to the third unit.
Each of the above units may be implemented by a physical device such as a processor.
In summary, the embodiment of the present invention provides an automatic image color matching scheme based on color psychology, which can be applied to the image advertisement production process. The color scheme in the process of automatically making the image creative (banner) is not required to be completed manually, and the color scheme can be given to a computer automatically by an algorithm. And, a more appropriate color scheme can be given from the psychology of color according to the main color of the object image. In the embodiment of the present invention, an Image processing Library (Python Image Library, PIL) may be used for Image processing, or an HSV color space may be used in a color scheme based on the prior art such as an Open Source Computer vision Library (OpenCV) issued (Open Source), and, of course, a hue (H), a saturation (S), a brightness (L) (HSL for short), and the like may also be used; in addition, the embodiment of the invention mainly performs color matching according to hue, saturation and brightness in the color scheme, and other color schemes can also be given through machine learning according to the type of the product and the like.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (16)

1. An image processing method, characterized in that the method comprises:
determining a foreground image in an original image and a main body color of the foreground image; the foreground image refers to an image of an object with background removed in an original image;
obtaining a background color according to the main body color and a preset color matching rule for realizing the comparative display of the foreground image and the background image, and obtaining a background image by using the background color; the obtaining of the background color according to the main color and a preset color matching rule for realizing the comparative display of the foreground image and the background image specifically includes: determining the lightness range of the background color by using the lightness of the main color and a plurality of preset lightness ranges, and selecting lightness from the lightness range to which the background color belongs as the lightness of the background color; and/or determining the saturation range of the background color by utilizing the saturation of the main body color and a plurality of preset saturation ranges, and selecting a saturation from the saturation range of the background color as the saturation of the background color; and/or determining the chroma of the background color by utilizing the chroma of the main body color and a preset chroma included angle; determining the background color by utilizing the lightness, the saturation and the chroma of the background color;
and synthesizing the foreground image and the obtained background image into a target image.
2. The method according to claim 1, wherein determining a foreground image in the original image and a main color of the foreground image specifically comprises:
determining the gray value of each pixel point of the original image;
determining a gray level histogram of the original image according to the gray level value of each pixel point of the original image;
the method comprises the steps of distinguishing the color of a foreground image from the color of a background image in an original image through a gray histogram of the original image, and determining the color of the foreground image and the color of a main body of the foreground image.
3. The method according to claim 1, wherein determining the lightness range of the background color by using the lightness of the subject color and a preset plurality of lightness ranges comprises:
when the lightness of the main body color belongs to a preset first lightness range, determining that the lightness range of the background color belongs to a preset second lightness range; when the lightness of the main body color belongs to a preset second lightness range, determining that the lightness range of the background color belongs to a preset first lightness range; wherein the first range of brightness is higher than or equal to the second range of brightness, the first range of brightness being higher than or equal to the second range of brightness meaning that a lower bound of the first range of brightness is higher than or equal to an upper bound of the second range of brightness.
4. The method of claim 1, wherein determining the saturation range of the background color by using the saturation of the subject color and a plurality of preset saturation ranges comprises:
when the saturation of the main color belongs to a preset first saturation range, determining that the saturation range of the background color belongs to a preset second saturation range; when the saturation of the main color belongs to a preset second saturation range, determining that the saturation range of the background color belongs to a preset first saturation range; wherein the first saturation range is higher than or equal to the second saturation range, the first saturation range being higher than or equal to the second saturation range meaning that the lower limit of the first saturation range is higher than or equal to the upper limit of the second saturation range.
5. The method of claim 1, wherein determining the chroma of the background color using the chroma of the subject color and the predetermined chroma angle comprises:
when the chroma of the main body color belongs to a preset first chroma range, determining the chroma of the background color by adopting a preset first chroma included angle and the chroma of the main body color; when the chroma of the main body color belongs to a preset second chroma range, determining the chroma of the background color by adopting a preset second chroma included angle and the chroma of the main body color; wherein the first chroma included angle is smaller than the second chroma included angle.
6. The method of claim 1, further comprising:
determining a mark to be added in the target image, and determining the color of the mark, wherein the mark is added in the target image by adopting the color.
7. The method of claim 6, wherein the marking comprises: text, graphics and/or symbols.
8. The method according to claim 6, wherein the determining the color of the mark specifically comprises: and determining the color with the highest saturation in the foreground image, and taking the color as the color of the mark.
9. An image processing apparatus, characterized by comprising:
a first unit, configured to determine a foreground image in an original image and a subject color of the foreground image; the foreground image refers to an image of an object with background removed in an original image;
the second unit is used for obtaining a background color according to the main body color and a preset color matching rule for realizing the comparative display of the foreground image and the background image, and obtaining a background image by using the background color; the obtaining of the background color according to the main color and a preset color matching rule for realizing the comparative display of the foreground image and the background image specifically includes: determining the lightness range of the background color by using the lightness of the main color and a plurality of preset lightness ranges, and selecting lightness from the lightness range to which the background color belongs as the lightness of the background color; and/or determining the saturation range of the background color by utilizing the saturation of the main body color and a plurality of preset saturation ranges, and selecting a saturation from the saturation range of the background color as the saturation of the background color; and/or determining the chroma of the background color by utilizing the chroma of the main body color and a preset chroma included angle; determining the background color by utilizing the lightness, the saturation and the chroma of the background color;
and a third unit, configured to combine the foreground image and the obtained background image into a target image.
10. The apparatus according to claim 9, wherein the first unit is specifically configured to:
determining the gray value of each pixel point of the original image;
determining a gray level histogram of the original image according to the gray level value of each pixel point of the original image;
the method comprises the steps of distinguishing the color of a foreground image from the color of a background image in an original image through a gray histogram of the original image, and determining the color of the foreground image and the color of a main body of the foreground image.
11. The apparatus according to claim 9, wherein the second unit, when determining the lightness range of the background color by using the lightness of the subject color and a plurality of preset lightness ranges, is specifically configured to:
when the lightness of the main body color belongs to a preset first lightness range, determining that the lightness range of the background color belongs to a preset second lightness range; when the lightness of the main body color belongs to a preset second lightness range, determining that the lightness range of the background color belongs to a preset first lightness range; wherein the first range of brightness is higher than or equal to the second range of brightness, the first range of brightness being higher than or equal to the second range of brightness meaning that a lower bound of the first range of brightness is higher than or equal to an upper bound of the second range of brightness.
12. The apparatus of claim 9, wherein the second unit, when determining the saturation range of the background color by using the saturation of the subject color and a plurality of preset saturation ranges, is specifically configured to:
when the saturation of the main color belongs to a preset first saturation range, determining that the saturation range of the background color belongs to a preset second saturation range; when the saturation of the main color belongs to a preset second saturation range, determining that the saturation range of the background color belongs to a preset first saturation range; wherein the first saturation range is higher than or equal to the second saturation range, the first saturation range being higher than or equal to the second saturation range meaning that the lower limit of the first saturation range is higher than or equal to the upper limit of the second saturation range.
13. The apparatus of claim 9, wherein the second unit is configured to determine the chroma of the background color by using the chroma of the main body color and a preset chroma angle, and is specifically configured to:
when the chroma of the main body color belongs to a preset first chroma range, determining the chroma of the background color by adopting a preset first chroma included angle and the chroma of the main body color; when the chroma of the main body color belongs to a preset second chroma range, determining the chroma of the background color by adopting a preset second chroma included angle and the chroma of the main body color; wherein the first chroma included angle is smaller than the second chroma included angle.
14. The apparatus of claim 9, wherein the third unit is further configured to:
determining a mark to be added in the target image, and determining the color of the mark, wherein the mark is added in the target image by adopting the color.
15. The apparatus of claim 14, wherein the indicia comprises: text, graphics and/or symbols.
16. The apparatus according to claim 14, wherein the first unit is further configured to determine a color with highest saturation in the foreground image, regard the color as the color of the mark, and send the color to the third unit.
CN201510222313.6A 2015-05-04 2015-05-04 Image processing method and device Active CN106204690B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510222313.6A CN106204690B (en) 2015-05-04 2015-05-04 Image processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510222313.6A CN106204690B (en) 2015-05-04 2015-05-04 Image processing method and device

Publications (2)

Publication Number Publication Date
CN106204690A CN106204690A (en) 2016-12-07
CN106204690B true CN106204690B (en) 2020-04-17

Family

ID=57458897

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510222313.6A Active CN106204690B (en) 2015-05-04 2015-05-04 Image processing method and device

Country Status (1)

Country Link
CN (1) CN106204690B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108320312B (en) * 2017-01-18 2022-01-11 阿里巴巴集团控股有限公司 Image color matching method and device and computer terminal
CN108416826A (en) * 2018-02-07 2018-08-17 李荣陆 A kind of planar design Automatic color matching device
CN109345612B (en) * 2018-09-13 2022-11-29 腾讯数码(天津)有限公司 Image generation method, device, equipment and storage medium
CN111199565B (en) * 2018-11-16 2022-05-27 阿里巴巴集团控股有限公司 Data processing method, device, system, electronic equipment and storage medium
CN111275777A (en) * 2018-12-04 2020-06-12 北京京东尚科信息技术有限公司 Automatic color matching method, device, medium and electronic equipment
CN109859283B (en) * 2018-12-22 2024-01-09 Oppo广东移动通信有限公司 Color taking method, color taking device, electronic equipment and storable medium
CN110795659A (en) * 2019-09-25 2020-02-14 口碑(上海)信息技术有限公司 Method and device for generating page background picture
CN112069340A (en) * 2020-09-04 2020-12-11 北京字节跳动网络技术有限公司 Background picture processing and search result display method, device, equipment and medium
CN112035210B (en) * 2020-09-30 2024-05-07 北京百度网讯科技有限公司 Method, apparatus, device and medium for outputting color information
CN113284198A (en) * 2021-05-13 2021-08-20 稿定(厦门)科技有限公司 Automatic image color matching method and device
CN114638914B (en) * 2022-03-21 2024-09-10 腾讯科技(深圳)有限公司 Image generation method, device, computer equipment and storage medium
CN114928731B (en) * 2022-05-05 2023-11-28 中国电子科技集团公司第十四研究所 Intelligent color interactive display method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1577336A (en) * 2003-07-04 2005-02-09 三菱电机株式会社 Method and apparatus for representing a group of images
CN102736920A (en) * 2012-06-11 2012-10-17 广东欧珀移动通信有限公司 Adaptive color matching method of desktop icon background mask
CN104793937A (en) * 2015-04-17 2015-07-22 魅族科技(中国)有限公司 Start-up control method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102651136B (en) * 2011-02-28 2014-11-26 国际商业机器公司 Color mapping method and device of image
US9154732B2 (en) * 2012-04-09 2015-10-06 Futurewei Technologies, Inc. Visual conditioning for augmented-reality-assisted video conferencing

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1577336A (en) * 2003-07-04 2005-02-09 三菱电机株式会社 Method and apparatus for representing a group of images
CN102736920A (en) * 2012-06-11 2012-10-17 广东欧珀移动通信有限公司 Adaptive color matching method of desktop icon background mask
CN104793937A (en) * 2015-04-17 2015-07-22 魅族科技(中国)有限公司 Start-up control method and device

Also Published As

Publication number Publication date
CN106204690A (en) 2016-12-07

Similar Documents

Publication Publication Date Title
CN106204690B (en) Image processing method and device
CN108416377B (en) Information extraction method and device in histogram
CN104063846B (en) Method and apparatus for handling image based on the information detected
CN109313793A (en) Assess and reduce the near-sighted source property effect of electronic console
CN109803172B (en) Live video processing method and device and electronic equipment
US11403560B2 (en) Training apparatus, image recognition apparatus, training method, and program
CN107730568B (en) Coloring method and device based on weight learning
CN105138317A (en) Window display processing method and device applied to terminal equipment
CN101360250A (en) Immersion method and system, factor dominating method, content analysis method and scaling parameter prediction method
CN109600605B (en) Detection method of 4K ultra-high-definition video, electronic device and computer program product
CN109255763A (en) Image processing method, device, equipment and storage medium
CN112328345A (en) Method and device for determining theme color, electronic equipment and readable storage medium
CN104915976A (en) Image processing method and system for simulating pencil sketch
CN113436284A (en) Image processing method and device, computer equipment and storage medium
KR102082766B1 (en) Method and apparatus for distinguishing objects
CN105139368B (en) A kind of mixed type tone mapping method available for machine vision
US20060257023A1 (en) Method and system for image border color selection
US20170274285A1 (en) Method and apparatus for automating the creation of a puzzle pix playable on a computational device from a photograph or drawing
JP4698709B2 (en) Data creation device, data creation method, data creation program, drawing device, drawing method, drawing program, and computer-readable recording medium
JP6816352B2 (en) Projectors, projection systems and programs
JP2015125543A (en) Line-of-sight prediction system, line-of-sight prediction method, and line-of-sight prediction program
JP2009050035A (en) Image processing method, image processing system, and image processing program
CN113760429A (en) Control method and control device
JP2016066990A (en) Evaluation method of tone correction, and arithmetic device
CN111062862A (en) Color-based data enhancement method and system, computer device and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20240223

Address after: # 01-21, Lai Zan Da Building 1, 51 Belarusian Road, Singapore

Patentee after: Alibaba Singapore Holdings Ltd.

Country or region after: Singapore

Address before: Cayman Islands Grand Cayman capital building, a four storey No. 847 mailbox

Patentee before: ALIBABA GROUP HOLDING Ltd.

Country or region before: Cayman Islands