CN111242836A - Method, device and equipment for generating target image and advertising image - Google Patents

Method, device and equipment for generating target image and advertising image Download PDF

Info

Publication number
CN111242836A
CN111242836A CN201811443456.XA CN201811443456A CN111242836A CN 111242836 A CN111242836 A CN 111242836A CN 201811443456 A CN201811443456 A CN 201811443456A CN 111242836 A CN111242836 A CN 111242836A
Authority
CN
China
Prior art keywords
image
color value
original
tone
dominant
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201811443456.XA
Other languages
Chinese (zh)
Other versions
CN111242836B (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 East China Co 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 CN201811443456.XA priority Critical patent/CN111242836B/en
Publication of CN111242836A publication Critical patent/CN111242836A/en
Application granted granted Critical
Publication of CN111242836B publication Critical patent/CN111242836B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Geometry (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)
  • Color Image Communication Systems (AREA)

Abstract

The application discloses a target image generation method, which comprises the following steps: obtaining an original image and a template image; determining a color value of a dominant tone of the original image according to whether the original image is a transparent image; judging whether the color value of the dominant tone of the template image is matched with the color value of the dominant tone of the original image; and if the original image and the template image are matched, synthesizing the original image and the template image to generate a target image. By adopting the method, the problems of limited application scene and weak universality existing in the technical scheme of matching the template image and the original image based on color in the prior art are solved.

Description

Method, device and equipment for generating target image and advertising image
Technical Field
The application relates to the technical field of image processing, in particular to a target image generation method, a target image generation device and electronic equipment. The application also relates to an advertisement image generation method, an advertisement image generation device and electronic equipment.
Background
In the process of producing a target image (e.g., a creative (a picture of an ad slot placed on a web page)), it is necessary to select a template image and an original image (e.g., a material image), and finally, the template image and the original image are subjected to a synthesis process to obtain a final target image. When the selection of the template image and the original image is manually completed, the color matching effect of the finally synthesized target image has strong subjective factors, the amount of the target image which is frequently placed on an external site and attracts the user to click is not large, one influencing factor is that the target image is not attractive enough, and one key factor determining the attractive force of the target image is color matching.
In view of the problems caused by manual selection, the prior art proposes a technical solution for matching the template image and the original image based on color, but the inventor finds that the prior art has limitations on the features of the original image. For example, the prior art requires that the original image be an image without a background (for example, the original image may be a person image, a poster form image, or the like). Therefore, the existing technical scheme has the problems of limited application scenes and weak universality.
Disclosure of Invention
The application provides a target image generation method and device, electronic equipment and storage equipment, and aims to solve the problems that in the prior art, the application scene is limited and the universality is not strong in the technical scheme of matching a template image and an original image based on colors.
The application provides a target image generation method, which comprises the following steps:
obtaining an original image and a template image;
determining a color value of a dominant tone of the original image according to whether the original image is a transparent image;
judging whether the color value of the dominant tone of the template image is matched with the color value of the dominant tone of the original image;
and if the original image and the template image are matched, synthesizing the original image and the template image to generate a target image.
Optionally, the determining a color value of a dominant hue of the original image according to whether the original image is a transparent image includes:
if the original image is a transparent image, taking the color value of the original dominant hue of the original image as the color value of the dominant hue of the original image;
and if the original image is not a transparent image, taking the color value of the original secondary main tone of the original image as the color value of the main tone of the original image.
Optionally, the method further comprises:
and judging whether the original image is a transparent image.
Optionally, the method further includes:
a color value of an original dominant hue of the original image or a color value of an original sub-dominant hue of the original image is determined.
Optionally, the determining a color value of an original dominant hue of the original image or a color value of an original secondary dominant hue of the original image includes:
obtaining a tone distribution ratio set of the original image; the tone distribution ratio refers to the area ratio of each tone in the original image;
taking a color value of a tone corresponding to the tone distribution ratio ranked first in the tone distribution ratio set as a color value of an original dominant tone of the original image; alternatively, the first and second electrodes may be,
and taking the color value of the tone corresponding to the tone distribution ratio ranked second in the tone distribution ratio set as the color value of the original secondary main tone of the original image.
Optionally, the determining whether the color value of the dominant hue of the template image matches the color value of the dominant hue of the original image includes:
acquiring Euclidean distance between the color value of the dominant tone of the template image and the color value of the dominant tone of the original image;
when the Euclidean distance is larger than a preset distance threshold value, judging that the Euclidean distance is matched;
and when the Euclidean distance is smaller than or equal to a preset distance threshold value, judging that the Euclidean distance is not matched.
The application also provides an advertisement image generation method, which comprises the following steps:
obtaining a material image and a template image;
obtaining a color value of a dominant tone of the template image;
judging whether the material image is a transparent image;
if so, taking the color value of the original dominant hue of the material image as the color value of the dominant hue of the material image;
if not, taking the color value of the original secondary dominant hue of the material image as the color value of the dominant hue of the material image;
judging whether the color value of the dominant tone of the template image is matched with the color value of the dominant tone of the material image;
and if the material image is matched with the template image, synthesizing the material image and the template image to generate an advertisement image.
Optionally, the method further includes:
a color value of an original dominant tone of the material image or a color value of an original sub-dominant tone of the material image is determined.
The present application also provides a target image generation apparatus, including:
an image obtaining unit for obtaining an original image and a template image;
a dominant hue color value determination unit that determines a color value of a dominant hue of the original image according to whether the original image is a transparent image;
a dominant hue color value matching unit for judging whether the color value of the dominant hue of the template image matches the color value of the dominant hue of the original image;
and a target image generation unit which synthesizes the original image and the template image to generate a target image when the output of the dominant hue color value matching unit is yes.
The present application further provides an electronic device, comprising:
a processor; and
a memory for storing a program of a target image generation method, the apparatus performing the following steps after being powered on and running the program of the target image generation method by the processor:
obtaining an original image and a template image;
determining a color value of a dominant tone of the original image according to whether the original image is a transparent image;
judging whether the color value of the dominant tone of the template image is matched with the color value of the dominant tone of the original image;
and if the original image and the template image are matched, synthesizing the original image and the template image to generate a target image.
The present application further provides an advertisement image generating apparatus, comprising:
an image obtaining unit for obtaining a material image and a template image;
a color value obtaining unit of a keytone of a template image, configured to obtain a color value of the keytone of the template image;
a transparent image judging unit for judging whether the material image is a transparent image;
the color value determining unit of the keytone of the material image is used for taking the color value of the original keytone of the material image as the color value of the keytone of the material image if the output of the transparent image judging unit is yes;
if the output of the transparent image judging unit is negative, taking the color value of the original secondary dominant hue of the material image as the color value of the dominant hue of the material image;
a color value matching judgment unit, configured to judge whether a color value of a keytone of the template image matches a color value of a keytone of the material image;
and the advertisement image generating unit is used for synthesizing the material image and the template image to generate an advertisement image if the output result of the color value matching judging unit is positive.
The present application further provides an electronic device, comprising:
a processor; and
a memory for storing a program of an advertisement image generation method, the apparatus performing the following steps after being powered on and running the program of the advertisement image generation method by the processor:
obtaining a material image and a template image;
obtaining a color value of a dominant tone of the template image;
judging whether the material image is a transparent image;
if so, taking the color value of the original dominant hue of the material image as the color value of the dominant hue of the material image;
if not, taking the color value of the original secondary dominant hue of the material image as the color value of the dominant hue of the material image;
judging whether the color value of the dominant tone of the template image is matched with the color value of the dominant tone of the material image;
and if the material image is matched with the template image, synthesizing the material image and the template image to generate an advertisement image.
Compared with the prior art, the method has the following advantages:
the application provides a target image generation method, a device, an electronic device and a storage device, firstly, the color value of the keytone of an original image is determined according to whether the original image is a transparent image, then, whether the color value of the keytone of a template image is matched with the color value of the keytone of the original image is judged, whether the original image is a transparent image or not is represented, whether the original image has a background or not is represented, whether the original image has the background or not can influence the keytone of the original image, and in order to ensure that the acquired keytone of the original image represents the original image more accurately, the application determines the color value of the keytone of the original image according to whether the original image is a transparent image or not, compared with the prior art, the application can more accurately obtain the keytone which can represent the original image, and provides accurate input for acquiring the template image matched with the original image, the method and the device ensure the tone fitting degree of the target image generated by synthesizing the original image and the template image, can determine the matched template image for the original image with the background and the original image without the background image, are applicable to application scenes of synthesizing various images, and have strong universality.
Drawings
Fig. 1 is a flowchart of a target image generation method according to a first embodiment of the present application.
Fig. 2 is a schematic diagram of an original image according to a first embodiment of the present application.
Fig. 3 is a schematic diagram of a template image according to a first embodiment of the present application.
Fig. 4 is a schematic diagram of a target image according to a first embodiment of the present application.
Fig. 5 is a flowchart of an advertisement image generation method according to a second embodiment of the present application.
Fig. 6 is a schematic diagram of a target image generation apparatus according to a third embodiment of the present application.
Fig. 7 is a schematic diagram of an electronic device according to a fourth embodiment of the present application.
Fig. 8 is a schematic diagram of an advertisement image generation device according to a fifth embodiment of the present application.
Fig. 9 is a schematic view of an electronic device according to a sixth embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein, but rather construed as limited to the embodiments set forth herein.
A first embodiment of the present application provides a target image generation method, which is described in detail below with reference to fig. 1, 2, 3, and 4.
As shown in fig. 1, in step S101, an original image and a template image are obtained.
The original image refers to an image to be beautified, and the original image can refer to a material image forming an advertisement creative idea and comprises certain material content; but also to the image of the person to be beautified, etc. For example, the image in fig. 2 is an original image.
The template image refers to an image for beautifying an original image. The original image is synthesized with the matched template image to generate the target image, so that the aesthetic degree of the original image can be increased, and the generated target image is more attractive.
The obtaining of the template image may be randomly selecting one template image from a template image library, or randomly selecting one template image from template images of corresponding categories in the template image library according to the category of the original image, or obtaining the template image in other manners. For example, the image in fig. 3 is a template image.
As shown in fig. 1, in step S102, a color value of a dominant tone of the original image is determined according to whether the original image is a transparent image.
The dominant hue of the original image refers to the dominant hue of the material contained in the original image, for example, in fig. 2, the packet is the material, and the dominant hue of the packet is the dominant hue of the original image.
In practical applications, the following preferred embodiments may be adopted to determine the color value of the dominant hue of the original image according to whether the original image is a transparent image:
if the original image is a transparent image, taking the color value of the original dominant hue of the original image as the color value of the dominant hue of the original image;
and if the original image is not a transparent image, taking the color value of the original secondary main tone of the original image as the color value of the main tone of the original image.
The application scenarios corresponding to the preferred embodiment are as follows: before the original image is processed in the present application, whether the original image is a transparent image or not is already processed, that is, the original image is labeled with a label of whether the original image is a transparent image or not, the above-mentioned preferred embodiment of this step 102 may specifically be:
if the label of the original image is a label representing that the original image is a transparent image, taking the color value of the original dominant hue of the original image as the color value of the dominant hue of the original image;
and if the label of the original image is a label which indicates that the original image is not a transparent image, taking the color value of the original secondary main tone of the original image as the color value of the main tone of the original image.
When the original image is matched with the template image, the tone of a material in the original image needs to be matched with the dominant tone of the template image, if the original image is a transparent image, the original image is an image without background color, and the tone of the material contained in the original image is the original dominant tone, so that the original dominant tone of the original image can be used as the dominant tone of the original image; if the original image is a non-transparent image, the original image is an image with a background color, the background color is a main tone, and the tone of a material contained in the original image is a sub-main tone, at this time, the original sub-main tone of the original image can be used as the main tone of the original image.
As shown in fig. 1, in step S103, it is determined whether the color value of the keytone of the template image matches the color value of the keytone of the original image; if so, go to step S104.
The present application describes a preferred embodiment of determining whether a color value of a keytone of a template image matches a color value of a keytone of an original image, which specifically includes:
determining Euclidean distances between the color values of the keytones of the template image and the color values of the keytones of the original image;
when the Euclidean distance is larger than a preset distance threshold value, judging that the Euclidean distance is matched;
and when the Euclidean distance is smaller than or equal to a preset distance threshold value, judging that the Euclidean distance is not matched.
Euclidean distance (also known as Euclidean metric, Euclidean metric) is a commonly used distance definition, which is the true distance between two points in an m-dimensional space. The euclidean distance in two and three dimensions is the distance between two points.
For example, in the above example, since the RGB value of the keytone of the template image is (100,149,237) blue, the euclidean distance between the RGB value of the keytone of the template image and the RGB value (0,0,0) of the keytone of the original image obtained in step S102 is 297 (rounded), and is greater than the matching threshold 150 obtained through the test (the greater the euclidean distance, the lower the color similarity), it is determined that the color value of the keytone of the template image matches the color value of the keytone of the original image, and it is described that the template image matches the color of the original image.
As shown in fig. 1, in step S104, the original image and the template image are synthesized to generate a target image.
After the color value of the keytone of the template image is determined to be matched with the color value of the keytone of the original image through step S103, the original image and the template image can be synthesized to generate the target image, and the color values are matched through technical means such as euclidean distance, so that subjectivity of artificial judgment is avoided, and the generated target image is more attractive. And if the color value of the dominant tone of the template image does not match the color value of the dominant tone of the original image, determining that the template image and the original image cannot be combined into the target image. As shown in fig. 4, which is the target image synthesized in fig. 2 and 3.
The first embodiment of the present application is described in detail, and the target image generating method provided by the first embodiment of the present application determines the color value of the dominant hue of the original image according to whether the original image is a transparent image, compared with the prior art, the method can more accurately obtain the dominant hue which can represent the original image, provide accurate input for obtaining a template image matched with the original image, and ensure the hue conformity of the target image generated by synthesizing the original image and the template image.
On the basis of the first embodiment and the included preferred embodiments thereof, the present application provides a second embodiment that does not perform transparent image processing on an original image, and the difference between the second embodiment and the included preferred embodiments thereof is that before the step of determining a color value of a dominant hue of the original image according to whether the original image is a transparent image, the method may further include: and judging whether the original image is a transparent image.
In practical application, whether the original image is a transparent image or not can be judged by an AlphaBlend transparency algorithm.
Judging whether the original image is a transparent image by an AlphaBlend transparency algorithm, may include the following steps:
obtaining RGBA values of pixel points contained in the original image;
judging whether transparent pixel points exist in the pixel points contained in the original image or not according to the RGBA values of the pixel points;
if so, determining that the original image is a transparent image, otherwise, determining that the original image is a non-transparent image.
Although RGBA is sometimes described as a color space, it is simply the RGB model that adds additional information, the color employed is RGB, which may belong to any RGB color space, but Catmull and Smith proposed this indispensable Alpha value in 1971 to 1972, making Alpha rendering and Alpha synthesis possible.
The alpha channel is typically used as the opacity parameter. If a pixel has an alpha channel value of 0%, the pixel is completely transparent (i.e., invisible), and a value of 100% means that the pixel is a completely opaque pixel (a conventional digital image).
The judging whether transparent pixel points exist in the pixel points contained in the original image according to the RGBA values of the pixel points comprises the following steps:
and judging whether a pixel point with the value of A being 0 exists in the pixel points contained in the original image according to the RGBA value of the pixel point, wherein the value of A is an alpha channel value.
Specifically, the following method may be adopted to determine whether the original image is a transparent image: traversing all pixel points of the original image, acquiring corresponding RGBA values, if a pixel point with the value of A equal to 0 exists, indicating that the pixel point is a transparent pixel point, jumping out of circulation, outputting a result that the original image is a transparent image, and determining that the original image is the transparent image; and if it is determined that no pixel point with the value of A equal to 0 exists after traversing all pixel points contained in the original image, outputting a result that the original image is a non-transparent image, and determining that the original image is the non-transparent image.
Further, when the hue of the original image is not determined before the original image is processed by the scheme provided in this application, this application provides a third embodiment on the basis of all the aforementioned embodiments, and the difference between this embodiment and all the aforementioned embodiments is that, further comprising:
a color value of an original dominant hue of the original image or a color value of an original sub-dominant hue of the original image is determined.
It should be noted that, when the original image is a transparent image, the third embodiment includes: determining a color value of an original dominant hue of an original image; when the original image is a non-transparent image, the third embodiment includes: a color value of an original secondary dominant tone of an original image is determined.
In practical applications, the determining the color value of the original dominant hue of the original image includes:
obtaining a tone distribution ratio set of the original image;
and taking the color value of the tone corresponding to the tone distribution ratio with the first rank in the tone distribution ratio set as the color value of the original dominant tone of the original image.
The color values of the original secondary dominant hue of the original image comprise:
obtaining a tone distribution ratio set of the original image;
and taking the color value of the tone corresponding to the tone distribution ratio ranked second in the tone distribution ratio set as the color value of the secondary dominant tone of the original image.
The tone distribution ratio refers to the area ratio of each tone in the original image. For example, if the number of pixels of the original image is 800 × 600, if the number of pixels of a certain tone is 400 × 600, the tone distribution ratio of this tone is 50%.
The color value of the dominant hue of the original image may be an RGB value or an HSV value of the dominant hue of the original image. HSV is a method of representing points in the RGB color space in an inverted cone. HSV is Hue (Hue), Saturation (Saturation), and lightness (Value), also known as HSB (Brightness).
Specifically, the tone distribution ratio set of the original image can be obtained through a K-MEANS technical scheme or a KNN (K-Nearest Neighbor classification technical scheme). The K-MEANS technical scheme is a clustering technical scheme based on distance.
As an embodiment, the tone distribution ratios in the tone distribution ratio set may be sorted in order from high to low to obtain a second tone distribution ratio set; taking the color value of the tone corresponding to the tone distribution occupation ratio ranked first in the second tone distribution occupation ratio set as the color value of the original dominant tone of the original image; and taking the color value of the tone corresponding to the tone distribution occupation ratio with the second rank in the second tone distribution occupation ratio set as the color value of the original secondary main tone of the original image.
For example, as shown in fig. 2, the tone distribution of the original image is analyzed by the K-MEANS s technical solution to obtain a tone distribution ratio set, the tone distribution ratio set is sorted from high to low according to the tone distribution ratio to obtain a second tone distribution ratio set, and the color values RGB corresponding to the first two tone distribution ratios in the second tone distribution ratio set are (255 ), (0,0,0) in sequence. Thereby, the color value of the original dominant tone of the original image is (255,255,255) white, and the color value of the sub-dominant tone is (0,0,0) black. If the original image is a transparent image, the color value (255 ) of the original keytone of the original image is taken as the color value of the keytone of the original image. If the original image in fig. 2 is a non-transparent image, the color value of the sub-dominant tone of the original image is (0,0,0) as the color value of the dominant tone of the original image, and the original sub-dominant tone is black.
Further, when the color tone of the template image is not determined before the template image is processed by the scheme provided in the present application, the present application provides a fourth embodiment on the basis of all the foregoing embodiments, and the fourth embodiment is different from all the foregoing embodiments only in that the fourth embodiment further includes:
color values of a dominant tone of the template image are determined.
The color value of the dominant hue of the template image may be an RGB value or an HSV value of the dominant hue of the template image.
In practical applications, the determining the color value of the dominant hue of the template image includes:
obtaining a tone distribution proportion set of the template image;
and taking the color value of the tone corresponding to the tone distribution ratio with the first rank in the tone distribution set as the color value of the dominant tone of the template image.
Specifically, the tone distribution proportion set of the template image may be obtained by a K-MEANS algorithm or a KNN (K-Nearest Neighbor classification algorithm) algorithm.
As shown in fig. 3, the first three RGB values obtained from the template image have a high tone distribution ratio of (100,149,237), (255,215,0), (245 ) in the order named (high RGB). The color value of the dominant tone of the template image is thus obtained as (100,149,237), indicating that the dominant tone is blue.
A second embodiment of the present application provides an advertisement image generation method, which is described below with reference to fig. 2 to 5.
As shown in fig. 5, in step S501, a material image and a template image are obtained.
The material image is an image containing a substitute advertisement object.
The template image refers to an image for beautifying a material image. The material image is synthesized with the matched template image to generate the advertisement image, so that the aesthetic degree of the material image can be increased, and the generated advertisement image is more attractive. The image as in fig. 2 is a material image.
As shown in fig. 5, in step S502, color values of the keytone of the template image are obtained.
The color value of the dominant hue of the template image may be an RGB value or an HSV value of the dominant hue of the template image.
Specifically, the color tone distribution set of the template image can be obtained through a K-MEANS technical scheme or a KNN (K-Nearest Neighbor classification technical scheme), and the color tone distribution set includes a color tone distribution ratio.
As shown in fig. 3, the first three RGB colors having high to low tone distribution ratios of the template image are (100,149,237), (255,215,0), (245 ) in this order. The color value of the dominant tone of the template image is thus obtained as (100,149,237), indicating that the dominant tone is blue.
As shown in fig. 5, in step S503, the color value of the original dominant tone of the material image or the color value of the original sub-dominant tone of the material image is determined.
The detailed description of this step may refer to the description of the part related to determining the color value of the original dominant hue of the original image or the color value of the original secondary dominant hue of the material image in the first embodiment of the present application, and the original image may be changed into the material image, which is not described herein again.
As shown in fig. 5, in step S504, it is determined whether the material image is a transparent image, and if so, step S505 is executed; if not, go to step S506.
As shown in fig. 5, in step S505, the color value of the original dominant tone of the material image is taken as the color value of the dominant tone of the material image.
As shown in fig. 5, in step S506, the color value of the original sub-dominant tone of the material image is taken as the color value of the dominant tone of the material image.
The detailed descriptions of step S504 to step S506 may refer to the description of the relevant parts in the first embodiment, and the original image may be changed into the material image, which is not described herein again.
As shown in fig. 5, in step S507, it is determined whether the color value of the keytone of the template image matches the color value of the keytone of the material image, and if so, step S508 is executed.
The determining whether the color value of the keytone of the template image matches the color value of the keytone of the material image includes:
determining Euclidean distance between the color value of the dominant tone of the template image and the color value of the dominant tone of the material image;
when the Euclidean distance is larger than a preset distance threshold value, judging that the Euclidean distance is matched;
and when the Euclidean distance is smaller than or equal to a preset distance threshold value, judging that the Euclidean distance is not matched.
As shown in fig. 5, in step S508, the material image and the template image are synthesized to generate an advertisement image.
The advertisement image may refer to an image of an ad slot placed on a web page, and may also be referred to as a creative image.
After the color value of the dominant tone of the template image is determined to be matched with the color value of the dominant tone of the material image, the original image and the material image can be synthesized to generate the advertisement image, and the generated advertisement image is more attractive. If the color value of the keytone of the template image does not match the color value of the keytone of the advertisement image, it is determined that the template image and the material image cannot be combined into the advertisement image. As shown in fig. 4, which is the composite advertisement image of fig. 2 and 3.
Corresponding to the target image generation method provided in the first embodiment of the present application, a third embodiment of the present application also provides a target image generation apparatus.
As shown in fig. 6, the target image generation apparatus includes: an image obtaining unit 601, a dominant hue color value determining unit 602, a dominant hue color value matching unit 603, and a target image generating unit 604.
An image obtaining unit 601 for obtaining an original image and a template image;
a dominant hue color value determination unit 602 that determines a color value of a dominant hue of the original image according to whether the original image is a transparent image;
a dominant hue color value matching unit 603, configured to determine whether a color value of a dominant hue of the template image matches a color value of a dominant hue of the original image;
and a target image generation unit 604 for generating a target image by synthesizing the original image and the template image when the output of the dominant hue color value matching unit is yes.
Optionally, the dominant hue color value determining unit is specifically configured to:
if the original image is a transparent image, taking the color value of the original dominant hue of the original image as the color value of the dominant hue of the original image;
and if the original image is not a transparent image, taking the color value of the original secondary main tone of the original image as the color value of the main tone of the original image.
Optionally, the apparatus further comprises:
and the transparent image judging unit is used for judging whether the original image is a transparent image.
Optionally, the apparatus further comprises:
and the color value determining unit is used for determining the color value of the original dominant tone of the original image or the color value of the original secondary dominant tone of the original image.
Optionally, the determining unit of the color value of the original dominant hue or the color value of the original secondary dominant hue is specifically configured to:
obtaining a tone distribution ratio set of the original image; the tone distribution ratio refers to the area ratio of each tone in the original image;
taking a color value of a tone corresponding to the tone distribution ratio ranked first in the tone distribution ratio set as a color value of an original dominant tone of the original image; alternatively, the first and second electrodes may be,
and taking the color value of the tone corresponding to the tone distribution ratio ranked second in the tone distribution ratio set as the color value of the original secondary main tone of the original image.
Optionally, the dominant hue color value matching unit is specifically configured to:
acquiring Euclidean distance between the color value of the dominant tone of the template image and the color value of the dominant tone of the original image;
when the Euclidean distance is larger than a preset distance threshold value, judging that the Euclidean distance is matched;
and when the Euclidean distance is smaller than or equal to a preset distance threshold value, judging that the Euclidean distance is not matched.
It should be noted that, for the detailed description of the target image generation apparatus provided in the third embodiment of the present application, reference may be made to the related description of the first embodiment of the present application, and details are not repeated here.
Corresponding to the target image generation method provided in the first embodiment of the present application, a fourth embodiment of the present application also provides an electronic device.
As shown in fig. 7, the electronic apparatus includes:
a processor 701; and
a memory 702 for storing a program of a target image generation method, which executes the following steps after the apparatus is powered on and the program of the target image generation method is executed by the processor:
obtaining an original image and a template image;
determining a color value of a dominant tone of the original image according to whether the original image is a transparent image;
judging whether the color value of the dominant tone of the template image is matched with the color value of the dominant tone of the original image;
and if the original image and the template image are matched, synthesizing the original image and the template image to generate a target image.
Optionally, the determining a color value of a dominant hue of the original image according to whether the original image is a transparent image includes:
if the original image is a transparent image, taking the color value of the original dominant hue of the original image as the color value of the dominant hue of the original image;
and if the original image is not a transparent image, taking the color value of the original secondary main tone of the original image as the color value of the main tone of the original image.
Optionally, the electronic device further performs the following steps:
and judging whether the original image is a transparent image.
Optionally, the electronic device further performs the following steps:
a color value of an original dominant hue of the original image or a color value of an original sub-dominant hue of the original image is determined.
Optionally, the determining a color value of an original dominant hue of the original image or a color value of an original secondary dominant hue of the original image includes:
obtaining a tone distribution ratio set of the original image; the tone distribution ratio refers to the area ratio of each tone in the original image;
taking a color value of a tone corresponding to the tone distribution ratio ranked first in the tone distribution ratio set as a color value of an original dominant tone of the original image; alternatively, the first and second electrodes may be,
and taking the color value of the tone corresponding to the tone distribution ratio ranked second in the tone distribution ratio set as the color value of the original secondary main tone of the original image.
Optionally, the determining whether the color value of the dominant hue of the template image matches the color value of the dominant hue of the original image includes:
acquiring Euclidean distance between the color value of the dominant tone of the template image and the color value of the dominant tone of the original image;
when the Euclidean distance is larger than a preset distance threshold value, judging that the Euclidean distance is matched;
and when the Euclidean distance is smaller than or equal to a preset distance threshold value, judging that the Euclidean distance is not matched.
It should be noted that, for the detailed description of the electronic device provided in the fourth embodiment of the present application, reference may be made to the related description of the first embodiment of the present application, and details are not repeated here.
Corresponding to the advertisement image generation method provided in the second embodiment of the present application, a fifth embodiment of the present application also provides an advertisement image generation apparatus.
As shown in fig. 8, the apparatus includes:
an image obtaining unit 801 for obtaining a material image and a template image;
a color value obtaining unit 802 of a dominant hue of the template image, configured to obtain a color value of the dominant hue of the template image;
a transparent image determination unit 803 configured to determine whether the material image is a transparent image;
a color value determination unit 804 of the keytone of the material image, configured to, if the output of the transparent image determination unit is yes, take the color value of the original keytone of the material image as the color value of the keytone of the material image;
if the output of the transparent image judging unit is negative, taking the color value of the original secondary dominant hue of the material image as the color value of the dominant hue of the material image;
a color value matching judgment unit 805 configured to judge whether a color value of a keytone of the template image matches a color value of a keytone of the material image;
and an advertisement image generating unit 806, configured to synthesize the material image and the template image to generate an advertisement image if an output result of the color value matching determination unit is yes.
Optionally, the apparatus further comprises:
a color value determination unit for determining a color value of an original dominant tone of the material image or a color value of an original sub-dominant tone of the material image.
It should be noted that, for the detailed description of the advertisement image generation apparatus provided in the fifth embodiment of the present application, reference may be made to the related description of the second embodiment of the present application, and details are not repeated here.
Corresponding to the advertisement image generation method provided in the second embodiment of the present application, a sixth embodiment of the present application also provides an electronic device.
As shown in fig. 9, the electronic apparatus includes:
a processor 901; and
a memory 902 for storing a program of an advertisement image generation method, which executes the following steps after the apparatus is powered on and the program of the advertisement image generation method is executed by the processor:
obtaining a material image and a template image;
obtaining a color value of a dominant tone of the template image;
judging whether the material image is a transparent image;
if so, taking the color value of the original dominant hue of the material image as the color value of the dominant hue of the material image;
if not, taking the color value of the original secondary dominant hue of the material image as the color value of the dominant hue of the material image;
judging whether the color value of the dominant tone of the template image is matched with the color value of the dominant tone of the material image;
and if the material image is matched with the template image, synthesizing the material image and the template image to generate an advertisement image.
Optionally, the electronic device further performs the following steps:
a color value of an original dominant tone of the material image or a color value of an original sub-dominant tone of the material image is determined.
It should be noted that, for the detailed description of the electronic device provided in the sixth embodiment of the present application, reference may be made to the related description of the second embodiment of the present application, and details are not described here again.
Although the present application has been described with reference to the preferred embodiments, it is not intended to limit the present application, and those skilled in the art can make variations and modifications without departing from the spirit and scope of the present application, therefore, the scope of the present application should be determined by the claims that follow.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media (transient media), such as modulated data signals and carrier waves.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application 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, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.

Claims (12)

1. A method of generating a target image, comprising:
obtaining an original image and a template image;
determining a color value of a dominant tone of the original image according to whether the original image is a transparent image;
judging whether the color value of the dominant tone of the template image is matched with the color value of the dominant tone of the original image;
and if the original image and the template image are matched, synthesizing the original image and the template image to generate a target image.
2. The method of claim 1, wherein determining the color value of the dominant hue of the original image according to whether the original image is a transparent image comprises:
if the original image is a transparent image, taking the color value of the original dominant hue of the original image as the color value of the dominant hue of the original image;
and if the original image is not a transparent image, taking the color value of the original secondary main tone of the original image as the color value of the main tone of the original image.
3. The method of claim 2, the method further comprising:
and judging whether the original image is a transparent image.
4. The method of claim 2, further comprising:
a color value of an original dominant hue of the original image or a color value of an original sub-dominant hue of the original image is determined.
5. The method of claim 4, wherein determining the color value of the original dominant hue of the original image or the color value of the original secondary dominant hue of the original image comprises:
obtaining a tone distribution ratio set of the original image; the tone distribution ratio refers to the area ratio of each tone in the original image;
taking a color value of a tone corresponding to the tone distribution ratio ranked first in the tone distribution ratio set as a color value of an original dominant tone of the original image; alternatively, the first and second electrodes may be,
and taking the color value of the tone corresponding to the tone distribution ratio ranked second in the tone distribution ratio set as the color value of the original secondary main tone of the original image.
6. The method of claim 1, wherein determining whether the color value of the dominant hue of the template image matches the color value of the dominant hue of the original image comprises:
acquiring Euclidean distance between the color value of the dominant tone of the template image and the color value of the dominant tone of the original image;
when the Euclidean distance is larger than a preset distance threshold value, judging that the Euclidean distance is matched;
and when the Euclidean distance is smaller than or equal to a preset distance threshold value, judging that the Euclidean distance is not matched.
7. An advertisement image generation method, comprising:
obtaining a material image and a template image;
obtaining a color value of a dominant tone of the template image;
judging whether the material image is a transparent image;
if so, taking the color value of the original dominant hue of the material image as the color value of the dominant hue of the material image;
if not, taking the color value of the original secondary dominant hue of the material image as the color value of the dominant hue of the material image;
judging whether the color value of the dominant tone of the template image is matched with the color value of the dominant tone of the material image;
and if the material image is matched with the template image, synthesizing the material image and the template image to generate an advertisement image.
8. The method of claim 7, further comprising:
a color value of an original dominant tone of the material image or a color value of an original sub-dominant tone of the material image is determined.
9. An object image generation apparatus, characterized by comprising:
an image obtaining unit for obtaining an original image and a template image;
a dominant hue color value determination unit that determines a color value of a dominant hue of the original image according to whether the original image is a transparent image;
a dominant hue color value matching unit for judging whether the color value of the dominant hue of the template image matches the color value of the dominant hue of the original image;
and a target image generation unit which synthesizes the original image and the template image to generate a target image when the output of the dominant hue color value matching unit is yes.
10. An electronic device, comprising:
a processor; and
a memory for storing a program of a target image generation method, the apparatus performing the following steps after being powered on and running the program of the target image generation method by the processor:
obtaining an original image and a template image;
determining a color value of a dominant tone of the original image according to whether the original image is a transparent image;
judging whether the color value of the dominant tone of the template image is matched with the color value of the dominant tone of the original image;
and if the original image and the template image are matched, synthesizing the original image and the template image to generate a target image.
11. An advertisement image generation apparatus characterized by comprising:
an image obtaining unit for obtaining a material image and a template image;
a color value obtaining unit of a keytone of a template image, configured to obtain a color value of the keytone of the template image;
a transparent image judging unit for judging whether the material image is a transparent image;
the color value determining unit of the keytone of the material image is used for taking the color value of the original keytone of the material image as the color value of the keytone of the material image if the output of the transparent image judging unit is yes;
if the output of the transparent image judging unit is negative, taking the color value of the original secondary dominant hue of the material image as the color value of the dominant hue of the material image;
a color value matching judgment unit, configured to judge whether a color value of a keytone of the template image matches a color value of a keytone of the material image;
and the advertisement image generating unit is used for synthesizing the material image and the template image to generate an advertisement image if the output result of the color value matching judging unit is positive.
12. An electronic device, comprising:
a processor; and
a memory for storing a program of an advertisement image generation method, the apparatus performing the following steps after being powered on and running the program of the advertisement image generation method by the processor:
obtaining a material image and a template image;
obtaining a color value of a dominant tone of the template image;
judging whether the material image is a transparent image;
if so, taking the color value of the original dominant hue of the material image as the color value of the dominant hue of the material image;
if not, taking the color value of the original secondary dominant hue of the material image as the color value of the dominant hue of the material image;
judging whether the color value of the dominant tone of the template image is matched with the color value of the dominant tone of the material image;
and if the material image is matched with the template image, synthesizing the material image and the template image to generate an advertisement image.
CN201811443456.XA 2018-11-29 2018-11-29 Target image generation method, device and equipment for generating advertisement image Active CN111242836B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811443456.XA CN111242836B (en) 2018-11-29 2018-11-29 Target image generation method, device and equipment for generating advertisement image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811443456.XA CN111242836B (en) 2018-11-29 2018-11-29 Target image generation method, device and equipment for generating advertisement image

Publications (2)

Publication Number Publication Date
CN111242836A true CN111242836A (en) 2020-06-05
CN111242836B CN111242836B (en) 2023-06-27

Family

ID=70865419

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811443456.XA Active CN111242836B (en) 2018-11-29 2018-11-29 Target image generation method, device and equipment for generating advertisement image

Country Status (1)

Country Link
CN (1) CN111242836B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112069341A (en) * 2020-09-04 2020-12-11 北京字节跳动网络技术有限公司 Background picture generation and search result display method, device, equipment and medium
CN112069339A (en) * 2020-09-04 2020-12-11 北京字节跳动网络技术有限公司 Background picture processing and search result display method, device, equipment and medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020102018A1 (en) * 1999-08-17 2002-08-01 Siming Lin System and method for color characterization using fuzzy pixel classification with application in color matching and color match location
CN104978186A (en) * 2015-05-26 2015-10-14 腾讯科技(深圳)有限公司 Interface skin rendering method and apparatus

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020102018A1 (en) * 1999-08-17 2002-08-01 Siming Lin System and method for color characterization using fuzzy pixel classification with application in color matching and color match location
CN104978186A (en) * 2015-05-26 2015-10-14 腾讯科技(深圳)有限公司 Interface skin rendering method and apparatus

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
LILI ZHAO,AND ETC: "Region Adaptive Inter-Color Prediction Approach to RGB 4:4:4 Intra Coding" *
黄元元,徐蔚鸿,杨静宇: "一种基于主色调匹配的图像检索方法" *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112069341A (en) * 2020-09-04 2020-12-11 北京字节跳动网络技术有限公司 Background picture generation and search result display method, device, equipment and medium
CN112069339A (en) * 2020-09-04 2020-12-11 北京字节跳动网络技术有限公司 Background picture processing and search result display method, device, equipment and medium

Also Published As

Publication number Publication date
CN111242836B (en) 2023-06-27

Similar Documents

Publication Publication Date Title
Klette Concise computer vision
US9070044B2 (en) Image adjustment
US10824910B2 (en) Image processing method, non-transitory computer readable storage medium and image processing system
US10755153B2 (en) Method of generating 3-dimensional code based on gaussian modulating function
US9292911B2 (en) Automatic image adjustment parameter correction
US8903169B1 (en) Automatic adaptation to image processing pipeline
JP6408314B2 (en) Color video processing system and method, and corresponding computer program
CN110399487B (en) Text classification method and device, electronic equipment and storage medium
US20150213331A1 (en) Emotion modification for image and video content
JP7383022B2 (en) Automatic real-time high dynamic range content review system
CN111242836B (en) Target image generation method, device and equipment for generating advertisement image
CN114758054A (en) Light spot adding method, device, equipment and storage medium
CN112149745B (en) Method, device, equipment and storage medium for determining difficult example sample
GB2572435A (en) Manipulating a face in an image
CN111383289A (en) Image processing method, image processing device, terminal equipment and computer readable storage medium
US20100260425A1 (en) Method and Device for the Automated Comparison of Two Sets of Measurement Values
CN110674720A (en) Picture identification method and device, electronic equipment and storage medium
CN113095147A (en) Skin area detection method, system, image processing terminal and storage medium
US11900258B2 (en) Learning device, image generating device, learning method, image generating method, and program
Wang et al. Multi illumination color constancy based on multi-scale supervision and single-scale estimation cascade convolution neural network
CN116569191A (en) Gating of contextual attention features and convolution features
CN116342848B (en) Intelligent manufacturing method and system for toy
WO2012168001A1 (en) Method and device for detecting an object in an image
Aydınlılar Visual similarity for hdr images with applications to tone mapping
CN115689861A (en) Image processing method and device, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20230602

Address after: Floor 8, building 2, Xincheng science and technology park complex, No. 8, Bailongjiang East Street, Jianye District, Nanjing, Jiangsu Province

Applicant after: Alibaba East China Co.,Ltd.

Address before: Box 847, four, Grand Cayman capital, Cayman Islands, UK

Applicant before: ALIBABA GROUP HOLDING Ltd.

GR01 Patent grant
GR01 Patent grant