WO2015113459A1 - 一种处理图片的方法及电子设备 - Google Patents

一种处理图片的方法及电子设备 Download PDF

Info

Publication number
WO2015113459A1
WO2015113459A1 PCT/CN2015/070340 CN2015070340W WO2015113459A1 WO 2015113459 A1 WO2015113459 A1 WO 2015113459A1 CN 2015070340 W CN2015070340 W CN 2015070340W WO 2015113459 A1 WO2015113459 A1 WO 2015113459A1
Authority
WO
WIPO (PCT)
Prior art keywords
picture
component
factor
standard deviation
average value
Prior art date
Application number
PCT/CN2015/070340
Other languages
English (en)
French (fr)
Inventor
王昊
罗巍
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to US15/114,801 priority Critical patent/US20160358320A1/en
Priority to EP15743853.2A priority patent/EP3091504A4/en
Priority to JP2016548619A priority patent/JP6273373B2/ja
Publication of WO2015113459A1 publication Critical patent/WO2015113459A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/46Colour picture communication systems
    • H04N1/56Processing of colour picture signals
    • H04N1/60Colour correction or control
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20216Image averaging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20224Image subtraction

Definitions

  • the present invention relates to the field of image processing, and in particular, to a method and an electronic device for processing a picture.
  • Photographing tools and social applications after satisfying the basic "photographing" function, also provide tools for beautifying photos.
  • Various styles of filters can achieve special effects such as “high-explosive” and “old photos”. welcome.
  • the effects of physical filters can also be obtained by processing digital photos with computer image processing algorithms. For example, applying a grayscale algorithm to a color image can change the color image into a grayscale image to achieve a black-and-white photo effect; Gaussian filtering the image can achieve a blurring effect.
  • the image is processed by the preset algorithm and parameters, and the result is presented to the user, and the user can save and share the result and other subsequent operations.
  • the various filters available to the user are preset in the application. From a technical point of view, each filter corresponds to an image processing algorithm and a corresponding set of parameters.
  • the application solidifies all the special effects filters, and the user can only passively accept the limited kinds of special effects filters provided by the application. The only operations that can be done are “selection”, and the user cannot achieve any creative and subjective expression. .
  • the embodiment of the invention provides a method for processing a picture, which aims to solve the problem of how to implement the personalized processing of the picture according to the user's wishes.
  • a method of processing a picture comprising:
  • the average value of the first factor of the third picture is equal to the average value of the first factor of the first picture
  • the third picture is The standard deviation of a factor is equal to the standard deviation of the first factor of the first picture
  • the first factor is an L component, an alpha component, and a beta component of each pixel of the picture;
  • the first factor is a red r component, a blue b component, and a green g component of each pixel of the picture.
  • the acquiring a first factor of the first picture, and acquiring according to the first factor of the first picture The average value of the first factor of the first picture and the standard deviation of the first factor of the first picture, including:
  • New ⁇ ( ⁇ 2-m ⁇ 2)*s ⁇ 1/s ⁇ 2+m ⁇ 1;
  • New ⁇ ( ⁇ 2-m ⁇ 2)*s ⁇ 1/s ⁇ 2+m ⁇ 1;
  • L1 is used to represent the L component of the first picture
  • ⁇ 1 is used to represent the ⁇ component of the first picture
  • ⁇ 1 is used to represent the ⁇ component of the first picture
  • mL1 is used to represent the average value of the L component of the first picture
  • sL1 is used to represent the standard deviation of the L component of the first picture
  • m ⁇ 1 is used to represent the average value of the ⁇ component of the first picture
  • s ⁇ 1 is used to represent the first picture.
  • the standard deviation of the ⁇ component, m ⁇ 1 is used to represent the average value of the ⁇ component of the first picture, and s ⁇ 1 is used to represent the standard deviation of the ⁇ component of the first picture;
  • L2 is used to represent the L component of the second picture
  • ⁇ 2 is used to represent the ⁇ component of the second picture
  • ⁇ 2 is used to represent the ⁇ component of the second picture
  • mL2 is used to represent the average value of the L component of the second picture
  • sL2 is used to represent the standard deviation of the L component of the second picture
  • m ⁇ 2 is used to represent the average value of the ⁇ component of the second picture
  • s ⁇ 2 is used to represent the second picture.
  • the standard deviation of the ⁇ component, m ⁇ 2 is used to represent the average value of the ⁇ component of the second picture
  • s ⁇ 2 is used to represent the standard deviation of the ⁇ component of the second picture.
  • the method further includes:
  • Generating a third picture according to the first factor of the second picture including:
  • the acquiring the first factor of the first picture, and acquiring according to the first factor of the first picture The average value of the first factor of the first picture and the standard deviation of the first factor of the first picture, including:
  • Newr (r2-mr2)*sr1/sr2+mr1;
  • Newg (g2-mg2)*sg1/sg2+mg1;
  • Newb (b2-mb2)*sb1/sb2+mb1;
  • mr1 represents the average value of the red r component of the first picture
  • sr1 represents the standard deviation of the red r component of the first picture
  • mb1 represents the average value of the blue b component of the first picture
  • sb1 represents a standard deviation of a blue b component of the first picture
  • mg1 represents an average value of green g components of the first picture
  • sg1 represents a standard deviation of a green g component of the first picture
  • an electronic device for processing a picture includes:
  • a first acquiring unit configured to acquire a first factor of the first picture, and acquire an average value of the first factor of the first picture and a first factor of the first picture according to the first factor of the first picture Standard deviation
  • a second acquiring unit configured to acquire a first factor of the second picture to be processed, and acquire an average value of the first factor of the second picture and the second picture according to the first factor of the second picture The standard deviation of the first factor;
  • a third acquiring unit configured to: average of a first factor of the first picture, a standard deviation of a first factor of the first picture, a first factor of the second picture, and a second picture Obtaining a first factor of a second picture by obtaining an average value of the first factor and a standard deviation of the first factor of the second picture;
  • a generating unit configured to generate a third picture according to the new first factor, an average value of a first factor of the third picture is equal to an average value of a first factor of the first picture, and the third The standard deviation of the first factor of the picture is equal to the standard deviation of the first factor of the first picture;
  • the first factor is an L component, an alpha component, and a beta component of each pixel of the picture;
  • the first factor is a red r component, a blue b component, and a green g component of each pixel of the picture.
  • the third acquiring unit is specifically configured to execute the following procedure:
  • the first acquiring unit is specifically configured to:
  • the second obtaining unit is specifically configured to:
  • the third obtaining unit is specifically configured to execute the following procedure:
  • New ⁇ ( ⁇ 2-m ⁇ 2)*s ⁇ 1/s ⁇ 2+m ⁇ 1;
  • New ⁇ ( ⁇ 2-m ⁇ 2)*s ⁇ 1/s ⁇ 2+m ⁇ 1;
  • L1 is used to represent the L component of the first picture
  • ⁇ 1 is used to represent the ⁇ component of the first picture
  • ⁇ 1 is used to represent the ⁇ component of the first picture
  • mL1 is used to represent the average value of the L component of the first picture
  • sL1 is used to represent the standard deviation of the L component of the first picture
  • m ⁇ 1 is used to represent the average value of the ⁇ component of the first picture
  • s ⁇ 1 is used to represent the first picture.
  • the standard deviation of the ⁇ component, m ⁇ 1 is used to represent the average value of the ⁇ component of the first picture, and s ⁇ 1 is used to represent the standard deviation of the ⁇ component of the first picture;
  • L2 is used to represent the L component of the second picture
  • ⁇ 2 is used to represent the ⁇ component of the second picture
  • ⁇ 2 is used to represent the ⁇ component of the second picture
  • mL2 is used to represent the average value of the L component of the second picture
  • sL2 is used to represent the standard deviation of the L component of the second picture
  • m ⁇ 2 is used to represent the average value of the ⁇ component of the second picture
  • s ⁇ 2 is used to represent the second picture.
  • the standard deviation of the ⁇ component, m ⁇ 2 is used to represent the average value of the ⁇ component of the second picture
  • s ⁇ 2 is used to represent the standard deviation of the ⁇ component of the second picture.
  • the electronic device further includes a conversion generating unit, where the conversion generating unit is specifically configured to:
  • the generating unit is specifically configured to:
  • the first acquiring unit is configured to:
  • a second obtaining unit for:
  • the third obtaining unit is specifically configured to execute the following procedure:
  • Newr (r2-mr2)*sr1/sr2+mr1;
  • Newg (g2-mg2)*sg1/sg2+mg1;
  • Newb (b2-mb2)*sb1/sb2+mb1;
  • mr1 represents the average value of the red r component of the first picture
  • sr1 represents the standard deviation of the red r component of the first picture
  • mb1 represents the average value of the blue b component of the first picture
  • sb1 represents a standard deviation of a blue b component of the first picture
  • mg1 represents an average value of green g components of the first picture
  • sg1 represents a standard deviation of a green g component of the first picture
  • An embodiment of the present invention provides a method for processing a picture, where a first factor of a first picture and a first factor of a second picture to be processed are obtained, according to a first factor of the first picture and a first factor of the second picture to be processed. Calculation of the mean and standard deviation, obtaining a new first factor of the second picture, and rooting The third picture is generated according to the new first factor, thereby realizing the user to personalize the picture according to his own wishes, expanding the manner of image processing, improving the efficiency of image processing, and improving the user experience.
  • FIG. 1 is a flowchart of a method for processing a picture according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a method for acquiring a first factor of a first picture according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a method for converting r, g, and b into L, alpha, and beta according to an embodiment of the present invention
  • FIG. 4 is a flowchart of a method for processing a picture according to an embodiment of the present invention.
  • FIG. 5 is a flowchart of a method for converting L, alpha, and beta into r, g, and b according to an embodiment of the present invention
  • FIG. 6 is a flowchart of a method for acquiring r, g, and b of a first picture according to an embodiment of the present invention
  • FIG. 7 is a flowchart of a method for processing a picture according to an embodiment of the present invention.
  • FIG. 8 is a structural diagram of an electronic device for processing a picture according to an embodiment of the present invention.
  • FIG. 9 is a structural diagram of an electronic device for processing a picture according to an embodiment of the present invention.
  • FIG. 1 is a flowchart of a method for processing a picture according to an embodiment of the present invention. As shown in FIG. 1, the method includes the following steps:
  • Step 101 Acquire a first factor of the first picture, and according to the first factor of the first picture Obtaining an average of a first factor of the first picture and a standard deviation of a first factor of the first picture;
  • the first picture may include a plurality of pixel points, and each pixel point may be represented as an L, ⁇ , ⁇ component, or an r, b, g component.
  • the obtaining the average value and the standard deviation of the first factor of the first picture refers to acquiring the first component according to the L, ⁇ , ⁇ component or the r, b, and g components of each pixel of the first picture.
  • the average value of the L component of the first picture is solved for other components of the first picture.
  • the first factor is an L component, an alpha component, and a beta component of each pixel of the picture; or, the first factor is a red r component, a blue b component, and a green g component of each pixel of the picture.
  • the standard deviation is calculated as
  • the first factor is the L component, the alpha component, and the beta component of each pixel of the picture, it needs to be converted into a red r component, a blue b component, and a green g component of the picture.
  • the picture is generated by the red r component, the blue b component, and the green g component of the picture.
  • L, ⁇ , and ⁇ are a color space with three components, namely L, ⁇ , and ⁇ . It has the least correlation between these three components for most natural scene images.
  • the RGB color mode is a color standard in the industry, r represents a red component, g represents a green component, and b represents a blue component.
  • the color of each pixel in the image is the color of the red, green and blue components of this pixel superimposed by intensity values.
  • the intensity value of each component ranges from [0, 255].
  • Step 102 Acquire a first factor of the second picture to be processed, and obtain an average value of the first factor of the second picture and a first factor of the second picture according to the first factor of the second picture. Standard deviation
  • a first factor of the second picture and an average of a first factor of the second picture and a standard deviation of a first factor of the second picture may be obtained.
  • the second picture is to be processed Image, the image that needs to be processed according to the filter.
  • Step 103 According to an average value of a first factor of the first picture, a standard deviation of a first factor of the first picture, a first factor of the second picture, and a first factor of the second picture And a standard deviation of the first factor of the second picture to obtain a new first factor of the second picture;
  • an average value and a standard deviation of the first factor of the first picture that is, an average value and a standard deviation of the L component, the ⁇ component, and the ⁇ component of each pixel point of the first picture, or a red r component
  • a first factor of the second picture an average value and a standard deviation of the first factor of the second picture, that is, each pixel of the second picture
  • the average value and standard deviation of the L component, the ⁇ component, and the ⁇ component of the point, or the average and standard deviation of the red r component, the blue b component, and the green g component can obtain a new first factor of the second picture, and obtain the first The L picture, the ⁇ component, and the ⁇ component of each of the new pixels; or the red r component, the blue b component, and the green g component of each pixel.
  • the acquiring a first factor of the second picture, the new first factor is used to generate a third picture, an average of the first factor of the third picture, and a first picture of the first picture
  • the average of a factor is equal
  • the standard deviation of the first factor of the third picture is equal to the standard deviation of the first factor of the first picture, including:
  • the formula can be expressed as follows:
  • New ⁇ ( ⁇ 2-m ⁇ 2)*s ⁇ 1/s ⁇ 2+m ⁇ 1;
  • New ⁇ ( ⁇ 2-m ⁇ 2)*s ⁇ 1/s ⁇ 2+m ⁇ 1;
  • L1 is used to represent the L component of the first picture
  • ⁇ 1 is used to represent the ⁇ component of the first picture
  • ⁇ 1 is used to represent the ⁇ component of the first picture
  • mL1 is used to represent the average value of the L component of the first picture
  • sL1 is used to represent the L of the first picture.
  • the standard deviation of the components m ⁇ 1 is used to represent the average value of the ⁇ component of the first picture
  • s ⁇ 1 is used to represent the standard deviation of the ⁇ component of the first picture
  • m ⁇ 1 is used to represent the average value of the ⁇ component of the first picture
  • s ⁇ 1 is used for Representing the standard deviation of the beta component of the first picture;
  • L2 is used to represent the L component of the second picture
  • ⁇ 2 is used to represent the ⁇ component of the second picture
  • ⁇ 2 is used to represent the ⁇ component of the second picture
  • mL2 is used to represent the average value of the L component of the second picture
  • sL2 is used to represent the standard deviation of the L component of the second picture
  • m ⁇ 2 is used to represent the average value of the ⁇ component of the second picture
  • s ⁇ 2 is used to represent the second picture.
  • the standard deviation of the ⁇ component, m ⁇ 2 is used to represent the average value of the ⁇ component of the second picture
  • s ⁇ 2 is used to represent the standard deviation of the ⁇ component of the second picture.
  • the average values of the L component, the ⁇ component, and the ⁇ component are equal.
  • newL, new ⁇ , new ⁇ are substituted into the standard deviation, and the standard deviation of the L component, the ⁇ component and the ⁇ component of the third picture is equal to the standard deviation of the L component, the ⁇ component and the ⁇ component of the first picture. .
  • the formula can be expressed as follows:
  • Newr (r2-mr2)*sr1/sr2+mr1;
  • Newg (g2-mg2)*sg1/sg2+mg1;
  • Newb (b2-mb2)*sb1/sb2+mb1;
  • mr1 represents the average value of the red r component of the first picture
  • sr1 represents the standard deviation of the red r component of the first picture
  • mb1 represents the average value of the blue b component of the first picture
  • sb1 represents a standard deviation of a blue b component of the first picture
  • mg1 represents an average value of green g components of the first picture
  • sg1 represents a standard deviation of a green g component of the first picture
  • the calculation can be obtained that the average values of the r component, the g component, and the b component of the third picture are equal to the average values of the L component, the alpha component, and the beta component of the first picture.
  • newr, newg, and newb are substituted into the standard deviation, and the standard deviation of the r component, the g component, and the b component of the third picture is equal to the standard deviation of the r component, the g component, and the b component of the first picture. .
  • Step 104 Generate a third picture according to the first factor of the second picture, the average value of the first factor of the third picture is equal to the average value of the first factor of the first picture, and the third The standard deviation of the first factor of the picture is equal to the standard deviation of the first factor of the first picture;
  • the new first factor includes an L component, an alpha component, and a beta component of each pixel of the second picture; or a red color of each pixel r component, blue b component, and green g component.
  • An embodiment of the present invention provides a method for processing a picture, where a first factor of a first picture and a first factor of a second picture to be processed are obtained, according to a first factor of the first picture and a first factor of the second picture to be processed. Calculating the average value and the standard deviation, acquiring a new first factor of the second picture, and generating a third picture according to the new first factor, thereby realizing the user to personalize the picture according to his or her own wishes, and expanding The way of image processing improves the efficiency of image processing and improves the user experience.
  • the acquiring a first factor of the first picture, and acquiring an average value of the first factor of the first picture according to the first factor of the first picture, and the The standard deviation of the first factor of the first picture including:
  • New ⁇ ( ⁇ 2-m ⁇ 2)*s ⁇ 1/s ⁇ 2+m ⁇ 1;
  • New ⁇ ( ⁇ 2-m ⁇ 2)*s ⁇ 1/s ⁇ 2+m ⁇ 1.
  • the method further includes:
  • the acquiring a first factor of the first picture, and acquiring an average value and a first factor of the first picture of the first picture according to the first factor of the first picture The standard deviation of the first factor of the first picture, including:
  • Newr (r2-mr2)*sr1/sr2+mr1;
  • Newg (g2-mg2)*sg1/sg2+mg1;
  • Newb (b2-mb2)*sb1/sb2+mb1;
  • mr1 represents the average value of the red r component of the first picture
  • sr1 represents the standard deviation of the red r component of the first picture
  • mb1 represents the average value of the blue b component of the first picture
  • sb1 represents a standard deviation of a blue b component of the first picture
  • mg1 represents an average value of green g components of the first picture
  • sg1 represents a standard deviation of a green g component of the first picture
  • the first picture may be one picture or multiple pictures; the second picture may be one picture or multiple pictures.
  • the embodiments of the present invention are not limited.
  • FIG. 2 is a flowchart of a method for acquiring a first factor of a first picture according to an embodiment of the present invention. As shown in FIG. 2, the method includes:
  • Step 201 Acquire an r component, a g component, and a b component of the first picture, and convert the r component, the g component, and the b component data into an L component, an alpha component, and a beta component data;
  • the first picture may be a photo taken by the mobile phone, or may be derived from a photo selected by the user in the mobile phone.
  • converting the r component, the g component, and the b component data into an L component, an alpha component, and a beta component data may be converted by the conversion method in FIG. 3 as follows.
  • Step 202 Perform statistics on the three-channel data of the L component, the alpha component, and the beta component of the first picture, and obtain an average value and a standard deviation of each channel, respectively, for a total of six data;
  • step 203 the six data stores are stored for use.
  • the average value and the standard deviation of the L component of the first picture, the mean value and the standard deviation of the alpha component, the mean value and the standard deviation of the beta component, and the three The 6 data stores of the channel are reserved.
  • FIG. 3 is a schematic diagram of a method for converting r, g, and b into L, alpha, and beta according to an embodiment of the present invention.
  • FIG. 3 is only one implementation of the embodiment, and the implementation manner of FIG. 3 is not limited to the following description, and only one implementation manner is described in detail. As shown in Figure 3,
  • Step 301 Acquire r component, g component, and b component of the picture, and generate r', g', b'; the r', g', b' are parameters in the conversion process;
  • r', g', b' can be generated according to the following calculation method.
  • Step 302 calculating l, m, s according to r', g', b', wherein l, m, s are parameters in the conversion process;
  • Step 303 taking a logarithm of l, m, s;
  • Step 303 obtaining L, alpha, and beta according to log_l, log_m, and log_s;
  • the RGB color mode is a color standard in the industry
  • r represents a red component
  • g represents a green component
  • b represents a blue component.
  • the color of each pixel in the image is the color of the red, green and blue components of this pixel superimposed by intensity values.
  • the intensity value of each component ranges from [0, 255].
  • L ⁇ is a color space with three components, namely L, ⁇ , ⁇ , also called L, Alpha, beta. It has the least correlation between these three components for most natural scene images.
  • L1 is used to indicate that the user selects the L component of the first picture
  • alpha1 is used to indicate that the user selects the alpha component of the first picture
  • beta1 is used to indicate that the user selects the beta component of the first picture
  • L2 is used to indicate that the user selects the second picture.
  • the L component, with alpha2 indicates that the user selects the alpha component of the second image
  • beta2 indicates that the user selects the beta component of the second image.
  • mL1 represents the average of the L components of the first picture. For example, if the first picture selected by the user is 100 pixels, the L component is a matrix containing 100 elements, and ml is the average of the matrix of the 100 elements in the L component.
  • sL1 represents the standard deviation of the L component of the first picture. For example, if the first picture selected by the user is 100 pixels, then the L component is a matrix containing 100 elements, and sl is the standard deviation of the matrix of the 100 elements in the L component.
  • FIG. 4 is a flowchart of a method for processing a picture according to an embodiment of the present invention.
  • FIG. 4 is a specific implementation manner in the case where the first factor is the L component, the alpha component, and the beta component of each pixel of the picture in the embodiment of the present invention.
  • FIG. 4 is only an implementation manner of the embodiment, and the implementation manner of FIG. 4 is not limited to the following description of the steps in FIG. 4, and only one implementation manner is described in detail.
  • Step 401 Obtain an average value and a standard deviation of L, alpha, and beta of the first picture
  • mL1 is used to represent the average value of the L component of the first picture
  • sL1 is used to represent the standard deviation of the L component of the first picture
  • m ⁇ 1 is used to represent the average value of the ⁇ component of the first picture
  • s ⁇ 1 is used to indicate the The standard deviation of the alpha component of a picture
  • m ⁇ 1 is used to represent the average of the beta components of the first picture
  • s ⁇ 1 is used to represent the standard deviation of the beta component of the first picture.
  • the r component, the g component, and the b component data are converted into an L component, an alpha component, and a beta by acquiring an r component, a g component, and a b component of the first picture.
  • the component data which in turn obtains the mean and standard deviation of the L, alpha, and beta of the first picture.
  • the average and standard deviation of the L, alpha, and beta of the first picture may also be directly obtained.
  • the L component, the alpha component, and the beta component of each pixel of the first picture are respectively obtained, and the average value and standard deviation of the L, alpha, and beta of the first picture are respectively obtained according to the calculation formulas of the average value and the standard deviation.
  • Step 402 acquiring L, alpha, and beta of the second picture
  • L2 is used to represent the L component of the second picture
  • ⁇ 2 is used to represent the ⁇ component of the second picture
  • ⁇ 2 is used to represent the ⁇ component of the second picture.
  • Step 403 obtaining an average value and a standard deviation of L, alpha, and beta of the second picture
  • mL2 is used to represent the average value of the L component of the second picture
  • sL2 is used to represent the standard deviation of the L component of the second picture
  • m ⁇ 2 is used to represent the average value of the ⁇ component of the second picture
  • s ⁇ 2 is used to indicate the The standard deviation of the alpha components of the two pictures
  • m ⁇ 2 is used to represent the average of the beta components of the second picture
  • s ⁇ 2 is used to represent the standard deviation of the beta components of the second picture.
  • the obtaining method may refer to the method for obtaining the average value of L, alpha, and beta of the first picture and the standard deviation in step 401.
  • Step 404 according to an average value of a first factor of the first picture, a standard deviation of a first factor of the first picture, a first factor of the second picture, and a first factor of the second picture And a standard deviation of the first factor of the second picture to obtain a new first factor of the second picture;
  • the method is not limited to the following:
  • Step 405 Acquire a new first factor of the second picture according to the second second factor of the second picture.
  • the method further includes:
  • a third picture is generated according to the new red r component, the blue b component, and the green g component of the second picture.
  • FIG. 5 is a flowchart of a method for converting L, alpha, and beta into r, g, and b according to an embodiment of the present invention.
  • FIG. 5 is only one implementation of the embodiment, and the implementation manner of FIG. 5 is not limited to the following description, and only one implementation manner is described in detail. As shown in Figure 5,
  • Step 501 acquiring new L, ⁇ , and ⁇ of the second picture
  • Step 502 Calculate temp_l, temp_m, and temp_s according to the new L, ⁇ , and ⁇ ; the l, m, and s are parameters in the conversion process;
  • temp_l 0.5774*L+0.4082* ⁇ +0.7071* ⁇ ;
  • Step 503 obtaining l, m, s according to temp_l, temp_m, temp_s;
  • l, m, s are indices of temp_l, temp_m, and temp_s, respectively.
  • Step 504 obtaining r, g, b according to l, m, s;
  • a value less than 0 is denoted as 0; a value greater than 255 is denoted as 255.
  • Step 505 Acquire a third picture according to the first factor of the second picture new.
  • a third picture is generated according to the new r, g, and b converted by the new picture L, ⁇ , and ⁇ .
  • the acquiring a first factor of the first picture, and acquiring an average value of the first factor of the first picture and a first factor of the first picture according to the first factor of the first picture Standard deviation including:
  • Newr (r2-mr2)*sr1/sr2+mr1;
  • Newg (g2-mg2)*sg1/sg2+mg1;
  • Newb (b2-mb2)*sb1/sb2+mb1.
  • FIG. 6 is a flowchart of a method for acquiring r, g, and b of a first picture according to an embodiment of the present invention. As shown in Figure 6,
  • Step 601 Acquire an r component, a g component, and a b component of the first picture, perform statistics on the r component, the g component, and the b component three-channel data of the first picture, and obtain an average value and a standard deviation of each channel respectively. A total of 6 data;
  • the first picture may be a photo taken by the mobile phone, or may be derived from a photo selected by the user in the mobile phone.
  • the L component, the alpha component, and the beta component of the first picture may also be acquired, and the L component, the alpha component, and the beta component are converted into the r component and the g component by the conversion method in FIG. 5 described above. , b component.
  • Step 602 storing the six data stores for use.
  • an average value and a standard deviation of the r component of the first picture, an average value and a standard deviation of the g component, an average value and a standard deviation of the b component, and the third may be respectively obtained by the above calculation formula
  • the 6 data stores of the channel are reserved.
  • mr1 represents the average value of the r component of the first picture.
  • the r component is a matrix containing 100 elements
  • mr is the average of the matrix of the 100 elements in the L component.
  • Sr1 represents the standard deviation of the r component of the first picture. For example, if the first picture selected by the user is 100 pixels, the r component is a matrix containing 100 elements, and sr is the standard deviation of the matrix of the 100 elements in the L component.
  • FIG. 7 is a specific implementation of the embodiment of the present invention in a case where the first factor is a red r component, a blue b component, and a green g component of each pixel of a picture.
  • FIG. 7 is a flowchart of a method for processing a picture according to an embodiment of the present invention. As shown in FIG. 7 , FIG. 7 is only one implementation manner of the embodiment, and the implementation manner of FIG. 7 is not limited to the following description of the steps in FIG. 7 , and only one implementation manner is described in detail.
  • Step 701 obtaining r, g, b of the first picture
  • mr1 represents an average value of red r components of the first picture
  • sr1 represents a standard deviation of a red r component of the first picture
  • mb1 represents an average of blue b components of the first picture.
  • a value sb1 represents the standard deviation of the blue b component of the first picture
  • mg1 represents the average of the green g components of the first picture
  • sg1 represents the standard deviation of the green g component of the first picture.
  • the average value and standard deviation of the r component of the first picture that has been stored, the average value and the standard deviation of the g component, and the mean and standard deviation of the b component can also be directly invoked.
  • Step 702 obtaining r, g, b of the second picture to be processed, and an average value and a standard deviation of r, g, and b of the second picture;
  • r2 represents an r component of the second picture
  • b2 represents a b component of the second picture
  • g2 represents a g component of the second picture
  • mr2 represents an average value of red r components of the second picture
  • Sr2 represents the standard deviation of the red r component of the second picture
  • mb2 represents the average value of the blue b component of the second picture
  • sb2 represents the standard deviation of the blue b component of the second picture
  • mg2 represents the An average of the green g components of the second picture
  • sg2 represents the standard deviation of the green g component of the second picture.
  • Step 703 according to an average value of a first factor of the first picture, a standard deviation of a first factor of the first picture, a first factor of the second picture, and a first factor of the second picture And calculating a standard deviation of the first factor of the second picture to obtain a new r, g, b of the second picture.
  • newr (r2-mr2)*sr1/sr2+mr1;
  • Newg (g2-mg2)*sg1/sg2+mg1;
  • Newb (b2-mb2)*sb1/sb2+mb1.
  • Step 704 Generate a third picture according to the new red r component, the blue b component, and the green g component of the second picture.
  • newr, newg, newb generate a third picture.
  • the first picture is at least one picture
  • the second picture is at least one picture
  • the filter processing manner of the second image to be processed generated by the image processing method in the embodiment of FIG. 1 to FIG. 7 may be shared to the server, for example, the user likes it.
  • the filter processing method is shared with other friends by means of instant messaging such as Weibo and WeChat, so that other users can select the filter they like to personalize the image, which makes the image processing method more diverse and the efficiency of image processing. Further improvement is achieved and the user experience is further enhanced.
  • FIG. 8 is a schematic diagram of an electronic device for processing a picture according to an embodiment of the present invention.
  • the electronic device includes the following units:
  • a first acquiring unit 801 configured to acquire a first factor of the first picture, and obtain an average value of the first factor of the first picture and a first of the first picture according to the first factor of the first picture Standard deviation of the factor;
  • the first factor is an L component, an alpha component, and a beta component of each pixel of the picture;
  • the first factor is a red r component, a blue b component, and a green g component of each pixel of the picture.
  • the standard deviation is calculated as
  • the red r component, the blue b component, and the green g component of the picture need to be converted, and the red r component and blue of the picture
  • the color b component and the green g component are used to generate the picture.
  • a second acquiring unit 802 configured to acquire a first factor of the second picture to be processed, and acquire an average value of the first factor of the second picture and the second picture according to the first factor of the second picture The standard deviation of the first factor;
  • the third obtaining unit 803 is configured to: according to an average value of the first factor of the first picture, a standard deviation of a first factor of the first picture, a first factor of the second picture, and the second picture Obtaining a first factor of the second picture by the average of the first factor and the standard deviation of the first factor of the second picture;
  • a generating unit 804 configured to generate, according to the new first factor, a third picture, where an average value of the first factor of the third picture is equal to an average value of the first factor of the first picture, where The standard deviation of the first factor of the three pictures is equal to the standard deviation of the first factor of the first picture;
  • the first factor is an L component, an alpha component, and a beta component of each pixel of the picture;
  • the first factor is a red r component, a blue b component, and a green g component of each pixel of the picture.
  • the third obtaining unit 803 is specifically configured to:
  • New ⁇ ( ⁇ 2-m ⁇ 2)*s ⁇ 1/s ⁇ 2+m ⁇ 1;
  • New ⁇ ( ⁇ 2-m ⁇ 2)*s ⁇ 1/s ⁇ 2+m ⁇ 1;
  • L1 is used to represent the L component of the first picture
  • ⁇ 1 is used to represent the ⁇ component of the first picture
  • ⁇ 1 is used to represent the ⁇ component of the first picture
  • mL1 is used to represent the average value of the L component of the first picture
  • sL1 is used to represent the standard deviation of the L component of the first picture
  • m ⁇ 1 is used to represent the average value of the ⁇ component of the first picture
  • s ⁇ 1 is used to represent the first picture.
  • the standard deviation of the ⁇ component, m ⁇ 1 is used to represent the average value of the ⁇ component of the first picture, and s ⁇ 1 is used to represent the standard deviation of the ⁇ component of the first picture;
  • L2 is used to represent the L component of the second picture
  • ⁇ 2 is used to represent the ⁇ component of the second picture
  • ⁇ 2 is used to represent the ⁇ component of the second picture
  • mL2 is used to represent the average value of the L component of the second picture
  • sL2 is used to represent the standard deviation of the L component of the second picture
  • m ⁇ 2 is used to represent the average value of the ⁇ component of the second picture
  • s ⁇ 2 is used to represent the second picture.
  • the standard deviation of the ⁇ component, m ⁇ 2 is used to represent the average value of the ⁇ component of the second picture
  • s ⁇ 2 is used to represent the standard deviation of the ⁇ component of the second picture.
  • Newr (r2-mr2)*sr1/sr2+mr1;
  • Newg (g2-mg2)*sg1/sg2+mg1;
  • Newb (b2-mb2)*sb1/sb2+mb1;
  • mr1 represents the average value of the red r component of the first picture
  • sr1 represents the standard deviation of the red r component of the first picture
  • mb1 represents the average value of the blue b component of the first picture
  • sb1 represents a standard deviation of a blue b component of the first picture
  • mg1 represents an average value of green g components of the first picture
  • sg1 represents a standard deviation of a green g component of the first picture
  • the first acquiring unit 801 is specifically configured to:
  • the second obtaining unit 802 is specifically configured to:
  • the third obtaining unit 803 is specifically configured to:
  • New ⁇ ( ⁇ 2-m ⁇ 2)*s ⁇ 1/s ⁇ 2+m ⁇ 1;
  • New ⁇ ( ⁇ 2-m ⁇ 2)*s ⁇ 1/s ⁇ 2+m ⁇ 1.
  • the electronic device further includes a conversion generating unit, where the conversion generating unit is specifically configured to:
  • the first obtaining unit 801 is configured to:
  • the second obtaining unit 802 is configured to:
  • the third obtaining unit 803 is specifically configured to:
  • Newr (r2-mr2)*sr1/sr2+mr1;
  • Newg (g2-mg2)*sg1/sg2+mg1;
  • Newb (b2-mb2)*sb1/sb2+mb1.
  • the first picture is at least one picture
  • the second picture is at least one picture
  • An embodiment of the present invention provides an electronic device that processes a picture, where the electronic device acquires a first factor of a first picture and a first factor of a second picture to be processed, according to a first factor of the first picture and a to-be-processed Calculating the average value and the standard deviation of the first factor of the two pictures, acquiring a new first factor of the second picture, and generating a third picture according to the new first factor, thereby realizing that the user performs the picture according to his or her own will Personalized processing expands the way of image processing, improves the efficiency of image processing, and improves the user experience.
  • FIG. 9 is a structural diagram of an electronic device for processing a picture according to an embodiment of the present invention.
  • FIG. 9 is an electronic device 900 according to an embodiment of the present invention.
  • the specific implementation of the present invention does not limit the specific implementation of the electronic device.
  • the electronic device 900 includes:
  • the processor 901, the communication interface 902, and the memory 903 complete communication with each other via the bus 904.
  • a communication interface 902 configured to communicate with other electronic devices
  • the processor 901 is configured to execute a program.
  • the processor is a control center of the electronic device, and connects various parts of the entire electronic device by using various interfaces and lines, by running or executing software programs and/or modules stored in the storage unit, and calling data stored in the storage unit, To perform various functions of the electronic device and/or process data.
  • the processor may be composed of an integrated circuit (IC), for example, may be composed of a single packaged IC, or may be composed of a plurality of packaged ICs that have the same function or different functions.
  • the processor may include only a central processing unit (CPU), or may be a GPU, a digital signal processor (DSP), and a control chip in the communication unit (for example, a baseband chip). )The combination.
  • the CPU may be a single operation core, and may also include multiple operation cores.
  • the program executed by the processor may include program code, the program code including computer operating instructions.
  • the processor 901 may be a central processing unit (CPU) or an application specific integrated circuit ASIC (Application Specific) Integrated Circuit), or one or more integrated circuits configured to implement embodiments of the present invention.
  • the memory 903 is configured to store a program.
  • the memory 903 may be a volatile memory such as a random-access memory (RAM) or a non-volatile memory such as a read-only memory. ROM), flash memory, hard disk drive (HDD) or solid-state drive (SSD).
  • the processor 901 executes the following method according to the program instructions stored in the memory 903:
  • Obtaining a first factor of the first picture and acquiring, according to a first factor of the first picture, an average value of a first factor of the first picture and a standard deviation of a first factor of the first picture;
  • the average value of the first factor of the third picture is equal to the average value of the first factor of the first picture
  • the third picture is The standard deviation of a factor is equal to the standard deviation of the first factor of the first picture
  • the first factor is an L component, an alpha component, and a beta component of each pixel of the picture;
  • the first factor is a red r component, a blue b component, and a green g component of each pixel of the picture.
  • the average value of the first factor of the first picture and the standard deviation of the first factor of the first picture including:
  • New ⁇ ( ⁇ 2-m ⁇ 2)*s ⁇ 1/s ⁇ 2+m ⁇ 1;
  • New ⁇ ( ⁇ 2-m ⁇ 2)*s ⁇ 1/s ⁇ 2+m ⁇ 1;
  • L1 is used to represent the L component of the first picture
  • ⁇ 1 is used to represent the ⁇ component of the first picture
  • ⁇ 1 is used to represent the ⁇ component of the first picture
  • mL1 is used to represent the average value of the L component of the first picture
  • sL1 is used to represent the standard deviation of the L component of the first picture
  • m ⁇ 1 is used to represent the average value of the ⁇ component of the first picture
  • s ⁇ 1 is used to represent the first picture.
  • the standard deviation of the ⁇ component, m ⁇ 1 is used to represent the average value of the ⁇ component of the first picture, and s ⁇ 1 is used to represent the standard deviation of the ⁇ component of the first picture;
  • L2 is used to represent the L component of the second picture
  • ⁇ 2 is used to represent the ⁇ component of the second picture
  • ⁇ 2 is used to represent the ⁇ component of the second picture
  • mL2 is used to represent the average value of the L component of the second picture
  • sL2 is used to represent the standard deviation of the L component of the second picture
  • m ⁇ 2 is used to represent the average value of the ⁇ component of the second picture
  • s ⁇ 2 is used to represent The standard deviation of the ⁇ component of the second picture
  • m ⁇ 2 is used to represent the average value of the ⁇ component of the second picture
  • s ⁇ 2 is used to represent the standard deviation of the ⁇ component of the second picture.
  • the method further includes:
  • Generating a third picture according to the first factor of the second picture including:
  • Obtaining a first factor of the first picture and acquiring, according to the first factor of the first picture, an average value of the first factor of the first picture and a standard deviation of the first factor of the first picture, including :
  • Newr (r2-mr2)*sr1/sr2+mr1;
  • Newg (g2-mg2)*sg1/sg2+mg1;
  • Newb (b2-mb2)*sb1/sb2+mb1;
  • mr1 represents the average value of the red r component of the first picture
  • sr1 represents the standard deviation of the red r component of the first picture
  • mb1 represents the average value of the blue b component of the first picture
  • sb1 represents a standard deviation of a blue b component of the first picture
  • mg1 represents an average value of green g components of the first picture
  • sg1 represents a standard deviation of a green g component of the first picture
  • the first picture is at least one picture
  • the second picture is at least one picture
  • An embodiment of the present invention provides an electronic device that processes a picture, where the electronic device acquires a first factor of a first picture and a first factor of a second picture to be processed, according to a first factor of the first picture and a to-be-processed Calculating the average value and the standard deviation of the first factor of the two pictures, acquiring a new first factor of the second picture, and generating a third picture according to the new first factor, thereby realizing that the user performs the picture according to his or her own will Personalized processing expands the way of image processing, improves the efficiency of image processing, and improves the user experience.
  • the electronic device disclosed by the present invention can be implemented as a single device or integrated into various devices, such as a mobile phone, a tablet personal computer, a laptop computer, a multimedia player, Digital cameras, personal digital assistants (PDAs), navigation devices, mobile Internet devices (MIDs) or wearable devices (Wearable Devices).
  • PDAs personal digital assistants
  • MIDs mobile Internet devices
  • Wearable Devices wearable devices

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

本发明实施例提供一种处理图片的方法及电子设备。所述方法包括:获取第一图片的第一因子,以及所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差;获取待处理的第二图片的第一因子,以及所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差;根据所述第一图片的第一因子的平均值、所述第一图片的第一因子的标准差、所述第二图片的第一因子、所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,获取第二图片新的第一因子;根据所述第二图片新的第一因子生成第三图片。从而实现了用户按照自己的意愿对图片进行个性化处理,扩大了图片处理的方式,提高了图片处理的效率,提高了用户体验。

Description

一种处理图片的方法及电子设备 技术领域
本发明涉及图片处理领域,尤其涉及到一种处理图片的方法及电子设备。
背景技术
随着拍照手机的普及和社交网络被越来越多的使用者所接受并喜爱,发送照片已成为了拍照应用和社交应用两种工具都同时必须具备的一项功能。
拍照工具和社交应用在满足了基本的“拍摄照片”功能后,还提供了对照片进行美化的工具,各种风格的滤镜可以实现“高爆光”、“老照片”等特效,广受用户欢迎。
随着数码摄影的普及,实体滤镜的效果也可以通过用计算机图像处理算法对数码照片进行处理而获得。例如:将彩色图像应用灰度化算法,可将彩图变为灰度图,从而实现黑白照片的效果;将图像进行高斯滤波,可实现模糊的效果等。
现今较为流行的拍照和社交应用都附带了滤镜功能,方式是提供若干预设的效果,并通过“效果式例缩略图+名称”的方式展现给用户,供用户选择。当用户选择某一滤镜后,则开始用预设好的算法和参数对图像进行处理,并将结果呈现给用户,用户可将结果进行保存、分享等后续操作。
通常的,用户可用的各种滤镜都是在应用中预设好的。从技术角度说,每一个滤镜都对应着一种图像处理算法和一组对应的参数。应用将所有的特效滤镜都固化在其中,用户只能被动地接受应用提供的有限种特效滤镜,能做的操作有且只有“选择”,用户无法实现有任何的创造性和主观意愿的表达。
发明内容
本发明实施例提供了一种处理图片的方法,旨在解决如何实现用户可以按照自己的意愿对图片进行个性化处理的问题。
第一方面,一种处理图片的方法,所述方法包括:
获取第一图片的第一因子,并根据所述第一图片的第一因子获取所述第 一图片的第一因子的平均值和所述第一图片的第一因子的标准差;
获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差;
根据所述第一图片的第一因子的平均值、所述第一图片的第一因子的标准差、所述第二图片的第一因子、所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,获取第二图片新的第一因子;
根据所述第二图片新的第一因子生成第三图片,所述第三图片的第一因子的平均值和所述第一图片的第一因子的平均值相等,所述第三图片的第一因子的标准差和所述第一图片的第一因子的标准差相等;
其中,所述第一因子为图片各像素点的L分量、α分量和β分量;或者
所述第一因子为图片各像素点的红色r分量、蓝色b分量和绿色g分量。
结合第一方面,在第一方面的第一种可能的实现方式中,所述根据所述第一图片的第一因子的平均值、所述第一图片的第一因子的标准差、所述第二图片的第一因子、所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,获取第二图片新的第一因子,包括:
将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;
将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;
将所述第一值和所述第二值相乘,获取第三值;
将所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子。
结合第一方面的第一种可能的实现方式,在第一方面的第二种可能的实现方式中,所述获取第一图片的第一因子,并根据所述第一图片的第一因子获取所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差,包括:
获取所述第一图片各像素点的L分量、α分量和β分量;
并根据所述第一图片各像素点的L分量、α分量和β分量获取所述第一图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述获取待处理的第二图片的第一因子,并根据所述第二图片的第一因 子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,包括:
获取待处理的第二图片各像素点的L分量、α分量和β分量;
并根据所述待处理的第二图片各像素点的L分量、α分量和β分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;将所述第一值和所述第二值相乘,获取第三值;所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子,所述第二图片新的第一因子用于生成第三图片,包括:
newL=(L2-mL2)*sL1/sL2+mL1;
newα=(α2-mα2)*sα1/sα2+mα1;
newβ=(β2-mβ2)*sβ1/sβ2+mβ1;
其中,L1用于表示第一图片的L分量,α1用于表示第一图片的α分量,β1用于表示第一图片的β分量;
mL1用于表示第一图片的L分量的平均值,sL1用于表示第一图片的L分量的标准差,mα1用于表示第一图片的α分量的平均值,sα1用于表示第一图片的α分量的标准差,mβ1用于表示第一图片的β分量的平均值,sβ1用于表示第一图片的β分量的标准差;
L2用于表示第二图片的L分量,α2用于表示第二图片的α分量,β2用于表示第二图片的β分量;
mL2用于表示第二图片的L分量的平均值,sL2用于表示第二图片的L分量的标准差,mα2用于表示第二图片的α分量的平均值,sα2用于表示第二图片的α分量的标准差,mβ2用于表示第二图片的β分量的平均值,sβ2用于表示第二图片的β分量的标准差。
结合第一方面的第二种可能的实现方式,在第一方面的第三种可能的实现方式中,所述方法在获取所述第二图片新的第一因子之后,还包括:
将所述第二图片的newL、newα、newβ转换成所述第二图片的新的红色r分量、蓝色b分量和绿色g分量;
根据所述第二图片新的第一因子,生成第三图片,包括:
根据所述第二图片的新的红色r分量、蓝色b分量、绿色g分量生成第三图片。
结合第一方面的第一种可能的实现方式,在第一方面的第四种可能的实现方式中,所述获取第一图片的第一因子,并根据所述第一图片的第一因子获取所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差,包括:
获取所述第一图片各像素点的r分量、b分量和g分量;
并根据所述第一图片各像素点的r分量、b分量、g分量获取所述第一图片的r分量的平均值和标准差、第一图片的b分量的平均值和标准差、第一图片的g分量的平均值和标准差;
所述获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,包括:
获取待处理的第二图片各像素点的r分量、b分量、g分量;
并根据所述待处理的第二图片各像素点的r分量、b分量、g分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;将所述第一值和所述第二值相乘,获取第三值;所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子,所述第二图片新的第一因子用于生成第三图片,包括:
newr=(r2-mr2)*sr1/sr2+mr1;
newg=(g2-mg2)*sg1/sg2+mg1;
newb=(b2-mb2)*sb1/sb2+mb1;
其中,mr1表示所述第一图片的红色r分量的平均值;sr1表示所述第一图片的红色r分量的标准差;mb1表示所述第一图片的蓝色b分量的平均值;sb1表示所述第一图片的蓝色b分量的标准差;mg1表示所述第一图片的绿色g分量的平均值;sg1表示所述第一图片的绿色g分量的标准差;
r2表示所述第二图片的r分量;b2表示所述第二图片的b分量;g2表示所述第二图片的g分量;mr2表示所述第二图片的红色r分量的平均值;sr2表示所述第二图片的红色r分量的标准差;mb2表示所述第二图片的蓝色b分量的平均值;sb2表示所述第二图片的蓝色b分量的标准差;mg2表示所述第二图片的绿色g分量的平均值;sg2表示所述第二图片的绿色g分量的标准差。
结合第二方面,一种处理图片的电子设备,所述电子设备包括:
第一获取单元,用于获取第一图片的第一因子,并根据所述第一图片的第一因子获取所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差;
第二获取单元,用于获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差;
第三获取单元,用于根据所述第一图片的第一因子的平均值、所述第一图片的第一因子的标准差、所述第二图片的第一因子、所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,获取第二图片新的第一因子;
生成单元,用于根据所述新的第一因子,生成第三图片,所述第三图片的第一因子的平均值和所述第一图片的第一因子的平均值相等,所述第三图片的第一因子的标准差和所述第一图片的第一因子的标准差相等;
其中,所述第一因子为图片各像素点的L分量、α分量和β分量;或者
所述第一因子为图片各像素点的红色r分量、蓝色b分量和绿色g分量。
结合第二方面,在第二方面的第一种可能的实现方式中,所述第三获取单元,具体用于执行如下程序:
将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;
将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;
将所述第一值和所述第二值相乘,获取第三值;
所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子。
结合第二方面的第一种可能的实现方式,在第二方面的第二种可能的实现方式中,所述第一获取单元,具体用于:
获取所述第一图片各像素点的L分量、α分量和β分量;
并根据所述第一图片各像素点的L分量、α分量和β分量获取所述第一图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述第二获取单元,具体用于:
获取待处理的第二图片各像素点的L分量、α分量和β分量;
并根据所述待处理的第二图片各像素点的L分量、α分量和β分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述第三获取单元,具体用于执行如下程序:
newL=(L2-mL2)*sL1/sL2+mL1;
newα=(α2-mα2)*sα1/sα2+mα1;
newβ=(β2-mβ2)*sβ1/sβ2+mβ1;
其中,L1用于表示第一图片的L分量,α1用于表示第一图片的α分量,β1用于表示第一图片的β分量;
mL1用于表示第一图片的L分量的平均值,sL1用于表示第一图片的L分量的标准差,mα1用于表示第一图片的α分量的平均值,sα1用于表示第一图片的α分量的标准差,mβ1用于表示第一图片的β分量的平均值,sβ1用于表示第一图片的β分量的标准差;
L2用于表示第二图片的L分量,α2用于表示第二图片的α分量,β2用于表示第二图片的β分量;
mL2用于表示第二图片的L分量的平均值,sL2用于表示第二图片的L分量的标准差,mα2用于表示第二图片的α分量的平均值,sα2用于表示第二图片的α分量的标准差,mβ2用于表示第二图片的β分量的平均值,sβ2用于表示第二图片的β分量的标准差。
结合第二方面的第二种可能的实现方式,在第二方面的第三种可能的实现方式中,所述电子设备还包括转换生成单元,所述转换生成单元具体用于:
将所述第二图片的newL、newα、newβ转换成所述第二图片的新的红色r分量、蓝色b分量和绿色g分量;
所述生成单元,具体用于:
根据所述第二图片的新的红色r分量、蓝色b分量、绿色g分量生成第三图片。
结合第二方面的第一种可能的实现方式,在第二方面的第四种可能的实现方式中,所述第一获取单元,用于:
获取所述第一图片各像素点的r分量、b分量和g分量
并根据所述第一图片各像素点的r分量、b分量、g分量获取所述第一图片的r分量的平均值和标准差、第一图片的b分量的平均值和标准差、第一图片的g分量的平均值和标准差;
第二获取单元,用于:
获取待处理的第二图片各像素点的r分量、b分量、g分量;
并根据所述待处理的第二图片各像素点的r分量、b分量、g分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述第三获取单元,具体用于执行如下程序:
newr=(r2-mr2)*sr1/sr2+mr1;
newg=(g2-mg2)*sg1/sg2+mg1;
newb=(b2-mb2)*sb1/sb2+mb1;
其中,mr1表示所述第一图片的红色r分量的平均值;sr1表示所述第一图片的红色r分量的标准差;mb1表示所述第一图片的蓝色b分量的平均值;sb1表示所述第一图片的蓝色b分量的标准差;mg1表示所述第一图片的绿色g分量的平均值;sg1表示所述第一图片的绿色g分量的标准差;
r2表示所述第二图片的r分量;b2表示所述第二图片的b分量;g2表示所述第二图片的g分量;mr2表示所述第二图片的红色r分量的平均值;sr2表示所述第二图片的红色r分量的标准差;mb2表示所述第二图片的蓝色b分量的平均值;sb2表示所述第二图片的蓝色b分量的标准差;mg2表示所述第二图片的绿色g分量的平均值;sg2表示所述第二图片的绿色g分量的标准差。
本发明实施例提供一种处理图片的方法,获取第一图片的第一因子、以及待处理的第二图片的第一因子,根据第一图片第一因子和待处理的第二图片第一因子的平均值和标准差的计算,获取第二图片的新的第一因子,并根 据所述新的第一因子生成第三图片,从而实现了用户按照自己的意愿对图片进行个性化处理,扩大了图片处理的方式,提高了图片处理的效率,提高了用户体验。
附图说明
为了更清楚地说明本发明实施例的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例提供的一种处理图片的方法流程图;
图2是本发明实施例提供的一种获取第一图片的第一因子的方法流程图;
图3是本发明实施例提供的一种r、g、b转化为L、alpha、beta的方法示意图;
图4是本发明实施例提供的一种处理图片的方法流程图;
图5是本发明实施例提供的一种L,alpha,beta转化为r、g、b的方法流程图;
图6是本发明实施例提供的一种获取第一图片的r、g、b的方法流程图;
图7是本发明实施例提供的一种处理图片的方法流程图;
图8是本发明实施例提供的一种处理图片的电子设备结构图;
图9是本发明实施例提供的一种处理图片的电子设备结构图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
参考图1,图1是本发明实施例提供的一种处理图片的方法流程图。如图1所示,所述方法包括以下步骤:
步骤101,获取第一图片的第一因子,并根据所述第一图片的第一因子 获取所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差;
具体地,所述第一图片可以包括多个像素点,每个像素点可以表示为L、α、β分量,或者r、b、g分量。所述获取所述第一图片的第一因子的平均值和标准差,是指根据所述第一图片的各像素点的L、α、β分量或者r、b、g分量,分别获取第一图片所有像素点的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和标准差,或者r分量的平均值和标准差、b分量的平均值和标准差、g分量的平均值和标准差。以获取第一图片L分量的平均值为例,获取所述第一图片中各像素点的L分量,根据平均值的计算公式=(x1+x2+x3+……+xn)/N,获取所述第一图片L分量的平均值。以此类推,可以对所述第一图片的其它分量求解相应的平均值或者标准差。
其中,所述第一因子为图片各个像素点的L分量、α分量和β分量;或者,所述第一因子为图片各个像素点的红色r分量、蓝色b分量和绿色g分量。
其中,所述平均值的计算方法为=(x1+x2+x3+……+xn)/N;
所述标准差的计算方法为
在所述第一因子为图片各像素点的L分量、α分量和β分量的情况下,需要将其转换为图片的红色r分量、蓝色b分量和绿色g分量。通过所述图片的红色r分量、蓝色b分量和绿色g分量生成所述图片。
其中,L、α、β是一种色彩空间,有3个分量,分别是L、α、β。它对于大多数自然场景图像具有这3个分量之间的相关性最小的特点。RGB色彩模式是工业界的一种颜色标准,r代表红色(Red)分量,g代表绿色(Green)分量,b代表蓝色(Blue)分量。图像中每一个像素的颜色为这个像素的红、绿、蓝三色分量按强度值叠加所呈现出的颜色。每一个分量的强度值范围为[0,255]。
步骤102,获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差;
类似地,可获取所述第二图片的第一因子,以及所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差。所述第二图片为待处理的 图片,即需要根据滤镜对图片进行处理的图片。
步骤103,根据所述第一图片的第一因子的平均值、所述第一图片的第一因子的标准差、所述第二图片的第一因子、所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,获取第二图片新的第一因子;
具体地,根据所述第一图片的第一因子的平均值和标准差,即所述第一图片各像素点的L分量、α分量和β分量的平均值和标准差,或者红色r分量、蓝色b分量和绿色g分量的平均值和标准差;以及所述第二图片的第一因子,所述第二图片的第一因子的平均值和标准差,即所述第二图片各像素点的L分量、α分量和β分量的平均值和标准差,或者红色r分量、蓝色b分量和绿色g分量的平均值和标准差,可获取第二图片新的第一因子,获取第二图片新的各像素点的L分量、α分量和β分量;或者各像素点的红色r分量、蓝色b分量和绿色g分量。
可选地,所述获取第二图片新的第一因子,所述新的第一因子用于生成第三图片,所述第三图片的第一因子的平均值和所述第一图片的第一因子的平均值相等,所述第三图片的第一因子的标准差和所述第一图片的第一因子的标准差相等,包括:
将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;
将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;
将所述第一值和所述第二值相乘,获取第三值;
所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子。
具体的,在所述第一因子为图片各像素点的L分量、α分量和β分量时,可用公式表达如下:
newL=(L2-mL2)*sL1/sL2+mL1;
newα=(α2-mα2)*sα1/sα2+mα1;
newβ=(β2-mβ2)*sβ1/sβ2+mβ1;
其中,L1用于表示第一图片的L分量,α1用于表示第一图片的α分量,β1用于表示第一图片的β分量;
mL1用于表示第一图片的L分量的平均值,sL1用于表示第一图片的L 分量的标准差,mα1用于表示第一图片的α分量的平均值,sα1用于表示第一图片的α分量的标准差,mβ1用于表示第一图片的β分量的平均值,sβ1用于表示第一图片的β分量的标准差;
L2用于表示第二图片的L分量,α2用于表示第二图片的α分量,β2用于表示第二图片的β分量;
mL2用于表示第二图片的L分量的平均值,sL2用于表示第二图片的L分量的标准差,mα2用于表示第二图片的α分量的平均值,sα2用于表示第二图片的α分量的标准差,mβ2用于表示第二图片的β分量的平均值,sβ2用于表示第二图片的β分量的标准差。
其中,将newL、newα、newβ代入平均值=(x1+x2+x3+……+xn)/N中计算可得,第三图片的L分量、α分量和β分量的平均值和第一图片的L分量、α分量和β分量的平均值相等。
同时,将newL、newα、newβ代入标准差中计算可得,第三图片的L分量、α分量和β分量的标准差值和第一图片的L分量、α分量和β分量的标准差值相等。
或者,具体地,在所述第一因子为图片各像素点的红色r分量、蓝色b分量和绿色g分量时,可用公式表达如下:
newr=(r2-mr2)*sr1/sr2+mr1;
newg=(g2-mg2)*sg1/sg2+mg1;
newb=(b2-mb2)*sb1/sb2+mb1;
其中,mr1表示所述第一图片的红色r分量的平均值;sr1表示所述第一图片的红色r分量的标准差;mb1表示所述第一图片的蓝色b分量的平均值;sb1表示所述第一图片的蓝色b分量的标准差;mg1表示所述第一图片的绿色g分量的平均值;sg1表示所述第一图片的绿色g分量的标准差;
r2表示所述第二图片的r分量;b2表示所述第二图片的b分量;g2表示所述第二图片的g分量;mr2表示所述第二图片的红色r分量的平均值;sr2表示所述第二图片的红色r分量的标准差;mb2表示所述第二图片的蓝色b分量的平均值;sb2表示所述第二图片的蓝色b分量的标准差;mg2表示所述第二图片的绿色g分量的平均值;sg2表示所述第二图片的绿色g分量的标准差。
其中,将newr、newg、newb代入平均值=(x1+x2+x3+……+xn)/N 中计算可得,第三图片的r分量、g分量和b分量的平均值和第一图片的L分量、α分量和β分量的平均值相等。
同时,将newr、newg、newb代入标准差中计算可得,第三图片的r分量、g分量和b分量的标准差值和第一图片的r分量、g分量和b分量的标准差值相等。
步骤104,根据所述第二图片新的第一因子生成第三图片,所述第三图片的第一因子的平均值和所述第一图片的第一因子的平均值相等,所述第三图片的第一因子的标准差和所述第一图片的第一因子的标准差相等;
具体地,获取所述第二图片的新的第一因子,所述新的第一因子包括所述第二图片新的各像素点的L分量、α分量和β分量;或者各像素点的红色r分量、蓝色b分量和绿色g分量。根据所述第二图片新的第一因子,生成第三图片。
本发明实施例提供一种处理图片的方法,获取第一图片的第一因子、以及待处理的第二图片的第一因子,根据第一图片第一因子和待处理的第二图片第一因子的平均值和标准差的计算,获取第二图片的新的第一因子,并根据所述新的第一因子生成第三图片,从而实现了用户按照自己的意愿对图片进行个性化处理,扩大了图片处理的方式,提高了图片处理的效率,提高了用户体验。
在本发明实施例的一种实现方式中,所述获取第一图片的第一因子,并根据所述第一图片的第一因子获取所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差,包括:
获取所述第一图片各像素点的L分量、α分量和β分量;
并根据所述第一图片各像素点的L分量、α分量和β分量获取所述第一图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,包括:
获取待处理的第二图片各像素点的L分量、α分量和β分量;
并根据所述待处理的第二图片各像素点的L分量、α分量和β分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分 量的平均值和平均值;
所述将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;将所述第一值和所述第二值相乘,获取第三值;所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子,所述第二图片新的第一因子用于生成第三图片,包括:
newL=(L2-mL2)*sL1/sL2+mL1;
newα=(α2-mα2)*sα1/sα2+mα1;
newβ=(β2-mβ2)*sβ1/sβ2+mβ1。
进一步地,在所述方法在获取所述第二图片新的第一因子之后,还包括:
将所述第二图片的newL、newα、newβ转换成所述第二图片的新的红色r分量、蓝色b分量和绿色g分量;
根据所述第二图片的红色r分量、蓝色b分量和绿色g分量生成所述第二图片。
在本发明实施例的另一种实现方式中,所述获取第一图片的第一因子,并根据所述第一图片的第一因子获取所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差,包括:
获取所述第一图片各像素点的r分量、b分量和g分量;
并根据所述第一图片各像素点的r分量、b分量、g分量获取所述第一图片的r分量的平均值和标准差、第一图片的b分量的平均值和标准差、第一图片的g分量的平均值和标准差;
所述获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,包括:
获取待处理的第二图片各像素点的r分量、b分量、g分量;
并根据所述待处理的第二图片各像素点的r分量、b分量、g分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;将所述第一图片的第一因子的标准差和所述第二图片的 第一因子的标准差相除,获取第二值;将所述第一值和所述第二值相乘,获取第三值;所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子,所述第二图片新的第一因子用于生成第三图片,包括:
newr=(r2-mr2)*sr1/sr2+mr1;
newg=(g2-mg2)*sg1/sg2+mg1;
newb=(b2-mb2)*sb1/sb2+mb1;
其中,mr1表示所述第一图片的红色r分量的平均值;sr1表示所述第一图片的红色r分量的标准差;mb1表示所述第一图片的蓝色b分量的平均值;sb1表示所述第一图片的蓝色b分量的标准差;mg1表示所述第一图片的绿色g分量的平均值;sg1表示所述第一图片的绿色g分量的标准差;
r2表示所述第二图片的r分量;b2表示所述第二图片的b分量;g2表示所述第二图片的g分量;mr2表示所述第二图片的红色r分量的平均值;sr2表示所述第二图片的红色r分量的标准差;mb2表示所述第二图片的蓝色b分量的平均值;sb2表示所述第二图片的蓝色b分量的标准差;mg2表示所述第二图片的绿色g分量的平均值;sg2表示所述第二图片的绿色g分量的标准差。
在本发明的上述实施例中,所述第一图片可以为一张图片,也可以为多张图片;所述第二图片可以为一张图片,也可以为多张图片。对此,本发明实施例不做限定。
请参考图2,图2是本发明实施例提供的一种获取第一图片的第一因子的方法流程图。如图2所示,所述方法包括:
步骤201,获取第一图片的r分量,g分量,b分量,将所述r分量,g分量,b分量数据转换为L分量,alpha分量,beta分量数据;
其中,所述第一图片可以为手机拍摄的照片,也可来源于用户选择手机中已有的照片。
可选地,所述将r分量,g分量,b分量数据转换为L分量,alpha分量,beta分量数据,可通过如下图3中的转换方法进行转换。
步骤202,对所述第一图片的L分量,alpha分量,beta分量三通道数据进行统计,分别获取每个通道的平均值和标准差,共6个数据;
步骤203,将所述6个数据存储备用。
具体地,可通过上述的计算公式,分别获取所述第一图片的L分量的平均值和标准差,alpha分量的平均值和标准差,beta分量的平均值和标准差,并将所述三通道的6个数据存储备用。
具体的,参考图3,图3是本发明实施例提供的一种r、g、b转化为L、alpha、beta的方法示意图。图3仅是本实施例的一种实现方式,图3的实现方式不局限于以下的描述,仅以其中一种实现方式做详细说明。如图3所示,
步骤301,获取图片的r分量、g分量、b分量,并生成r’、g’、b’;所述r’、g’、b’是转换过程中的参数;
具体地,可根据以下计算方式生成r’、g’、b’。
r'=r+1;
g’=g+1;
b’=b+1。
步骤302,根据r’、g’、b’计算l、m、s,所述l、m、s是转换过程中的参数;
l=0.3811*r’+0.5783*g’+0.0402*b’;
m=0.1967*r’+0.7244*g’+0.0782*b’;
s=0.0241*r’+0.1228*g’+0.8444*b’。
步骤303,对l、m、s取对数;
log_l=log10(l);
log_m=log10(m);
log_s=log10(s)。
步骤303,根据log_l、log_m、log_s获取L、alpha,beta;
L=0.5774(log_l+log_m+log_s)
alpha=0.4082(log_l+log_m)-0.8165*log_s
beta=0.7071(log_l-log_m)
其中,RGB色彩模式是工业界的一种颜色标准,r代表红色(Red)分量,g代表绿色(Green)分量,b代表蓝色(Blue)分量。图像中每一个像素的颜色为这个像素的红、绿、蓝三色分量按强度值叠加所呈现出的颜色。每一个分量的强度值范围为[0,255]。
lαβ是一种色彩空间,有3个分量,分别是L、α、β,也称之为L、 alpha,beta。它对于大多数自然场景图像具有这3个分量之间的相关性最小的特点。这里用L1表示用户选择第一张图片的L分量,用alpha1表示用户选择第一张图片的α分量,用beta1表示用户选择第一张图片的β分量;用L2表示用户选择第二张图片的L分量,用alpha2表示用户选择第二张图片的α分量,用beta2表示用户选择第二张图片的β分量。
mL1表示第一图片的L分量的平均值。例如,用户选择的第一张图片为100个像素,则L分量就是个包含100个元素的矩阵,ml就是L分量中这100个元素的矩阵的平均值。
sL1表示第一图片的L分量的标准差。例如,用户选择的第一张图片为100个像素,则L分量就是个包含100个元素的矩阵,sl就是L分量中这100个元素的矩阵的标准差。
参考图4,图4是本发明实施例提供的一种处理图片的方法流程图。图4是本发明实施例在所述第一因子为图片各像素点的L分量、α分量和β分量的情况下的一种具体的实现方式。如图4所示,图4仅是本实施例的一种实现方式,图4实现方式不局限于以下的图4的各步骤描述的顺序,仅以其中一种实现方式做详细说明。
步骤401,获取第一图片的L,alpha,beta的平均值和标准差;
具体的,mL1用于表示第一图片的L分量的平均值,sL1用于表示第一图片的L分量的标准差,mα1用于表示第一图片的α分量的平均值,sα1用于表示第一图片的α分量的标准差,mβ1用于表示第一图片的β分量的平均值,sβ1用于表示第一图片的β分量的标准差。
可选地,可参考图2实施例中的方法,通过获取第一图片的r分量,g分量,b分量,将所述r分量,g分量,b分量数据转换为L分量,alpha分量,beta分量数据,进而获取第一图片的L,alpha,beta的平均值和标准差。
可选地,也可直接获取第一图片的L,alpha,beta的平均值和标准差。例如,分别获取第一图片各像素点的L分量,alpha分量,beta分量,根据前述平均值和标准差的计算公式,分别获取获取第一图片的L,alpha,beta的平均值和标准差。
步骤402,获取第二图片的L,alpha,beta;
具体的,L2用于表示第二图片的L分量,α2用于表示第二图片的α分量,β2用于表示第二图片的β分量。
步骤403,获取第二图片的L,alpha,beta的平均值和标准差;
具体的,mL2用于表示第二图片的L分量的平均值,sL2用于表示第二图片的L分量的标准差,mα2用于表示第二图片的α分量的平均值,sα2用于表示第二图片的α分量的标准差,mβ2用于表示第二图片的β分量的平均值,sβ2用于表示第二图片的β分量的标准差。
所述获取方法可参考步骤401中,第一图片的L,alpha,beta的平均值和标准差的获取方法。
步骤404,根据所述第一图片的第一因子的平均值、所述第一图片的第一因子的标准差、所述第二图片的第一因子、所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,获取第二图片新的第一因子;
具体的,以一种具体的实现方式为例,并不局限于以下方式:
newL=(L2-mL2)*sL1/sL2+mL1
newα=(α2-mα2)*sα1/sα2+mα1
newβ=(β2-mβ2)*sβ1/sβ2+mβ1
步骤405,根据所述第二图片新的第二因子获取第二图片新的第一因子。
进一步地,所述方法在获取所述第二图片新的第一因子之后,还包括:
将所述第二图片的newL、newα、newβ转换成所述第二图片的新的红色r分量、蓝色b分量和绿色g分量;
根据所述第二图片的新的红色r分量、蓝色b分量和绿色g分量生成第三图片。
具体地,请参考图5,图5是本发明实施例提供的一种L,alpha,beta转化为r、g、b的方法流程图。图5仅是本实施例的一种实现方式,图5的实现方式不局限于以下的描述,仅以其中一种实现方式做详细说明。如图5所示,
步骤501,获取所述第二图片新的L、α、β;
步骤502,根据所述新的L、α、β计算temp_l、temp_m、temp_s;所述l、m、s是转换过程中的参数;
具体的,temp_l=0.5774*L+0.4082*α+0.7071*β;
temp_m=0.5774*L+0.4082*α+0.7071*β;
temp_s=0.5774*L-0.8165*α。
步骤503,根据temp_l、temp_m、temp_s获取l、m、s;
l、m、s分别是temp_l、temp_m、temp_s的指数。
步骤504,根据l、m、s获取r、g、b;
r=4.4679*l-3.5873*m+0.1193*s-1;
g=-1.2186*l+2.3809*m-0.1624*s-1;
b=0.0497*l-0.2439*m+1.2045*s-1。
对r、g、b的值,小于0的记为0;大于255的记为255。
步骤505,根据所述第二图片新的第一因子获取第三图片。
具体地,根据所述所述第二图片新的L、α、β转换成的新的r、g、b,生成第三图片。
可选地,所述获取第一图片的第一因子,并根据所述第一图片的第一因子获取所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差,包括:
获取所述第一图片各像素点的r分量、b分量和g分量;
并根据所述第一图片各像素点的r分量、b分量、g分量获取所述第一图片的r分量的平均值和标准差、第一图片的b分量的平均值和标准差、第一图片的g分量的平均值和标准差;
所述获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,包括:
获取待处理的第二图片各像素点的r分量、b分量、g分量;
并根据所述待处理的第二图片各像素点的r分量、b分量、g分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;将所述第一值和所述第二值相乘,获取第三值;所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子,所述第二图片新的第一因子用于生成第三图片,包括:
newr=(r2-mr2)*sr1/sr2+mr1;
newg=(g2-mg2)*sg1/sg2+mg1;
newb=(b2-mb2)*sb1/sb2+mb1。
在本发明的另一种实施例中,参考图6,图6是本发明实施例提供的一种获取第一图片的r、g、b的方法流程图。如图6所示,
步骤601,获取第一图片的r分量,g分量,b分量,对所述第一图片的r分量,g分量,b分量三通道数据进行统计,分别获取每个通道的平均值和标准差,共6个数据;
其中,所述第一图片可以为手机拍摄的照片,也可来源于用户选择手机中已有的照片。
可选地,也可获取所述第一图片的L分量,alpha分量,beta分量,并通过上述图5中的转换方法,将所述L分量,alpha分量,beta分量转换为r分量,g分量,b分量。
步骤602,将所述6个数据存储备用。
具体地,可通过上述的计算公式,分别获取所述第一图片的r分量的平均值和标准差,g分量的平均值和标准差,b分量的平均值和标准差,并将所述三通道的6个数据存储备用。
其中,mr1表示第一图片的r分量的平均值。例如,用户选择的第一张图片为100个像素,则r分量就是个包含100个元素的矩阵,mr就是L分量中这100个元素的矩阵的平均值。
sr1表示第一图片的r分量的标准差。例如,用户选择的第一张图片为100个像素,则r分量就是个包含100个元素的矩阵,sr就是L分量中这100个元素的矩阵的标准差。
图7是本发明实施例在所述第一因子为图片各像素点的红色r分量、蓝色b分量和绿色g分量的情况下的一种具体的实现方式。
参考图7,图7是本发明实施例提供的一种处理图片的方法流程图。如图7所示,图7仅是本实施例的一种实现方式,图7的实现方式不局限于以下的图7的各步骤描述的顺序,仅以其中一种实现方式做详细说明。
步骤701,获取第一图片的r、g、b;
具体的,mr1表示所述第一图片的红色r分量的平均值;sr1表示所述第一图片的红色r分量的标准差;mb1表示所述第一图片的蓝色b分量的平均 值;sb1表示所述第一图片的蓝色b分量的标准差;mg1表示所述第一图片的绿色g分量的平均值;sg1表示所述第一图片的绿色g分量的标准差。
可选地,也可直接调用图6所述方法生成的,已经存储的第一图片的r分量的平均值和标准差,g分量的平均值和标准差,b分量的平均值和标准差
步骤702,获取待处理的第二图片的r、g、b,以及第二图片的r、g、b的平均值和标准差;
具体,r2表示所述第二图片的r分量;b2表示所述第二图片的b分量;g2表示所述第二图片的g分量;mr2表示所述第二图片的红色r分量的平均值;sr2表示所述第二图片的红色r分量的标准差;mb2表示所述第二图片的蓝色b分量的平均值;sb2表示所述第二图片的蓝色b分量的标准差;mg2表示所述第二图片的绿色g分量的平均值;sg2表示所述第二图片的绿色g分量的标准差。
步骤703,根据所述第一图片的第一因子的平均值、所述第一图片的第一因子的标准差、所述第二图片的第一因子、所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,获取第二图片新的r,g,b。
具体的,newr=(r2-mr2)*sr1/sr2+mr1;
newg=(g2-mg2)*sg1/sg2+mg1;
newb=(b2-mb2)*sb1/sb2+mb1。
步骤704,根据所述第二图片新的红色r分量、蓝色b分量和绿色g分量生成第三图片。
具体地,根据所述,newr、newg、newb生成第三图片。
可选地,所述第一图片为至少一张图片,所述第二图片为至少一张图片。
需要说明的是,本发明图1-图7所述的实施例中的图片处理方法所生成的对所述待处理的第二图片的滤镜处理方式可以共享到服务器,例如用户将其喜欢的滤镜处理方式通过微博、微信等即时通讯手段共享给他的朋友等,使得其他用户可以选择自己喜欢的滤镜对图片进行个性化处理,从而使得图片处理的方式更加多元,图片处理的效率获取进一步提高,也进一步提高了用户体验。
请参考图8,图8是本发明实施例提供的一种处理图片的电子设备结构 图。如图8所示,所述电子设备包括以下单元:
第一获取单元801,用于获取第一图片的第一因子,并根据所述第一图片的第一因子获取所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差;
其中,所述第一因子为图片各像素点的L分量、α分量和β分量;或者
所述第一因子为图片各像素点的红色r分量、蓝色b分量和绿色g分量。
其中,平均值的计算方法为=(x1+x2+x3+……+xn)/N;
标准差的计算方法为
所述第一因子为图片各像素点的L分量、α分量和β分量的情况下,需要转换为图片的红色r分量、蓝色b分量和绿色g分量,所述图片的红色r分量、蓝色b分量和绿色g分量用于生成所述图片。
第二获取单元802,用于获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差;
第三获取单元803,用于根据所述第一图片的第一因子的平均值、所述第一图片的第一因子的标准差、所述第二图片的第一因子、所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,获取第二图片新的第一因子;
生成单元804,用于根据所述新的第一因子,生成第三图片,所述第三图片的第一因子的平均值和所述第一图片的第一因子的平均值相等,所述第三图片的第一因子的标准差和所述第一图片的第一因子的标准差相等;
其中,所述第一因子为图片各像素点的L分量、α分量和β分量;或者
所述第一因子为图片各像素点的红色r分量、蓝色b分量和绿色g分量。
可选地,所述第三获取单元803,具体用于:
将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;
将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;
将所述第一值和所述第二值相乘,获取第三值;
所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子。
具体的,表达式如下:
newL=(L2-mL2)*sL1/sL2+mL1;
newα=(α2-mα2)*sα1/sα2+mα1;
newβ=(β2-mβ2)*sβ1/sβ2+mβ1;
其中,L1用于表示第一图片的L分量,α1用于表示第一图片的α分量,β1用于表示第一图片的β分量;
mL1用于表示第一图片的L分量的平均值,sL1用于表示第一图片的L分量的标准差,mα1用于表示第一图片的α分量的平均值,sα1用于表示第一图片的α分量的标准差,mβ1用于表示第一图片的β分量的平均值,sβ1用于表示第一图片的β分量的标准差;
L2用于表示第二图片的L分量,α2用于表示第二图片的α分量,β2用于表示第二图片的β分量;
mL2用于表示第二图片的L分量的平均值,sL2用于表示第二图片的L分量的标准差,mα2用于表示第二图片的α分量的平均值,sα2用于表示第二图片的α分量的标准差,mβ2用于表示第二图片的β分量的平均值,sβ2用于表示第二图片的β分量的标准差。
或者,表达式如下:
newr=(r2-mr2)*sr1/sr2+mr1;
newg=(g2-mg2)*sg1/sg2+mg1;
newb=(b2-mb2)*sb1/sb2+mb1;
其中,mr1表示所述第一图片的红色r分量的平均值;sr1表示所述第一图片的红色r分量的标准差;mb1表示所述第一图片的蓝色b分量的平均值;sb1表示所述第一图片的蓝色b分量的标准差;mg1表示所述第一图片的绿色g分量的平均值;sg1表示所述第一图片的绿色g分量的标准差;
r2表示所述第二图片的r分量;b2表示所述第二图片的b分量;g2表示所述第二图片的g分量;mr2表示所述第二图片的红色r分量的平均值;sr2表示所述第二图片的红色r分量的标准差;mb2表示所述第二图片的蓝色b分量的平均值;sb2表示所述第二图片的蓝色b分量的标准差;mg2表示所述第二图片的绿色g分量的平均值;sg2表示所述第二图片的绿色g分量的标准差。
可选地,所述第一获取单元801,具体用于:
获取所述第一图片各像素点的L分量、α分量和β分量;
并根据所述第一图片各像素点的L分量、α分量和β分量获取所述第一图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述第二获取单元802,具体用于:
获取待处理的第二图片各像素点的L分量、α分量和β分量;
并根据所述待处理的第二图片各像素点的L分量、α分量和β分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述第三获取单元803,具体用于:
newL=(L2-mL2)*sL1/sL2+mL1;
newα=(α2-mα2)*sα1/sα2+mα1;
newβ=(β2-mβ2)*sβ1/sβ2+mβ1。
可选地,所述电子设备还包括转换生成单元,所述转换生成单元具体用于:
将所述第二图片的newL、newα、newβ转换成所述第二图片的新的红色r分量、蓝色b分量和绿色g分量;
根据所述第二图片的红色r分量、蓝色b分量和绿色g分量生成所述第二图片。
可选地,所述第一获取单元801,用于:
获取所述第一图片各像素点的r分量、b分量和g分量
并根据所述第一图片各像素点的r分量、b分量、g分量获取所述第一图片的r分量的平均值和标准差、第一图片的b分量的平均值和标准差、第一图片的g分量的平均值和标准差;
第二获取单元802,用于:
获取待处理的第二图片各像素点的r分量、b分量、g分量;
并根据所述待处理的第二图片各像素点的r分量、b分量、g分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述第三获取单元803,具体用于:
newr=(r2-mr2)*sr1/sr2+mr1;
newg=(g2-mg2)*sg1/sg2+mg1;
newb=(b2-mb2)*sb1/sb2+mb1。
所述第一图片为至少一张图片,所述第二图片为至少一张图片。
具体的,参考图2-图7所描述的实施例,在此不再赘述。
本发明实施例提供一种处理图片的电子设备,所述电子设备获取第一图片的第一因子、以及待处理的第二图片的第一因子,根据第一图片第一因子和待处理的第二图片第一因子的平均值和标准差的计算,获取第二图片的新的第一因子,并根据所述新的第一因子生成第三图片,从而实现了用户按照自己的意愿对图片进行个性化处理,扩大了图片处理的方式,提高了图片处理的效率,提高了用户体验。
图9是本发明实施例提供的一种处理图片的电子设备结构图。参考图9,图9是本发明实施例提供的一种电子设备900,本发明具体实施例并不对所述电子设备的具体实现做限定。所述电子设备900包括:
处理器(processor)901,通信接口(Communications Interface)902,存储器(memory)903,总线904。
处理器901,通信接口902,存储器903通过总线904完成相互间的通信。
通信接口902,用于与其他电子设备进行通信;
处理器901,用于执行程序。处理器为电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储单元内的软件程序和/或模块,以及调用存储在存储单元内的数据,以执行电子设备的各种功能和/或处理数据。所述处理器可以由集成电路(Integrated Circuit,简称IC)组成,例如可以由单颗封装的IC所组成,也可以由连接多颗相同功能或不同功能的封装IC而组成。举例来说,处理器可以仅包括中央处理器(Central Processing Unit,简称CPU),也可以是GPU、数字信号处理器(Digital Signal Processor,简称DSP)、及通信单元中的控制芯片(例如基带芯片)的组合。在本发明实施方式中,CPU可以是单运算核心,也可以包括多运算核心。具体地,所述处理器执行的程序可以包括程序代码,所述程序代码包括计算机操作指令。处理器901可能是一个中央处理器(central processing unit,CPU),或者是特定集成电路ASIC(Application Specific  Integrated Circuit),或者是被配置成实施本发明实施例的一个或多个集成电路。
存储器903,用于存储程序。存储器903可以是易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM),或者非易失性存储器(non-volatile memory),例如只读存储器(read-only memory,ROM),快闪存储器(flash memory),硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD)。处理器901根据存储器903存储的程序指令,执行以下方法:
获取所述第一图片的第一因子,并根据所述第一图片的第一因子获取所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差;
获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差;
根据所述第一图片的第一因子的平均值、所述第一图片的第一因子的标准差、所述第二图片的第一因子、所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,获取第二图片新的第一因子;
根据所述第二图片新的第一因子生成第三图片,所述第三图片的第一因子的平均值和所述第一图片的第一因子的平均值相等,所述第三图片的第一因子的标准差和所述第一图片的第一因子的标准差相等;
其中,所述第一因子为图片各像素点的L分量、α分量和β分量;或者
所述第一因子为图片各像素点的红色r分量、蓝色b分量和绿色g分量。
所述根据所述第一图片的第一因子的平均值、所述第一图片的第一因子的标准差、所述第二图片的第一因子、所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,获取第二图片新的第一因子,包括:
将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;
将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;
将所述第一值和所述第二值相乘,获取第三值;
所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子。
所述获取第一图片的第一因子,并根据所述第一图片的第一因子获取所 述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差,包括:
获取所述第一图片各像素点的L分量、α分量和β分量;
并根据所述第一图片各像素点的L分量、α分量和β分量,获取所述第一图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,包括:
获取待处理的第二图片各像素点的L分量、α分量和β分量;
并根据所述待处理的第二图片各像素点的L分量、α分量和β分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;将所述第一值和所述第二值相乘,获取第三值;将所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子,包括:
newL=(L2-mL2)*sL1/sL2+mL1;
newα=(α2-mα2)*sα1/sα2+mα1;
newβ=(β2-mβ2)*sβ1/sβ2+mβ1;
其中,L1用于表示第一图片的L分量,α1用于表示第一图片的α分量,β1用于表示第一图片的β分量;
mL1用于表示第一图片的L分量的平均值,sL1用于表示第一图片的L分量的标准差,mα1用于表示第一图片的α分量的平均值,sα1用于表示第一图片的α分量的标准差,mβ1用于表示第一图片的β分量的平均值,sβ1用于表示第一图片的β分量的标准差;
L2用于表示第二图片的L分量,α2用于表示第二图片的α分量,β2用于表示第二图片的β分量;
mL2用于表示第二图片的L分量的平均值,sL2用于表示第二图片的L分量的标准差,mα2用于表示第二图片的α分量的平均值,sα2用于表示 第二图片的α分量的标准差,mβ2用于表示第二图片的β分量的平均值,sβ2用于表示第二图片的β分量的标准差。
所述方法在获取所述第二图片新的第一因子之后,还包括:
将所述第二图片的newL、newα、newβ转换成所述第二图片的新的红色r分量、蓝色b分量和绿色g分量;
根据所述第二图片新的第一因子,生成第三图片,包括:
根据所述第二图片的新的红色r分量、蓝色b分量、绿色g分量生成第三图片。
所述获取第一图片的第一因子,并根据所述第一图片的第一因子获取所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差,包括:
获取所述第一图片各像素点的r分量、b分量和g分量
并根据所述第一图片各像素点的r分量、b分量、g分量获取所述第一图片的r分量的平均值和标准差、第一图片的b分量的平均值和标准差、第一图片的g分量的平均值和标准差;
所述获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,包括:
获取待处理的第二图片各像素点的r分量、b分量、g分量;
并根据所述待处理的第二图片各像素点的r分量、b分量、g分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
所述将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;将所述第一值和所述第二值相乘,获取第三值;所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子,所述第二图片新的第一因子用于生成第三图片,包括:
newr=(r2-mr2)*sr1/sr2+mr1;
newg=(g2-mg2)*sg1/sg2+mg1;
newb=(b2-mb2)*sb1/sb2+mb1;
其中,mr1表示所述第一图片的红色r分量的平均值;sr1表示所述第一图片的红色r分量的标准差;mb1表示所述第一图片的蓝色b分量的平均值;sb1表示所述第一图片的蓝色b分量的标准差;mg1表示所述第一图片的绿色g分量的平均值;sg1表示所述第一图片的绿色g分量的标准差;
r2表示所述第二图片的r分量;b2表示所述第二图片的b分量;g2表示所述第二图片的g分量;mr2表示所述第二图片的红色r分量的平均值;sr2表示所述第二图片的红色r分量的标准差;mb2表示所述第二图片的蓝色b分量的平均值;sb2表示所述第二图片的蓝色b分量的标准差;mg2表示所述第二图片的绿色g分量的平均值;sg2表示所述第二图片的绿色g分量的标准差。
所述第一图片为至少一张图片,所述第二图片为至少一张图片。
本发明实施例提供一种处理图片的电子设备,所述电子设备获取第一图片的第一因子、以及待处理的第二图片的第一因子,根据第一图片第一因子和待处理的第二图片第一因子的平均值和标准差的计算,获取第二图片的新的第一因子,并根据所述新的第一因子生成第三图片,从而实现了用户按照自己的意愿对图片进行个性化处理,扩大了图片处理的方式,提高了图片处理的效率,提高了用户体验。
需要说明的是,本发明实施例中的上述相应的技术特征可以相互参考。
本发明所揭示的电子设备可以实作成单独一台装置,或整合于各种不同的装置中,诸如移动电话、平板电脑(Tablet Personal Computer)、膝上型电脑(Laptop Computer)、多媒体播放器、数字摄影机、个人数字助理(personal digital assistant,简称PDA)、导航装置、移动上网装置(Mobile Internet Device,MID)或可穿戴式设备(Wearable Device)等。
以上所述,仅为本发明较佳的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应该以权利要求的保护范围为准。

Claims (10)

  1. 一种处理图片的方法,其特征在于,所述方法包括:
    获取第一图片的第一因子,并根据所述第一图片的第一因子获取所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差;
    获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差;
    根据所述第一图片的第一因子的平均值、所述第一图片的第一因子的标准差、所述第二图片的第一因子、所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,获取第二图片新的第一因子;
    根据所述第二图片新的第一因子生成第三图片,所述第三图片的第一因子的平均值和所述第一图片的第一因子的平均值相等,所述第三图片的第一因子的标准差和所述第一图片的第一因子的标准差相等;
    其中,所述第一因子为图片各像素点的L分量、α分量和β分量;或者
    所述第一因子为图片各像素点的红色r分量、蓝色b分量和绿色g分量。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述第一图片的第一因子的平均值、所述第一图片的第一因子的标准差、所述第二图片的第一因子、所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,获取第二图片新的第一因子,包括:
    将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;
    将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;
    将所述第一值和所述第二值相乘,获取第三值;
    将所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子。
  3. 根据权利要求2所述的方法,其特征在于,所述获取第一图片的第一因子,并根据所述第一图片的第一因子获取所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差,包括:
    获取所述第一图片各像素点的L分量、α分量和β分量;
    并根据所述第一图片各像素点的L分量、α分量和β分量,获取所述第 一图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
    所述获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,包括:
    获取待处理的第二图片各像素点的L分量、α分量和β分量;
    并根据所述待处理的第二图片各像素点的L分量、α分量和β分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
    所述将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;将所述第一值和所述第二值相乘,获取第三值;将所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子,包括:
    newL=(L2-mL2)*sL1/sL2+mL1;
    newα=(α2-mα2)*sα1/sα2+mα1;
    newβ=(β2-mβ2)*sβ1/sβ2+mβ1;
    其中,L1用于表示第一图片的L分量,α1用于表示第一图片的α分量,β1用于表示第一图片的β分量;
    mL1用于表示第一图片的L分量的平均值,sL1用于表示第一图片的L分量的标准差,mα1用于表示第一图片的α分量的平均值,sα1用于表示第一图片的α分量的标准差,mβ1用于表示第一图片的β分量的平均值,sβ1用于表示第一图片的β分量的标准差;
    L2用于表示第二图片的L分量,α2用于表示第二图片的α分量,β2用于表示第二图片的β分量;
    mL2用于表示第二图片的L分量的平均值,sL2用于表示第二图片的L分量的标准差,mα2用于表示第二图片的α分量的平均值,sα2用于表示第二图片的α分量的标准差,mβ2用于表示第二图片的β分量的平均值,sβ2用于表示第二图片的β分量的标准差。
  4. 根据权利要求3所述的方法,其特征在于,在获取所述第二图片新的第一因子后,所述方法还包括:
    将所述第二图片的newL、newα、newβ转换成所述第二图片的新的红色r分量、蓝色b分量和绿色g分量;
    根据所述第二图片新的第一因子,生成第三图片,包括:
    根据所述第二图片的新的红色r分量、蓝色b分量、绿色g分量生成第三图片。
  5. 根据权利要求2所述的方法,其特征在于,所述获取第一图片的第一因子,并根据所述第一图片的第一因子获取所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差,包括:
    获取所述第一图片各像素点的r分量、b分量和g分量;
    并根据所述第一图片各像素点的r分量、b分量、g分量获取所述第一图片的r分量的平均值和标准差、第一图片的b分量的平均值和标准差、第一图片的g分量的平均值和标准差;
    所述获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,包括:
    获取待处理的第二图片各像素点的r分量、b分量、g分量;
    并根据所述待处理的第二图片各像素点的r分量、b分量、g分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
    所述将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;将所述第一值和所述第二值相乘,获取第三值;将所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子,包括:
    newr=(r2-mr2)*sr1/sr2+mr1;
    newg=(g2-mg2)*sg1/sg2+mg1;
    newb=(b2-mb2)*sb1/sb2+mb1;
    其中,mr1表示所述第一图片的红色r分量的平均值;sr1表示所述第一图片的红色r分量的标准差;mb1表示所述第一图片的蓝色b分量的平均值;sb1表示所述第一图片的蓝色b分量的标准差;mg1表示所述第一图片的绿色g分量的平均值;sg1表示所述第一图片的绿色g分量的标准差;
    r2表示所述第二图片的r分量;b2表示所述第二图片的b分量;g2表示所述第二图片的g分量;mr2表示所述第二图片的红色r分量的平均值;sr2表示所述第二图片的红色r分量的标准差;mb2表示所述第二图片的蓝色b分量的平均值;sb2表示所述第二图片的蓝色b分量的标准差;mg2表示所述第二图片的绿色g分量的平均值;sg2表示所述第二图片的绿色g分量的标准差。
  6. 一种电子设备,其特征在于,所述电子设备包括:
    第一获取单元,用于获取第一图片的第一因子,并根据所述第一图片的第一因子获取所述第一图片的第一因子的平均值和所述第一图片的第一因子的标准差;
    第二获取单元,用于获取待处理的第二图片的第一因子,并根据所述第二图片的第一因子获取所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差;
    第三获取单元,用于根据所述第一图片的第一因子的平均值、所述第一图片的第一因子的标准差、所述第二图片的第一因子、所述第二图片的第一因子的平均值和所述第二图片的第一因子的标准差,获取第二图片新的第一因子;
    生成单元,用于根据所述新的第一因子,生成第三图片,所述第三图片的第一因子的平均值和所述第一图片的第一因子的平均值相等,所述第三图片的第一因子的标准差和所述第一图片的第一因子的标准差相等;
    其中,所述第一因子为图片各像素点的L分量、α分量和β分量;或者
    所述第一因子为图片各像素点的红色r分量、蓝色b分量和绿色g分量。
  7. 根据权利要求6所述的电子设备,其特征在于,所述第三获取单元,具体用于执行如下程序:
    将所述第二图片的第一因子和所述第二图片的第一因子的平均值相减,获取第一值;
    将所述第一图片的第一因子的标准差和所述第二图片的第一因子的标准差相除,获取第二值;
    将所述第一值和所述第二值相乘,获取第三值;
    将所述第三值和所述第二图片的第一因子的平均值相加,获取所述第二图片新的第一因子。
  8. 根据权利要求7所述的电子设备,其特征在于,所述第一获取单元,具体用于:
    获取所述第一图片各像素点的L分量、α分量和β分量;
    并根据所述第一图片各像素点的L分量、α分量和β分量,获取所述第一图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
    所述第二获取单元,具体用于:
    获取待处理的第二图片各像素点的L分量、α分量和β分量;
    并根据所述待处理的第二图片各像素点的L分量、α分量和β分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
    所述第三获取单元,具体用于执行如下程序:
    newL=(L2-mL2)*sL1/sL2+mL1;
    newα=(α2-mα2)*sα1/sα2+mα1;
    newβ=(β2-mβ2)*sβ1/sβ2+mβ1;
    其中,L1用于表示第一图片的L分量,α1用于表示第一图片的α分量,β1用于表示第一图片的β分量;
    mL1用于表示第一图片的L分量的平均值,sL1用于表示第一图片的L分量的标准差,mα1用于表示第一图片的α分量的平均值,sα1用于表示第一图片的α分量的标准差,mβ1用于表示第一图片的β分量的平均值,sβ1用于表示第一图片的β分量的标准差;
    L2用于表示第二图片的L分量,α2用于表示第二图片的α分量,β2用于表示第二图片的β分量;
    mL2用于表示第二图片的L分量的平均值,sL2用于表示第二图片的L分量的标准差,mα2用于表示第二图片的α分量的平均值,sα2用于表示第二图片的α分量的标准差,mβ2用于表示第二图片的β分量的平均值,sβ2用于表示第二图片的β分量的标准差。
  9. 根据权利要求8所述的电子设备,其特征在于,所述电子设备还包括转换单元,所述转换单元具体用于:
    将所述第二图片的newL、newα、newβ转换成所述第二图片的新的红色r分量、蓝色b分量和绿色g分量;
    所述生成单元,具体用于:
    根据所述第二图片的新的红色r分量、蓝色b分量、绿色g分量生成第三图片。
  10. 根据权利要求7所述的电子设备,其特征在于,所述第一获取单元,用于:
    获取所述第一图片各像素点的r分量、b分量和g分量;
    并根据所述第一图片各像素点的r分量、b分量、g分量获取所述第一图片的r分量的平均值和标准差、第一图片的b分量的平均值和标准差、第一图片的g分量的平均值和标准差;
    第二获取单元,用于:
    获取待处理的第二图片各像素点的r分量、b分量、g分量;
    并根据所述待处理的第二图片各像素点的r分量、b分量、g分量获取所述第二图片的L分量的平均值和标准差、α分量的平均值和标准差、β分量的平均值和平均值;
    所述第三获取单元,具体用于执行如下程序:
    newr=(r2-mr2)*sr1/sr2+mr1;
    newg=(g2-mg2)*sg1/sg2+mg1;
    newb=(b2-mb2)*sb1/sb2+mb1;
    其中,mr1表示所述第一图片的红色r分量的平均值;sr1表示所述第一图片的红色r分量的标准差;mb1表示所述第一图片的蓝色b分量的平均值;sb1表示所述第一图片的蓝色b分量的标准差;mg1表示所述第一图片的绿色g分量的平均值;sg1表示所述第一图片的绿色g分量的标准差;
    r2表示所述第二图片的r分量;b2表示所述第二图片的b分量;g2表示所述第二图片的g分量;mr2表示所述第二图片的红色r分量的平均值;sr2表示所述第二图片的红色r分量的标准差;mb2表示所述第二图片的蓝色b分量的平均值;sb2表示所述第二图片的蓝色b分量的标准差;mg2表示所述第二图片的绿色g分量的平均值;sg2表示所述第二图片的绿色g分量的标准差。
PCT/CN2015/070340 2014-01-28 2015-01-08 一种处理图片的方法及电子设备 WO2015113459A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
US15/114,801 US20160358320A1 (en) 2014-01-28 2015-01-08 Image processing method and electronic device
EP15743853.2A EP3091504A4 (en) 2014-01-28 2015-01-08 Image processing method and electronic device
JP2016548619A JP6273373B2 (ja) 2014-01-28 2015-01-08 画像処理方法および電子デバイス

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410042340.0A CN103761134A (zh) 2014-01-28 2014-01-28 一种处理图片的方法及电子设备
CN201410042340.0 2014-01-28

Publications (1)

Publication Number Publication Date
WO2015113459A1 true WO2015113459A1 (zh) 2015-08-06

Family

ID=50528378

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/070340 WO2015113459A1 (zh) 2014-01-28 2015-01-08 一种处理图片的方法及电子设备

Country Status (5)

Country Link
US (1) US20160358320A1 (zh)
EP (1) EP3091504A4 (zh)
JP (1) JP6273373B2 (zh)
CN (1) CN103761134A (zh)
WO (1) WO2015113459A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103942755B (zh) * 2013-01-23 2017-11-17 深圳市腾讯计算机系统有限公司 图像亮度调节方法和装置
CN103761134A (zh) * 2014-01-28 2014-04-30 华为技术有限公司 一种处理图片的方法及电子设备

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101872473A (zh) * 2010-06-25 2010-10-27 清华大学 基于过分割与优化的多尺度图像自然色彩融合方法及装置
US20110135200A1 (en) * 2009-12-04 2011-06-09 Chao-Ho Chen Method for determining if an input image is a foggy image, method for determining a foggy level of an input image and cleaning method for foggy images
CN102419867A (zh) * 2011-12-31 2012-04-18 大连海事大学 一种图像的润色方法
CN102509320A (zh) * 2011-10-25 2012-06-20 深圳市万兴软件有限公司 一种基于电子终端的图片处理方法和装置
CN102693532A (zh) * 2011-02-25 2012-09-26 微软公司 图像阴影和高光的自动局部调整
CN103761134A (zh) * 2014-01-28 2014-04-30 华为技术有限公司 一种处理图片的方法及电子设备

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020172419A1 (en) * 2001-05-15 2002-11-21 Qian Lin Image enhancement using face detection
JP4843297B2 (ja) * 2005-11-24 2011-12-21 良次 大塲 被写体監視方法、被写体監視装置、および被写体監視プログラム
US8103120B2 (en) * 2008-09-22 2012-01-24 Solomon Systech Limited Method and apparatus of local contrast enhancement
CN101661730B (zh) * 2009-09-15 2012-01-04 华为终端有限公司 减少图片显示的色阶的方法和装置
US8280184B2 (en) * 2010-04-01 2012-10-02 Himax Media Solutions, Inc. Image enhancement method and apparatuses utilizing the same

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110135200A1 (en) * 2009-12-04 2011-06-09 Chao-Ho Chen Method for determining if an input image is a foggy image, method for determining a foggy level of an input image and cleaning method for foggy images
CN101872473A (zh) * 2010-06-25 2010-10-27 清华大学 基于过分割与优化的多尺度图像自然色彩融合方法及装置
CN102693532A (zh) * 2011-02-25 2012-09-26 微软公司 图像阴影和高光的自动局部调整
CN102509320A (zh) * 2011-10-25 2012-06-20 深圳市万兴软件有限公司 一种基于电子终端的图片处理方法和装置
CN102419867A (zh) * 2011-12-31 2012-04-18 大连海事大学 一种图像的润色方法
CN103761134A (zh) * 2014-01-28 2014-04-30 华为技术有限公司 一种处理图片的方法及电子设备

Also Published As

Publication number Publication date
JP6273373B2 (ja) 2018-01-31
US20160358320A1 (en) 2016-12-08
JP2017505952A (ja) 2017-02-23
EP3091504A1 (en) 2016-11-09
EP3091504A4 (en) 2017-01-25
CN103761134A (zh) 2014-04-30

Similar Documents

Publication Publication Date Title
US9811894B2 (en) Image processing method and apparatus
US9478054B1 (en) Image overlay compositing
JP6475339B2 (ja) 画像共有方法及び装置、並びに端末デバイス
JP6326411B2 (ja) ビデオ通信方法、ビデオ通信装置、プログラム及び記録媒体
WO2021218325A1 (zh) 视频处理方法、装置、计算机可读介质和电子设备
US8538089B2 (en) Method of performing eyebrow shaping on an image and related computing device
WO2016180126A1 (zh) 一种图像处理方法和装置
WO2019114328A1 (zh) 一种基于增强现实的视频处理方法及其装置
WO2014146561A1 (zh) 缩略图生成方法及系统
CN109948093B (zh) 表情图片生成方法、装置及电子设备
US10373361B2 (en) Picture processing method and apparatus
WO2017076199A1 (zh) 一种相机应用的图像预览方法、装置及相机应用系统
TW201923703A (zh) 圖像硬體編碼處理方法和裝置
WO2021169736A1 (zh) 美颜处理方法及装置
EP4170580A1 (en) Picture processing method and apparatus, device, and storage medium
JP2024506639A (ja) 画像表示方法、装置、機器及び媒体
WO2015113459A1 (zh) 一种处理图片的方法及电子设备
JP7471510B2 (ja) ピクチャのビデオへの変換の方法、装置、機器および記憶媒体
WO2022016996A1 (zh) 图像处理方法、装置、电子设备及计算机可读存储介质
CN111583102B (zh) 人脸图像处理方法、装置、电子设备及计算机存储介质
US11967344B2 (en) Video processing method and apparatus, device and computer readable storage medium
WO2017124312A1 (zh) 一种基于微信的共享信息分享方法及系统
JP2023070068A (ja) 動画結合方法、装置、電子機器および記憶媒体
US20140193083A1 (en) Method and apparatus for determining the relationship of an image to a set of images
WO2017084011A1 (zh) 一种视频平滑方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15743853

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2016548619

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 15114801

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

REEP Request for entry into the european phase

Ref document number: 2015743853

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2015743853

Country of ref document: EP