CN112330763A - Method and device for determining atmosphere color of picture, computer equipment and storage medium - Google Patents

Method and device for determining atmosphere color of picture, computer equipment and storage medium Download PDF

Info

Publication number
CN112330763A
CN112330763A CN202011186383.8A CN202011186383A CN112330763A CN 112330763 A CN112330763 A CN 112330763A CN 202011186383 A CN202011186383 A CN 202011186383A CN 112330763 A CN112330763 A CN 112330763A
Authority
CN
China
Prior art keywords
picture
display area
color
determining
atmosphere
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
CN202011186383.8A
Other languages
Chinese (zh)
Other versions
CN112330763B (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.)
Suning Cloud Computing Co Ltd
Original Assignee
Suning Cloud Computing Co 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 Suning Cloud Computing Co Ltd filed Critical Suning Cloud Computing Co Ltd
Priority to CN202011186383.8A priority Critical patent/CN112330763B/en
Publication of CN112330763A publication Critical patent/CN112330763A/en
Priority to CA3136984A priority patent/CA3136984A1/en
Application granted granted Critical
Publication of CN112330763B publication Critical patent/CN112330763B/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
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/56Extraction of image or video features relating to colour

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Image Processing (AREA)
  • Processing Or Creating Images (AREA)
  • Color Image Communication Systems (AREA)

Abstract

The invention discloses a method, a device, computer equipment and a storage medium for determining picture atmosphere color, wherein the method comprises the steps of determining a display area according to the condition of a target picture to be displayed in a target scene, the display area is used for displaying atmosphere color, calculating the closest distance between a key point on the target picture and the display area, acquiring a distance matrix, calculating to obtain the dominant hue of the display area according to the distance matrix, the color value of the key point and a preset algorithm, correcting the dominant hue according to the target scene, and determining the atmosphere color of the display area, and when the atmosphere color is calculated, the color value distribution of each pixel on the picture and the space distance between each pixel on the picture and an adjacent area for displaying the atmosphere color are considered, so that the calculated atmosphere color is more accurate, is closer to and matched with the hue, the lightness and the saturation of the boundary pixel color of the target picture, and cannot cause overlarge color jump, therefore, the experience of deep immersion in a larger area than the original picture is visually brought to the user.

Description

Method and device for determining atmosphere color of picture, computer equipment and storage medium
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method and an apparatus for determining an atmosphere color of a picture, a computer device, and a storage medium.
Background
Websites or apps (including but not limited to) often show some event or promotional carousel pictures in a striking position, and when a picture is shown, the adjacent area of the picture is filled with a color corresponding to the tone of the picture as an extension of the picture, so that the color atmosphere of the event is baked out in a larger area range, and the attention of users is attracted. When switching to another picture at a timing (e.g., 5 seconds) or manually by a user, the picture adjacent area also needs to be changed to a color that matches the hue of the new picture to present a new color atmosphere matching therewith. When the number of scenes in which carousel pictures need to be displayed is large, it takes a lot of manpower to manually set an atmosphere color for each picture. For example, thousands of people need to show different carousel graphs for different user groups, and assuming that there are 100 user groups, each user group shows 5 specific carousel graphs, the atmosphere color of one picture needs to be manually set for 1 minute, and the setting of the batch needs 100 × 5 × 1 to 500 minutes, which is about the workload of one person in one day.
Therefore, it is desirable to provide an atmosphere color determination method, which can automatically and rapidly calculate the atmosphere color of each picture in each scene, so as to save the labor cost.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for determining an atmosphere color of a picture, a computer device, and a storage medium, which can automatically and quickly calculate the atmosphere color of each picture in this scene, so as to save labor cost.
In order to solve one or more technical problems, the invention adopts the technical scheme that:
in a first aspect, a method for determining an atmosphere color of a picture is provided, the method comprising the steps of:
determining a display area according to the condition of a target picture to be displayed in a target scene, wherein the display area is used for displaying atmosphere colors;
calculating the closest distance between the key point on the target picture and the display area to obtain a distance matrix;
calculating to obtain the dominant hue of the display area according to the distance matrix, the color values of the key points and a preset algorithm;
and correcting the dominant hue according to the target scene to determine the atmosphere color of the display area.
In some embodiments, the determining a display area according to a situation that the target picture is to be displayed in the target scene includes:
adjusting the size of a target picture according to the condition of the target picture to be displayed in a target scene;
and determining a display area according to the adjusted target picture and the condition to be displayed.
In some embodiments, the presentation area comprises an area of the target scene that is adjacent to the target picture.
In some embodiments, the calculating the dominant hue of the display area according to the distance matrix, the color values of the key points, and a preset algorithm includes:
calculating and acquiring a distance weighting matrix of the target picture according to the distance matrix;
and calculating the distance weighting matrix and the color values of the key points by using a preset algorithm to obtain the dominant hue of the display area.
In some embodiments, the correcting the dominant hue according to the target scene, and the determining the atmosphere color of the display area includes:
and weakening the main tone according to the target scene to obtain the atmosphere color of the display area.
In some embodiments, the preset algorithm comprises one of a clustering algorithm or a palette extraction algorithm.
In some embodiments, the keypoints comprise each pixel point in the target picture.
In a second aspect, there is provided an apparatus for determining an ambient color of a picture, the apparatus comprising:
the area determining module is used for determining a display area according to the condition of the target picture to be displayed in the target scene, and the display area is used for displaying atmosphere colors;
the distance calculation module is used for calculating the closest distance between the key point on the target picture and the display area and acquiring a distance matrix;
the hue calculation module is used for calculating to obtain the dominant hue of the display area according to the distance matrix, the color values of the key points and a preset algorithm;
a color tone adjusting module for correcting the dominant color tone according to the target scene and determining the atmosphere color of the display area
In a third aspect, a computer device is provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the following steps are implemented:
determining a display area according to the condition of a target picture to be displayed in a target scene, wherein the display area is used for displaying atmosphere colors;
calculating the closest distance between the key point on the target picture and the display area to obtain a distance matrix;
calculating to obtain the dominant hue of the display area according to the distance matrix, the color values of the key points and a preset algorithm;
and correcting the dominant hue according to the target scene to determine the atmosphere color of the display area.
In a fourth aspect, there is provided a computer readable storage medium having a computer program stored thereon, which when executed by a processor, performs the steps of:
determining a display area according to the condition of a target picture to be displayed in a target scene, wherein the display area is used for displaying atmosphere colors;
calculating the closest distance between the key point on the target picture and the display area to obtain a distance matrix;
calculating to obtain the dominant hue of the display area according to the distance matrix, the color values of the key points and a preset algorithm;
and correcting the dominant hue according to the target scene to determine the atmosphere color of the display area.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
the method, the device, the computer equipment and the storage medium for determining the picture atmosphere color provided by the embodiment of the invention determine a display area according to the condition of a target picture to be displayed in a target scene, wherein the display area is used for displaying the atmosphere color, calculate the closest distance between a key point on the target picture and the display area, acquire a distance matrix, calculate the dominant hue of the display area according to the distance matrix, the color value of the key point and a preset algorithm, correct the dominant hue according to the target scene, and determine the atmosphere color of the display area, and simultaneously consider the color value distribution of each pixel on the picture and the space distance between each pixel on the picture and an adjacent area of the display atmosphere color, calculate the environment atmosphere color which is displayed on the periphery of the picture and is matched with the picture color, thereby visually bringing a deep immersion experience feeling of a larger area than that of the original picture, compared with a conventional algorithm without considering distance factors, the atmosphere color calculated by the method is more accurate, is closer to and matched with the hue, lightness and saturation of the adjacent picture boundary pixel color, and cannot cause excessive color jump.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic illustration of a picture keytone as an atmosphere color, shown in accordance with an exemplary embodiment;
FIG. 2 is a diagram illustrating a display of a target picture in a target scene and a corresponding display area displaying an atmosphere color in accordance with an exemplary embodiment;
FIG. 3 is a schematic diagram illustrating a distance matrix in accordance with an exemplary embodiment;
FIG. 4 is a schematic diagram illustrating a distance weighting matrix in accordance with an exemplary embodiment;
FIG. 5 is a flowchart illustrating a method for determining a picture atmosphere color according to an example embodiment
FIG. 6 is a schematic diagram illustrating an architecture of an apparatus for determining a mood color of a picture according to an exemplary embodiment;
FIG. 7 is a schematic diagram illustrating an internal architecture of a computer device, according to an example embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
As described in the background art, no special atmosphere color calculation method exists in the market at present, only some picture dominant hue extraction methods exist, the dominant hue extraction methods are usually extracted only according to the self-attributes of the pictures, the use scenes of the extracted dominant hue and the position spatial relationship between the extracted dominant hue and the pictures are not considered, and the proximity principle and the similarity principle of human vision are ignored. However, the relative distances between the pixels of the picture and the surrounding area influence the user's perception of whether they are organized together, pixels that are close to each other appear to belong to a group, while pixels that are relatively far away are classified as out of a group, and visually similar colors appear to belong more to a group, which together may form an atmosphere.
For example, in the adjacent top area of the moving picture, a color needs to be filled to form an atmosphere. The method on the market is simply to calculate its dominant hue from the moving picture itself and then fill the top as the atmosphere color. Fig. 1 is a schematic diagram showing a picture keytone as an atmosphere color according to an exemplary embodiment, and as shown in fig. 1, assuming that there is a picture in which the color of the top edge of the picture (shown as a square in the figure) is very different from the color of the center (shown as a circle in the figure), although the keytone is calculated without error (shown as a circle in the figure) from the whole picture, the color of the top edge of the picture (shown as a square in the figure) is strongly contrasted with the color of the top edge of the picture (shown as a square in the figure) after filling the top of the picture, which is obviously not a group in vision, thereby creating a visual interval, and a user can see a sense of grid-miss instead of harmoniously blending the atmosphere.
In addition, in some specific scenes, it is necessary to display a color similar to a dominant hue to form an atmosphere corresponding to a moving picture, but the color cannot obscure the dominant color, and the calculated color cannot be directly filled into a peripheral region of the picture, so that some correction is required to slightly weaken the background atmosphere and highlight the moving picture, which is not considered by the conventional dominant hue extraction method.
In order to solve the above problems, the embodiment of the present invention creatively provides a method for determining an atmosphere color of a picture, which follows a proximity principle and a similarity principle of human vision, combines an actual usage scene, and adopts a distance weighting manner to realize automatic calculation of an adjacent atmosphere color, so as to save a manual setting cost.
Specifically, the above scheme can be realized by the following steps:
the method comprises the steps of firstly, obtaining area information displayed by a target picture in a target scene and area information of a display area which is adjacent to the target picture and used for displaying atmosphere colors, and zooming the target picture to the size of the display area.
Specifically, first, target scene information for displaying a target picture and a situation to be displayed of the target picture in the target scene, such as information of size, position and the like of the target picture in the target scene, are acquired, and then a display area for displaying an atmosphere color is determined according to the acquired information. Fig. 2 is a schematic diagram illustrating a display condition of a target picture in a target scene and a corresponding display area for displaying an ambient color according to an exemplary embodiment, and referring to fig. 2, it is assumed that there is a target picture of 6 × 5 pixels (a dashed area in fig. 2), and the display area for displaying the ambient color includes a left partial area, an upper partial area, and a right partial area (a solid area adjacent to the outside of the dashed area in fig. 2) adjacent to the target picture.
And step two, calculating the closest distance between each key point in the target picture and the adjacent display area to obtain a distance matrix of the target picture.
Specifically, taking the key point as a pixel point in the target picture as an example, the pixel point is represented by (x, y), where x and y are two-dimensional coordinates of the pixel point, and a closest distance d (x, y) from each pixel point (x, y) in the target picture to an adjacent display area is calculated, so as to obtain a distance matrix of the target picture. Fig. 3 is a schematic diagram of a distance matrix according to an exemplary embodiment, and referring to fig. 3, assuming that a distance between a pixel point in a target picture directly adjacent to a display region is 1, distances between adjacent pixel points are sequentially calculated until all pixel points in the target picture are traversed. It should be noted here that in the embodiment of the present invention, different scenarios may be selected from different d (x, y) functions, for example:
d(x,y)=min(d(x-1,y),d(x+1,y),d(x,y-1),d(x,y+1))+1
and step three, calculating the distance weighted value of each pixel point of the target picture to obtain the distance weighted matrix of the target picture.
Specifically, the distance matrix is calculated by using a preset weighting calculation method, and a corresponding distance weighting matrix is obtained. The calculation of the obtained distance weighting matrix is shown with reference to fig. 4. It should be noted that, in the embodiment of the present invention, for different scenarios, different weighting functions w (d) may be selected, for example:
w(d)=1+(1/d)
here, the closer picture pixels are to the display atmosphere color region, the greater the influence on the finally generated atmosphere color, and the more consistent and harmonious the visual effect. Therefore, in the embodiment of the present invention, the closer the distance weighted value of the picture pixel to the display atmosphere color area is, the larger the distance weighted value of the picture pixel is, so that the distant and close pixels contribute different to the atmosphere color, thereby avoiding the problems of color jump, more abrupt appearance, and the like.
And step four, calculating the distance weighted dominant hue according to the color value of each pixel of the target picture and the distance weighting matrix through a preset algorithm.
Specifically, in the embodiment of the present invention, the preset algorithm includes, but is not limited to, KMeans clustering, palette extraction, and other algorithms. After the color value of each pixel in the target picture is obtained, the color value of each pixel in the target picture and a distance weighting matrix are calculated through a preset algorithm, and a distance weighted dominant hue is calculated and is represented as dc (r1, g1, b1), wherein r1, g1 and b1 are RGB values of the pixel in an RBG color space. It should be noted that, in the embodiment of the present invention, the contribution value of each pixel of the target picture in the algorithm is no longer 1, but is a distance weighted value. Similarly, the closer the picture pixels are to the display atmosphere color, the greater the influence on the finally generated atmosphere color, and the more harmonious and harmonious the visual effect. Therefore, in the embodiment of the invention, the contribution value of each pixel of the target picture in the algorithm is adjusted, so that the far and near pixels have different contributions to the atmosphere color, and the problems of color jump, more salience and the like are avoided.
And step five, correcting the dominant hue obtained in the step five to obtain the final atmosphere color.
Specifically, in general, in order to make the atmosphere color closer to and match with the target picture without causing excessive color jump, the background atmosphere should be weakened (slightly darker) appropriately to highlight the moving picture. In specific implementation, the main tone is weakened according to the target scene, and the atmosphere color suitable for the display area is determined and is represented as ac (r2, g2, b 2).
The following is an example of a weakening algorithm:
ac(r2,g2,b2)=dc(r1,g1,b1)-DARK
r2=(r1-DARK>0)?r1-DARK:0
g2=(g1-DARK>0)?g1-DARK:O
b2=(b1-DARK>0)?b1-DARK:0
wherein, DARK is a constant, which can be determined according to actual needs and scenes, and can be generally 30. The larger the DARK constant, the more pronounced the ambient background weakening, but not too much, otherwise the ambient hue will be deviated. Here, the above "r 2 ═ (r1-DARK > 0)? r 1-DARK: 0 "indicates that if r1-DARK > 0 holds, the final result of the expression is r 1-DARK; if r1-DARK > 0 does not hold, the final result is 0, and so on, and the description is omitted.
Example two
Fig. 5 is a flowchart illustrating a method of determining a picture atmosphere color according to an exemplary embodiment, and referring to fig. 5, the method includes the steps of:
s1: and determining a display area according to the condition of the target picture to be displayed in the target scene, wherein the display area is used for displaying the atmosphere color.
Specifically, in the embodiment of the present invention, the condition to be displayed includes information such as a display position and a size of the target picture in the target scene.
S2: and calculating the closest distance between the key point on the target picture and the display area to obtain a distance matrix.
Specifically, as a preferred example, the key point may be each pixel point of the target picture. It should be noted that, the key points in the embodiment of the present invention may be set according to actual requirements, and are not limited herein.
S3: and calculating to obtain the dominant hue of the display area according to the distance matrix, the color values of the key points and a preset algorithm.
Specifically, in the embodiment of the invention, when the atmosphere color is calculated, not only the color value distribution of each pixel on the target picture is considered, but also the space distance between each pixel on the target picture and the adjacent display area is considered, so that the experience of deep immersion in a larger area than that of the original picture can be visually brought to the user.
S4: and correcting the dominant hue according to the target scene to determine the atmosphere color of the display area.
Specifically, because a color similar to the dominant hue of the target picture needs to be displayed in the display area to form an atmosphere in accordance with the moving picture, but the color cannot obscure the moving picture, the calculated color cannot be directly filled in the peripheral area of the picture, and certain correction needs to be made to slightly weaken the background atmosphere and highlight the target picture.
As a preferred implementation manner, in the embodiment of the present invention, the determining a display area according to a situation of a target picture to be displayed in a target scene includes:
adjusting the size of a target picture according to the condition of the target picture to be displayed in a target scene;
and determining a display area according to the adjusted target picture and the condition to be displayed.
Specifically, when the display area is determined according to the condition of the target picture to be displayed in the target scene, the size of the target picture to be displayed may be adjusted to a required size.
As a preferred implementation, in the embodiment of the present invention, the display area includes an area adjacent to the target picture in the target scene.
As a preferred implementation manner, in an embodiment of the present invention, the calculating the dominant hue of the display area according to the distance matrix, the color values of the key points, and a preset algorithm includes:
calculating and acquiring a distance weighting matrix of the target picture according to the distance matrix;
and calculating the distance weighting matrix and the color values of the key points by using a preset algorithm to obtain the dominant hue of the display area.
As a preferred implementation, in an embodiment of the present invention, the modifying the dominant hue according to the target scene and determining the atmosphere color of the display area includes:
and weakening the main tone according to the target scene to obtain the atmosphere color of the display area.
As a preferred implementation manner, in the embodiment of the present invention, the preset algorithm includes one of a clustering algorithm and a palette extraction algorithm.
As a preferred implementation manner, in the embodiment of the present invention, the key point includes each pixel point in the target picture.
EXAMPLE III
Fig. 6 is a schematic structural diagram illustrating an apparatus for determining an atmosphere color of a picture according to an exemplary embodiment, the apparatus including:
the area determining module is used for determining a display area according to the condition of the target picture to be displayed in the target scene, and the display area is used for displaying atmosphere colors;
the distance calculation module is used for calculating the closest distance between the key point on the target picture and the display area and acquiring a distance matrix;
the hue calculation module is used for calculating to obtain the dominant hue of the display area according to the distance matrix, the color values of the key points and a preset algorithm;
and the tone adjusting module is used for correcting the dominant tone according to the target scene and determining the atmosphere color of the display area.
As a preferred implementation manner, in an embodiment of the present invention, the region determining module is specifically configured to:
adjusting the size of a target picture according to the condition of the target picture to be displayed in a target scene;
and determining a display area according to the adjusted target picture and the condition to be displayed.
As a preferred implementation, in the embodiment of the present invention, the display area includes an area adjacent to the target picture in the target scene.
As a preferred implementation manner, in an embodiment of the present invention, the hue calculation module is specifically configured to:
calculating and acquiring a distance weighting matrix of the target picture according to the distance matrix;
and calculating the distance weighting matrix and the color values of the key points by using a preset algorithm to obtain the dominant hue of the display area.
As a preferred implementation manner, in an embodiment of the present invention, the color tone adjustment module is specifically configured to:
and weakening the main tone according to the target scene to obtain the atmosphere color of the display area.
As a preferred implementation manner, in the embodiment of the present invention, the preset algorithm includes one of a clustering algorithm and a palette extraction algorithm.
As a preferred implementation manner, in the embodiment of the present invention, the key point includes each pixel point in the target picture.
Fig. 7 is a schematic diagram illustrating an internal configuration of a computer device according to an exemplary embodiment, which includes a processor, a memory, and a network interface connected through a system bus, as shown in fig. 7. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of optimization of an execution plan.
Those skilled in the art will appreciate that the configuration shown in fig. 6 is a block diagram of only a portion of the configuration associated with aspects of the present invention and is not intended to limit the computing devices to which aspects of the present invention may be applied, and that a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
As a preferred implementation manner, in an embodiment of the present invention, the computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the following steps when executing the computer program:
determining a display area according to the condition of a target picture to be displayed in a target scene, wherein the display area is used for displaying atmosphere colors;
calculating the closest distance between the key point on the target picture and the display area to obtain a distance matrix;
calculating to obtain the dominant hue of the display area according to the distance matrix, the color values of the key points and a preset algorithm;
and correcting the dominant hue according to the target scene to determine the atmosphere color of the display area.
As a preferred implementation manner, in the embodiment of the present invention, when the processor executes the computer program, the following steps are further implemented:
adjusting the size of a target picture according to the condition of the target picture to be displayed in a target scene;
and determining a display area according to the adjusted target picture and the condition to be displayed.
As a preferred implementation manner, in the embodiment of the present invention, when the processor executes the computer program, the following steps are further implemented:
calculating and acquiring a distance weighting matrix of the target picture according to the distance matrix;
and calculating the distance weighting matrix and the color values of the key points by using a preset algorithm to obtain the dominant hue of the display area.
As a preferred implementation manner, in the embodiment of the present invention, when the processor executes the computer program, the following steps are further implemented:
and weakening the main tone according to the target scene to obtain the atmosphere color of the display area.
In an embodiment of the present invention, a computer-readable storage medium is further provided, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the following steps:
determining a display area according to the condition of a target picture to be displayed in a target scene, wherein the display area is used for displaying atmosphere colors;
calculating the closest distance between the key point on the target picture and the display area to obtain a distance matrix;
calculating to obtain the dominant hue of the display area according to the distance matrix, the color values of the key points and a preset algorithm;
and correcting the dominant hue according to the target scene to determine the atmosphere color of the display area.
As a preferred implementation manner, in the embodiment of the present invention, when executed by the processor, the computer program further implements the following steps:
adjusting the size of a target picture according to the condition of the target picture to be displayed in a target scene;
and determining a display area according to the adjusted target picture and the condition to be displayed.
As a preferred implementation manner, in the embodiment of the present invention, when executed by the processor, the computer program further implements the following steps:
calculating and acquiring a distance weighting matrix of the target picture according to the distance matrix;
and calculating the distance weighting matrix and the color values of the key points by using a preset algorithm to obtain the dominant hue of the display area.
As a preferred implementation manner, in the embodiment of the present invention, when executed by the processor, the computer program further implements the following steps:
and weakening the main tone according to the target scene to obtain the atmosphere color of the display area.
In summary, the technical solution provided by the embodiment of the present invention has the following beneficial effects:
the method, the device, the computer equipment and the storage medium for determining the picture atmosphere color provided by the embodiment of the invention determine a display area according to the condition of a target picture to be displayed in a target scene, wherein the display area is used for displaying the atmosphere color, calculate the closest distance between a key point on the target picture and the display area, acquire a distance matrix, calculate the dominant hue of the display area according to the distance matrix, the color value of the key point and a preset algorithm, correct the dominant hue according to the target scene, and determine the atmosphere color of the display area, and simultaneously consider the color value distribution of each pixel on the picture and the space distance between each pixel on the picture and an adjacent area of the display atmosphere color, calculate the environment atmosphere color which is displayed on the periphery of the picture and is matched with the picture color, thereby visually bringing a deep immersion experience feeling of a larger area than that of the original picture, compared with a conventional algorithm without considering distance factors, the atmosphere color calculated by the method is more accurate, is closer to and matched with the hue, lightness and saturation of the adjacent picture boundary pixel color, and cannot cause excessive color jump.
It should be noted that: the image atmosphere color determining apparatus provided in the foregoing embodiment is only illustrated by dividing the functional modules when triggering the atmosphere color calculation service, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus for determining an ambient color of a picture and the method for determining an ambient color of a picture provided in the above embodiments belong to the same concept, that is, the apparatus is based on the method for determining an ambient color of a picture, and the specific implementation process thereof is described in the method embodiments in detail, and is not described herein again.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (10)

1. A method for determining ambient colors of a picture, the method comprising:
determining a display area according to the condition of a target picture to be displayed in a target scene, wherein the display area is used for displaying atmosphere colors;
calculating the closest distance between the key point on the target picture and the display area to obtain a distance matrix;
calculating to obtain the dominant hue of the display area according to the distance matrix, the color values of the key points and a preset algorithm;
and correcting the dominant hue according to the target scene to determine the atmosphere color of the display area.
2. The method for determining the atmosphere color of a picture according to claim 1, wherein the determining the display area according to the target picture to be displayed in the target scene comprises:
adjusting the size of a target picture according to the condition of the target picture to be displayed in a target scene;
and determining a display area according to the adjusted target picture and the condition to be displayed.
3. Method for determining a picture atmosphere color according to claim 1 or 2, wherein the presentation area comprises an area of the target scene adjacent to the target picture.
4. The method for determining the atmosphere color of a picture according to any one of claims 1 or 2, wherein the calculating the dominant hue of the display area according to the distance matrix, the color values of the key points and a preset algorithm comprises:
calculating and acquiring a distance weighting matrix of the target picture according to the distance matrix;
and calculating the distance weighting matrix and the color values of the key points by using a preset algorithm to obtain the dominant hue of the display area.
5. The method for determining the atmosphere color of a picture according to claim 1 or 2, wherein the correcting the dominant hue according to the target scene, and the determining the atmosphere color of the display area comprises:
and weakening the main tone according to the target scene to obtain the atmosphere color of the display area.
6. The method for determining atmosphere color of pictures according to claim 1 or 2, wherein the preset algorithm comprises one of a clustering algorithm or a palette extraction algorithm.
7. The method of claim 1 or 2, wherein the key point comprises each pixel point in the target picture.
8. An apparatus for determining an ambient color of a picture, the apparatus comprising:
the area determining module is used for determining a display area according to the condition of the target picture to be displayed in the target scene, and the display area is used for displaying atmosphere colors;
the distance calculation module is used for calculating the closest distance between the key point on the target picture and the display area and acquiring a distance matrix;
the hue calculation module is used for calculating to obtain the dominant hue of the display area according to the distance matrix, the color values of the key points and a preset algorithm;
and the tone adjusting module is used for correcting the dominant tone according to the target scene and determining the atmosphere color of the display area.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 7 are implemented when the computer program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202011186383.8A 2020-10-29 2020-10-29 Method and device for determining atmosphere color of picture, computer equipment and storage medium Active CN112330763B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011186383.8A CN112330763B (en) 2020-10-29 2020-10-29 Method and device for determining atmosphere color of picture, computer equipment and storage medium
CA3136984A CA3136984A1 (en) 2020-10-29 2021-10-29 Image ambiance color determination method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011186383.8A CN112330763B (en) 2020-10-29 2020-10-29 Method and device for determining atmosphere color of picture, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112330763A true CN112330763A (en) 2021-02-05
CN112330763B CN112330763B (en) 2023-04-21

Family

ID=74297530

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011186383.8A Active CN112330763B (en) 2020-10-29 2020-10-29 Method and device for determining atmosphere color of picture, computer equipment and storage medium

Country Status (2)

Country Link
CN (1) CN112330763B (en)
CA (1) CA3136984A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6236750B1 (en) * 1998-06-30 2001-05-22 Microsoft Corporation System and method for varying the color of reflective objects in digitized images
CN107368295A (en) * 2017-06-07 2017-11-21 努比亚技术有限公司 A kind of terminal wallpaper generation method, terminal and computer-readable recording medium
CN109597664A (en) * 2018-09-21 2019-04-09 北京字节跳动网络技术有限公司 Background configuration method, device, equipment and the readable medium of display area
CN110780873A (en) * 2019-09-06 2020-02-11 平安普惠企业管理有限公司 Interface color adaptation method and device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6236750B1 (en) * 1998-06-30 2001-05-22 Microsoft Corporation System and method for varying the color of reflective objects in digitized images
CN107368295A (en) * 2017-06-07 2017-11-21 努比亚技术有限公司 A kind of terminal wallpaper generation method, terminal and computer-readable recording medium
CN109597664A (en) * 2018-09-21 2019-04-09 北京字节跳动网络技术有限公司 Background configuration method, device, equipment and the readable medium of display area
CN110780873A (en) * 2019-09-06 2020-02-11 平安普惠企业管理有限公司 Interface color adaptation method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CA3136984A1 (en) 2022-04-29
CN112330763B (en) 2023-04-21

Similar Documents

Publication Publication Date Title
US11323676B2 (en) Image white balance processing system and method
WO2021169307A1 (en) Makeup try-on processing method and apparatus for face image, computer device, and storage medium
US20090009525A1 (en) Color Adjustment Device and Method
KR20070090224A (en) Method of electronic color image saturation processing
JP2004194342A (en) User's preference data generation method and unit relevant to video color characteristic and video color preference characteristic conversion method and unit using the same
US11576478B2 (en) Method for simulating the rendering of a make-up product on a body area
CN114359305A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN110149550B (en) Image data processing method and device and storage medium
CN112598582A (en) Image correction and correction data generation method, device and system and display method
CN111160267A (en) Image processing method, terminal and storage medium
CN114140358A (en) Image display method, device, terminal and storage medium
CN113724175A (en) Image processing method and device based on artificial intelligence and electronic equipment
CN112330763A (en) Method and device for determining atmosphere color of picture, computer equipment and storage medium
CN113240760B (en) Image processing method, device, computer equipment and storage medium
WO2023000868A1 (en) Image processing method and apparatus, device, and storage medium
CN114663570A (en) Map generation method and device, electronic device and readable storage medium
CN115604887A (en) Atmosphere lamp group control method, control console and device
KR102215607B1 (en) Electronic device capable of correction to improve the brightness of dark images and operating method thereof
CN115474316A (en) Method and device for controlling atmosphere lamp, electronic equipment and storage medium
CN114816619A (en) Information processing method and electronic equipment
CN114527950A (en) Picture color adjusting method, device, equipment and storage medium
US11055881B2 (en) System and a method for providing color vision deficiency assistance
JP2002010283A (en) Display method and processor for face image
CN113487497A (en) Image processing method and device and electronic equipment
CN111613168A (en) Image display processing method and device 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
GR01 Patent grant
GR01 Patent grant