Summary of the invention
In view of this, main purpose of the present invention is to provide a kind of method of digital image exposure adjustment, can adjust the digital picture of exposure easily, makes photo reach more perfect effect.
Another object of the present invention is to provide a kind of device of digital image exposure adjustment, can adjust the digital picture of exposure easily, make photo reach more perfect effect.
For achieving the above object, technical scheme of the present invention specifically is achieved in that
The method that a kind of digital image exposure is adjusted, this method may further comprise the steps:
Original image is duplicated two parts, obtain first intermediate images and second intermediate images;
When described original image is under-exposed image,
Dark portion in described first intermediate images is separated, described second intermediate images is carried out the adjustment that brightens of dark portion; With described original image and described dark portion first intermediate images of adjusted second intermediate images after separating with described dark portion that brighten serves as to cover layer to superpose according to screen S creen pattern, obtains image behind the final required digital light filling,
Or, when described original image is over-exposed image,
Highlights in described first intermediate images is separated, described second intermediate images is carried out the highlight shadowing adjustment; First intermediate images after adjusted second intermediate images of described original image and described highlight shadowing separated with described highlights serves as to cover layer to superpose according to positive stack Multiply pattern, obtains image behind the final required digital dim light.
The device that a kind of digital image exposure is adjusted, this device comprises: copied cells, processing unit and superpositing unit, described copied cells is used for original image is duplicated two parts, obtains first intermediate images and second intermediate images,
When described original image is under-exposed image, described processing unit, the dark portion to described first intermediate images of being used for separates and described second intermediate images is carried out the adjustment that brightens of dark portion; Described superpositing unit, with described original image and described dark portion first intermediate images of adjusted second intermediate images after separating with described dark portion that brighten serves as to cover layer to superpose according to screen S creen pattern, obtain image behind the final required digital light filling, or
When described original image was over-exposed image, described processing unit was used for highlights to described first intermediate images and separates and described second intermediate images is carried out the highlight shadowing adjustment; Described superpositing unit, first intermediate images after being used for adjusted second intermediate images of described original image and described highlight shadowing separated with described highlights serves as to cover layer to superpose according to positive stack Multiply pattern, obtains image behind the final required digital dim light.
Described copied cells comprises:
Pending subelement is used to preserve described original image;
The replicon unit is used for the original image of pending subelement is duplicated.
Described processing unit comprises:
Handling subelement, be used for described each pixel of first intermediate images, be transitional region with [Threshold, Threshold+feather], carries out gray value calculating according to following formula respectively, first intermediate images after obtaining dark portion and separating:
Wherein, described Threshold is 80, and described feather is (255-Threshold); Described Gray represents the gray values of pixel points on described first intermediate images; Described Value represents the gray values of pixel points on first intermediate images after described dark portion separates; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign;
Adjust subelement, be used for by inquiry being used to of setting in advance preserve dark portion brighten adjust before and after the form of corresponding value relation, red R component value on each pixel in described second intermediate images, green G component value and blue B component value are converted to adjusted value in the described form respectively by the value before adjusting, obtain dark portion adjusted second intermediate images that brightens.
Described superpositing unit comprises:
Be used for brightening each of adjusted second intermediate images and described dark portion first intermediate images after separating to corresponding pixel points at being positioned at described original image and described dark portion, calculate according to following formula respectively, obtain image behind the digital light filling:
R3=R1+R2*(255-MaskBmp[i])/255*K
-(R1*R2*((255-MaskBmp[i])/255)*K)/255’
Wherein, i represents arbitrary pixel; Described MaskBmp[i] gray value on i the pixel in first intermediate images of the described dark portion of expression after separating; Described coefficient correlation K is a figure layer transparency coefficient, and its value is one more than or equal to 0 and smaller or equal to 1 real number; Described R1 represents to be arranged in R, G, the B component value on the pixel of original image of described under-exposure; Described R2 represents to be arranged in described dark portion brighten R, G, B component value on the pixel of adjusted second intermediate images; Described R3 represents to be arranged in R, G, the B component value on the pixel of image behind the described digital light filling; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign.
Described processing unit comprises:
Handling subelement, be used for each pixel to described first intermediate images, be transitional region with [Threshold, Threshold+feather], carries out gray value calculating according to following formula respectively, first intermediate images after obtaining highlights and separating:
Wherein, described Threshold is 100, and described feather is (255-Threshold); Described Gray represents the gray values of pixel points on described first intermediate images; Described Value represents the gray values of pixel points on first intermediate images after described dark portion separates; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign;
Adjust subelement, be used for by inquiry being used to of setting in advance preserve highlight shadowing adjust before and after the form of corresponding value relation, R component value on each pixel in described second intermediate images, G component value and B component value are converted to adjusted value in the described form respectively by the value before adjusting, obtain adjusted second intermediate images of highlight shadowing.
Described superpositing unit comprises:
Be used at each of first intermediate images after being positioned at described original image and adjusted second intermediate images of described highlight shadowing and described highlights separating corresponding pixel points, calculate according to following formula respectively, obtain image behind the digital dim light:
R6=R4*(R5+(255-R5)*(1-MaskBmp[i]/255)*(1-K))/255,
Wherein, i represents arbitrary pixel; Described MaskBmp[i] i gray values of pixel points in first intermediate images of the described highlights of expression after separating; Described K is a figure layer transparency coefficient, and its value is one more than or equal to 0 and smaller or equal to 1 real number; Described R5 represents to be arranged in R, G, the B component value on the pixel of adjusted second intermediate images of described highlight shadowing; Described R4 represents to be arranged in R, G, the B component value on the pixel of described over-exposed original image; Described R6 represents to be arranged in R, G, the B component value on the pixel of image behind the described digital dim light; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign.
As seen, adopt technical scheme of the present invention, by to the original image after under-exposed and the over-exposed two kinds of exposures, threshold process that dark portion is separated, dark portion adjustments, the stack of Screen pattern and the threshold process that highlights is separated, highlight shadowing adjustment, the Multiply pattern two kinds of different exposure adjustment methods that superpose that brighten have been adopted respectively, thereby finished adjustment, made image reach more perfect effect under-exposed and over-exposed image.In addition, scheme of the present invention can be applicable in the softwares such as nEO iMAGING, and the user only need click corresponding button, and software self can be finished processing according to scheme of the present invention on the backstage, for the user has saved time and expense, convenient for users.
Embodiment
At problems of the prior art, the present invention proposes a kind of new digital image exposure and adjusts scheme, carries out digital light filling and over-exposed picture is carried out digital dim light with the picture of realization to under-exposure.
Before introducing concrete implementation, at first introduce the notion of RGB (RGB) colour model.The rgb color model is a kind of color standard of industrial quarters, obtain various colors by R, G, three Color Channels of B being changed and they being superposeed each other, so, for each pixel in the image, all available R, G, three components of B (passage) are represented.Usually, the span of each component is 0~255; Like this, as R, G, when the B component is got different values respectively, the color of corresponding expression is also with difference.Such as, pure red R component value is 255, G component value and B component value are 0; The R component value of shiny red is 246, and the G component value is 20, and the B component value is 50.
Based on above-mentioned introduction, the specific implementation of scheme of the present invention comprises: original image is duplicated two parts, obtain first intermediate images and second intermediate images; Described first intermediate images is carried out threshold process, described second intermediate images is carried out the brightness adjustment; With described original image and adjusted second intermediate images of described brightness first intermediate images after with described threshold process serves as to cover layer to superpose, and obtains final needing image.
In the embodiment of the invention, being under-exposure or over-exposed judgement to original image, is that the subjective desire according to the people carries out, also be this image of human eye perceives for under-exposed, then it is carried out the operation of digital light filling; People's subjectivity thinks that this image exposure is excessive, then this image is carried out the operation of digital light filling, more meets the effect that the people can view and admire thereby processing back image is reached.
Need to prove that above-mentioned determination methods for original image quality is not limited to technical scheme of the present invention only for illustrating.Thereby also can come the quality of automatic detected image to judge that image is under-exposed or over-exposed, for example can pass through gray value of detected image or the like among the present invention by associative operation software.
For make purpose of the present invention, technical scheme, and advantage clearer, below with reference to the accompanying drawing embodiment that develops simultaneously, the present invention is described in more detail.
Fig. 1 is the flow chart of digital image exposure method of adjustment embodiment of the present invention.Before the adjustment that exposes, can duplicate original image, with the image that is duplicated be respectively applied for threshold process that the dark portion of image is separated, dark portion brightens and adjusts and the threshold process that the image highlights is separated, highlight shadowing adjustment, also can directly carry out above-mentioned threshold process and brightness adjustment to original image.As shown in Figure 1, may further comprise the steps:
Step 101: original image is duplicated two parts, obtain first intermediate images and second intermediate images.
How to copy as prior art, repeat no more here.
Step 102: first intermediate images is carried out threshold process, second intermediate images is carried out the brightness adjustment.
If original image is under-exposed image, then need the operation carried out as follows:
The threshold process that first intermediate images in the step 102 is carried out is that the dark portion in the image is separated, and the brightness adjustment that second intermediate images in the step 102 is carried out is the adjustment that brightens of dark portion.
After dark portion in first intermediate images separated, just can directly improve the brightness of dark portion effectively, specifically comprise:
1, the transitional region of described first intermediate images of setting is [Threshold, Threshold+feather];
2,, carry out gray value according to following formula respectively and calculate, first intermediate images after obtaining dark portion and separating to each pixel in described first intermediate images:
Above in described first intermediate images computing formula of each gray values of pixel points be:
Gray=(R*28+G*77+B*151)/255
Or Gray=(R+G+B)/3;
Wherein, described Threshold is a threshold point, and value is 80, and described feather is the emergence parameter, and value is (255-Threshold), and described Gray represents the gray values of pixel points on described first intermediate images; Described R, G, B represent to be arranged in R, G, the B component value on the pixel of original image of described under-exposure respectively; Described Value represents the gray values of pixel points on first intermediate images after described dark portion separates; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign.
In the present embodiment, to the also promptly under-exposed original image of second intermediate images carry out dark portion brighten when adjusting be by inquiry being used to of setting in advance preserve dark portion brighten adjust before and after the form of corresponding value relation, R component value on each pixel in described second intermediate images, G component value and B component value be converted to adjusted value in the described form respectively by the value before adjusting, thereby obtain dark portion adjusted second intermediate images that brightens.
Wherein, being provided with of form described in the present embodiment adopted light filling brightness mapping curve as shown in Figure 2.In Fig. 2, transverse axis is represented the pixel range of original image, and the pixel range after the longitudinal axis is represented to shine upon, slope are that 1 straight line is the pixel mapping line of standard, and curve is the line when in the present embodiment under-exposed image being carried out light filling brightness mapping.This curve is along with the change of pixel value is big, and slope correspondingly reduces, and until being 0, also promptly promoting for the brightness of dark portion and is greater than highlights.
After three passages of R, G, B of the original image of under-exposure are carried out light filling brightness mapping among Fig. 2 respectively, obtain dark portion adjusted second intermediate images that brightens, the pixel value scope of the R of this image, G, B is by original [0,255] become [0,128], the light filling effect is determined by slope of a curve.
If original image is over-exposed image, then need to carry out following operation:
The threshold process that first intermediate images in the step 102 is carried out is that the highlights in the image is separated, and the brightness adjustment that second intermediate images in the step 102 is carried out is the highlight shadowing adjustment.
First intermediate images is carried out highlights to be separated specifically and comprises:
1, the transitional region of the described gray level image of setting is [Threshold, Threshold+feather];
2,, carry out gray value according to following formula respectively and calculate, first intermediate images after obtaining highlights and separating to each pixel in the described gray level image:
Above in described first intermediate images computing formula of each gray values of pixel points be:
Gray=(R*28+G*77+B*151)/255
Or Gray=(R+G+B)/3;
Wherein, described Threshold is a threshold point, and value is 100, and described feather is the emergence parameter, and value is (255-Threshold), and described Gray represents the gray values of pixel points on described first intermediate images; Described R, G, B represent to be arranged in R, G, the B component value on the pixel of described over-exposed original image respectively; Described Value represents the gray values of pixel points on first intermediate images after described highlights separates; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign.
In the present embodiment, to second intermediate images also be over-exposed original image carry out highlight shadowing when adjusting by inquiry being used to of setting in advance preserve highlight shadowing adjust before and after the form of corresponding value relation, R component value on each pixel in described second intermediate images, G component value and B component value are converted to adjusted value in the described form respectively by the value before adjusting, promptly obtain adjusted second intermediate images of highlight shadowing.
Form in the present embodiment is by adopting dim light brightness mapping curve as shown in Figure 3 to obtain.In Fig. 3, transverse axis is represented the pixel range of original image, and the pixel range after the longitudinal axis is represented to shine upon, slope are that 1 straight line is the pixel mapping line of standard, and curve is the line when in the present embodiment over-exposed image being carried out dim light brightness mapping.This curve is along with the change of pixel value is big, and slope correspondingly increases, and until being 1, also promptly is greater than dark portion for the inhibitory action of highlights.
After three passages of R, G, B of over-exposed original image are carried out dim light brightness mapping among Fig. 3 respectively, promptly obtain adjusted second intermediate images of highlight shadowing, the pixel value scope of the R of this image, G, B is by original [0,255] become [128,255], the dim light effect is determined by slope of a curve.
Step 103: with original image and adjusted second intermediate images of brightness first intermediate images after with threshold process serves as to cover layer to superpose, and obtains final needing image.
The same with step 102, this step has adopted two kinds of different methods of operation for under-exposed respectively with over-exposed original image.
Original image for under-exposure, owing to the dark portion to image separates image after the threshold process that obtains is first intermediate images after dark portion separates, adopting the dark portion that obtains after the light filling brightness mapping to brighten to adjust image is dark portion adjusted second intermediate images that brightens, so this operation should be: with the original image and the described dark portion of under-exposure first intermediate images of adjusted second intermediate images after separating with described dark portion that brighten serves as to cover layer to superpose according to the Screen pattern, obtain image behind the final required digital light filling, specifically may further comprise the steps:
1) all pixels are handled by following formula on the pixel of first intermediate images after dark portion is separated, and try to achieve coefficient correlation K1,
K1=(255-MaskBmp[i]/3)/255;
2) brighten each pixel of adjusted second intermediate images of dark portion be multiply by coefficient correlation K1*K2, obtain new dark portion adjusted second intermediate images that brightens;
3) brighten each of adjusted second intermediate images to corresponding pixel points at the original image that is arranged in described under-exposure and described new dark portion, calculate according to following formula respectively, obtain image behind the digital light filling:
R3=R1+R2-R1*R2/255;
G3=G1+G2-G1*G2/255;
B3=B1+B2-B1*B2/255;
Wherein, i represents arbitrary pixel; Described MaskBmp[i] i gray values of pixel points in first intermediate images of the described dark portion of expression after separating; Described coefficient correlation K2 is a figure layer transparency coefficient, and its value is one more than or equal to 0 and smaller or equal to 1 real number; Described R1, G1, B1 represent to be arranged in R, G, the B component value on the pixel of original image of described under-exposure respectively; Described R2, G2, B2 represent to be arranged in described new dark portion brighten R, G, B component value on the pixel of adjusted second intermediate images respectively; Described R3, G3, B3 represent to be arranged in R, G, the B component value on the pixel of image behind the described digital light filling respectively; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign.
This operation can be summarized as: brighten each of adjusted second intermediate images and described dark portion first intermediate images after separating to corresponding pixel points at being arranged in described original image and described dark portion, calculate according to following formula respectively, obtain image behind the digital light filling:
R3=R1+R2*(255-MaskBmp[i])/255*K
-(R1*R2*((255-MaskBmp[i])/255)*K)/255’
Wherein, i represents arbitrary pixel; Described MaskBmp[i] gray value on i the pixel in first intermediate images of the described dark portion of expression after separating; Described coefficient correlation K is a figure layer transparency coefficient, and its value is one more than or equal to 0 and smaller or equal to 1 real number; Described R1 represents to be arranged in R, G, the B component value on the pixel of described original image; Described R2 represents to be arranged in described dark portion brighten R, G, B component value on the pixel of adjusted second intermediate images; Described R3 represents to be arranged in R, G, the B component value on the pixel of image behind the described digital light filling; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign.
Carrying out in the Screen pattern that figure is stacked to be added, is because the color in the Screen pattern has the effect of addition, by the picture of this mode treatment, divides than highlights to keep constant, can highlight than the color of dark-part, promptly can reach the effect of digital light filling.
The basic principle of brief description Screen pattern, if bitmap, TempBmp and MaskBmp represent under-exposed original image respectively, the original image of under-exposure are carried out the image after the light filling brightness mapping and the original image of under-exposure carried out the dark portion adjusted image that brightens, bitmap, TempBmp, i pixel of MaskBmp are respectively bmp[i],, bmp2[i] and MaskBmp[i], result[i] i the pixel of expression final image result, then each pixel is carried out following operation respectively according to the Screen pattern:
Wherein, described * represents multiplication sign, and is described+the expression plus sige, described-the expression minus sign.
For over-exposed original image, separate image after the threshold process that obtains owing to highlights and be first intermediate images after highlights separates to image, image is adjusted second intermediate images of highlight shadowing after the highlight shadowing adjustment that obtains after adopting dim light brightness to shine upon, so this operation should be: first intermediate images after adjusted second intermediate images of over-exposed original image and described highlight shadowing separated with described highlights serves as to cover layer to superpose according to the Multiply pattern, obtain image behind the final required digital dim light, specifically may further comprise the steps:
1, all pixels are handled by following formula on first intermediate images after highlights is separated, and try to achieve coefficient correlation K3,
K3=(MaskBmp[i]/3)/255;
2, each pixel of adjusted second intermediate images of highlight shadowing is calculated according to following formula, is obtained adjusted second intermediate images of new highlight shadowing,
R5=R5’+(255-R5’)*(1-K3)*(1-K2);
G5=G5’+(255-G5’)*(1-K3)*(1-K2);
B5=B5’+(255-B5’)*(1-K3)*(1-K2);
3, at be arranged in described over-exposed original image and described new adjusted second intermediate images of highlight shadowing each to corresponding pixel points, calculate according to following formula respectively, obtain image behind the digital dim light:
R6=R4*R5/255;
G6=G4*G5/255;
B6=B4*B5/255;
Wherein, i represents arbitrary pixel; Described MaskBmp[i] i gray values of pixel points in first intermediate images of the described highlights of expression after separating; Described K2 is a figure layer transparency coefficient, and its value is one more than or equal to 0 and smaller or equal to 1 real number; Described R5 ', G5 ', B5 ' represent to be arranged in R, G, the B component value on the pixel of adjusted second intermediate images of described highlight shadowing respectively; Described R5, G5, B5 represent to be arranged in R, G, the B component value on the pixel of described new adjusted second intermediate images of highlight shadowing respectively; Described R4, G4, B4 represent to be arranged in R, G, the B component value on the pixel of described over-exposed original image respectively; Described R6, G6, B6 represent to be arranged in R, G, the B component value on the pixel of image behind the described digital dim light respectively; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign.
This operation can be summarized as: at each of first intermediate images after being arranged in described original image and adjusted second intermediate images of described highlight shadowing and described highlights separating to corresponding pixel points, calculate according to following formula respectively, obtain image behind the digital dim light:
R6=R4*(R5+(255-R5)*(1-MaskBmp[i]/255)*(1-K))/255,
Wherein, i represents arbitrary pixel; Described MaskBmp[i] i gray values of pixel points in first intermediate images of the described highlights of expression after separating; Described K is a figure layer transparency coefficient, and its value is one more than or equal to 0 and smaller or equal to 1 real number; Described R5 represents to be arranged in R, G, the B component value on the pixel of adjusted second intermediate images of described highlight shadowing; Described R4 represents to be arranged in R, G, the B component value on the pixel of described original image; Described R6 represents to be arranged in R, G, the B component value on the pixel of image behind the described digital dim light; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign.
Carry out according to the Multiply pattern that figure is stacked to be added, with the superimposed mixing of colourity of two figure layers, the overlay color that is produced is darker than both colors separately, thereby reaches the effect of digital dim light.
So far, promptly finished the processing procedure that the digital image exposure among the method for the invention embodiment is adjusted.
Based on said method, Fig. 4 is the composition structural representation of digital image exposure adjusting device embodiment of the present invention.As shown in Figure 4, this device comprises:
Copied cells 41 is used for original image is duplicated two parts, obtains first intermediate images and second intermediate images;
Processing unit 42 is used for described first intermediate images is carried out threshold process and described second intermediate images is carried out the brightness adjustment;
Superpositing unit 43, being used for described original image and adjusted second intermediate images of described brightness first intermediate images after with described threshold process serves as to cover layer to superpose, and obtains final needing image.
Wherein, copied cells 41 can specifically comprise:
Pending subelement 411 is used to preserve described original image;
Replicon unit 412 is used for the original image of pending subelement 411 is duplicated.
For under-exposed and over-exposed two kinds of original images, the effect of the concrete module in processing unit 42 and the superpositing unit 43 is different.
For the original image of under-exposure, the acting as of processing unit 42: the dark portion to described first intermediate images of being used for separates and described second intermediate images is carried out the adjustment that brightens of dark portion, and it specifically can comprise again:
Handling subelement 421, be used for described each pixel of first intermediate images, be transitional region with [Threshold, Threshold+feather], carries out gray value calculating according to following formula respectively, first intermediate images after obtaining dark portion and separating:
Wherein, described threshold value Threshold is 80, and described emergence parameter f eather is (255-Threshold); Described Gray represents the gray values of pixel points on described first intermediate images; Described Value represents the gray values of pixel points on first intermediate images after described dark portion separates; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign;
Adjust subelement 422, be used for by inquiry being used to of setting in advance preserve dark portion brighten adjust before and after the form of corresponding value relation, R component value on each pixel in described second intermediate images, G component value and B component value are converted to adjusted value in the described form respectively by the value before adjusting, obtain dark portion adjusted second intermediate images that brightens.
For over-exposed original image, the acting as of processing unit 42: be used for the highlights of described first intermediate images is separated, the described second interim original image is carried out the highlight shadowing adjustment, it specifically comprises again:
Handle subelement 421, being used for each pixel to described first intermediate images, is transitional region with [Threshold, Threshold+feather], carry out gray value according to following formula respectively and calculate, first intermediate images after obtaining highlights and separating:
Wherein, described threshold value Threshold is 100, and described emergence parameter f eather is (255-Threshold); Described Gray represents the gray values of pixel points on described first intermediate images; Described Value represents the gray values of pixel points on first intermediate images after described highlights separates; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign;
Adjust subelement 422, be used for by inquiry being used to of setting in advance preserve highlight shadowing adjust before and after the form of corresponding value relation, R component value on each pixel in described second intermediate images, G component value and B component value are converted to adjusted value in the described form respectively by the value before adjusting, obtain adjusted second intermediate images of highlight shadowing.
Original image for under-exposure, acting as of superpositing unit 43: with the original image and the described dark portion of described under-exposure first intermediate images of adjusted second intermediate images after separating with described dark portion that brighten serves as to cover layer to superpose according to the Screen pattern, obtain image behind the final required digital light filling, can be specially:
Be used for brightening each of adjusted second intermediate images and described dark portion first intermediate images after separating to corresponding pixel points at being positioned at described original image and described dark portion, calculate according to following formula respectively, obtain image behind the digital light filling:
R3=R1+R2*(255-MaskBmp[i])/255*K
-(R1*R2*((255-MaskBmp[i])/255)*K)/255’
Wherein, i represents arbitrary pixel; Described MaskBmp[i] gray value on i the pixel in first intermediate images of the described dark portion of expression after separating; Described coefficient correlation K is a figure layer transparency coefficient, and its value is one more than or equal to 0 and smaller or equal to 1 real number; Described R1 represents to be arranged in R, G, the B component value on the pixel of described original image; Described R2 represents to be arranged in described dark portion brighten R, G, B component value on the pixel of adjusted second intermediate images; Described R3 represents to be arranged in R, G, the B component value on the pixel of image behind the described digital light filling; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign.
Wherein can comprise again:
First computation subunit 431, all pixels are handled by following formula on first intermediate images after being used for the described dark portion that the processing subelement 421 by processing unit 42 obtains separated, and try to achieve coefficient correlation K1,
K1=(255-MaskBmp[i]/3)/255;
Second computation subunit 432 is used for brighten each pixel of adjusted second intermediate images of the described dark portion that the adjustment subelement 422 by processing unit 42 obtains be multiply by coefficient correlation K1*K2, obtains new dark portion adjusted second intermediate images that brightens;
The 3rd computation subunit 433, be used for brightening each of adjusted second intermediate images to corresponding pixel points at the original image that is positioned at described under-exposure and by the described new dark portion that second computation subunit 432 obtains, calculate according to following formula respectively, obtain image behind the digital light filling:
R3=R1+R2-R1*R2/255;
G3=G1+G2-G1*G2/255;
B3=B1+B2-B1*B2/255;
Wherein, i represents arbitrary pixel; Described MaskBmp[i] i gray values of pixel points in first intermediate images of the described dark portion of expression after separating; Described coefficient correlation K2 is a figure layer transparency coefficient, and its value is one more than or equal to 0 and smaller or equal to 1 real number; Described R1, G1, B1 represent to be arranged in R, G, the B component value on the pixel of original image of described under-exposure respectively; Described R2, G2, B2 represent to be arranged in described new dark portion brighten R, G, B component value on the pixel of adjusted second intermediate images respectively; Described R3, G3, B3 represent to be arranged in R, G, the B component value on the pixel of image behind the described digital light filling respectively; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign.
For over-exposed original image, acting as of superpositing unit 43: serves as to cover layer to superpose according to the Multiply pattern with described over-exposed original image with first intermediate images after adjusted second intermediate images of described highlight shadowing separates with described highlights, obtain image behind the final required digital dim light, can be specially:
Be used at each of first intermediate images after being positioned at described original image and adjusted second intermediate images of described highlight shadowing and described highlights separating corresponding pixel points, calculate according to following formula respectively, obtain image behind the digital dim light:
R6=R4*(R5+(255-R5)*(1-MaskBmp[i]/255)*(1-K))/255,
Wherein, i represents arbitrary pixel; Described MaskBmp[i] i gray values of pixel points in first intermediate images of the described highlights of expression after separating; Described K is a figure layer transparency coefficient, and its value is one more than or equal to 0 and smaller or equal to 1 real number; Described R5 represents to be arranged in R, G, the B component value on the pixel of adjusted second intermediate images of described highlight shadowing; Described R4 represents to be arranged in R, G, the B component value on the pixel of described original image; Described R6 represents to be arranged in R, G, the B component value on the pixel of image behind the described digital dim light; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign.
This superpositing unit 43 can comprise again:
First computation subunit 431, all pixels are handled by following formula on first intermediate images after being used for the described highlights that the processing subelement 421 by processing unit 42 obtains separated, and try to achieve coefficient correlation K3,
K3=(MaskBmp[i]/3)/255;
Second computation subunit 432, each pixel that is used for adjusted second intermediate images of described highlight shadowing that the adjustment subelement 422 by processing unit 42 is obtained is calculated according to following formula, obtains adjusted second intermediate images of new highlight shadowing,
R5=R5’+(255-R5’)*(1-K3)*(1-K2);
G5=G5’+(255-G5’)*(1-K3)*(1-K2);
B5=B5’+(255-B5’)*(1-K3)*(1-K2);
The 3rd computation subunit 433, be used at each of described new adjusted second intermediate images of highlight shadowing that is positioned at described over-exposed original image and obtains by second computation subunit 432 corresponding pixel points, calculate according to following formula respectively, obtain image behind the digital dim light:
R6=R4*R5/255;
G6=G4*G5/255;
B6=B4*B5/255;
Wherein, i represents arbitrary pixel; Described MaskBmp[i] i gray values of pixel points in first intermediate images of the described highlights of expression after separating; Described K2 is a figure layer transparency coefficient, and its value is one more than or equal to 0 and smaller or equal to 1 real number; Described R5 ', G5 ', B5 ' represent to be arranged in R, G, the B component value on the pixel of adjusted second intermediate images of described highlight shadowing respectively; Described R5, G5, B5 represent to be arranged in R, G, the B component value on the pixel of described new adjusted second intermediate images of highlight shadowing respectively; Described R4, G4, B4 represent to be arranged in R, G, the B component value on the pixel of described over-exposed original image respectively; Described R6, G6, B6 represent to be arranged in R, G, the B component value on the pixel of image behind the described digital dim light respectively; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign.
The concrete workflow of device shown in Figure 4 please refer to the respective description among the method embodiment shown in Figure 1, repeats no more herein.
Fig. 5 carries out histogram information schematic diagram behind the digital light filling for under-exposed image and to it.Among Fig. 5, solid line is the histogram information of under-exposed image, and dotted line is for carrying out the histogram information behind the digital light filling to under-exposed image.As can be seen from Figure 5, the pixel value of under-exposed image is all lower, also is that the dark zone of image is very gloomy, and the loss of detail of image is a lot; Then become more even through the histogram distribution behind the digital light filling, thereby reached due light filling effect.
Fig. 6 carries out histogram information schematic diagram behind the digital dim light for over-exposed image and to it.Among Fig. 6, solid line is the histogram information of over-exposed image, and dotted line is for carrying out the histogram information behind the digital dim light to over-exposed image.As shown in Figure 6, the pixel value of over-exposed image is all than higher, and the image highlights is very bright; Distribution becomes more even through the image histogram behind the digital dim light, and the variation of colourity and brightness is also very level and smooth.
Here the histogram of being mentioned is meant with the form of X-Y scheme and expresses R, G, the distribution situation of B component on different values in all pixels of original image.In simple terms, the transverse axis in the histogram is used to represent all possible value 0~255 of each component, and the longitudinal axis is used to represent the corresponding respectively number of pixels of different values (or the corresponding respectively number of pixels of obstructed value accounts for the ratio of total number of pixels).For instance,, can know when its value is 120 by the whole original image of traversal for the R component, corresponding number of pixels, the R component value that promptly has what pixels in the original image is 120, then, it is illustrated in the histogram gets final product.In actual applications, the histogram of three components can be based upon on the same figure, also can distinguish separately and set up.Histogram how to set up R, G, three components of B is a prior art, repeats no more.
As can be seen from the above-described embodiment, the present invention carries out the method for exposure-processed to image, the user is operated simply to under-exposed or over-exposed image just can make image reach the effect of nature, farthest, be subjected to liking of users deeply for the user has saved time and expense.
The above only is preferred embodiment of the present invention, and is in order to restriction the present invention, within the spirit and principles in the present invention not all, any modification of being done, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.