Summary of the invention
In view of this, fundamental purpose of the present invention is to provide a kind of method that suppresses night image noise, can suppress night image noise easily and effectively.
Another object of the present invention is to provide a kind of device that suppresses night image noise, can suppress night image noise easily and effectively.
For achieving the above object, technical scheme of the present invention specifically is achieved in that
A kind of method that suppresses night image noise, this method comprises:
With two parts of original night copying images, obtain first intermediate images and second intermediate images;
Described first intermediate images is carried out threshold process, obtain comprising the gray level image of described original night picture noise, described second intermediate images is dimmed processing, obtain the 3rd intermediate images;
To red R, green G on each pixel in described original night image and described the 3rd intermediate images, blue B component, calculate in such a way respectively, obtain final needing image,
Wherein, i represents arbitrary pixel; Described bmp[i] R, G or B component value on i the pixel of expression in the described original night image; Described bmp2[i] R, G or B component value on i the pixel of expression in described the 3rd intermediate images; Described MaskBmp[i] i gray values of pixel points in the described gray level image that comprises described original night picture noise of expression; Result[i] R, G or B component value on i the pixel in the final needing image that calculates of expression; Described transparency represents transparency, and its value is one more than or equal to 0 and smaller or equal to 1 real number; Described * represents multiplication sign, and is described-the expression minus sign.
A kind of device that suppresses night image noise, this device comprises:
Copied cells is used for two parts of original night copying images are obtained first intermediate images and second intermediate images;
Processing unit is used for described first intermediate images is carried out threshold process, obtains comprising the gray level image of described original night picture noise, and described second intermediate images is dimmed processing, obtains the 3rd intermediate images;
The 3rd computation subunit is used for R, G, B component on each pixel of the 3rd intermediate images that obtains to described original night image and by described processing unit, calculates in such a way respectively, obtains final needing image,
Wherein, i represents arbitrary pixel; Described bmp[i] R, G or B component value on i the pixel of expression in the described original night image; Described bmp2[i] R, G or B component value on i the pixel of expression in described the 3rd intermediate images; Described MaskBmp[i] i gray values of pixel points in the described gray level image that comprises described original night picture noise of expression; Result[i] red R, green G or blue B component value on i the pixel in the final needing image that calculates of expression; Described transparency represents transparency, and its value is one more than or equal to 0 and smaller or equal to 1 real number; Described * represents multiplication sign, and is described-the expression minus sign.
As seen, adopt technical scheme of the present invention, it is less to have made full use of the daylighting of night scene integral image, general integral body presents the characteristics of black, pixel in certain threshold value is done special processing to determine the noise of night scene image, with the noise of the described night scene image of original night figure image subtraction, guaranteeing to reach the purpose of reasonable inhibition night image noise under the constant situation of integral image effect again; Scheme of the present invention can be applicable in the software, the user only need click corresponding button, software self can be finished processing on the backstage according to scheme of the present invention, saved the process that the user adjusts a series of complex parameters, thereby for the user has saved time and expense, and treatment effect is desirable more.
Embodiment
For solving problems of the prior art, the present invention is directed to the night scene image and have some total characteristics, for example whole daylighting is less, generally present some details are arranged in black, the image, it is few or not obvious etc. that but details mostly is high-gloss colour zone, dark portion details, a kind of scheme of brand-new inhibition night image noise has been proposed: at first, be threshold value of original night image setting, determine the noise of original night image by this threshold value; Then, the described noise of original night figure image subtraction has promptly been obtained the night scene image behind the noise reduction; This scheme can suppress the noise that occurs in the night scene photo under the prerequisite that does not change the sharpness of photo own easily effectively, thereby makes photo reach more perfect effect.
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 industry member, 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: with two parts of original night copying images, obtain first intermediate images and second intermediate images; First intermediate images is carried out threshold process, obtain comprising the gray level image of described original night picture noise, second intermediate images is dimmed processing, obtain the 3rd intermediate images; Serves as to cover layer to merge by the Subtract pattern with original night image and the 3rd intermediate images with the gray level image that comprises described original night picture noise, obtains final needing image.
For making 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 suppresses the process flow diagram of night image noise method embodiment for the present invention.As shown in Figure 1, may further comprise the steps:
Step 101:, obtain first intermediate images and second intermediate images with two parts of original night copying images.
How to copy as prior art, repeat no more.
Need to prove, in this step the original night image is only duplicated to illustrating, be not limited to technical scheme of the present invention.In the present embodiment, also can directly carry out following processing operation to described original night image.
Step 102: first intermediate images is carried out threshold process, obtain comprising the gray level image of original night picture noise, second intermediate images is dimmed processing, obtain the 3rd intermediate images.
The operation of this step has two purposes: after 1) image being carried out threshold process, can obtain the gray level image of picture noise, remove the operation of noise for the back and carried out sufficient preparation; 2) because the operation of back can be adjusted the brightness of entire image, and through the processing that dims to image, the brightness of image can be become secretly, therefore, again through behind the associative operation of back, the brightness of image just can be followed original being consistent.
In this step, first intermediate images is carried out threshold process, the specific implementation that obtains comprising the gray level image of original night picture noise is:
By red (R) component value, green (G) component value and indigo plant (B) component value on each pixel in more described first intermediate images respectively, find out wherein maximum component value, and the component value of described maximum is made as r ';
For each r ' in described first intermediate images, carry out the r component value in such a way and calculate:
Wherein, definition of T hreshold is a threshold point, and Feather is the emergence parameter, and pixel value is less than the some melanism of Threshold, and pixel value is greater than the some albefaction of Feather, and in [Threshold, Threshold+Feather] scope, albefaction is the nature transition; Threshold value Threshold and emergence parameter F eather are empirical values, and according to user feedback with obtain after repeatedly reconciling, the default value here is: Threshold=70, Feather=80; Described r represents to calculate the r ' on each pixel in the described original night image and value on each pixel of obtaining; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign;
The r component value that calculates is distinguished assignment to the R component on the corresponding pixel points, G component and B component, obtain comprising the gray level image of described original night picture noise.
Second intermediate images is dimmed processing, and the specific implementation that obtains the 3rd intermediate images comprises:
With the R component value on each pixel in described second intermediate images, G component value and B component value, calculate in such a way respectively:
T=t '-t ' * Amount/255 obtains described the 3rd intermediate images,
Wherein, R, G, B component value on described each pixel of the 3rd intermediate images that R, G, B component value on described each pixel of second intermediate images of t ' expression, t are represented to calculate; Threshold value A mount=180; Described * represents multiplication sign, and is described/the expression division sign, described-the expression minus sign.
Step 103: serves as to cover layer to merge by the Subtract pattern with original night image and the 3rd intermediate images with the gray level image that comprises the original night picture noise, obtains final needing image.
Subtract pattern in this step can be adjusted the brightness of entire image.
Its specific implementation comprises:
R, G, B component on each pixel in described original night image and described the 3rd intermediate images, calculate respectively in such a way:
Wherein, i represents arbitrary pixel; Described bmp[i] R, G or B component value on i the pixel of expression in the described original night image; Described bmp2[i] R, G or B component value on i the pixel of expression in described the 3rd intermediate images; Described MaskBmp[i] i gray values of pixel points in the described gray level image that comprises described original night picture noise of expression; Result[i] R, G or B component value on i the pixel in the final needing image that calculates of expression; Described transparency represents transparency, and its value is one more than or equal to 0 and smaller or equal to 1 real number; Described * represents multiplication sign, and is described-the expression minus sign.
In the present embodiment, when transparency is transparency when being 1, R, G, B component value on each pixel of the image after merging by the Subtract pattern are:
Then result is the night scene image of removing behind the noise.
The night scene noise restraint method that the present invention adopts can only be applied in the night scene, is because the most of pixel in the night scene image is relatively more black, that is to say that R, G, B are smaller.If the one or more pixel values among R, G, the B are higher, this pixel will be brighter.
So far, promptly finished the processing procedure of the inhibition night image noise among the method for the invention embodiment.
Based on said method, Fig. 2 suppresses the composition structural representation of night image noise device embodiment for the present invention.As shown in Figure 2, this device comprises:
Copied cells 21 is used for two parts of original night copying images are obtained first intermediate images and second intermediate images;
Need to prove also can not have copied cells 21 in the present embodiment, and directly the original night image is carried out the processing operation of back.
Processing unit 22 is used for described first intermediate images is carried out threshold process, obtains comprising the gray level image of described original night picture noise, and second intermediate images is dimmed processing, obtains the 3rd intermediate images;
Computing unit 23, being used for described original night image and described the 3rd intermediate images serves as to cover layer to merge by the Subtract pattern with the described gray level image that comprises described original night picture noise, obtains final needing image.
Wherein, copied cells 21 comprises:
Pending subelement 211 is used to preserve the original night image;
Replicon unit 212 is used for the original night image of pending subelement 211 is carried out described duplicating.
Need to prove that owing to can not have copied cells 21 in the present embodiment, therefore, the pending subelement 211 and the replicon unit 212 that are comprised in the copied cells 21 can not have yet.
Processing unit 22 can specifically comprise:
First handles subelement 221, is used for described first intermediate images is carried out threshold process, obtains comprising the gray level image of described original night picture noise, and this sub-processing unit 221 comprises again:
Search subelement 2211, be used for finding out component value maximum in red (R) component value of described first each pixel of intermediate images, green (G) component value and indigo plant (B) component value, and the component value of described maximum is made as r ';
First computation subunit 2212 is used for each r ' to described first intermediate images, carries out the r component value in such a way and calculates:
Wherein, definition of T hreshold is a threshold point, and Feather is the emergence parameter, and pixel value is less than the some melanism of Threshold, and pixel value is greater than the some albefaction of Feather, and in [Threshold, Threshold+Feather] scope, albefaction is the nature transition; Threshold value Threshold and emergence parameter F eather are empirical values, and according to user feedback with obtain after repeatedly reconciling, the default value here is: Threshold=70, Feather=80; Described r represents to calculate the r ' on each pixel in described first intermediate images and value on each pixel of obtaining; Described * represents multiplication sign, and is described/the expression division sign, described+the expression plus sige, described-the expression minus sign;
Assignment subelement 2213, the r component value difference assignment that is used for first computation subunit 2212 is calculated obtains comprising the gray level image of described original night picture noise to the R component on the corresponding pixel points, G component and B component.
Second handles subelement 222, is used for second intermediate images is dimmed processing, obtains the 3rd intermediate images, and this processing subelement 222 can comprise:
Second computation subunit 2221 is used for the R component value on each pixel of described second intermediate images, G component value and B component value are calculated respectively in such a way:
T=t '-t ' * Amount/255 obtains described the 3rd intermediate images,
Wherein, R, G, B component value on described each pixel of the 3rd intermediate images that R, G, B component value on described each pixel of second intermediate images of t ' expression, t are represented to calculate; Threshold value A mount=180; Described * represents multiplication sign, and is described/the expression division sign, described-the expression minus sign.
Wherein, computing unit 23 can be specially:
The 3rd computation subunit 231 is used for calculating in such a way respectively for R, G on each pixel of described original night image and described the 3rd intermediate images, B component:
Wherein, i represents arbitrary pixel; Described bmp[i] R, G or B component value on i the pixel of expression in the described original night image; Described bmp2[i] R, G or B component value on i the pixel of expression in described the 3rd intermediate images; Described MaskBmp[i] i gray values of pixel points in the described gray level image that comprises described original night picture noise of expression; Result[i] expression calculates R, G or the B component value on i the pixel in the final needing image; Described transparency represents transparency, and its value is one more than or equal to 0 and smaller or equal to 1 real number; Described * represents multiplication sign, and is described-the expression minus sign.
The concrete workflow of device shown in Figure 2 please refer to the respective description among the method embodiment shown in Figure 1, repeats no more herein.
As can be seen from the above-described embodiment, the method of the inhibition night image noise that the present invention adopts, it is less to have made full use of the daylighting of night scene integral image, general integral body presents the characteristics of black, pixel in certain threshold value is done special processing to determine the noise of night scene image, with the noise of the described night scene image of original night figure image subtraction,, reach the purpose of reasonable inhibition night image noise again guaranteeing that the integral image effect is constant; Scheme of the present invention can be applicable in the software, the user only need click corresponding button, software self can be finished processing on the backstage according to scheme of the present invention, saved the process that the user adjusts a series of complex parameters, thereby for the user has saved time and expense, and treatment effect is desirable more.
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.