CN112330763B - 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
CN112330763B
CN112330763B CN202011186383.8A CN202011186383A CN112330763B CN 112330763 B CN112330763 B CN 112330763B CN 202011186383 A CN202011186383 A CN 202011186383A CN 112330763 B CN112330763 B CN 112330763B
Authority
CN
China
Prior art keywords
picture
color
display area
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.)
Active
Application number
CN202011186383.8A
Other languages
Chinese (zh)
Other versions
CN112330763A (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 the atmosphere color of a picture, 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, wherein the display area is used for displaying the atmosphere color, calculating the nearest distance between a key point on the target picture and the display area, obtaining a distance matrix, calculating 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.

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 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 display some live or promotional carousel pictures in a striking position, and when displaying one of the pictures, color matching the hue of the picture is filled in adjacent areas of the picture to serve as an extension of the picture, so that the live color atmosphere is baked out in a larger area range, and the attention of users is attracted. When the timing (e.g., 5 seconds) or the user manually switches to another picture, the adjacent picture area also needs to be changed to a color corresponding to the tone of the new picture to reveal a new color atmosphere matching it. When the number of scenes in which the carousel pictures need to be displayed is large, a lot of manpower is required to manually set an atmosphere color for each picture. For example, thousands of people and thousands of faces need to display different carousel graphs for different user groups, assuming that there are 100 user groups, each user group displays a specific 5 carousel graph, setting atmosphere color of one picture manually needs 1 minute, and the batch of setting needs 100×5×1=500 minutes, which is about one-day workload of one person.
Therefore, it is needed to provide an atmosphere color determining method capable of automatically and rapidly calculating the atmosphere color of each picture in each scene, so as to save labor cost.
Disclosure of Invention
In order to solve the problems in the prior art, the embodiment of the invention provides a method, a device, computer equipment and a storage medium for determining the atmosphere color of pictures, which can automatically and quickly calculate the atmosphere color of each picture in the scene so as to save labor cost.
In order to solve one or more of the technical problems, the invention adopts the following technical scheme:
in a first aspect, a method for determining an ambient color of a picture is provided, the method comprising the steps of:
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 atmosphere colors;
calculating the nearest distance between the key points on the target picture and the display area, and obtaining 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;
and correcting the main tone according to the target scene, and determining the atmosphere color of the display area.
In some embodiments, the determining the display area according to the condition that the target picture is to be displayed in the target scene includes:
adjusting the size of a target picture according to the condition that the target picture is 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 includes an area in the target scene adjacent to the target picture.
In some embodiments, the calculating the dominant hue of the display area according to the distance matrix, the color value of the key point, 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 value of the key point by using a preset algorithm to obtain the dominant hue of the display area.
In some embodiments, said modifying said dominant hue according to said target scene, determining an ambient color of said display region comprises:
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 a device for determining an ambient color of a picture, the device comprising:
the region determining module is used for determining a display region according to the condition that the target picture is to be displayed in the target scene, wherein the display region is used for displaying atmosphere colors;
the distance calculation module is used for calculating the nearest distance between the key points on the target picture and the display area and obtaining a distance matrix;
the tone calculation module is used for calculating the dominant tone of the display area according to the distance matrix, the color value of the key point and a preset algorithm;
and the tone adjustment module is used for correcting the main tone according to the target scene and determining the atmosphere color of the display area.
In a third aspect, there is provided a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of:
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 atmosphere colors;
calculating the nearest distance between the key points on the target picture and the display area, and obtaining 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;
and correcting the main tone according to the target scene, and determining the atmosphere color of the display area.
In a fourth aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
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 atmosphere colors;
calculating the nearest distance between the key points on the target picture and the display area, and obtaining 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;
and correcting the main tone according to the target scene, and determining the atmosphere color of the display area.
The technical scheme provided by the embodiment of the invention has the beneficial effects that:
according to the method, the device, the computer equipment and the storage medium for determining the atmosphere color of the picture, the display area is determined according to the condition that a target picture is to be displayed in a target scene, the display area is used for displaying the atmosphere color, the nearest distance between a key point on the target picture and the display area is calculated, a distance matrix is obtained, the dominant hue of the display area is calculated according to the distance matrix, the color value of the key point and a preset algorithm, the dominant hue is corrected according to the target scene, the atmosphere color of the display area is determined, the color value distribution of each pixel on the picture and the space distance between each pixel on the picture and the adjacent area of the display atmosphere color are considered, and the environment atmosphere color which is displayed on the periphery of the picture and is overlapped with the picture color is calculated, so that the sense of experience of depth of a larger area than that of the original picture is brought to a user visually.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic illustration of a picture dominant hue as an ambient color, shown according to an exemplary embodiment;
FIG. 2 is a schematic diagram of a display of a target picture in a target scene and a corresponding display area displaying an ambient color, according to an example embodiment;
FIG. 3 is a schematic diagram of a distance matrix shown according to an exemplary embodiment;
FIG. 4 is a schematic diagram of a distance weighting matrix shown in accordance with an exemplary embodiment;
FIG. 5 is a flowchart illustrating a method of determining a picture atmosphere color according to an exemplary embodiment;
fig. 6 is a schematic structural diagram of a determination device of a picture atmosphere color shown according to an exemplary embodiment;
fig. 7 is a schematic diagram showing an internal structure of a computer device according to an exemplary embodiment.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, 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 apparent that the described embodiments are only some embodiments of the present invention, not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
As described in the background art, no special calculation method for atmosphere color exists in the market at present, only some extraction methods for main color tone of pictures exist, usually only the main color tone of the pictures is extracted according to the self attribute of the pictures, the use scene of the extracted main color tone and the position space relation between the main color tone and the pictures are not considered, and the proximity principle and the similarity principle of human vision are ignored. However, the relative distance between the pixels of the picture and the surrounding area affects the user's perception of whether they are organized together, the pixels that are closer to each other appear to belong to a group, while the pixels that are relatively farther apart are grouped together, and similar colors appear to be more visually grouped together, together forming an atmosphere.
For example, in the adjacent top area of the moving picture, it is necessary to fill in a color to form an atmosphere. The method on the market is simply to calculate its dominant hue from the moving picture itself and then fill it on top as an ambient color. Fig. 1 is a schematic diagram showing a dominant hue of a picture as an atmosphere color according to an exemplary embodiment, and as shown in fig. 1, assuming that there is a picture whose top edge color (shown as a square in the figure) and center color (shown as a circle in the figure) are very different, although the dominant hue is calculated well (shown as a circle in the figure) from the whole picture, after filling the top of the picture, a strong contrast is formed with the top edge color (shown as a square in the figure) of the picture, which is visually apparent as not a group, thereby causing a visual interval, and the user sees an assorted feeling instead of a harmonious atmosphere.
In addition, in some specific scenes, colors similar to the main color tone are required to be displayed, an atmosphere conforming to the moving picture is formed, but the colors cannot be loud and dominant, and the calculated colors cannot be directly filled in the peripheral area of the picture, so that certain correction is required, the background atmosphere is weakened slightly, the moving picture is highlighted, and the existing main color tone extraction method is not considered.
In order to solve the problems, the invention provides a method for determining the atmosphere color of the picture, which follows the proximity principle and the similarity principle of human vision, combines the actual use scene, adopts a distance weighting mode to realize automatic calculation of adjacent atmosphere colors, saves the labor setting cost, and does not deviate from the scene and the environment any more and achieves the more real user experience effect compared with the prior art.
Specifically, the scheme can be realized through the following steps:
step one, obtaining region information of a target picture in a target scene and region information of a display region adjacent to the target picture for displaying atmosphere colors, and scaling the target picture to the size of the display region.
Specifically, firstly, target scene information of a display target picture and information of a to-be-displayed condition of the target picture in the target scene, such as the size, the position and the like of the target picture in the target scene, are obtained, and then a display area for displaying atmosphere colors is determined according to the obtained information. Fig. 2 is a schematic diagram showing a display situation of a target picture in a target scene and a corresponding display area of a display atmosphere color according to an exemplary embodiment, and referring to fig. 2, assuming a target picture of one 6*5 pixel (a dotted line area in fig. 2), the display area of the display atmosphere color includes a left partial area, an upper partial area, and a right partial area (a solid line area adjacent outside the dotted line in fig. 2) adjacent to the target picture.
And step two, calculating the nearest 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 a key point as an example of a pixel point in a target picture, the pixel point is represented by (x, y), wherein x, y are two-dimensional coordinates of the pixel point, and the nearest distance d (x, y) between each pixel point (x, y) in the target picture and an adjacent display area is calculated 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 area is 1, distances between adjacent pixel points are sequentially calculated until all the pixel points in the target picture are traversed. It should be noted that in the embodiment of the present invention, different d (x, y) functions may be selected for different scenarios, for example:
d(x,y)=min(d(x-1,y),d(x+1,y),d(x,y-1),d(x,y+1))+1
step three, calculating a distance weighting value of each pixel point of the target picture to obtain a distance weighting matrix of the target picture.
Specifically, the distance matrix is calculated by using a preset weight calculation method, and a corresponding distance weight matrix is obtained. The calculated distance weighting matrix is shown with reference to fig. 4. It should be noted that in the embodiment of the present invention, for different scenes, different weighting functions w (d) may be selected, for example:
w(d)=1+(1/d)
the closer the picture pixels are to the display atmosphere color region, the greater the influence on the finally generated atmosphere color, and the more consistent and more coordinated the visual effect. Therefore, in the embodiment of the invention, the closer the image pixels to the atmosphere color area are displayed, the larger the distance weighted value is, so that the pixels at far and near positions have different contributions to the atmosphere color, and the problems of color jump, abrupt comparison and the like are avoided.
And step four, calculating a 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, kmens clustering, palette extraction, and other algorithms. After the color value of each pixel in the target picture is obtained, calculating the color value of each pixel of the target picture and a distance weighting matrix through a preset algorithm, and calculating a distance weighted dominant hue which is expressed as dc (r 1, g1, b 1), wherein r1, g1 and b1 are RGB values 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 not 1 any more, but a distance weighting value. Similarly, the closer the image pixels are to the display atmosphere color, the greater the influence on the finally generated atmosphere color, and the more consistent and more coordinated 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-distance pixels and the near-distance pixels have different contributions to the atmosphere color, and the problems of color jump, abrupt comparison and the like are avoided.
And fifthly, correcting the main tone obtained in the step to obtain the final atmosphere color.
In particular, in order to make the atmosphere color more similar to and match with the target picture, without causing excessive color jump, the background atmosphere should be properly weakened (slightly darker) 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 expressed as ac (r 2, g2 and 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:0
b2=(b1-DARK>0)?b1-DARK:0
the DARK is a constant, which can be determined according to actual requirements and scenes, and is generally 30. The greater the DARK constant, the more pronounced the ambient background weakening, but not too great, otherwise the ambient hue will deviate. Here, "r2= (r 1-DARK > 0)? r1-DARK:0 "means that if r1-DARK >0 holds, the end result of the expression is r1-DARK; if r1-DARK >0 is not true, the end result is 0, and so on, not described in one-to-one here.
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 that the target picture is 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 display size of the target picture in the target scene.
S2: and calculating the nearest distance between the key points on the target picture and the display area, and obtaining 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, which is not limited herein.
S3: and 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.
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 spatial distance between each pixel on the target picture and the adjacent display area is considered, so that a deep immersion experience sense with a larger area than that of the original picture can be visually brought to a user.
S4: and correcting the main tone according to the target scene, and determining the atmosphere color of the display area.
Specifically, because the color similar to the main tone of the target picture needs to be displayed in the display area to form the atmosphere conforming to the moving picture, but the atmosphere cannot be loud and attractive, the calculated color cannot be directly filled in the peripheral area of the picture, a certain correction is needed, the background atmosphere is weakened slightly, and the target picture is highlighted.
In an embodiment of the present invention, determining the display area according to the to-be-displayed condition of the target picture in the target scene includes:
adjusting the size of a target picture according to the condition that the target picture is 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 that the target picture is to be displayed in the target scene, the size of the target picture to be displayed can be adjusted to the required size.
In a preferred embodiment of the present invention, the display area includes an area adjacent to the target picture in the target scene.
In a preferred embodiment of the present invention, the calculating the dominant hue of the display area according to the distance matrix, the color value of the key point, 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 value of the key point by using a preset algorithm to obtain the dominant hue of the display area.
In a preferred embodiment of the present invention, the modifying the dominant color 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.
In a preferred 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 of a determination apparatus of a picture atmosphere color, which includes:
the region determining module is used for determining a display region according to the condition that the target picture is to be displayed in the target scene, wherein the display region is used for displaying atmosphere colors;
the distance calculation module is used for calculating the nearest distance between the key points on the target picture and the display area and obtaining a distance matrix;
the tone calculation module is used for calculating the dominant tone of the display area according to the distance matrix, the color value of the key point and a preset algorithm;
and the tone adjustment module is used for correcting the main tone according to the target scene and determining the atmosphere color of the display area.
As a preferred implementation manner, in the embodiment of the present invention, the area determining module is specifically configured to:
adjusting the size of a target picture according to the condition that the target picture is 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 a preferred 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 the embodiment of the present invention, the tone 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 value of the key point 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, the 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.
In a preferred embodiment of the present invention, the key point includes each pixel point in the target picture.
Fig. 7 is a schematic diagram showing an internal structure of a computer device including a processor, a memory, and a network interface connected through a system bus, as shown with reference to fig. 7, according to an exemplary embodiment. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. 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 optimizing an execution plan.
It will be appreciated by those skilled in the art that the structure shown in FIG. 6 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
As a preferred implementation manner, in an embodiment of the present invention, a computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer program to implement the following steps:
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 atmosphere colors;
calculating the nearest distance between the key points on the target picture and the display area, and obtaining 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;
and correcting the main tone according to the target scene, and determining the atmosphere color of the display area.
In a preferred embodiment of the present invention, the processor executes the computer program to further implement the following steps:
adjusting the size of a target picture according to the condition that the target picture is 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 a preferred embodiment of the present invention, the processor executes the computer program to further implement 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 value of the key point by using a preset algorithm to obtain the dominant hue of the display area.
In a preferred embodiment of the present invention, the processor executes the computer program to further implement the following steps:
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, there is also provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
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 atmosphere colors;
calculating the nearest distance between the key points on the target picture and the display area, and obtaining 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;
and correcting the main tone according to the target scene, and determining the atmosphere color of the display area.
As a preferred implementation manner, in the embodiment of the present invention, when the computer program is executed by the processor, the following steps are further implemented:
adjusting the size of a target picture according to the condition that the target picture is 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 computer program is executed by the processor, 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 value of the key point 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 computer program is executed by the processor, 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 summary, the technical solution provided by the embodiment of the present invention has the following beneficial effects:
according to the method, the device, the computer equipment and the storage medium for determining the atmosphere color of the picture, the display area is determined according to the condition that a target picture is to be displayed in a target scene, the display area is used for displaying the atmosphere color, the nearest distance between a key point on the target picture and the display area is calculated, a distance matrix is obtained, the dominant hue of the display area is calculated according to the distance matrix, the color value of the key point and a preset algorithm, the dominant hue is corrected according to the target scene, the atmosphere color of the display area is determined, the color value distribution of each pixel on the picture and the space distance between each pixel on the picture and the adjacent area of the display atmosphere color are considered, and the environment atmosphere color which is displayed on the periphery of the picture and is overlapped with the picture color is calculated, so that the sense of experience of depth of a larger area than that of the original picture is brought to a user visually.
It should be noted that: the determining device for the ambient color of the picture provided in the above embodiment only uses the division of the above functional modules to illustrate when the ambient color computing service is triggered, in practical application, the above functional allocation may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus for determining the color of the picture atmosphere provided in the foregoing embodiment belongs to the same concept as the method embodiment for determining the color of the picture atmosphere, that is, the apparatus is based on the method for determining the color of the picture atmosphere, and detailed implementation processes of the apparatus are referred to the method embodiment, which 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 for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The foregoing description of the preferred embodiments of the invention is not intended to limit the invention to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and scope of the invention are intended to be included within the scope of the invention.

Claims (8)

1. A method for determining an ambient color of a picture, the method comprising:
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 atmosphere colors;
calculating the nearest distance between the key points on the target picture and the display area, and obtaining a distance matrix;
calculating and acquiring a distance weighting matrix of the target picture according to the distance matrix;
calculating the distance weighting matrix and the color value of the key point by using a preset algorithm to obtain the dominant hue of the display area;
weakening the main tone according to the target scene to obtain the atmosphere color of the display area;
wherein the nearest distance is d (x, y),
d (x, y) =min (d (x-1, y), d (x+1, y), d (x, y-1), d (x, y+1)) +1; x and y are two-dimensional coordinates of pixel points in the target picture;
the weighting function of the distance weighting matrix is as follows: w (d) =1+ (1/d);
the weakening algorithm of the weakening treatment is as follows:
ac(r2,g2,b2)=dc(r1,g1,b1)–DARK
r2=(r1-DARK>0)?r1-DARK:0
g2=(g1-DARK>0)?g1-DARK:0
b2=(b1-DARK>0)?b1-DARK:0;
wherein ac (r 2, g2, b 2) is the ambient color of the display area, dc (r 1, g1, b 1) is the distance-weighted dominant hue, r1, g1, b1 is its RGB value in the RGB color space; DARK is constant; r2= (r 1-DARK > 0)? r1-DARK:0 "means that if r1-DARK >0 holds, the end result of the expression is r1-DARK; if r1-DARK >0 is not true, the final result is 0.
2. The method for determining the color of the picture atmosphere according to claim 1, wherein the determining the display area according to the condition that the target picture is to be displayed in the target scene comprises:
adjusting the size of a target picture according to the condition that the target picture is 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. The method of determining a picture atmosphere color according to claim 1 or 2, wherein the presentation area includes an area adjacent to the target picture in the target scene.
4. The method for determining the ambient color of a picture according to claim 1 or 2, wherein the preset algorithm is a clustering algorithm or a palette extraction algorithm.
5. The method of determining a picture atmosphere color according to claim 1 or 2, wherein the key points include each pixel point in the target picture.
6. An apparatus for implementing the method for determining a color of a picture atmosphere according to any one of claims 1 to 5, characterized in that the apparatus comprises:
the region determining module is used for determining a display region according to the condition that the target picture is to be displayed in the target scene, wherein the display region is used for displaying atmosphere colors;
the distance calculation module is used for calculating the nearest distance between the key points on the target picture and the display area and obtaining a distance matrix;
the tone calculation module is used for calculating the dominant tone of the display area according to the distance matrix, the color value of the key point and a preset algorithm;
and the tone adjustment module is used for correcting the main tone according to the target scene and determining the atmosphere color of the display area.
7. 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 processor implements the steps of the method according to any one of claims 1 to 5 when the computer program is executed by the processor.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 5.
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 CN112330763A (en) 2021-02-05
CN112330763B true 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)

Family Cites Families (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
CN110780873B (en) * 2019-09-06 2024-05-03 平安普惠企业管理有限公司 Interface color adaptation method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CA3136984A1 (en) 2022-04-29
CN112330763A (en) 2021-02-05

Similar Documents

Publication Publication Date Title
US20090009525A1 (en) Color Adjustment Device and Method
CN110149550B (en) Image data processing method and device and storage medium
CN111145135A (en) Image descrambling processing method, device, equipment and storage medium
CN111815786A (en) Information display method, device, equipment and storage medium
EP4261784A1 (en) Image processing method and apparatus based on artificial intelligence, and electronic device, computer-readable storage medium and computer program product
WO2020064676A1 (en) Method for simulating the rendering of a make-up product on a body area
CN112598582A (en) Image correction and correction data generation method, device and system and display method
WO2017113620A1 (en) Method and system for processing high dynamic-range image
CN112330763B (en) Method and device for determining atmosphere color of picture, computer equipment and storage medium
CN112133260B (en) Image adjusting method and device
CN117061882A (en) Video image processing method, apparatus, device, storage medium, and program product
Gong et al. Impacts of appearance parameters on perceived image quality for mobile-phone displays
EP2988485A1 (en) Methods and apparatus for mapping input image
CN112435173A (en) Image processing and live broadcasting method, device, equipment and storage medium
CN115604887A (en) Atmosphere lamp group control method, control console and device
CN114663570A (en) Map generation method and device, electronic device and readable storage medium
CN115474316A (en) Method and device for controlling atmosphere lamp, electronic equipment and storage medium
US8295539B2 (en) Method and system of immersive sensation enhancement for video sequence displaying
CN114816619A (en) Information processing method and electronic equipment
CN114527950A (en) Picture color adjusting method, device, equipment and storage medium
CN111613168B (en) Image display processing method and device and computer readable storage medium
KR102215607B1 (en) Electronic device capable of correction to improve the brightness of dark images and operating method thereof
CN113810673A (en) Projector uniformity testing method and device and computer readable storage medium
CN113240760A (en) Image processing method and device, computer equipment and storage medium
JP2011223509A (en) Color correction system, program and color correction method

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