Summary of the invention
The object of the invention is to, for existing image capture method and device, the corner of imaging exists the defect of shadow, a kind of method and apparatus that corner shadow can be made to eliminate is provided.
Solution of the above problems of the present invention is: provide a kind of image dark angular brightness control method, comprise the following steps:
S100) obtain two dimensional image, and dark angular zone is divided to two dimensional image;
S200) brightness of dark angular zone is adjusted;
S300) image after output brightness adjustment.
The dark angular brightness control method of image of the present invention, wherein also comprises the step that two dimensional image divides dark angular zone:
S110) width W and the height H of two dimensional image is obtained;
S120) construct the dark angular zone of isosceles triangle, the right-angled apices of isosceles triangle is the summit of two dimensional image, and the waist length direction of isosceles triangle is width and the short transverse of two dimensional image, waist long r=1/2 × min{W, H}.
The dark angular brightness control method of image of the present invention, wherein S200 specifically comprises:
S210) a selected dark angular zone, and calculate R, G, B component of each pixel in this dark angular zone;
S220) regulation coefficient rateR, rateG, rateB of R, G, B component of each pixel is calculated;
S230) each R ', G ', the B ' after adjustment is exported, wherein:
R’=R×rateR;
G’=G×rateG;
B’=B×rateR。
The dark angular brightness control method of image of the present invention, in step S220, rateR, rateG, rateB are as follows:
Wherein, r represents that the waist of dark angular zone is long, and d represents the distance of selected pixel apart from the right-angled apices of dark angular zone;
Rave, Gave, Bave are the mean value of two dimensional image first area R, G, B component, and first area is square area, and the foursquare length of side is 80 to 120 pixels, and first area is positioned at the center of two dimensional image, are preferably 100 pixels;
PRave, PGave, PBave are the mean value of two dimensional image second area R, G, B component, and second area is four identical square area, and the foursquare length of side is 5 to 20 pixels, and second area is positioned at four drift angles of two dimensional image, are preferably 10 pixels;
RateR represents the regulation coefficient of any point R component in dark angular zone;
RateG represents the regulation coefficient of any point G component in dark angular zone;
RateB represents the regulation coefficient of any point B component in dark angular zone.
The present invention also provides a kind of image dark angular brightness adjusting device, comprising:
Dark angle acquisition module, for obtaining two dimensional image, and divides dark angular zone to two dimensional image;
Dark angular brightness adjusting module, for adjusting the brightness of dark angular zone;
Image output module, for the image after output brightness adjustment;
Dark angle acquisition module, dark angular brightness adjusting module, image output module are connected successively.
The dark angular brightness adjusting device of image of the present invention, wherein dark angle acquisition module to the process that two dimensional image divides dark angular zone is:
Obtain width W and the height H of two dimensional image;
The dark angular zone of structure isosceles triangle, the right-angled apices of isosceles triangle is the summit of two dimensional image, and the waist length direction of isosceles triangle is width and the short transverse of two dimensional image, waist long r=1/2 × min{W, H}.
The dark angular brightness adjusting device of image of the present invention, dark angular brightness adjusting module also comprises:
Component computing module, for calculating R, G, B component of each pixel in dark angular zone;
Regulation coefficient module, calculates regulation coefficient rateR, rateG, rateB of R, G, B component of each pixel;
Each R ', G ' that image output module exports, B ' are:
R’=R×rateR;
G’=G×rateG;
B’=B×rateR。
The dark angular brightness adjusting device of image of the present invention, it is as follows that regulation coefficient module calculates rateR, rateG, rateB:
Wherein, r represents that the waist of dark angular zone is long, and d represents the distance of selected pixel apart from the right-angled apices of dark angular zone;
Rave, Gave, Bave are the mean value of two dimensional image first area R, G, B component, and first area is square area, and the foursquare length of side is 80 to 120 pixels, and first area is positioned at the center of two dimensional image, are preferably 100 pixels;
PRave, PGave, PBave are the mean value of two dimensional image second area R, G, B component, and second area is four identical square area, the foursquare length of side is 5 to 20 pixels, and second area is positioned at four drift angles of two dimensional image, is preferably 10 pixels;
RateR represents the regulation coefficient of any point R component in dark angular zone;
RateG represents the regulation coefficient of any point G component in dark angular zone;
RateB represents the regulation coefficient of any point B component in dark angular zone.
Implementing the dark angular brightness control method of image of the present invention and device, utilizing image capturing device to carry out in the process of taking, automatically can adjust the brightness at the dark angle of image, the brightness adjusting rear view picture figure is consistent, improve the comfort level of image-watching; And the present invention is by realizing existing most of camera head transformation, and pervasive degree is high.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention is described in detail.
Be illustrated in figure 1 the flow chart of the dark angular brightness control method of image of the present invention, in the present invention, the method obtaining dark angular zone is as follows:
S100) obtain two dimensional image, and dark angular zone is divided to two dimensional image; For the two dimensional image obtained, be converted into by the data format of each pixel of RGB numeric representation;
Dark angular zone is divided for two dimensional image, needs to carry out following step:
S110) width W and the height H of two dimensional image is obtained;
S120) construct the dark angular zone of isosceles triangle, the right-angled apices of isosceles triangle is the summit of two dimensional image, and the waist length direction of isosceles triangle is width and the short transverse of two dimensional image, the long r of waist is in W and H, compared with the half of fractional value, i.e. r=1/2 × min{W, H}.Form 4 dark angular zones as shown in Figure 2.
It should be noted that the dark angular zone constructing isosceles triangle is based on the preferred selection done by the Luminance Distribution characteristic of existing apparatus for making a video recording acquisition image: it is comparatively dark that general apparatus for making a video recording obtains the brightness of image in the position of four drift angles, and its distribution about becomes the distribution of isosceles right triangle.
Certainly for the concrete image that different equipment obtains, also can obtain image difference according to it to choose flexibly, such as, select the mid point on each limit of two dimensional image, connect adjacent mid point, form the dark angular zone of 4 right-angled triangles, or be in two dimensional image, select the positive round of inscribe or ellipse as central area, remaining is as dark angular zone.
After choosing dark angular zone, carry out step S200:
S200) brightness of dark angular zone is adjusted; The specific implementation of the brightness of dark angular zone is regulated to be the RGB numerical value regulating each pixel in dark angular zone; Concrete comprises:
S210) a selected dark angular zone, and calculate R, G, B component of each pixel in this dark angular zone;
S220) regulation coefficient rateR, rateG, rateB of R, G, B component of each pixel is calculated;
S230) each R ', G ', the B ' after adjustment is exported, wherein:
R’=R×rateR;
G’=G×rateG;
B’=B×rateR。
The dark angular brightness control method of image of the present invention, in step S220, rateR, rateG, rateB are as follows:
Wherein, r represents that the waist of dark angular zone is long, and d represents the distance of selected pixel apart from the right-angled apices of dark angular zone;
Rave, Gave, Bave are the mean value of two dimensional image first area R, G, B component, and first area is square area, and the foursquare length of side is 80 to 120 pixels, and first area is positioned at the center of two dimensional image, are preferably 100 pixels;
PRave, PGave, PBave are the mean value of two dimensional image second area R, G, B component, and second area is four identical square area, and the foursquare length of side is 5 to 20 pixels, and second area is positioned at four drift angles of two dimensional image, are preferably 10 pixels;
RateR represents the regulation coefficient of any point R component in dark angular zone;
RateG represents the regulation coefficient of any point G component in dark angular zone;
RateB represents the regulation coefficient of any point B component in dark angular zone.
Above computational methods are the corresponding computational methods of the dark angular zone of isosceles right triangle, when selecting the dark angular zone of other shapes, need the account form of accommodation r.
S300) image after output brightness adjustment.The image exported is the new two dimensional image of the RGB composition after adjustment.
As shown in Figure 3, be the schematic diagram of the dark angular brightness control method of image of the present invention preferred embodiment first; In the present embodiment, the dark angular zone of division as shown in Figure 2, and introduces two parameter: K, for representing dark angle; Pi, for representing the pixel in dark angle.Such as, the dark angle 1, pi=1 in the upper left corner that K=1 represents in Fig. 2 represents first pixel in dark angular zone.
First initialization K and pi, makes K=1, namely processes from first dark angle, and selects pi=1, first pixel.
Calculate the RGB regulation coefficient of pi pixel, be specially:
According to regulation coefficient, export new RGB numerical value:
R’=R×rateR;
G’=G×rateG;
B’=B×rateR。
After processing this pixel, judge that whether pixel is the last pixel at current dark angle, if not then get new pi value, new pi value adds 1 for currency; And RGB process is carried out to new pixel; Until process all pixels of current dark angular zone.
After this judge whether current dark angular zone is the last dark angle, if not, then gets new K value, new K value adds 1 for currency; And new dark angular zone is carried out to the RGB process of whole pixel; Until all dark angular zone process complete.
Fig. 4 is the building-block of logic of the dark angular brightness adjusting device of image of the present invention, and correspondence realizes dark angular brightness method of adjustment of the present invention.This device comprises:
Dark angle acquisition module 100, for obtaining two dimensional image, and divides dark angular zone to two dimensional image;
Dark angular brightness adjusting module 200, for adjusting the brightness of dark angular zone;
Image output module 300, for the image after output brightness adjustment;
Dark angle acquisition module 100, dark angular brightness adjusting module 200, image output module 300 are connected successively.
At dark angle acquisition module 100, when dark angular zone is divided to two dimensional image, take following mode of operation:
Obtain width W and the height H of two dimensional image;
The dark angular zone of structure isosceles triangle, the right-angled apices of isosceles triangle is the summit of two dimensional image, and the waist length direction of isosceles triangle is width and the short transverse of two dimensional image, waist long r=1/2 × min{W, H}.The dark angular zone of final acquisition as shown in Figure 2.
After dark angle acquisition module 100 divides good dark angular zone, the data of the dark angular zone of correspondence are sent to dark angular brightness adjusting module 200, carry out the brightness adjusting dark angular zone; Dark angular brightness adjusting module 200 also comprises:
Component computing module 210, for calculating R, G, B component of each pixel in dark angular zone;
Regulation coefficient module 220, calculates regulation coefficient rateR, rateG, rateB of R, G, B component of each pixel;
Each R ', G ' that image output module 300 exports, B ' are:
R’=R×rateR;
G’=G×rateG;
B’=B×rateR。
Wherein the computational process of regulation coefficient rateR, rateG, rateB is as follows:
Wherein:
R represents the right angle length of side of dark angular zone;
D represents that in dark angular zone, any point is to the distance of right-angled apices;
Rave, Gave, Bave are the mean value of two dimensional image first area R, G, B component, and first area is square area, and the foursquare length of side is 80 to 120 pixels, and first area is positioned at the center of two dimensional image, are preferably 100 pixels;
PRave, PGave, PBave are the mean value of two dimensional image second area R, G, B component, and second area is four identical square area, and the foursquare length of side is 5 to 20 pixels, and second area is positioned at four drift angles of two dimensional image, are preferably 10 pixels;
RateR represents the regulation coefficient of any point R component in dark angular zone;
RateG represents the regulation coefficient of any point G component in dark angular zone;
RateB represents the regulation coefficient of any point B component in dark angular zone.
New R, G, B numerical value of dark angular zone is replaced original legacy data by image output module 300, and with original image, the view data of zone line (namely not carrying out the part of brightness adjustment) combines, and generates new two dimensional image.
These are only the specific embodiment of the invention, scope of the present invention can not be limited with this, the equalization change that those skilled in the art in the art do according to this creation, and the change that those skilled in that art know, all still should belong to the scope that the present invention is contained.