CN115587930B - Image color style migration method, device and medium - Google Patents
Image color style migration method, device and medium Download PDFInfo
- Publication number
- CN115587930B CN115587930B CN202211587298.1A CN202211587298A CN115587930B CN 115587930 B CN115587930 B CN 115587930B CN 202211587298 A CN202211587298 A CN 202211587298A CN 115587930 B CN115587930 B CN 115587930B
- Authority
- CN
- China
- Prior art keywords
- color
- image
- source image
- pixel
- space
- 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
Links
- 238000013508 migration Methods 0.000 title claims abstract description 58
- 230000005012 migration Effects 0.000 title claims abstract description 56
- 238000000034 method Methods 0.000 title claims abstract description 32
- 239000000203 mixture Substances 0.000 claims abstract description 29
- 238000005457 optimization Methods 0.000 claims abstract description 23
- 238000006243 chemical reaction Methods 0.000 claims description 44
- 230000009466 transformation Effects 0.000 claims description 23
- 230000006870 function Effects 0.000 claims description 21
- 239000000126 substance Substances 0.000 claims description 18
- 238000010606 normalization Methods 0.000 claims description 15
- 238000004364 calculation method Methods 0.000 claims description 13
- 238000009826 distribution Methods 0.000 claims description 12
- 238000004590 computer program Methods 0.000 claims description 10
- 239000011159 matrix material Substances 0.000 claims description 8
- 238000005520 cutting process Methods 0.000 claims description 6
- 230000008859 change Effects 0.000 claims description 5
- 238000003860 storage Methods 0.000 claims description 5
- 238000005315 distribution function Methods 0.000 claims description 3
- 230000017105 transposition Effects 0.000 claims description 3
- 238000011156 evaluation Methods 0.000 claims 1
- 238000004422 calculation algorithm Methods 0.000 description 4
- 238000010276 construction Methods 0.000 description 2
- 230000005251 gamma ray Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 206010026749 Mania Diseases 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/04—Context-preserving transformations, e.g. by using an importance map
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T10/00—Road transport of goods or passengers
- Y02T10/10—Internal combustion engine [ICE] based vehicles
- Y02T10/40—Engine management systems
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Facsimile Image Signal Circuits (AREA)
- Color Image Communication Systems (AREA)
- Image Processing (AREA)
Abstract
The invention discloses an image color style migration method, equipment and a medium, belonging to the field of image color migration and comprising the following steps: extracting color information of a source image and a color style target image and converting a color space; constructing a pixel-level color Gaussian mixture model; continuous color migration iterative optimization; and converting the image color space after color migration. The invention realizes smooth and stable image color style transfer.
Description
Technical Field
The present invention relates to the field of image color migration, and more particularly, to an image color style migration method, device, and medium.
Background
With the popularity of self-media and the widespread streaming of short videos in recent years, there has been a new demand for short video-related image and video editing technologies. Color is an important way to convey information visually, for example: white can transmit cold and pure, and red can transmit enthusiasm and mania. Different visual information can be transmitted between the image works and the video works by utilizing different color styles, so that differentiated impression is generated. When we need a certain style of image content, we can make manual color adjustment by color matching software to achieve the same color expression as the target color style. A great deal of time and energy are consumed by relying on manual color adjustment, and the technical requirement threshold for an operator is high; a series of algorithms have been developed that automatically migrate the color style of an image to be consistent with a target image.
However, the existing color style migration methods have various problems, such as: (1) Only global color migration can be carried out, and local colors are easy to distort; (2) The color migration effect is discontinuous, and color faults are easy to appear; (3) Color migration failure can be caused when the target color distribution is more complex; and (4) the color migration timeliness is low, and the processing speed is slow.
Disclosure of Invention
The invention aims to overcome the defects of the prior art, and provides an image color style migration method, equipment and a medium, which realize smooth and stable image color style migration and the like.
The purpose of the invention is realized by the following scheme:
an image color style migration method comprises the following steps:
A. extracting color information of a source image and a color style target image, and converting the color information into the same image color space;
B. setting the color probability distribution of any pixel point of a color style target image in the same image color space to obey a Gaussian mixture model taking all pixel points of a source image as a Gaussian centroid, and constructing a pixel-level color Gaussian mixture model;
C. calculating the discrete approximation of Laplacian operators of all pixel points of the source image in the same image color space by using the constructed pixel-level color Gaussian mixture model; carrying out continuous color migration by using a result of Laplace discrete approximation calculation;
D. and after the color migration is finished, performing image color space conversion to obtain an image subjected to color style migration.
Further, the extracting the color information of the source image and the color style target image, and then converting to the same image color space, includes the substeps:
first, an input source image is recorded asThe total number of pixels is recorded asReading the RGB values of all the pixels and recording the values asM represents the pixel sequence number of the source image, whereinRepresents the source imageThe RGB values of the individual pixels are then compared,respectively representing numerical values of three color channels of an m-th pixel point Red, green and Blue; the total number of pixels of the input color style target image is recorded asReading the RGB values of all the pixels and recording the RGB values asWhereinRepresenting a color-style object imageRGB values of individual pixel points; k represents the serial number of pixel points of the color style target image;
then, the source image is processedAnd all pixel points of the color style target imageAndconversion to LAB color space, respectivelyAndwherein,For identifying variables before and after the differential transformation.
Further, the color probability distribution of any pixel point of the set color style target image in the same image color space obeys a Gaussian mixture model taking all pixel points of the source image as a Gaussian centroid, and a pixel-level color Gaussian mixture model is constructed, comprising the substeps of:
firstly, setting any pixel point of color style target imageObeying a color probability distribution in an LAB color space to a source imageAll pixel points are used as a Gaussian mixture model of a Gaussian centroid, namely:
whereinIs recorded as;,Is a unit matrix;the variance value of the mth pixel point of the source image is obtained; p represents a probability distribution function, and e represents a natural constant; t represents transposition;
then, let M = h.w, whereThe number of pixels in each column of the source image, namely the image height,The number of pixels in each line of the source image is the image width, then the source imageAll the pixel points have unique correspondenceCoordinates, memoryTo (1)Of a pixelThe coordinates areAnd the coordinate of the 1 st pixel point of S is recorded asAnd finishing constructing the pixel-level color Gaussian mixture model.
Further, after completing the construction of the pixel-level color gaussian mixture model, the method comprises the following steps:
the calculation of the discrete approximation of the Laplacian operator of all pixel points of the source image in the same image color space comprises the following substeps:
computing a source imageDiscrete approximation of Laplacian operator of all pixel points in LAB space is recorded asIn whichIs a discrete laplacian operator.
Further, the performing continuous color migration by using the result of the laplacian discrete approximation calculation includes the sub-steps of:
C1. let us rememberThe probability set obtained after the secondary iteration optimization is(ii) a Let us rememberThe variance obtained after the secondary iteration optimization isTo remember the firstThe numerical value of each pixel of the color style image obtained after the secondary iteration optimization in the LAB space isSetting the optimization coefficientSetting the maximum number of iterationsAnd setting an initialization iteration count;
C2. In the first placeIn the second iteration, the source image is processedPixel point and color style target imageEach pixel point is defined according to the following formulaPerforming updating, after updatingIs marked as:
M 'is used for identifying and distinguishing M, and the value range of M' is still 1,2.. Multidot.M;
C3. in thatIn iteration, executing the step C2 to all pixel points of the source image and all pixel points of the color style target image to obtain optimized pixel points;
C4. In the first placeIn the second iteration, the first to the source imageEach pixel point is calculated according to the following formula:
C5. In the first placeIn the sub-iteration, the process is repeated,c4, executing all pixel points of the source image to obtain the optimized source image;
C6. In the first placeIn the second iteration, the first to the source imageEach pixel point is calculated according to the following formula:
Wherein, | | | represents a modular length calculation operation;
C7. in the first placeIn the secondary iteration, the step C6 is executed on all pixel points of the source image to obtain the optimized source image;
C8. The iteration number q is increased by 1;
C9. repeating steps C2 to C8 untilStopping the operation; the representation of the image obtained by transferring the source image through the color style in the LAB color space is as follows:whereinWherein, in the step (A),representing the set of all pixel points corresponding to the source image in the LAB color space after qmax iterations are executed,the numerical values of the three channels are respectively expressed under L, A and B.
Further, after the color migration is completed, performing image color space conversion to obtain an image subjected to color style migration, including the substeps of:
D1. for is toFirst, theThe pixel points are linearly transformed according to the following formula:
wherein the content of the first and second substances,、、respectively representing the numerical value pairs after linear transformation and respective numerical values under the three XYZ channels;
D2. to pairFirst, theThe non-linear transformation is carried out on each pixel point according to the following formula:
wherein, the first and the second end of the pipe are connected with each other,respectively representing the values of the mth pixel point in XYZ three channels after nonlinear transformation; a represents the argument of the function and,representing a non-linear variation function;
D3. to pairFirst, theThe pixel points are subjected to inverse normalization according to the following formula:
wherein, the first and the second end of the pipe are connected with each other,respectively representing the numerical value pairs of the pixel points m corresponding to the source image in the XYZ space after the reverse normalization;
D4. to pairFirst, theThe inverse conversion operation is carried out on each pixel point according to the following formula:
whereinRepresenting a matrix inversion operation;representing a numerical value pair of a corresponding pixel point m of the source image in an RGB space after inverse transformation operation;
D5. to pairFirst, theThe pixel points perform inverse gamma conversion and cutting operation according to the following formula:
wherein the content of the first and second substances,respectively representing the source images after inverse gamma conversion and clipping operationThe image corresponds to a numerical value pair of a pixel point m in an RGB space;which represents an inverse gamma transformation of the gamma-ray image,representing a clipping operation;
D6. to pairFirst, theThe RGB estimation is carried out on each pixel point according to the following formula:
wherein the content of the first and second substances,representing the RGB estimated value pair of the mth pixel point of the source image,respectively representValues under three channels R, G, B;
D7. for is toPerforming the steps D1 to D7 on all the pixel points to obtain a final pixel set subjected to color style migration;
D8. Arrangement ofAll the pixels inThe final color-style transferred format can be obtained asAn RGB image of (1); r, G, B represent the red, green, blue channel symbolic representation of the image, respectively.
Further, the source imageAnd all pixel points of the color style target imageAndconversion to LAB color space, comprising the sub-steps of:
(1) RGB normalization:
wherein the content of the first and second substances,respectively representing the normalized numerical values of Red, green and Blue channels of a source image;
(2) Carrying out gamma conversion:
the function argument is represented by a value of,representing a gamma transformation function;,,respectively representing numerical values of Red, green and Blue channels after gamma conversion is carried out on the mth pixel point of the source image;respectively representing the normalized numerical values of Red, green and Blue channels of a source image;
(3) Conversion from RGB space to XYZ space:
,,respectively representing the values of the mth pixel point of the source image in an XYZ space;,,respectively representing the number of Red, green and Blue channels after gamma conversion of the mth pixel point of the source imageA value;
(4) XYZ space normalization:
respectively representing the normalized numerical values of the mth pixel point of the source image in an XYZ space;,,respectively representing the values of the mth pixel point of the source image in an XYZ space;
(5) Carrying out nonlinear change:
respectively representing the normalized values of the mth pixel point of the source image in an XYZ space, a representing a function independent variable,representing a non-linear variation function;
(6) Conversion from XYZ space to LAB space:
,,respectively representing the numerical values of three corresponding channels after the mth pixel point of the source image is converted into the LAB space,respectively representing the normalized numerical values of the mth pixel point of the source image in an XYZ space;
r, G, B represent red, green, blue channel symbolic representations of the R image, respectively.
Further, in step C1, the sub-step of: initializing variance,Setting optimization coefficient and maximum iteration number(ii) a Setting initialization iteration countIs shown byIt represents the m-th initialization variance,a set of representations is presented that are,indicating the value of the initialized pixel point.
A computer device comprising a processor and a memory, the memory having stored therein a computer program which, when loaded by the processor and executed, carries out the method of any preceding claim.
A readable storage medium, in which a computer program is stored, which computer program is loaded by a processor and executes a method according to any of the above.
The beneficial effects of the invention include:
the technical scheme of the embodiment of the invention adopts a Gaussian mixture model to carry out pixel-level modeling on the source image and the color style target image to ensure the stability of local color migration, and utilizes a Laplace operator to ensure the smoothness and continuity of the color migration.
The technical scheme of the embodiment of the invention quickly performs optimization iteration based on the maximum expectation algorithm to meet the high efficiency of color migration.
The technical scheme of the embodiment of the invention utilizes the Gaussian mixture model to model the color distribution of the image, iteratively optimizes the pixel-level color mapping relation between the source image and the color style target image based on the maximum expectation algorithm, realizes the smooth and stable image color style migration technical scheme, and solves the technical problems in the background.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flow chart of steps of a method according to an embodiment of the present invention.
Detailed Description
All features disclosed in all embodiments in this specification, or all methods or process steps implicitly disclosed, may be combined and/or expanded, or substituted, in any way, except for mutually exclusive features and/or steps.
As shown in fig. 1, the image color style migration method provided by the technical solution of the embodiment of the present invention includes the following steps:
A. extracting color information of a source image and a color style target image and converting a color space;
B. constructing a pixel-level color Gaussian mixture model;
C. continuous color migration iterative optimization;
D. and converting the image color space after color migration.
In some alternative embodiments, step a includes the following substeps:
A1. noting the input source image asThe total number of pixels is recorded asReading the RGB values of all the pixel points according to the order from top to bottom and from left to right, and recording the RGB values asIn whichRepresents the source imageRGB values of the individual pixel points;
A2. input ofColor style target image with total number of pixels recorded asReading the RGB values of all the pixel points according to the order from top to bottom and from left to right, and recording the RGB values asWhereinRepresenting a color-style object imageRGB values of individual pixel points;
A3. a source imageAnd all pixel points of the color style target imageAndconversion to LAB color space, respectivelyAndwherein,(ii) a The specific conversion formula is as follows (in orderSwitch toFor example, the conversion of the remaining pixels is analogized to this example:
(1) RGB normalization:
(2) Carrying out gamma conversion:
(3) Conversion from RGB space to XYZ space:
(4) XYZ space normalization:
(5) Carrying out nonlinear change:
(6) Conversion from XYZ space to LAB space:
in some alternative embodiments, step B includes the following sub-steps:
B1. setting any pixel point of color style target imageObeying a color probability distribution in an LAB color space to a source imageAll pixel points are used as a Gaussian mixture model of a Gaussian centroid, namely:
B2. let M = H.W, whereinThe number (height) of pixels in each column of the source image,The number (i.e. width) of pixels of each line of the source image is the source imageAll the pixel points have unique correspondenceCoordinates, memoryTo (1)Of a pixelThe coordinates areAnd the coordinate of the 1 st pixel point of S is recorded as;
B3. Computing a source imageAnd (5) performing discrete approximation on Laplacian operators of all pixel points in LAB space, and recording the discrete approximation asIn whichIs a discrete Laplacian operator, toThe calculation formula for example is as follows:
wherein the content of the first and second substances,as a coordinateThe value of the corresponding pixel in the LAB color space (e.g.:=) (ii) a If it isOrOrOrWhen it is used, make;
In some alternative embodiments, step C comprises the following substeps:
C1. let us rememberThe probability set obtained after the secondary iteration optimization is(ii) a Let us rememberThe variance obtained after the secondary iteration optimization isIn particular, let the variance be initialized(ii) a Let us rememberThe numerical value of each pixel of the color style image obtained after the secondary iteration optimization in the LAB space isSpecially, order(ii) a Setting optimization coefficients(ii) a Setting a maximum number of iterations(ii) a Setting initialization iteration count;
C2. In the first placeIn the second iteration, the source image is processedPixel point and color style target imageEach pixel point is defined as the following formulaPerforming updating, after updatingIs marked as:
C3. In the first placeIn the secondary iteration, the step C2 is executed for all pixel points of the source image and all pixel points of the color style target image, and the optimized pixel points are obtained;
C4. In the first placeIn the second iteration, the first to the source imageEach pixel point is calculated according to the following formula:
C5. In the first placeIn the secondary iteration, the step C4 is executed on all pixel points of the source image to obtain the optimized source image;
C6. In the first placeIn the second iteration, the first to the source imageEach pixel point is calculated according to the following formula:
C7. In the first placeIn the secondary iteration, step C6 is executed on all pixel points of the source image to obtain optimized pixel points;
C8. The iteration number q is increased by 1;
C9. repeating steps C2 to C8 untilStopping the operation; the representation of the image obtained by the color style migration of the source image in the LAB color space is as follows:wherein;
In some alternative embodiments, step D includes the following sub-steps:
wherein the content of the first and second substances,、、respectively representing the numerical value pairs after linear transformation and respective numerical values under the three XYZ channels;
D2. for is toFirst, theThe pixel points are subjected to nonlinear transformation according to the following formula:
wherein the content of the first and second substances,are respectively shown inThe values of the mth pixel point in XYZ three channels after nonlinear transformation; a represents the argument of the function and,representing a non-linear variation function;
D3. to pairFirst, theThe pixel points are subjected to inverse normalization according to the following formula:
D4. to pairFirst, theThe pixel points are subjected to inverse conversion operation according to the following formula:
D5. to pairFirst, theThe pixel points perform inverse gamma conversion and cutting operation according to the following formula:
D6. to pairFirst, theThe RGB estimation is carried out on each pixel point according to the following formula:
D7. for is toAll the pixel points execute the steps D1 to D7 to obtain a pixel set subjected to color style migration finally;
D8. Arranged according to the order of priority from top to bottom and from left to rightAll the pixel points can obtain the final breadth after color style migrationThe RGB image of (a).
Thus, in conclusion of the steps A to D, the color style of the given source image can be migrated to be consistent with that of the target image. In addition, the method adopts a Gaussian mixture model to carry out pixel-level modeling on the source image and the color style target image to ensure the stability of local color migration, utilizes a Laplacian operator to ensure the smoothness and continuity of the color migration, and carries out optimization iteration quickly based on a maximum expectation algorithm to meet the high efficiency of the color migration.
It should be noted that the following embodiments can be combined and/or expanded, replaced in any way that is logical in any way from the above detailed description, such as the technical principles disclosed, the technical features disclosed or the technical features implicitly disclosed, etc., within the scope of protection defined by the claims of the present invention.
Example 1
An image color style migration method is characterized by comprising the following steps:
A. extracting color information of a source image and a color style target image, and converting the color information into the same image color space;
B. setting the color probability distribution of any pixel point of a color style target image in the same image color space to obey a Gaussian mixture model taking all pixel points of a source image as a Gaussian centroid, and constructing a pixel-level color Gaussian mixture model;
C. calculating the discrete approximation of Laplacian operators of all pixel points of the source image in the same image color space by using the constructed pixel-level color Gaussian mixture model; carrying out continuous color migration by using a result of Laplace discrete approximation calculation;
D. and after the color migration is finished, performing image color space conversion to obtain an image subjected to color style migration.
Example 2
On the basis of the embodiment 1, the extracting of the color information of the source image and the color style target image and the converting to the same image color space comprises the following substeps:
first, an input source image is written asThe total number of pixels is recorded asReading the RGB values of all the pixels and recording the values asM represents the pixel sequence number of the source image, whereinRepresenting a source imageThe RGB values of the individual pixels are then compared,respectively representing numerical values of three color channels of an m-th pixel point Red, green and Blue; the total number of pixels of the input color style target image is recorded asReading the RGB values of all the pixels and recording the values asIn whichRepresenting a color-style object imageRGB values of individual pixel points; k represents the serial number of pixel points of the color style target image;
then, the source image is processedAnd all pixel points of the color style target imageAndconversion to LAB color space, respectivelyAndin which,For identifying variables before and after the differential transformation.
Example 3
On the basis of the embodiment 2, the color probability distribution of any pixel point of the set color style target image in the same image color space obeys a gaussian mixture model taking all pixel points of the source image as a gaussian centroid, and a pixel-level color gaussian mixture model is constructed, including the substeps of:
firstly, setting any pixel point of color style target imageObeying a color probability distribution in an LAB color space to a source imageAll pixel points are used as a Gaussian mixture model of a Gaussian centroid, namely:
whereinIs recorded as;,Is an identity matrix;the variance value of the mth pixel point of the source image is obtained; p represents a probability distribution function, and e represents a natural constant; t represents transposition;
then, let M = h.w, whereThe number of pixels in each column of the source image, namely the image height,The number of pixels in each line of the source image is the image width, then the source imageAll the pixel points have unique correspondenceCoordinates and notesTo (1) aOf a pixelHaving coordinates ofAnd the coordinate of the 1 st pixel point of S is recorded asAnd finishing constructing the pixel-level color Gaussian mixture model.
Example 4
On the basis of embodiment 3, after completing the construction of the pixel-level color gaussian mixture model, the method comprises the following steps:
the calculation of the Laplacian discrete approximation of all pixel points of the source image in the same image color space comprises the following substeps:
computing a source imageAnd (5) performing discrete approximation on Laplacian operators of all pixel points in LAB space, and recording the discrete approximation asWhereinIs a discrete laplacian operator.
Example 5
On the basis of embodiment 4, the performing continuous color migration by using the result of the laplace discrete approximation calculation includes the sub-steps of:
C1. let us rememberThe probability set obtained after the secondary iteration optimization is(ii) a Let us rememberThe variance obtained after the secondary iteration optimization isTo remember the firstThe numerical value of each pixel of the color style image obtained after the secondary iteration optimization in the LAB space isSetting the optimization coefficientSetting the maximum number of iterationsAnd setting an initialization iteration count;
C2. In the first placeIn the second iteration, the source image is processedPixel point and color style target imageEach pixel point is defined as the following formulaPerforming updating, after updatingIs marked as:
M 'is used for identifying and distinguishing M, and the value range of M' is still 1,2.. Multidot.M;
C3. in thatIn iteration, all pixel points and color style target map of source imageC2, all pixel points of the image are executed, and the optimized pixel points are obtained;
C4. In the first placeIn the second iteration, the first to the source imageEach pixel point is calculated according to the following formula:
C5. In the first placeIn the secondary iteration, the step C4 is executed on all pixel points of the source image to obtain the optimized source image;
C6. In the first placeIn the second iteration, the first to the source imageEach pixel point is calculated according to the following formula:
Wherein, | | | represents a modular length calculation operation;
C7. in the first placeIn the secondary iteration, step C6 is executed on all pixel points of the source image to obtain optimized pixel points;
C8. The iteration number q is increased by 1;
C9. repeating steps C2 to C8 untilStopping the operation; the representation of the image obtained by the color style migration of the source image in the LAB color space is as follows:whereinWherein, in the step (A),representing the set of all pixel points corresponding to the source image in the LAB color space after qmax iterations are executed,the values of the three channels are respectively expressed under L, A and B.
Example 6
On the basis of embodiment 5, after the color migration is completed, performing image color space conversion to obtain an image subjected to color style migration, including the substeps of:
D1. for is toFirst, theA pixelThe points are linearly transformed according to the following formula:
wherein, the first and the second end of the pipe are connected with each other,、、respectively representing the numerical value pairs after linear transformation and respective numerical values under the three XYZ channels;
D2. to pairFirst, theThe pixel points are subjected to nonlinear transformation according to the following formula:
wherein the content of the first and second substances,respectively representThe values of the mth pixel point in XYZ three channels after nonlinear transformation; a represents the argument of the function and,representing a non-linear variation function;
D3. to pairFirst, theThe pixel points are subjected to inverse normalization according to the following formula:
wherein the content of the first and second substances,respectively representing the numerical value pairs of the pixel points m corresponding to the source image in the XYZ space after the reverse normalization;
D4. to pairFirst, theThe pixel points are subjected to inverse conversion operation according to the following formula:
whereinRepresenting a matrix inversion operation;representing a numerical value pair of a corresponding pixel point m of the source image in an RGB space after inverse transformation operation;
D5. for is toFirst, theCarrying out inverse gamma conversion and cutting operation on each pixel point according to the following formula:
wherein the content of the first and second substances,respectively representing the numerical value pairs of the corresponding pixel points m of the source image in the RGB space after inverse gamma conversion and cutting operation;which represents an inverse gamma transformation of the gamma-ray image,representing a clipping operation;
D6. for is toFirst, theThe RGB estimation is carried out on each pixel point according to the following formula:
wherein the content of the first and second substances,representing the RGB estimated value pair of the mth pixel point of the source image,respectively representValues under three channels R, G, B;
D7. to pairPerforming the steps D1 to D7 on all the pixel points to obtain a final pixel set subjected to color style migration;
D8. Arrangement ofAll the pixel points can obtain the final breadth after color style migrationAn RGB image of (1); r, G, B represent the red, green, blue channel symbolic representation of the image, respectively.
Example 7
Based on embodiment 2, the source imageAnd all pixel points of the color style target imageAndconversion to LAB color space, comprising the sub-steps of:
(1) RGB normalization:
wherein the content of the first and second substances,respectively representing the normalized numerical values of Red, green and Blue channels of a source image;
(2) Carrying out gamma conversion:
the function argument is represented by a function of,representing a gamma transformation function;,,respectively representing numerical values of Red, green and Blue channels after gamma conversion is carried out on the mth pixel point of the source image;respectively representing the normalized numerical values of Red, green and Blue channels of a source image;
(3) Conversion from RGB space to XYZ space:
,,respectively representing the values of the mth pixel point of the source image in an XYZ space;,,respectively representing numerical values of Red, green and Blue channels after gamma conversion is carried out on the mth pixel point of the source image;
(4) XYZ space normalization:
respectively representing the normalized numerical values of the mth pixel point of the source image in an XYZ space;,,respectively representing the values of the mth pixel point of the source image in an XYZ space;
(5) Carrying out nonlinear change:
respectively representing the normalized values of the mth pixel point of the source image in an XYZ space, a represents a function independent variable,representing a non-linear variation function;
(6) Conversion from XYZ space to LAB space:
,,respectively representing the numerical values of three corresponding channels after the mth pixel point of the source image is converted into the LAB space,respectively representing the normalized numerical values of the mth pixel point of the source image in an XYZ space;
r, G, B represent red, green, blue channel symbolic representations of the R image, respectively.
Example 8
On the basis of embodiment 5, in step C1, the substeps of: initializing variance,Setting optimization coefficient and maximum iteration number(ii) a Setting initialization iteration countIs shown byIt represents the m-th initialization variance,a set of representations is presented that are,indicating the value of the initialized pixel.
Example 9
A computer arrangement comprising a processor and a memory, the memory having stored thereon a computer program which, when loaded by the processor and executed, carries out the method of any one of embodiments 1 to 8.
Example 10
A readable storage medium, in which a computer program is stored, which computer program is loaded by a processor and executes a method according to any of embodiments 1-8.
The units described in the embodiments of the present invention may be implemented by software or hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
According to an aspect of an embodiment of the present invention, there is provided a computer program product or a computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the method provided in the various alternative implementations described above.
As another aspect, an embodiment of the present invention further provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method described in the above embodiments.
The parts not involved in the present invention are the same as or can be implemented using the prior art.
The above-described embodiment is only one embodiment of the present invention, and it will be apparent to those skilled in the art that various modifications and variations can be easily made based on the application and principle of the present invention disclosed in the present application, and the present invention is not limited to the method described in the above-described embodiment of the present invention, so that the above-described embodiment is only preferred, and not restrictive.
Other embodiments than the above examples may be devised by those skilled in the art based on the foregoing disclosure, or by adapting and using knowledge or techniques of the relevant art, and features of various embodiments may be interchanged or substituted and such modifications and variations that may be made by those skilled in the art without departing from the spirit and scope of the present invention are intended to be within the scope of the following claims.
Claims (8)
1. An image color style migration method is characterized by comprising the following steps:
A. extracting color information of a source image and a color style target image, and converting the color information into the same image color space;
B. setting the color probability distribution of any pixel point of a color style target image in the same image color space to obey a Gaussian mixture model taking all pixel points of a source image as a Gaussian centroid, and constructing a pixel-level color Gaussian mixture model;
C. calculating the discrete approximation of Laplacian operators of all pixel points of the source image in the same image color space by using the constructed pixel-level color Gaussian mixture model; carrying out continuous color migration by using a Laplace discrete approximation calculation result;
the calculation of the discrete approximation of the Laplacian operator of all pixel points of the source image in the same image color space comprises the following substeps:
computing a source imageDiscrete approximation of Laplacian operator of all pixel points in LAB space is recorded asIn which>Is a discrete Laplace operator;
the continuous color migration using the result of the laplacian discrete approximation calculation includes the substeps of:
C1. let us rememberThe resulting set of probabilities after the sub-iterative optimization is combined into @>(ii) a Marking the fifth->The variance obtained after the sub-iterative optimization is ^ er>On a first or second basis>The value of each pixel of the color style image obtained after the secondary iteration optimization in the LAB space is->Setting an optimization coefficient->Setting a maximum number of iterations->And setting an initialization iteration count ≧ or>;
C2. In the first placeIn a sub-iteration, a source image is first +>Number ^ greater or less than or equal to pixel point and color style target image>Each pixel point is used for combining the following formula>Update is performed, the updated->Is recorded as->:
M 'is used for identifying and distinguishing M, and the value range of M' is still 1,2.. Multidot.M;
C3. in thatIn iteration, executing the step C2 on all pixel points of the source image and all pixel points of the color style target image, and acquiring optimized ^ greater than or equal to>;
C4. In the first placeIn a sub-iteration, the ^ th or ^ th of the source image>Each pixel point is calculated according to the following formula>:
C5. In the first placeIn the secondary iteration, the step C4 is executed on all pixel points of the source image to obtain the optimized source image;
C6. In the first placeIn a sub-iteration, a first +of source images>Each pixel point is calculated according to the following formula>:/>
Wherein, | | | represents a modular length calculation operation;
C7. in the first placeIn the secondary iteration, executing the step C6 on all pixel points of the source image to obtain optimized->;
C8. The iteration number q is increased by 1;
C9. repeating steps C2 to C8 untilStopping the operation; the representation of the image obtained by transferring the source image through the color style in the LAB color space is as follows: />WhereinWherein is present>Representing that after qmax iterations are executed, all pixel points corresponding to the source image are collected in the LAB color space and then are subjected to the judgment of the judgment result, and expressing that all pixel points corresponding to the source image are collected in the LAB color space and are subjected to the judgment of the judgment result in the judgment of the judgment result>Respectively representing the numerical values of the three channels of L, A and B;
D. and after the color migration is finished, performing image color space conversion to obtain an image subjected to color style migration.
2. The image color style migration method according to claim 1, wherein the extracting of the color information of the source image and the color style target image and the converting to the same image color space comprises the sub-steps of:
first, an input source image is recorded asThe total number of pixels is recorded as->Reading the RGB values of all the pixels and recording the values asM represents the serial number of the pixel point of the source image, wherein>Represents the source image ^ h->The RGB value of each pixel point is greater or less>Respectively representing numerical values of three color channels of an m-th pixel point Red, green and Blue; the total number of pixels of the input color-style target image is recorded as->Reading the RGB values of all the pixel points and recording the values as->WhereinRepresenting the ^ th or greater of a color-style target image>RGB values of individual pixel points; k represents the serial number of pixel points of the color style target image;
3. The image color style migration method according to claim 2, wherein the color probability distribution of any pixel point of the set color style target image in the same image color space obeys a gaussian mixture model with all pixel points of the source image as the gaussian centroid, and a pixel-level color gaussian mixture model is constructed, comprising the sub-steps of:
firstly, setting any pixel point of a color style target imageThe color probability distribution in the LAB color space is obeyed with the source image->All pixel points are used as a Gaussian mixture model of a Gaussian centroid, namely:
(ii) a Wherein it is present>Is recorded as->;/>,/>Is a unit matrix; />The variance value of the mth pixel point of the source image is obtained; p represents a probability distribution function, and e represents a natural constant; t represents transposition;
then, let M = h.w, whereFor each column of pixels of the source image, i.e. the image height>For the number of pixels per line of the source image, i.e. the image width, the source image>All the pixel points have unique corresponding->Coordinates, recording->In a first or second section>Of a pixelCoordinate is->And the coordinate of the 1 st pixel point of S is recorded as->And finishing constructing the pixel-level color Gaussian mixture model.
4. The image color style migration method according to claim 1, wherein after the color migration is completed, performing image color space conversion to obtain an image subjected to color style migration, comprising the substeps of:
wherein the content of the first and second substances,、/>、/>respectively representing the numerical value pairs after linear transformation and respective numerical values under the three XYZ channels;
D2. to pairA fifth or fifth letter>The non-linear transformation is carried out on each pixel point according to the following formula:
wherein the content of the first and second substances,respectively representing the values of the mth pixel point in XYZ three channels after nonlinear transformation; a denotes a function argument, <' > greater or lesser>Representing a non-linear variation function;
D3. to pairIs/are>The pixel points are subjected to inverse normalization according to the following formula: />
Wherein the content of the first and second substances,respectively representing the values of the corresponding pixel points m of the source image in XYZ space after the reverse normalization;
D4. to pairIs/are>The inverse conversion operation is carried out on each pixel point according to the following formula:
whereinRepresenting a matrix inversion operation; />Representing the numerical value pair of the corresponding pixel point m of the source image in the RGB space after the inverse transformation operation;
D5. to pairIs/are>The pixel points perform inverse gamma conversion and cutting operation according to the following formula:
wherein the content of the first and second substances,respectively representing the numerical value pairs of the corresponding pixel points m of the source image in the RGB space after inverse gamma conversion and cutting operation; />Represents an inverse gamma change, and>representing a clipping operation;
D6. to pairIs/are>The RGB estimation is carried out on each pixel point according to the following formula:
wherein the content of the first and second substances,an RGB pre-evaluation value pair representing an mth pixel point in a source image, based on a pixel value in the image sensor>Respectively representValues under three channels R, G, B;
D7. to pairAll the pixel points execute the steps D1 to D7 to obtain a pixel set subjected to color style migration finally;
5. The method for migrating image color style according to claim 2, characterized in that the source image is migratedAnd all pixel points of a color-style target image->And &>Conversion to LAB color space, comprising the sub-steps of:
(1) RGB normalization:
wherein the content of the first and second substances,respectively representing sourcesNormalizing the Red, green and Blue channels of the image to obtain normalized values;
(2) Carrying out gamma conversion:
represents a function argument, <' > or>Representing a gamma transformation function; />,/>,/>Respectively representing numerical values of Red, green and Blue channels after gamma conversion is carried out on the mth pixel point of the source image; />Respectively representing the normalized numerical values of Red, green and Blue channels of a source image;
(3) Conversion from RGB space to XYZ space:
,/>,/>respectively representing the values of the mth pixel point of the source image in an XYZ space; />,/>,/>Respectively representing numerical values of Red, green and Blue channels after gamma conversion is carried out on the mth pixel point of the source image;
(4) XYZ space normalization:
respectively representing the normalized numerical values of the mth pixel point of the source image in an XYZ space; />,/>,Respectively representing the values of the mth pixel point of the source image in an XYZ space;
(5) Carrying out nonlinear change:
respectively represents the normalized value of the mth pixel point of the source image in an XYZ space, a represents the function independent variable and the device>Representing a non-linear variation function;
(6) Conversion from XYZ space to LAB space:
,/>,/>respectively representing the numerical values of three corresponding channels after the mth pixel point of the source image is converted into an LAB space,respectively representing the normalized numerical values of the mth pixel point of the source image in an XYZ space;
r, G, B represent red, green, blue channel symbolic representations of the R image, respectively.
6. The image color style migration method according to claim 1, characterized in that in step C1, it comprises the sub-steps of: initializing variance,/>Setting an optimization factor and setting a maximum number of iterations>(ii) a Setting an initialization iteration count ≧>Means->Represents the mth initialization variance, < >>Represents a set, <' > based on>Indicating the value of the initialized pixel.
7. A computer arrangement comprising a processor and a memory, in which a computer program is stored which, when loaded by the processor, carries out the method according to any one of claims 1 to 6.
8. A readable storage medium, in which a computer program is stored which, when being loaded by a processor, is adapted to carry out the method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211587298.1A CN115587930B (en) | 2022-12-12 | 2022-12-12 | Image color style migration method, device and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211587298.1A CN115587930B (en) | 2022-12-12 | 2022-12-12 | Image color style migration method, device and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115587930A CN115587930A (en) | 2023-01-10 |
CN115587930B true CN115587930B (en) | 2023-04-18 |
Family
ID=84783218
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211587298.1A Active CN115587930B (en) | 2022-12-12 | 2022-12-12 | Image color style migration method, device and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115587930B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116934936A (en) * | 2023-09-19 | 2023-10-24 | 成都索贝数码科技股份有限公司 | Three-dimensional scene style migration method, device, equipment and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110009708A (en) * | 2019-04-10 | 2019-07-12 | 上海大学 | Color development transform method, system and terminal based on color segmentation |
CN111476831A (en) * | 2020-03-20 | 2020-07-31 | 清华大学 | PCB image color migration device and method based on cluster analysis |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9516197B2 (en) * | 2014-10-21 | 2016-12-06 | Pixspan, Inc. | Apparatus and method for lossless compression of raw color sensor data from a color array filtered image sensor |
CN104732506B (en) * | 2015-03-27 | 2018-04-10 | 浙江大学 | A kind of portrait photographs' Color Style conversion method based on face semantic analysis |
US11544823B2 (en) * | 2019-06-12 | 2023-01-03 | Intel Corporation | Systems and methods for tone mapping of high dynamic range images for high-quality deep learning based processing |
CN111696062A (en) * | 2020-06-14 | 2020-09-22 | 荆门汇易佳信息科技有限公司 | Color-balanced non-deformable DOM local repair aggregation method |
CN113298704B (en) * | 2021-07-27 | 2021-11-09 | 成都索贝数码科技股份有限公司 | Skin color segmentation and beautification method by utilizing graph migration under broadcast television news |
CN113656627B (en) * | 2021-08-20 | 2024-04-19 | 北京达佳互联信息技术有限公司 | Skin color segmentation method and device, electronic equipment and storage medium |
-
2022
- 2022-12-12 CN CN202211587298.1A patent/CN115587930B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110009708A (en) * | 2019-04-10 | 2019-07-12 | 上海大学 | Color development transform method, system and terminal based on color segmentation |
CN111476831A (en) * | 2020-03-20 | 2020-07-31 | 清华大学 | PCB image color migration device and method based on cluster analysis |
Also Published As
Publication number | Publication date |
---|---|
CN115587930A (en) | 2023-01-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108428229B (en) | Lung texture recognition method based on appearance and geometric features extracted by deep neural network | |
CN102982544B (en) | Many foreground object image interactive segmentation method | |
WO2020005650A1 (en) | Image colorization based on reference information | |
CN109849576B (en) | Method for assisting drawing by referring to gray level diagram | |
CN104732506A (en) | Character picture color style converting method based on face semantic analysis | |
CN115587930B (en) | Image color style migration method, device and medium | |
CN111325750B (en) | Medical image segmentation method based on multi-scale fusion U-shaped chain neural network | |
CN105631807A (en) | Single-frame image super resolution reconstruction method based on sparse domain selection | |
CN105957124B (en) | With the natural image color edit methods and device for repeating situation elements | |
CN110400275A (en) | One kind being based on full convolutional neural networks and the pyramidal color calibration method of feature | |
WO2022062164A1 (en) | Image classification method using partial differential operator-based general-equivariant convolutional neural network model | |
CN108198196A (en) | The design and implementation methods of quantum Image Edge-Detection based on Sobel operators | |
CN112884758A (en) | Defective insulator sample generation method and system based on style migration method | |
CN115760552A (en) | Face image makeup migration method and system based on image makeup migration network | |
CN103413331A (en) | High-resolution video image content sparse expression method supporting edition and propagation | |
CN103500447B (en) | Video foreground and background partition method based on incremental high-order Boolean energy minimization | |
CN115601744B (en) | License plate detection method for vehicle body and license plate with similar colors | |
CN116469103A (en) | Automatic labeling method for medical image segmentation data | |
CN115019038B (en) | Similar image pixel level semantic matching method | |
CN115018729A (en) | White box image enhancement method for content | |
CN105957013B (en) | A kind of single image super-resolution reconstruction method | |
CN116823700A (en) | Image quality determining method and device | |
Dai et al. | Automatic image vectorization using superpixels and random walkers | |
CN113344771A (en) | Multifunctional image style migration method based on deep learning | |
CN106204451B (en) | Based on the Image Super-resolution Reconstruction method for constraining fixed neighborhood insertion |
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 |