CN113870099B - Picture color conversion method, device, equipment and readable storage medium - Google Patents

Picture color conversion method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN113870099B
CN113870099B CN202111143452.1A CN202111143452A CN113870099B CN 113870099 B CN113870099 B CN 113870099B CN 202111143452 A CN202111143452 A CN 202111143452A CN 113870099 B CN113870099 B CN 113870099B
Authority
CN
China
Prior art keywords
original
rgb channel
color conversion
pixel point
black
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
CN202111143452.1A
Other languages
Chinese (zh)
Other versions
CN113870099A (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.)
Taishan Information Technology Co ltd
Original Assignee
Taishan Information Technology 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 Taishan Information Technology Co ltd filed Critical Taishan Information Technology Co ltd
Priority to CN202111143452.1A priority Critical patent/CN113870099B/en
Publication of CN113870099A publication Critical patent/CN113870099A/en
Application granted granted Critical
Publication of CN113870099B publication Critical patent/CN113870099B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Color Image Communication Systems (AREA)
  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

The invention discloses a picture color conversion method, which comprises the following steps: acquiring an original picture to be subjected to color conversion and a color conversion type; acquiring original RGB channel components corresponding to original pixel points in an original picture respectively; when the color conversion type is black and white effect processing, weighting calculation is carried out on each original RGB channel component aiming at each original pixel point; determining each black-and-white pixel point according to each first weighted calculation result to obtain a black-and-white effect graph; when the color conversion type is the coloring effect processing, the concentration and saturation of each target color pixel point in the target coloring effect graph are adjusted to obtain adjusted RGB channel components, and the target coloring effect graph is generated by combining each original RGB channel component and each adjusted RGB channel component. The invention greatly improves the color conversion efficiency and ensures the space consistency of the color in the transfer process. The invention also discloses a device, equipment and a storage medium, which have corresponding technical effects.

Description

Picture color conversion method, device, equipment and readable storage medium
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method, an apparatus, a device, and a computer readable storage medium for converting colors of pictures.
Background
In information transfer and exchange, images are important propagation media. In the human visual system, color is one of the important factors that embody visual perception. The original picture swatch sometimes fails to show the user's various needs, at which time the picture needs to be processed, e.g., the picture of a different style scene is switched.
The existing picture color conversion methods are mostly color conversion methods based on color transfer. At present, in the research aspect of a coloring method based on color transfer, the coloring process at each pixel point in a target gray image is independent, so that the traditional color conversion method generally has the problem of inconsistent space of colors in the transfer process, and the picture color conversion process is complex and has low conversion efficiency.
In summary, how to effectively solve the problems that the existing color conversion method is prone to have inconsistent space of colors in the transfer process, the color conversion process of pictures is complex, the conversion efficiency is low, and the like is a urgent need of those skilled in the art at present.
Disclosure of Invention
The invention aims to provide a picture color conversion method, which greatly reduces the complexity of color conversion, improves the color conversion efficiency and ensures the spatial consistency of colors in the transfer process; another object of the present invention is to provide a picture color conversion apparatus, device, and computer-readable storage medium.
In order to solve the technical problems, the invention provides the following technical scheme:
a picture color conversion method, comprising:
analyzing the received picture color conversion request to obtain an original picture to be color-converted and a color conversion type;
acquiring original RGB channel components corresponding to original pixel points in the original picture respectively;
when the color conversion type is black and white effect processing, carrying out weighted calculation on the original RGB channel components aiming at each original pixel point;
determining black and white pixel points corresponding to the original pixel points respectively according to the obtained first weighted calculation results, and returning the black and white pixel points to the positions of the corresponding original pixel points in the original picture to obtain a black and white effect picture;
when the color conversion type is coloring effect processing, obtaining each target color pixel point in a target coloring effect graph, and adjusting the concentration and saturation of each target color pixel point to obtain each adjusted pixel point;
acquiring adjusted RGB channel components corresponding to the adjusted pixel points respectively, and generating pixel points to be added by combining the original RGB channel components and the adjusted RGB channel components;
and returning each pixel point to be added to the corresponding original pixel point position in the original picture to obtain the target coloring effect graph.
In a specific embodiment of the present invention, the weighting calculation is performed on the original RGB channel components for each original pixel point, including:
acquiring RGB channel weight coefficients obtained by pre-training;
and carrying out weighted calculation on the original RGB channel components according to the RGB channel weight coefficients for each original pixel point.
In a specific embodiment of the present invention, determining black-and-white pixel points corresponding to the original pixel points according to the obtained first weighted calculation results includes:
comparing each first weighted calculation result with a preset pixel threshold value respectively, and determining each target black-and-white pixel value according to each obtained comparison result;
and generating black-and-white pixel points corresponding to the original pixel points respectively according to the target black-and-white pixel values.
In one embodiment of the present invention, the adjusting the concentration and saturation of each of the target color pixels includes:
acquiring first RGB channel components corresponding to the target color pixel points respectively;
performing concentration adjustment on each first RGB channel component by using a pre-trained pixel concentration adjustment model to obtain each second RGB channel component;
and performing saturation adjustment operation on each second RGB channel component by using a saturation adjustment model obtained through pre-training.
In one embodiment of the present invention, generating each pixel to be added by combining each of the original RGB channel components and each of the adjusted RGB channel components includes:
performing weighted calculation on the adjusted RGB channel components aiming at each adjusted pixel point to obtain a second weighted calculation result;
calculating each target RGB channel component by combining each original RGB channel component and each second weighting calculation result;
and generating each pixel point to be added according to each target RGB channel component.
A picture color conversion apparatus comprising:
the request analysis module is used for analyzing the received picture color conversion request to obtain an original picture to be color-converted and a color conversion type;
the original component acquisition module is used for acquiring original RGB channel components corresponding to original pixel points in the original picture respectively;
the weighting calculation module is used for carrying out weighting calculation on the original RGB channel components aiming at each original pixel point when the color conversion type is black-and-white effect processing;
the black-and-white effect graph obtaining module is used for determining black-and-white pixel points corresponding to the original pixel points respectively according to the obtained first weighted calculation results, and returning the black-and-white pixel points to the positions of the corresponding original pixel points in the original picture to obtain a black-and-white effect graph;
the concentration and saturation adjustment module is used for obtaining each target color pixel point in the target coloring effect graph when the color conversion type is coloring effect processing, and adjusting the concentration and saturation of each target color pixel point to obtain each adjusted pixel point;
the pixel point generation module is used for acquiring adjusted RGB channel components corresponding to the adjusted pixel points respectively, and generating pixel points to be added by combining the original RGB channel components and the adjusted RGB channel components;
and the coloring effect diagram obtaining module is used for returning each pixel point to be added to the corresponding original pixel point position in the original picture to obtain the target coloring effect diagram.
In one embodiment of the present invention, the weight calculation module includes:
the weight coefficient acquisition sub-module is used for acquiring RGB channel weight coefficients obtained through pre-training;
and the weighting calculation sub-module is used for carrying out weighting calculation on each original RGB channel component according to the RGB channel weight coefficient for each original pixel point.
In one embodiment of the present invention, the black-and-white effect map obtaining module includes:
the black-and-white pixel value determining submodule is used for respectively comparing each first weighted calculation result with a preset pixel threshold value and determining each target black-and-white pixel value according to each obtained comparison result;
and the black-and-white pixel point generation sub-module is used for generating black-and-white pixel points corresponding to the original pixel points respectively according to the target black-and-white pixel values.
A picture color conversion apparatus comprising:
a memory for storing a computer program;
a processor for implementing the steps of the picture color conversion method as described above when executing the computer program.
A computer readable storage medium having stored thereon a computer program which when executed by a processor implements the steps of a picture color conversion method as described above.
According to the picture color conversion method provided by the invention, the received picture color conversion request is analyzed to obtain the original picture to be color-converted and the color conversion type; acquiring original RGB channel components corresponding to original pixel points in an original picture respectively; when the color conversion type is black and white effect processing, carrying out weighted calculation on the original RGB channel components aiming at each original pixel point; determining black and white pixel points corresponding to the original pixel points respectively according to the obtained first weighted calculation results, and returning the black and white pixel points to the corresponding original pixel point positions in the original picture to obtain a black and white effect picture; when the color conversion type is the coloring effect processing, obtaining each target color pixel point in the target coloring effect graph, and adjusting the concentration and saturation of each target color pixel point to obtain each adjusted pixel point; acquiring adjusted RGB channel components corresponding to the adjusted pixel points respectively, and generating pixel points to be added by combining the original RGB channel components and the adjusted RGB channel components; and returning each pixel point to be added to the corresponding original pixel point position in the original picture to obtain the target coloring effect graph.
According to the technical scheme, the rapid conversion from the original picture to the corresponding effect picture is realized by calculating the RGB channel components, so that the switching speed under different scenes can be met, the conversion complexity is greatly reduced, the color conversion efficiency is improved, and the spatial consistency of the color in the transfer process is ensured.
Correspondingly, the invention further provides a picture color conversion device, equipment and a computer readable storage medium corresponding to the picture color conversion method, which have the technical effects and are not repeated herein.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of an embodiment of a method for converting colors of pictures;
FIG. 2 is a flowchart of another embodiment of a method for converting color of a picture according to the present invention;
FIG. 3 is a schematic diagram of a picture color conversion type setting interface according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a picture color setting interface according to an embodiment of the present invention;
FIG. 5 is a block diagram illustrating a picture color conversion apparatus according to an embodiment of the present invention;
fig. 6 is a block diagram of a picture color conversion apparatus according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a specific structure of a picture color conversion apparatus according to the present embodiment.
Detailed Description
In order to better understand the aspects of the present invention, the present invention will be described in further detail with reference to the accompanying drawings and detailed description. It will be apparent that the described embodiments are only some, but not all, embodiments of the 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.
Referring to fig. 1, fig. 1 is a flowchart of an implementation of a method for converting a color of a picture according to an embodiment of the present invention, where the method may include the following steps:
s101: and analyzing the received picture color conversion request to obtain an original picture to be color-converted and a color conversion type.
When the color conversion is needed for the picture, a picture color conversion request is sent to a picture color conversion center, wherein the picture color conversion request contains an original picture to be color-converted and a color conversion type. The picture color conversion center receives the picture color conversion request and analyzes the received picture color conversion request to obtain an original picture to be color-converted and a color conversion type. The color conversion type may include black-and-white effect processing and coloring effect processing.
S102: and acquiring original RGB channel components corresponding to each original pixel point in the original picture.
After the original picture to be subjected to color conversion and the color conversion type are obtained through analysis, the original RGB channel components corresponding to the original pixel points in the original picture are obtained, namely the numerical values of R, G, B three channels of the original pixel points are obtained.
RGB is a color standard in industry, which is to obtain various colors by changing three color channels of red (R), green (G) and blue (B) and overlapping them with each other, and RGB is a color representing three channels of red, green and blue, which includes almost all colors perceived by human eyesight, and is one of the most widely used color systems.
S103: when the color conversion type is black-and-white effect processing, the original RGB channel components are weighted for each original pixel point.
After the original RGB channel components corresponding to the original pixel points in the original picture are obtained, when the color conversion type is black and white effect processing, weighting calculation is carried out on the original RGB channel components aiming at each original pixel point. And setting a weight coefficient for each of the R, G, B channels of the pixel point, multiplying the corresponding weight coefficient by the values of the R, G, B three channels of the original pixel point, and adding the three calculated product values.
S104: and determining black and white pixel points corresponding to the original pixel points respectively according to the obtained first weighted calculation results, and returning the black and white pixel points to the corresponding original pixel point positions in the original picture to obtain a black and white effect picture.
And carrying out weight calculation on the original RGB channel components aiming at each original pixel point to obtain each first weight calculation result. After each first weighted calculation result is obtained, determining black-and-white pixel points corresponding to each original pixel point according to each obtained first weighted calculation result, if a pixel judgment critical value is preset, determining black-and-white pixel points corresponding to each original pixel point according to the magnitude relation between the first weighted calculation result obtained by calculating each original pixel point and the pixel judgment critical value. After determining black and white pixel points corresponding to the original pixel points respectively, returning the black and white pixel points to the positions of the corresponding original pixel points in the original picture to obtain a black and white effect picture, namely finally obtaining the picture to be black or white, and completely removing the original color degree.
S105: when the color conversion type is the coloring effect processing, each target color pixel point in the target coloring effect graph is obtained, and the concentration and saturation of each target color pixel point are adjusted to obtain each adjusted pixel point.
After the original RGB channel components corresponding to the original pixel points in the original picture are obtained, when the color conversion type is the coloring effect processing, all colors of the original picture are close to the target colors as much as possible, all target color pixel points in the target coloring effect picture are obtained, concentration and saturation adjustment are carried out on all target color pixel points, and all adjusted pixel points are obtained. By adjusting the density and saturation of the target color pixels, the image can be made to look more natural.
S106: and acquiring adjusted RGB channel components corresponding to the adjusted pixel points respectively, and generating pixel points to be added by combining the original RGB channel components and the adjusted RGB channel components.
And after the concentration and saturation of each target color pixel point are adjusted to obtain each adjusted pixel point, acquiring an adjusted RGB channel component corresponding to each adjusted pixel point. Since pixels are added on the basis of each original pixel point of the original image, new pixel points cannot be directly generated according to the adjusted RGB channel components, and each pixel point to be added needs to be generated by combining each original RGB channel component and each adjusted RGB channel component.
S107: and returning each pixel point to be added to the corresponding original pixel point position in the original picture to obtain the target coloring effect graph.
After each pixel point to be added is generated by combining each original RGB channel component and each adjusted RGB channel component, returning each pixel point to be added to the corresponding original pixel point position in the original picture, and obtaining the target coloring effect graph. And superposing the pixel points to be added and the corresponding original pixel points to obtain each target color pixel point.
According to the technical scheme, the rapid conversion from the original picture to the corresponding effect picture is realized by calculating the RGB channel components, so that the switching speed under different scenes can be met, the color conversion complexity is greatly reduced, the color conversion efficiency is improved, and the spatial consistency of the color in the transfer process is ensured.
It should be noted that, based on the above embodiments, the embodiments of the present invention further provide corresponding improvements. The following embodiments relate to the same steps as those in the above embodiments or the steps corresponding to the steps may be referred to each other, and the corresponding beneficial effects may also be referred to each other, which will not be described in detail in the following modified embodiments.
Referring to fig. 2, fig. 2 is a flowchart of another implementation of a method for converting a color of a picture according to an embodiment of the present invention, where the method may include the following steps:
s201: and analyzing the received picture color conversion request to obtain an original picture to be color-converted and a color conversion type.
S202: and acquiring original RGB channel components corresponding to each original pixel point in the original picture.
S203: when the color conversion type is black and white effect processing, the RGB channel weight coefficient obtained by pre-training is obtained.
RGB channel weight coefficients are trained in advance, for example, the R channel coefficient is 0.2125, the g channel coefficient is 0.7154, and the b channel coefficient is 0.0721. And acquiring RGB channel weight coefficients obtained through pre-training.
S204: and carrying out weighted calculation on the original RGB channel components according to the RGB channel weight coefficients for each original pixel point.
After the RGB channel weight coefficient obtained through pre-training is obtained, weighting calculation is carried out on the original RGB channel components according to the RGB channel weight coefficient aiming at each original pixel point, the corresponding weight coefficient obtained through training is multiplied by the numerical values of the R, G, B three channels of the original pixel point respectively, and then the three product values obtained through calculation are added.
S205: and comparing each first weighted calculation result with a preset pixel threshold value, and determining each target black-and-white pixel value according to each obtained comparison result.
The preset pixel threshold, for example, the preset pixel threshold is set to be a certain percentage of 255, which may be 25%, 50%, 75%, etc. After the original RGB channel components are weighted according to the RGB channel weight coefficients for each original pixel point to obtain each first weighted calculation result, comparing each first weighted calculation result with a preset pixel threshold value, and determining each target black-and-white pixel value according to each obtained comparison result, setting the pixel value of the pixel point to (255, 255, 255) if the first weighted calculation result is greater than the preset pixel threshold value, that is, setting the pixel point to be a white pixel point, and setting the pixel point to (0, 0) if the first weighted calculation result is less than or equal to the preset pixel threshold value, that is, setting the pixel point to be a black pixel point.
S206: and generating black-and-white pixel points corresponding to the original pixel points respectively according to the target black-and-white pixel values.
After determining each target black-and-white pixel value, generating black-and-white pixel points corresponding to each original pixel point respectively according to each target black-and-white pixel value, namely generating black pixel points when the target black-and-white pixel value is the pixel value corresponding to the black pixel point, and generating white pixel points when the target black-and-white pixel value is the pixel value corresponding to the white pixel point.
S207: and returning each black-and-white pixel point to the corresponding original pixel point position in the original picture to obtain a black-and-white effect picture.
S208: and when the color conversion type is the coloring effect processing, acquiring each target color pixel point in the target coloring effect graph.
S209: and acquiring first RGB channel components corresponding to the target color pixel points respectively.
After each target color pixel point in the target coloring effect diagram is obtained, a first RGB channel component corresponding to each target color pixel point is obtained, wherein the first RGB channel component is formed by a first R channel component R 1 First G channel component G 1 First B channel component B 1 The numerical values of R, G, B three channels of the target color pixel point are obtained.
S210: and performing concentration adjustment on each first RGB channel component by using a pre-trained pixel concentration adjustment model to obtain each second RGB channel component.
And (3) training a pixel concentration adjustment model in advance, and after obtaining the first RGB channel components corresponding to each target color pixel point respectively, performing concentration adjustment on each first RGB channel component by using the pixel concentration adjustment model obtained by pre-training to obtain each second RGB channel component. The second RGB channel component is composed of a second R channel component R 2 Second G channel component G 2 Second B channel component B 2 The coloring effect processing can be classified into a deep coloring effect processing and a light coloring effect processing.
When belonging to the deep coloring effect processing category, the trained pixel density adjustment model may include the following density adjustment formula:
Figure BDA0003284530430000091
Figure BDA0003284530430000092
Figure BDA0003284530430000093
when belonging to the class of light shading effect treatment, the trained pixel density adjustment model may comprise the following density adjustment formula:
R 2 =R 1 ×0.45 0.44999998
G 2 =G 1 ×0.45 0.44999998
B 2 =B 1 ×0.45 0.44999998
thereby obtaining each of the second RGB channel components after the density adjustment.
S211: and carrying out saturation adjustment operation on each second RGB channel component by using the saturation adjustment model obtained through pre-training to obtain each adjusted pixel point.
And pre-training a saturation adjustment model, performing concentration adjustment on each first RGB channel component by using the pixel concentration adjustment model obtained by pre-training to obtain each second RGB channel component, and performing saturation adjustment operation on each second RGB channel component by using the saturation adjustment model obtained by pre-training to obtain each adjusted pixel point. Setting the adjusted RGB channel component corresponding to each adjusted pixel point to be composed of a third R channel component R 3 Third G channel component G 3 Third B channel component B 3 The composition is formed.
When belonging to the deep coloring effect processing category, the trained saturation adjustment model may include the following saturation adjustment formula:
Figure BDA0003284530430000101
Figure BDA0003284530430000102
Figure BDA0003284530430000103
when belonging to the class of light shading effect processing, the trained saturation adjustment model may comprise the following saturation adjustment formula:
Figure BDA0003284530430000104
Figure BDA0003284530430000105
Figure BDA0003284530430000106
and obtaining each adjusted pixel point after concentration adjustment and saturation adjustment.
S212: and acquiring adjusted RGB channel components corresponding to the adjusted pixel points respectively.
S213: and carrying out weighted calculation on the adjusted RGB channel components aiming at each adjusted pixel point to obtain a second weighted calculation result.
After the adjusted RGB channel components corresponding to the adjusted pixel points are obtained, weighting calculation is carried out on the adjusted RGB channel components aiming at each adjusted pixel point, and a second weighting calculation result is obtained. Third R channel component R in the adjusted RGB channel component 3 Third G channel component G 3 Third B channel component B 3 The weight coefficients respectively corresponding to the first weight calculation results may be identical to the weight coefficients at the time of calculation of the first weight calculation results.
S214: and calculating each target RGB channel component by combining each original RGB channel component and each second weighted calculation result.
Calculating a second weightAfter the calculation result, each target RGB channel component is calculated in combination with each original RGB channel component and each second weighted calculation result. The target RGB channel component is represented by a fourth R channel component R 4 Fourth G channel component G 4 Fourth B channel component B 4 The composition is formed.
When belonging to the deep coloring effect processing category, each target RGB channel component can be calculated by the following formula:
Figure BDA0003284530430000111
Figure BDA0003284530430000112
Figure BDA0003284530430000113
wherein R is 0 G as B channel component in the original RGB channel components 0 For the G channel component, B of the original RGB channel components 0 Is the B-channel component of the original RGB channel components.
When belonging to the light shading effect processing category, each target RGB channel component can be calculated by the following formula:
Figure BDA0003284530430000114
Figure BDA0003284530430000115
Figure BDA0003284530430000116
thereby calculating each target RGB channel component.
S215: and generating each pixel point to be added according to each target RGB channel component.
After the target RGB channel components are obtained, generating each pixel point to be added according to each target RGB channel component.
S216: and returning each pixel point to be added to the corresponding original pixel point position in the original picture to obtain the target coloring effect graph.
After each pixel point to be added is generated according to each target RGB channel component, returning each pixel point to be added to the corresponding original pixel point position in the original picture, and obtaining a target coloring effect diagram.
The present embodiment is different from the first embodiment corresponding to the technical solution claimed in the independent claim 1, and further adds the technical solutions corresponding to the claims 2 to 5, and of course, according to the actual situation and the different requirements, the technical solutions corresponding to the claims can be flexibly combined on the basis of not affecting the integrity of the solutions, so as to better meet the requirements of different use scenarios, and the present embodiment only provides one of the solutions with the most inclusion solutions and the optimal effect, because the situation is complex, all possible solutions cannot be listed one by one, and a person skilled in the art should realize that many examples can exist according to the basic method principle provided by the present application in combination with the actual situation, and all the solutions should be within the scope of the present application without enough creative labor.
Corresponding to the above method embodiment, the present invention further provides a picture color conversion apparatus, and the picture color conversion apparatus described below and the picture color conversion method described above may be referred to correspondingly to each other.
Referring to fig. 5, fig. 5 is a block diagram illustrating a picture color conversion apparatus according to an embodiment of the present invention, the apparatus may include:
the request parsing module 51 is configured to parse the received image color conversion request to obtain an original image to be color-converted and a color conversion type;
the original component obtaining module 52 is configured to obtain original RGB channel components corresponding to each original pixel point in the original image;
a weighting calculation module 53, configured to perform weighting calculation on the original RGB channel components for each original pixel point when the color conversion type is black-and-white effect processing;
the black-and-white effect graph obtaining module 54 is configured to determine black-and-white pixel points corresponding to the original pixel points respectively according to the obtained first weighted calculation results, and return the black-and-white pixel points to the corresponding original pixel point positions in the original picture, so as to obtain a black-and-white effect graph;
the concentration and saturation adjustment module 55 is configured to obtain each target color pixel point in the target color effect map when the color conversion type is color effect processing, and adjust the concentration and saturation of each target color pixel point to obtain each adjusted pixel point;
the pixel point generating module 56 is configured to obtain adjusted RGB channel components corresponding to the adjusted pixel points, and combine the original RGB channel components and the adjusted RGB channel components to generate pixel points to be added;
and the coloring effect diagram obtaining module 57 is configured to return each pixel to be added to a corresponding original pixel position in the original picture, so as to obtain a target coloring effect diagram.
According to the technical scheme, the rapid conversion from the original picture to the corresponding effect picture is realized by calculating the RGB channel components, so that the switching speed under different scenes can be met, the color conversion complexity is greatly reduced, the color conversion efficiency is improved, and the spatial consistency of the color in the transfer process is ensured.
In one embodiment of the present invention, the weight calculation module 53 includes:
the weight coefficient acquisition sub-module is used for acquiring RGB channel weight coefficients obtained through pre-training;
and the weighting calculation sub-module is used for carrying out weighting calculation on the original RGB channel components according to the RGB channel weight coefficient aiming at each original pixel point.
In one embodiment of the present invention, the black-and-white effect map obtaining module 54 includes:
the black-and-white pixel value determining submodule is used for respectively comparing each first weighted calculation result with a preset pixel threshold value and determining each target black-and-white pixel value according to each obtained comparison result;
and the black-and-white pixel point generation sub-module is used for generating black-and-white pixel points corresponding to the original pixel points respectively according to the target black-and-white pixel values.
In one embodiment of the present invention, the concentration and saturation adjustment module 55 includes:
the first component acquisition sub-module is used for acquiring first RGB channel components corresponding to each target color pixel point respectively;
the concentration adjustment submodule is used for carrying out concentration adjustment on each first RGB channel component by utilizing a pixel concentration adjustment model obtained through pre-training to obtain each second RGB channel component;
and the saturation adjustment sub-module is used for carrying out saturation adjustment operation on each second RGB channel component by utilizing the pre-trained saturation adjustment model.
In one embodiment of the present invention, the pixel point generating module 56 includes:
the weighting calculation sub-module is used for carrying out weighting calculation on the adjusted RGB channel components aiming at each adjusted pixel point to obtain a second weighting calculation result;
the component calculation operator module is used for combining each original RGB channel component with each second weighted calculation result to calculate each target RGB channel component;
and the pixel point generation sub-module is used for generating each pixel point to be added according to each target RGB channel component.
Corresponding to the above method embodiment, referring to fig. 6, fig. 6 is a schematic diagram of a picture color conversion apparatus provided by the present invention, where the apparatus may include:
a memory 332 for storing a computer program;
a processor 322 for implementing the steps of the picture color conversion method of the above-described method embodiment when executing a computer program.
Specifically, referring to fig. 7, fig. 7 is a schematic diagram of a specific structure of a picture color conversion apparatus according to the present embodiment, where the picture color conversion apparatus may have a relatively large difference due to different configurations or performances, and may include a processor (central processing units, CPU) 322 (e.g., one or more processors) and a memory 332, where the memory 332 stores one or more computer applications 342 or data 344. Wherein the memory 332 may be transient storage or persistent storage. The program stored in memory 332 may include one or more modules (not shown), each of which may include a series of instruction operations in the data processing apparatus. Still further, the processor 322 may be configured to communicate with the memory 332 to execute a series of instruction operations in the memory 332 on the picture color conversion device 301.
The picture color conversion apparatus 301 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input output interfaces 358, and/or one or more operating systems 341.
The steps in the picture color conversion method described above may be implemented by the structure of the picture color conversion apparatus.
Corresponding to the above method embodiments, the present invention also provides a computer readable storage medium having a computer program stored thereon, which when executed by a processor, performs the steps of:
analyzing the received picture color conversion request to obtain an original picture to be color-converted and a color conversion type; acquiring original RGB channel components corresponding to original pixel points in an original picture respectively; when the color conversion type is black and white effect processing, carrying out weighted calculation on the original RGB channel components aiming at each original pixel point; determining black and white pixel points corresponding to the original pixel points respectively according to the obtained first weighted calculation results, and returning the black and white pixel points to the corresponding original pixel point positions in the original picture to obtain a black and white effect picture; when the color conversion type is the coloring effect processing, obtaining each target color pixel point in the target coloring effect graph, and adjusting the concentration and saturation of each target color pixel point to obtain each adjusted pixel point; acquiring adjusted RGB channel components corresponding to the adjusted pixel points respectively, and generating pixel points to be added by combining the original RGB channel components and the adjusted RGB channel components; and returning each pixel point to be added to the corresponding original pixel point position in the original picture to obtain the target coloring effect graph.
The computer readable storage medium may include: a U-disk, a removable hard disk, a Read-only memory (ROM), a random access memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
For the description of the computer-readable storage medium provided by the present invention, refer to the above method embodiments, and the disclosure is not repeated here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. The apparatus, device and computer readable storage medium of the embodiments are described more simply because they correspond to the methods of the embodiments, and the description thereof will be given with reference to the method section.
The principles and embodiments of the present invention have been described herein with reference to specific examples, but the description of the examples above is only for aiding in understanding the technical solution of the present invention and its core ideas. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the invention can be made without departing from the principles of the invention and these modifications and adaptations are intended to be within the scope of the invention as defined in the following claims.

Claims (6)

1. A picture color conversion method, comprising:
analyzing the received picture color conversion request to obtain an original picture to be color-converted and a color conversion type;
acquiring original RGB channel components corresponding to original pixel points in the original picture respectively;
when the color conversion type is black-and-white effect processing, acquiring RGB channel weight coefficients obtained through pre-training;
weighting calculation is carried out on the original RGB channel components according to the RGB channel weight coefficients aiming at each original pixel point;
comparing each first weighted calculation result with a preset pixel threshold value respectively, and determining each target black-and-white pixel value according to each obtained comparison result;
generating black-and-white pixel points corresponding to the original pixel points respectively according to the target black-and-white pixel values, and returning the black-and-white pixel points to the corresponding original pixel point positions in the original picture to obtain a black-and-white effect picture;
when the color conversion type is coloring effect processing, obtaining each target color pixel point in a target coloring effect graph, and adjusting the concentration and saturation of each target color pixel point to obtain each adjusted pixel point;
acquiring adjusted RGB channel components corresponding to the adjusted pixel points respectively, and generating pixel points to be added by combining the original RGB channel components and the adjusted RGB channel components;
and returning each pixel point to be added to the corresponding original pixel point position in the original picture to obtain the target coloring effect graph.
2. The picture color conversion method according to claim 1, wherein performing density and saturation adjustment for each of the target color pixels comprises:
acquiring first RGB channel components corresponding to the target color pixel points respectively;
performing concentration adjustment on each first RGB channel component by using a pre-trained pixel concentration adjustment model to obtain each second RGB channel component;
and performing saturation adjustment operation on each second RGB channel component by using a saturation adjustment model obtained through pre-training.
3. The method of claim 2, wherein generating each pixel to be added by combining each of the original RGB channel components and each of the adjusted RGB channel components, comprises:
performing weighted calculation on the adjusted RGB channel components aiming at each adjusted pixel point to obtain a second weighted calculation result;
calculating each target RGB channel component by combining each original RGB channel component and each second weighting calculation result;
and generating each pixel point to be added according to each target RGB channel component.
4. A picture color conversion apparatus, comprising:
the request analysis module is used for analyzing the received picture color conversion request to obtain an original picture to be color-converted and a color conversion type;
the original component acquisition module is used for acquiring original RGB channel components corresponding to original pixel points in the original picture respectively;
the weighting calculation module comprises a weighting coefficient acquisition submodule and a weighting calculation submodule, wherein the weighting coefficient acquisition submodule is used for acquiring RGB channel weighting coefficients obtained through pre-training when the color conversion type is black-white effect processing;
the weighting calculation sub-module is used for carrying out weighting calculation on the original RGB channel components according to the RGB channel weight coefficients for each original pixel point;
the black-and-white effect image obtaining module is used for returning each black-and-white pixel point to the corresponding original pixel point position in the original picture to obtain a black-and-white effect image; the black-and-white effect graph obtaining module comprises a black-and-white pixel value determining submodule, wherein the black-and-white effect graph obtaining module is used for respectively comparing each first weighted calculation result with a preset pixel threshold value and determining each target black-and-white pixel value according to each obtained comparison result; a black-and-white pixel point generation sub-module, configured to generate black-and-white pixel points corresponding to the original pixel points respectively according to the target black-and-white pixel values;
the concentration and saturation adjustment module is used for obtaining each target color pixel point in the target coloring effect graph when the color conversion type is coloring effect processing, and adjusting the concentration and saturation of each target color pixel point to obtain each adjusted pixel point;
the pixel point generation module is used for acquiring adjusted RGB channel components corresponding to the adjusted pixel points respectively, and generating pixel points to be added by combining the original RGB channel components and the adjusted RGB channel components;
and the coloring effect diagram obtaining module is used for returning each pixel point to be added to the corresponding original pixel point position in the original picture to obtain the target coloring effect diagram.
5. A picture color conversion apparatus, characterized by comprising:
a memory for storing a computer program;
a processor for implementing the steps of the picture color conversion method according to any one of claims 1 to 3 when executing said computer program.
6. A computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the steps of the picture color conversion method according to any one of claims 1 to 3.
CN202111143452.1A 2021-09-28 2021-09-28 Picture color conversion method, device, equipment and readable storage medium Active CN113870099B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111143452.1A CN113870099B (en) 2021-09-28 2021-09-28 Picture color conversion method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111143452.1A CN113870099B (en) 2021-09-28 2021-09-28 Picture color conversion method, device, equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN113870099A CN113870099A (en) 2021-12-31
CN113870099B true CN113870099B (en) 2023-06-27

Family

ID=78991763

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111143452.1A Active CN113870099B (en) 2021-09-28 2021-09-28 Picture color conversion method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN113870099B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115797494B (en) * 2023-02-06 2023-05-23 武汉精臣智慧标识科技有限公司 Picture binarization processing method and device, electronic equipment and storage medium
CN117435156B (en) * 2023-12-20 2024-05-28 汉朔科技股份有限公司 Display information generation method, device, equipment and medium of electronic price tag

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105263009B (en) * 2015-09-14 2017-12-15 深圳市华星光电技术有限公司 A kind of self-adaptive conversion method of image
CN109741279B (en) * 2019-01-04 2021-09-07 Oppo广东移动通信有限公司 Image saturation adjusting method and device, storage medium and terminal
CN110335195A (en) * 2019-07-09 2019-10-15 北京字节跳动网络技术有限公司 Body color method of adjustment, device, electronic equipment and storage medium
CN112788321B (en) * 2021-01-05 2022-08-19 锐芯微电子股份有限公司 Image color recovery method and apparatus, image pickup apparatus, and storage medium

Also Published As

Publication number Publication date
CN113870099A (en) 2021-12-31

Similar Documents

Publication Publication Date Title
CN109934776B (en) Model generation method, video enhancement method, device and computer-readable storage medium
CN113870099B (en) Picture color conversion method, device, equipment and readable storage medium
US11455516B2 (en) Image lighting methods and apparatuses, electronic devices, and storage media
CA2462486C (en) Automatic color correction for sequences of images
CN101082992A (en) Drawing of real time high dynamic range image and display process
CN111489322B (en) Method and device for adding sky filter to static picture
CN113518185B (en) Video conversion processing method and device, computer readable medium and electronic equipment
CN108205804A (en) Image processing method, device and electronic equipment
JP2002083293A (en) Noise reduction method using color information for digital image processing
US7319798B2 (en) Apparatus generating 3-dimensional image from 2-dimensional image and method thereof
CN107895350B (en) HDR image generation method based on self-adaptive double gamma transformation
Wang et al. Color contrast-preserving decolorization
KR101437626B1 (en) System and method for region-of-interest-based artifact reduction in image sequences
CN112991165B (en) Image processing method and device
WO2022218082A1 (en) Image processing method and apparatus based on artificial intelligence, and electronic device, computer-readable storage medium and computer program product
CN113781321B (en) Information compensation method, device and equipment for image highlight region and storage medium
CN113112422B (en) Image processing method, device, electronic equipment and computer readable medium
CN113327208B (en) High dynamic range image tone mapping method, device, electronic equipment and medium
US20240054622A1 (en) Image processing method and image processing apparatus
JP2002281327A (en) Device, method and program for image processing
CN107945139A (en) A kind of image processing method, storage medium and intelligent terminal
US9619864B2 (en) Image processing apparatus and method for increasing sharpness of images
CN106408617A (en) Interactive single image material acquiring system based on YUV color space and method
KR20240063943A (en) Tone mapping methods, devices and systems
CN113591838B (en) Target detection method, device, electronic equipment and 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
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A method, device, device, and readable storage medium for image color conversion

Effective date of registration: 20231009

Granted publication date: 20230627

Pledgee: Tai'an Taiyue Tourism Technology Co.,Ltd.

Pledgor: Taishan Information Technology Co.,Ltd.

Registration number: Y2023980060332

PE01 Entry into force of the registration of the contract for pledge of patent right